diff options
Diffstat (limited to 'cpu/mpc824x/drivers/i2c')
| -rw-r--r-- | cpu/mpc824x/drivers/i2c/README | 1 | ||||
| -rw-r--r-- | cpu/mpc824x/drivers/i2c/i2c.h | 54 | ||||
| -rw-r--r-- | cpu/mpc824x/drivers/i2c/i2c2.S | 36 | ||||
| -rw-r--r-- | cpu/mpc824x/drivers/i2c/i2c_export.h | 26 | 
4 files changed, 57 insertions, 60 deletions
| diff --git a/cpu/mpc824x/drivers/i2c/README b/cpu/mpc824x/drivers/i2c/README index 8d82df359..1db72108c 100644 --- a/cpu/mpc824x/drivers/i2c/README +++ b/cpu/mpc824x/drivers/i2c/README @@ -102,4 +102,3 @@ USAGE:     host system a way to use its own event     handler instead of the I2C_ISR provided     here. - diff --git a/cpu/mpc824x/drivers/i2c/i2c.h b/cpu/mpc824x/drivers/i2c/i2c.h index 3209bfed2..48a401d90 100644 --- a/cpu/mpc824x/drivers/i2c/i2c.h +++ b/cpu/mpc824x/drivers/i2c/i2c.h @@ -109,13 +109,13 @@ typedef enum _i2c_mode   */  static I2CStatus I2C_put( unsigned int  eumbbar,  						  unsigned char rcv_addr,    /* receiver's address */ -	                      unsigned char *buffer_ptr, /* pointer of data to be sent */ +			      unsigned char *buffer_ptr, /* pointer of data to be sent */  					      unsigned int  length,      /* number of byte of in the buffer */  					      unsigned int  stop_flag,   /* 1 - signal STOP when buffer is empty -					                                  * 0 - no STOP signal when buffer is empty -											          */ +									  * 0 - no STOP signal when buffer is empty +												  */  						  unsigned int  is_cnt );    /* 1 - this is a restart, don't check MBB -                                                      * 0 - this is a new start, check MBB +						      * 0 - this is a new start, check MBB  													  */  /* Receive a buffer of data from the desired sender_addr @@ -130,12 +130,12 @@ static I2CStatus I2C_put( unsigned int  eumbbar,  static I2CStatus I2C_get( unsigned int  eumbbar,  						  unsigned char sender_addr, /* sender's address */  					      unsigned char *buffer_ptr, /* pointer of receiving buffer */ -				          unsigned int  length,      /* length of the receiving buffer */ +					  unsigned int  length,      /* length of the receiving buffer */  					      unsigned int  stop_flag,   /* 1 - signal STOP when buffer is full -					                                  * 0 - no STOP signal when buffer is full +									  * 0 - no STOP signal when buffer is full  												      */  						  unsigned int  is_cnt );    /* 1 - this is a restart, don't check MBB -                                                      * 0 - this is a new start, check MBB +						      * 0 - this is a new start, check MBB  													  */  #if 0 /* the I2C_write and I2C_read functions are not active */ @@ -160,10 +160,10 @@ static I2CStatus I2C_get( unsigned int  eumbbar,   */  static I2CStatus I2C_write( unsigned int eumbbar,  						    unsigned char *buffer_ptr, /* pointer of data to be sent */ -					        unsigned int  length,      /* number of byte of in the buffer */ -					        unsigned int  stop_flag ); /* 1 - signal STOP when buffer is empty -								                        * 0 - no STOP signal when buffer is empty -											            */ +						unsigned int  length,      /* number of byte of in the buffer */ +						unsigned int  stop_flag ); /* 1 - signal STOP when buffer is empty +											* 0 - no STOP signal when buffer is empty +												    */   /* Receive a buffer of data from the sending master.   * If stop_flag is set, when the buffer is full and the @@ -175,8 +175,8 @@ static I2CStatus I2C_write( unsigned int eumbbar,  static I2CStatus I2C_read(unsigned int  eumbbar,  						  unsigned char *buffer_ptr, /* pointer of receiving buffer */  					      unsigned int  length,      /* length of the receiving buffer */ -				          unsigned int  stop_flag ); /* 1 - signal STOP when buffer is full -					                                  * 0 - no STOP signal when buffer is full +					  unsigned int  stop_flag ); /* 1 - signal STOP when buffer is full +									  * 0 - no STOP signal when buffer is full  												      */  #endif /* of if0 for turning off I2C_read & I2C_write */ @@ -203,12 +203,12 @@ static I2CStatus I2C_Timer_Event( unsigned int eumbbar, I2CStatus (*handler)( un   */  static I2CStatus I2C_Start( unsigned int  eumbbar,  						    unsigned char slave_addr, /* address of the receiver */ -	                        I2C_MODE     mode,       /* XMIT(1) - put (write) -							                          * RCV(0)  - get (read) +				I2C_MODE     mode,       /* XMIT(1) - put (write) +										  * RCV(0)  - get (read)  													  */  						    unsigned int is_cnt ); /* 1 - this is a restart, don't check MBB  													* 0 - this is a new start, check MBB -                                                    */ +						    */  /* Generate a STOP signal to terminate the transaction. */  static I2CStatus I2C_Stop( unsigned int eumbbar ); @@ -258,10 +258,10 @@ static I2CStatus I2C_Slave_Addr( unsigned int eumbbar );   */  static I2CStatus I2C_Init( unsigned int  eumbbar,  						   unsigned char fdr,       /* frequency divider */ -	                       unsigned char addr,      /* driver's address used for receiving */ -	 			           unsigned int en_int);    /* 1 - enable I2C interrupt -					                                 * 0 - disable I2C interrup -											         */ +			       unsigned char addr,      /* driver's address used for receiving */ +					   unsigned int en_int);    /* 1 - enable I2C interrupt +									 * 0 - disable I2C interrup +												 */  /* I2C interrupt service routine.   * @@ -299,11 +299,11 @@ static I2C_CTRL I2C_Get_Ctrl( unsigned int eumbbar );   *        I2C_RESTART, this is a continuation of existing transaction   */  static I2C_Status I2C_do_buffer( I2C_INTERRUPT_MODE en_int, -                                 I2C_TRANSACTION_MODE act, -                                 unsigned char i2c_addr, -                                 int len, -                                 unsigned char *buffer, -                                 I2C_STOP_MODE stop, -                                 int retry, -                                 I2C_RESTART_MODE rsta); +				 I2C_TRANSACTION_MODE act, +				 unsigned char i2c_addr, +				 int len, +				 unsigned char *buffer, +				 I2C_STOP_MODE stop, +				 int retry, +				 I2C_RESTART_MODE rsta);  #endif diff --git a/cpu/mpc824x/drivers/i2c/i2c2.S b/cpu/mpc824x/drivers/i2c/i2c2.S index 5cc7c9876..3fd7e03fe 100644 --- a/cpu/mpc824x/drivers/i2c/i2c2.S +++ b/cpu/mpc824x/drivers/i2c/i2c2.S @@ -16,20 +16,20 @@   *   * output: r3 - register content   **********************************************************/ -      .text -      .align 2 -      .global load_runtime_reg +	.text +	.align 2 +	.global load_runtime_reg  load_runtime_reg: -/*		  xor r5,r5,r5 -*         or  r5,r5,r3 -* -*	      lwbrx	r3,r4,r5 -*/ -	      lwbrx r3,r4,r3 -	      sync +/*	xor r5,r5,r5 + *	or  r5,r5,r3 + * + *	lwbrx	r3,r4,r5 + */ +	lwbrx r3,r4,r3 +	sync - 	      bclr 20, 0 +	bclr 20, 0  /****************************************************************   * function: store_runtime_reg @@ -39,16 +39,14 @@ load_runtime_reg:   *        r5 - new value to be stored   *   ****************************************************************/ -           .text -           .align 2 -           .global store_runtime_reg +	.text +	.align 2 +	.global store_runtime_reg  store_runtime_reg: -	      stwbrx r5,  r4, r3 -	      sync - -              bclr   20,0 - +	stwbrx r5,  r4, r3 +	sync +	bclr   20,0  #endif /* CONFIG_HARD_I2C */ diff --git a/cpu/mpc824x/drivers/i2c/i2c_export.h b/cpu/mpc824x/drivers/i2c/i2c_export.h index 17403ea2c..6264d189b 100644 --- a/cpu/mpc824x/drivers/i2c/i2c_export.h +++ b/cpu/mpc824x/drivers/i2c/i2c_export.h @@ -71,11 +71,11 @@ typedef enum _i2c_restart  extern I2C_Status I2C_Initialize(  	unsigned char addr,            /* driver's I2C slave address */  	I2C_INTERRUPT_MODE en_int,     /* 1 - enable I2C interrupt -	                                * 0 - disable I2C interrupt -	                                */ -        int (*app_print_function)(char *,...)); /* pointer to optional "printf" -                                                 * provided by application -                                                 */ +					* 0 - disable I2C interrupt +					*/ +	int (*app_print_function)(char *,...)); /* pointer to optional "printf" +						 * provided by application +						 */  /* Perform the given I2C transaction, only MASTER_XMIT and MASTER_RCV   * are implemented.  Both are only in polling mode. @@ -92,12 +92,12 @@ extern I2C_Status I2C_Initialize(   *        I2C_RESTART, this is a continuation of existing transaction   */  extern I2C_Status I2C_do_transaction( I2C_INTERRUPT_MODE en_int, -                                      I2C_TRANSACTION_MODE act, -                                      unsigned char i2c_addr, -                                      unsigned char data_addr, -                                      int len, -                                      char *buffer, -                                      I2C_STOP_MODE stop, -                                      int retry, -                                      I2C_RESTART_MODE rsta); +				      I2C_TRANSACTION_MODE act, +				      unsigned char i2c_addr, +				      unsigned char data_addr, +				      int len, +				      char *buffer, +				      I2C_STOP_MODE stop, +				      int retry, +				      I2C_RESTART_MODE rsta);  #endif |