Ignore:
Timestamp:
Jul 3, 2020, 7:19:17 PM (4 years ago)
Author:
coas-nagasima
Message:

ASP3, TINET, mbed を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • EcnlProtoTool/trunk/asp3_dcre/mbed/hal/i2c_api.h

    r321 r429  
     1
     2/** \addtogroup hal */
     3/** @{*/
    14/* mbed Microcontroller Library
    25 * Copyright (c) 2006-2015 ARM Limited
     
    1821
    1922#include "device.h"
    20 #include "buffer.h"
     23#include "hal/buffer.h"
     24
     25#if DEVICE_I2C_ASYNCH
     26#include "hal/dma_api.h"
     27#endif
    2128
    2229#if DEVICE_I2C
    2330
    2431/**
    25  * @defgroup I2CEvents I2C Events Macros
     32 * @defgroup hal_I2CEvents I2C Events Macros
    2633 *
    2734 * @{
     
    3643
    3744#if DEVICE_I2C_ASYNCH
    38 /** Asynch i2c hal structure
     45/** Asynch I2C HAL structure
    3946 */
    4047typedef struct {
    41     struct i2c_s    i2c;     /**< Target specific i2c structure */
     48    struct i2c_s    i2c;     /**< Target specific I2C structure */
    4249    struct buffer_s tx_buff; /**< Tx buffer */
    4350    struct buffer_s rx_buff; /**< Rx buffer */
     
    4552
    4653#else
    47 /** Non-asynch i2c hal structure
     54/** Non-asynch I2C HAL structure
    4855 */
    4956typedef struct i2c_s i2c_t;
     
    6168
    6269/**
    63  * \defgroup GeneralI2C I2C Configuration Functions
     70 * \defgroup hal_GeneralI2C I2C Configuration Functions
    6471 * @{
    6572 */
    6673
    6774/** Initialize the I2C peripheral. It sets the default parameters for I2C
    68  *  peripheral, and configure its specifieds pins.
    69  *  @param obj  The i2c object
     75 *  peripheral, and configures its specifieds pins.
     76 * 
     77 *  @param obj  The I2C object
    7078 *  @param sda  The sda pin
    7179 *  @param scl  The scl pin
     
    7381void i2c_init(i2c_t *obj, PinName sda, PinName scl);
    7482
    75 /** Configure the I2C frequency.
    76  *  @param obj The i2c object
     83/** Configure the I2C frequency
     84 *
     85 *  @param obj The I2C object
    7786 *  @param hz  Frequency in Hz
    7887 */
    7988void i2c_frequency(i2c_t *obj, int hz);
    8089
    81 /** Send START command.
    82  *  @param obj The i2c object
     90/** Send START command
     91 *
     92 *  @param obj The I2C object
    8393 */
    8494int  i2c_start(i2c_t *obj);
    8595
    86 /** Send STOP command.
    87  *  @param obj The i2c object
     96/** Send STOP command
     97 *
     98 *  @param obj The I2C object
    8899 */
    89100int  i2c_stop(i2c_t *obj);
    90101
    91 /** Blocking reading data.
    92  *  @param obj     The i2c object
     102/** Blocking reading data
     103 *
     104 *  @param obj     The I2C object
    93105 *  @param address 7-bit address (last bit is 1)
    94106 *  @param data    The buffer for receiving
     
    97109 *  @return Number of read bytes
    98110 */
    99 int  i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
    100 
    101 /** Blocking sending data.
    102  *  @param obj     The i2c object
     111int i2c_read(i2c_t *obj, int address, char *data, int length, int stop);
     112
     113/** Blocking sending data
     114 *
     115 *  @param obj     The I2C object
    103116 *  @param address 7-bit address (last bit is 0)
    104117 *  @param data    The buffer for sending
    105  *  @param length  Number of bytes to wrte
     118 *  @param length  Number of bytes to write
    106119 *  @param stop    Stop to be generated after the transfer is done
    107  *  @return Number of written bytes
    108  */
    109 int  i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
    110 
    111 /** Reset I2C peripheral. TODO: The action here. Most of the implementation sends stop().
    112  *  @param obj The i2c object
     120 *  @return
     121 *      zero or non-zero - Number of written bytes
     122 *      negative - I2C_ERROR_XXX status
     123 */
     124int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop);
     125
     126/** Reset I2C peripheral. TODO: The action here. Most of the implementation sends stop()
     127 *
     128 *  @param obj The I2C object
    113129 */
    114130void i2c_reset(i2c_t *obj);
    115131
    116 /** Read one byte.
    117  *  @param obj The i2c object
     132/** Read one byte
     133 *
     134 *  @param obj The I2C object
    118135 *  @param last Acknoledge
    119136 *  @return The read byte
    120137 */
    121 int  i2c_byte_read(i2c_t *obj, int last);
    122 
    123 /** Write one byte.
    124  *  @param obj The i2c object
     138int i2c_byte_read(i2c_t *obj, int last);
     139
     140/** Write one byte
     141 *
     142 *  @param obj The I2C object
    125143 *  @param data Byte to be written
    126  *  @return 1 if NAK was received, 0 if ACK was received, 2 for timeout.
    127  */
    128 int  i2c_byte_write(i2c_t *obj, int data);
     144 *  @return 0 if NAK was received, 1 if ACK was received, 2 for timeout.
     145 */
     146int i2c_byte_write(i2c_t *obj, int data);
    129147
    130148/**@}*/
     
    139157/** Configure I2C as slave or master.
    140158 *  @param obj The I2C object
     159 *  @param enable_slave Enable i2c hardware so you can receive events with ::i2c_slave_receive
    141160 *  @return non-zero if a value is available
    142161 */
     
    152171/** Configure I2C as slave or master.
    153172 *  @param obj The I2C object
     173 *  @param data    The buffer for receiving
     174 *  @param length  Number of bytes to read
    154175 *  @return non-zero if a value is available
    155176 */
     
    158179/** Configure I2C as slave or master.
    159180 *  @param obj The I2C object
     181 *  @param data    The buffer for sending
     182 *  @param length  Number of bytes to write
    160183 *  @return non-zero if a value is available
    161184 */
     
    177200
    178201/**
    179  * \defgroup AsynchI2C Asynchronous I2C Hardware Abstraction Layer
    180  * @{
    181  */
    182 
    183 /** Start i2c asynchronous transfer.
     202 * \defgroup hal_AsynchI2C Asynchronous I2C Hardware Abstraction Layer
     203 * @{
     204 */
     205
     206/** Start I2C asynchronous transfer
     207 *
    184208 *  @param obj       The I2C object
    185  *  @param tx        The buffer to send
    186  *  @param tx_length The number of words to transmit
    187  *  @param rx        The buffer to receive
    188  *  @param rx_length The number of words to receive
    189  *  @param address   The address to be set - 7bit or 9 bit
     209 *  @param tx        The transmit buffer
     210 *  @param tx_length The number of bytes to transmit
     211 *  @param rx        The receive buffer
     212 *  @param rx_length The number of bytes to receive
     213 *  @param address   The address to be set - 7bit or 9bit
    190214 *  @param stop      If true, stop will be generated after the transfer is done
    191215 *  @param handler   The I2C IRQ handler to be set
     216 *  @param event     Event mask for the transfer. See \ref hal_I2CEvents
    192217 *  @param hint      DMA hint usage
    193218 */
     
    195220
    196221/** The asynchronous IRQ handler
     222 *
    197223 *  @param obj The I2C object which holds the transfer information
    198  *  @return event flags if a transfer termination condition was met or 0 otherwise.
     224 *  @return Event flags if a transfer termination condition was met, otherwise return 0.
    199225 */
    200226uint32_t i2c_irq_handler_asynch(i2c_t *obj);
    201227
    202 /** Attempts to determine if I2C peripheral is already in use.
    203  *  @param obj The I2C object
    204  *  @return non-zero if the I2C module is active or zero if it is not
     228/** Attempts to determine if the I2C peripheral is already in use
     229 *
     230 *  @param obj The I2C object
     231 *  @return Non-zero if the I2C module is active or zero if it is not
    205232 */
    206233uint8_t i2c_active(i2c_t *obj);
    207234
    208 /** Abort ongoing asynchronous transaction.
     235/** Abort asynchronous transfer
     236 *
     237 *  This function does not perform any check - that should happen in upper layers.
    209238 *  @param obj The I2C object
    210239 */
     
    222251
    223252#endif
     253
     254/** @}*/
Note: See TracChangeset for help on using the changeset viewer.