Index: EcnlProtoTool/trunk/asp3_dcre/mbed/hal/i2c_api.h
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/mbed/hal/i2c_api.h	(revision 321)
+++ EcnlProtoTool/trunk/asp3_dcre/mbed/hal/i2c_api.h	(revision 429)
@@ -1,2 +1,5 @@
+
+/** \addtogroup hal */
+/** @{*/
 /* mbed Microcontroller Library
  * Copyright (c) 2006-2015 ARM Limited
@@ -18,10 +21,14 @@
 
 #include "device.h"
-#include "buffer.h"
+#include "hal/buffer.h"
+
+#if DEVICE_I2C_ASYNCH
+#include "hal/dma_api.h"
+#endif
 
 #if DEVICE_I2C
 
 /**
- * @defgroup I2CEvents I2C Events Macros
+ * @defgroup hal_I2CEvents I2C Events Macros
  *
  * @{
@@ -36,8 +43,8 @@
 
 #if DEVICE_I2C_ASYNCH
-/** Asynch i2c hal structure
+/** Asynch I2C HAL structure
  */
 typedef struct {
-    struct i2c_s    i2c;     /**< Target specific i2c structure */
+    struct i2c_s    i2c;     /**< Target specific I2C structure */
     struct buffer_s tx_buff; /**< Tx buffer */
     struct buffer_s rx_buff; /**< Rx buffer */
@@ -45,5 +52,5 @@
 
 #else
-/** Non-asynch i2c hal structure
+/** Non-asynch I2C HAL structure
  */
 typedef struct i2c_s i2c_t;
@@ -61,11 +68,12 @@
 
 /**
- * \defgroup GeneralI2C I2C Configuration Functions
+ * \defgroup hal_GeneralI2C I2C Configuration Functions
  * @{
  */
 
 /** Initialize the I2C peripheral. It sets the default parameters for I2C
- *  peripheral, and configure its specifieds pins.
- *  @param obj  The i2c object
+ *  peripheral, and configures its specifieds pins.
+ *  
+ *  @param obj  The I2C object
  *  @param sda  The sda pin
  *  @param scl  The scl pin
@@ -73,22 +81,26 @@
 void i2c_init(i2c_t *obj, PinName sda, PinName scl);
 
-/** Configure the I2C frequency.
- *  @param obj The i2c object
+/** Configure the I2C frequency
+ *
+ *  @param obj The I2C object
  *  @param hz  Frequency in Hz
  */
 void i2c_frequency(i2c_t *obj, int hz);
 
-/** Send START command.
- *  @param obj The i2c object
+/** Send START command
+ *
+ *  @param obj The I2C object
  */
 int  i2c_start(i2c_t *obj);
 
-/** Send STOP command.
- *  @param obj The i2c object
+/** Send STOP command
+ *
+ *  @param obj The I2C object
  */
 int  i2c_stop(i2c_t *obj);
 
-/** Blocking reading data.
- *  @param obj     The i2c object
+/** Blocking reading data
+ *
+ *  @param obj     The I2C object
  *  @param address 7-bit address (last bit is 1)
  *  @param data    The buffer for receiving
@@ -97,34 +109,40 @@
  *  @return Number of read bytes
  */
-int  i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
-
-/** Blocking sending data.
- *  @param obj     The i2c object
+int i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
+
+/** Blocking sending data
+ *
+ *  @param obj     The I2C object
  *  @param address 7-bit address (last bit is 0)
  *  @param data    The buffer for sending
- *  @param length  Number of bytes to wrte
+ *  @param length  Number of bytes to write
  *  @param stop    Stop to be generated after the transfer is done
- *  @return Number of written bytes
- */
-int  i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
-
-/** Reset I2C peripheral. TODO: The action here. Most of the implementation sends stop().
- *  @param obj The i2c object
+ *  @return 
+ *      zero or non-zero - Number of written bytes
+ *      negative - I2C_ERROR_XXX status
+ */
+int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
+
+/** Reset I2C peripheral. TODO: The action here. Most of the implementation sends stop()
+ *
+ *  @param obj The I2C object
  */
 void i2c_reset(i2c_t *obj);
 
-/** Read one byte.
- *  @param obj The i2c object
+/** Read one byte
+ *
+ *  @param obj The I2C object
  *  @param last Acknoledge
  *  @return The read byte
  */
-int  i2c_byte_read(i2c_t *obj, int last);
-
-/** Write one byte.
- *  @param obj The i2c object
+int i2c_byte_read(i2c_t *obj, int last);
+
+/** Write one byte
+ *
+ *  @param obj The I2C object
  *  @param data Byte to be written
- *  @return 1 if NAK was received, 0 if ACK was received, 2 for timeout.
- */
-int  i2c_byte_write(i2c_t *obj, int data);
+ *  @return 0 if NAK was received, 1 if ACK was received, 2 for timeout.
+ */
+int i2c_byte_write(i2c_t *obj, int data);
 
 /**@}*/
@@ -139,4 +157,5 @@
 /** Configure I2C as slave or master.
  *  @param obj The I2C object
+ *  @param enable_slave Enable i2c hardware so you can receive events with ::i2c_slave_receive
  *  @return non-zero if a value is available
  */
@@ -152,4 +171,6 @@
 /** Configure I2C as slave or master.
  *  @param obj The I2C object
+ *  @param data    The buffer for receiving
+ *  @param length  Number of bytes to read
  *  @return non-zero if a value is available
  */
@@ -158,4 +179,6 @@
 /** Configure I2C as slave or master.
  *  @param obj The I2C object
+ *  @param data    The buffer for sending
+ *  @param length  Number of bytes to write
  *  @return non-zero if a value is available
  */
@@ -177,17 +200,19 @@
 
 /**
- * \defgroup AsynchI2C Asynchronous I2C Hardware Abstraction Layer
- * @{
- */
-
-/** Start i2c asynchronous transfer.
+ * \defgroup hal_AsynchI2C Asynchronous I2C Hardware Abstraction Layer
+ * @{
+ */
+
+/** Start I2C asynchronous transfer
+ *
  *  @param obj       The I2C object
- *  @param tx        The buffer to send
- *  @param tx_length The number of words to transmit
- *  @param rx        The buffer to receive
- *  @param rx_length The number of words to receive
- *  @param address   The address to be set - 7bit or 9 bit
+ *  @param tx        The transmit buffer
+ *  @param tx_length The number of bytes to transmit
+ *  @param rx        The receive buffer
+ *  @param rx_length The number of bytes to receive
+ *  @param address   The address to be set - 7bit or 9bit
  *  @param stop      If true, stop will be generated after the transfer is done
  *  @param handler   The I2C IRQ handler to be set
+ *  @param event     Event mask for the transfer. See \ref hal_I2CEvents
  *  @param hint      DMA hint usage
  */
@@ -195,16 +220,20 @@
 
 /** The asynchronous IRQ handler
+ *
  *  @param obj The I2C object which holds the transfer information
- *  @return event flags if a transfer termination condition was met or 0 otherwise.
+ *  @return Event flags if a transfer termination condition was met, otherwise return 0.
  */
 uint32_t i2c_irq_handler_asynch(i2c_t *obj);
 
-/** Attempts to determine if I2C peripheral is already in use.
- *  @param obj The I2C object
- *  @return non-zero if the I2C module is active or zero if it is not
+/** Attempts to determine if the I2C peripheral is already in use
+ *
+ *  @param obj The I2C object
+ *  @return Non-zero if the I2C module is active or zero if it is not
  */
 uint8_t i2c_active(i2c_t *obj);
 
-/** Abort ongoing asynchronous transaction.
+/** Abort asynchronous transfer
+ *
+ *  This function does not perform any check - that should happen in upper layers.
  *  @param obj The I2C object
  */
@@ -222,2 +251,4 @@
 
 #endif
+
+/** @}*/
