NetBurner 3.1
nm_bus_wrapper.h
Go to the documentation of this file.
1 
42 #ifndef _NM_BUS_WRAPPER_H_
43 #define _NM_BUS_WRAPPER_H_
44 
46 
50 #define NM_BUS_TYPE_I2C ((uint8)0)
51 #define NM_BUS_TYPE_SPI ((uint8)1)
52 #define NM_BUS_TYPE_SDIO ((uint8)3)
53 
56 #define NM_BUS_IOCTL_R ((uint8)0)
57 #define NM_BUS_IOCTL_W ((uint8)1)
58 #define NM_BUS_IOCTL_W_SPECIAL ((uint8)2)
60 #define NM_BUS_IOCTL_RW ((uint8)3)
62 #define NM_BUS_IOCTL_WR_RESTART ((uint8)4)
63 #define NM_BUS_IOCTL_CMD_52 ((uint8)5)
64 #define NM_BUS_IOCTL_CMD_53 ((uint8)6)
71 typedef struct
72 {
73  uint16 u16MaxTrxSz;
75 
81 typedef struct
82 {
83  uint8 u8SlaveAdr;
84  uint8 *pu8Buf;
85  uint16 u16Sz;
87 
93 typedef struct
94 {
95  uint8 u8SlaveAdr;
96  uint8 *pu8Buf1;
97  uint8 *pu8Buf2;
98  uint16 u16Sz1;
99  uint16 u16Sz2;
101 
107 typedef struct
108 {
109  uint8 *pu8InBuf;
111  uint8 *pu8OutBuf;
113  uint16 u16Sz;
115 
116 #ifdef CONF_WILC_USE_SDIO
117 
122 typedef struct {
123  uint32_t read_write:1;
124  uint32_t function:3;
125  uint32_t raw:1;
126  uint32_t address:17;
127  uint32_t data:8;
128 } tstrNmSdioCmd52;
129 
135 typedef struct {
136  uint32_t read_write:1;
137  uint32_t function:3;
138  uint32_t block_mode:1;
139  uint32_t increment:1;
140  uint32_t address:17;
141  uint32_t count:9;
142  uint8_t *buffer;
143  uint32_t block_size;
144 } tstrNmSdioCmd53;
145 
146 #endif /* CONF_WILC_USE_SDIO */
147 
150 
151 #ifdef __cplusplus
152  extern "C" {
153  #endif
154 
159 sint8 nm_bus_init(void *);
160 
171 sint8 nm_bus_ioctl(uint8 u8Cmd, void* pvParameter);
172 
178 sint8 nm_bus_deinit(void);
179 
180 /*
181 * @fn nm_bus_reinit
182 * @brief re-initialize the bus wrapper
183 * @param [in] void *config
184 * re-init configuration data
185 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
186 */
187 sint8 nm_bus_reinit(void *config);
188 /*
189 * @fn nm_bus_get_chip_type
190 * @brief get chip type
191 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
192 */
193 #ifdef __cplusplus
194  }
195  #endif
196 
197 #endif /*_NM_BUS_WRAPPER_H_*/
This module contains common APIs declarations.
Structure holding I2C default operation parameters.
Definition: nm_bus_wrapper.h:82
Structure holding bus capabilities information.
Definition: nm_bus_wrapper.h:72
Structure holding I2C special operation parameters.
Definition: nm_bus_wrapper.h:94
tstrNmBusCapabilities egstrNmBusCapabilities
signed char sint8
Range of values between -128 to 127.
Definition: nm_bsp.h:123
Structure holding SPI R/W parameters.
Definition: nm_bus_wrapper.h:108
sint8 nm_bus_deinit(void)
De-initialize the bus wrapper.
unsigned short uint16
Range of values between 0 to 65535.
Definition: ahdlc.cpp:46