lpi2c_adapter.c
Go to the documentation of this file.
1 /*
2  * Copyright 2018 NXP
3  * All rights reserved.
4  *
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #include "fsl_common.h"
10 #include "fsl_lpi2c.h"
11 
12 #include "i2c.h"
13 
14 /*******************************************************************************
15  * Definitions
16  ******************************************************************************/
17 
19 typedef struct _hal_i2c_master
20 {
22  void *callbackParam;
24  uint8_t instance;
26 
28 typedef struct _hal_i2c_slave
29 {
34  uint8_t instance;
36 
37 /*******************************************************************************
38  * Prototypes
39  ******************************************************************************/
40 
41 /*******************************************************************************
42  * Variables
43  ******************************************************************************/
44 
47 
48 /*******************************************************************************
49  * Code
50  ******************************************************************************/
51 
53 {
54  hal_i2c_status_t returnStatus;
55  switch (status)
56  {
57  case kStatus_Success:
58  {
59  returnStatus = kStatus_HAL_I2cSuccess;
60  break;
61  }
62  case kStatus_LPI2C_Busy:
63  {
64  returnStatus = kStatus_HAL_I2cBusy;
65  break;
66  }
67  case kStatus_LPI2C_Idle:
68  {
69  returnStatus = kStatus_HAL_I2cIdle;
70  break;
71  }
72  case kStatus_LPI2C_Nak:
73  {
74  returnStatus = kStatus_HAL_I2cNak;
75  break;
76  }
78  {
79  returnStatus = kStatus_HAL_I2cArbitrationLost;
80  break;
81  }
83  {
84  returnStatus = kStatus_HAL_I2cTimeout;
85  break;
86  }
87  default:
88  {
89  returnStatus = kStatus_HAL_I2cError;
90  break;
91  }
92  }
93  return returnStatus;
94 }
95 
96 static void HAL_I2cMasterCallback(LPI2C_Type *base, lpi2c_master_handle_t *handle, status_t status, void *callbackParam)
97 {
98  hal_i2c_master_t *i2cMasterHandle;
99  assert(callbackParam);
100 
101  i2cMasterHandle = (hal_i2c_master_t *)callbackParam;
102 
103  if (NULL != i2cMasterHandle->callback)
104  {
105  i2cMasterHandle->callback(i2cMasterHandle, HAL_I2cGetStatus(status), i2cMasterHandle->callbackParam);
106  }
107 }
108 
109 static void HAL_I2cSlaveCallback(LPI2C_Type *base, lpi2c_slave_transfer_t *xfer, void *callbackParam)
110 {
111  hal_i2c_slave_t *i2cSlaveHandle;
112  assert(callbackParam);
113 
114  i2cSlaveHandle = (hal_i2c_slave_t *)callbackParam;
115 
116  if (NULL != i2cSlaveHandle->callback)
117  {
118  i2cSlaveHandle->transfer.event = (hal_i2c_slave_transfer_event_t)xfer->event;
119  i2cSlaveHandle->transfer.data = xfer->data;
120  i2cSlaveHandle->transfer.dataSize = xfer->dataSize;
122  i2cSlaveHandle->transfer.transferredCount = xfer->transferredCount;
123  i2cSlaveHandle->callback(i2cSlaveHandle, &i2cSlaveHandle->transfer, i2cSlaveHandle->callbackParam);
124  xfer->data = i2cSlaveHandle->transfer.data;
125  xfer->dataSize = i2cSlaveHandle->transfer.dataSize;
126  }
127 }
128 
130 {
131  hal_i2c_master_t *i2cMasterHandle;
132  lpi2c_master_config_t i2cConfig;
133 
134  assert(handle);
135  assert(config);
136  assert(HAL_I2C_MASTER_HANDLE_SIZE >= sizeof(hal_i2c_master_t));
137 
138  i2cMasterHandle = (hal_i2c_master_t *)handle;
139 
140  LPI2C_MasterGetDefaultConfig(&i2cConfig);
141  i2cConfig.enableMaster = config->enableMaster;
142  i2cConfig.baudRate_Hz = config->baudRate_Bps;
143  i2cMasterHandle->instance = config->instance;
144 
145  LPI2C_MasterInit(s_i2cBases[i2cMasterHandle->instance], &i2cConfig, config->srcClock_Hz);
146 
147  return kStatus_HAL_I2cSuccess;
148 }
149 
151 {
152  hal_i2c_slave_t *i2cSlaveHandle;
153  lpi2c_slave_config_t i2cConfig;
154 
155  assert(handle);
156  assert(config);
157  assert(HAL_I2C_SLAVE_HANDLE_SIZE >= sizeof(hal_i2c_slave_t));
158 
159  i2cSlaveHandle = (hal_i2c_slave_t *)handle;
160 
161  LPI2C_SlaveGetDefaultConfig(&i2cConfig);
162  i2cConfig.enableSlave = config->enableSlave;
163  i2cConfig.address0 = (uint8_t)config->slaveAddress;
164  i2cSlaveHandle->instance = config->instance;
165 
166  LPI2C_SlaveInit(s_i2cBases[i2cSlaveHandle->instance], &i2cConfig, config->srcClock_Hz);
167 
168  return kStatus_HAL_I2cSuccess;
169 }
170 
172 {
173  hal_i2c_master_t *i2cMasterHandle;
174 
175  assert(handle);
176 
177  i2cMasterHandle = (hal_i2c_master_t *)handle;
178 
179  LPI2C_MasterDeinit(s_i2cBases[i2cMasterHandle->instance]);
180 
181  return kStatus_HAL_I2cSuccess;
182 }
183 
185 {
186  hal_i2c_slave_t *i2cSlaveHandle;
187 
188  assert(handle);
189 
190  i2cSlaveHandle = (hal_i2c_slave_t *)handle;
191 
192  LPI2C_SlaveDeinit(s_i2cBases[i2cSlaveHandle->instance]);
193 
194  return kStatus_HAL_I2cSuccess;
195 }
196 
198  const uint8_t *txBuff,
199  size_t txSize,
200  uint32_t flags)
201 {
202  return kStatus_HAL_I2cError;
203 }
204 
206  uint8_t *rxBuff,
207  size_t rxSize,
208  uint32_t flags)
209 {
210  return kStatus_HAL_I2cError;
211 }
212 
213 hal_i2c_status_t HAL_I2cSlaveWriteBlocking(hal_i2c_slave_handle_t handle, const uint8_t *txBuff, size_t txSize)
214 {
215  return kStatus_HAL_I2cError;
216 }
217 
218 hal_i2c_status_t HAL_I2cSlaveReadBlocking(hal_i2c_slave_handle_t handle, uint8_t *rxBuff, size_t rxSize)
219 {
220  return kStatus_HAL_I2cError;
221 }
222 
224 {
225  hal_i2c_master_t *i2cMasterHandle;
226  lpi2c_master_transfer_t transfer;
227 
228  assert(handle);
229  assert(xfer);
230 
231  i2cMasterHandle = (hal_i2c_master_t *)handle;
232 
233  transfer.flags = xfer->flags;
234  transfer.slaveAddress = xfer->slaveAddress;
235  transfer.direction = (kHAL_I2cRead == xfer->direction) ? kLPI2C_Read : kLPI2C_Write;
236  transfer.subaddress = xfer->subaddress;
237  transfer.subaddressSize = xfer->subaddressSize;
238  transfer.data = xfer->data;
239  transfer.dataSize = xfer->dataSize;
240 
241  return HAL_I2cGetStatus(LPI2C_MasterTransferBlocking(s_i2cBases[i2cMasterHandle->instance], &transfer));
242 }
243 
246  void *callbackParam)
247 {
248  hal_i2c_master_t *i2cMasterHandle;
249 
250  assert(handle);
251 
252  i2cMasterHandle = (hal_i2c_master_t *)handle;
253 
254  i2cMasterHandle->callback = callback;
255  i2cMasterHandle->callbackParam = callbackParam;
256  LPI2C_MasterTransferCreateHandle(s_i2cBases[i2cMasterHandle->instance], &i2cMasterHandle->hardwareHandle,
257  HAL_I2cMasterCallback, i2cMasterHandle);
258 
259  return kStatus_HAL_I2cSuccess;
260 }
261 
263 {
264  hal_i2c_master_t *i2cMasterHandle;
265  lpi2c_master_transfer_t transfer;
266 
267  assert(handle);
268  assert(xfer);
269 
270  i2cMasterHandle = (hal_i2c_master_t *)handle;
271 
272  transfer.flags = xfer->flags;
273  transfer.slaveAddress = xfer->slaveAddress;
274  transfer.direction = (kHAL_I2cRead == xfer->direction) ? kLPI2C_Read : kLPI2C_Write;
275  transfer.subaddress = xfer->subaddress;
276  transfer.subaddressSize = xfer->subaddressSize;
277  transfer.data = xfer->data;
278  transfer.dataSize = xfer->dataSize;
280  &i2cMasterHandle->hardwareHandle, &transfer));
281 }
282 
284 {
285  hal_i2c_master_t *i2cMasterHandle;
286 
287  assert(handle);
288  assert(count);
289 
290  i2cMasterHandle = (hal_i2c_master_t *)handle;
291  return HAL_I2cGetStatus(
292  LPI2C_MasterTransferGetCount(s_i2cBases[i2cMasterHandle->instance], &i2cMasterHandle->hardwareHandle, count));
293 }
294 
296 {
297  hal_i2c_master_t *i2cMasterHandle;
298 
299  assert(handle);
300 
301  i2cMasterHandle = (hal_i2c_master_t *)handle;
302  LPI2C_MasterTransferAbort(s_i2cBases[i2cMasterHandle->instance], &i2cMasterHandle->hardwareHandle);
303 
304  return kStatus_HAL_I2cSuccess;
305 }
306 
309  void *callbackParam)
310 {
311  hal_i2c_slave_t *i2cSlaveHandle;
312 
313  assert(handle);
314 
315  i2cSlaveHandle = (hal_i2c_slave_t *)handle;
316 
317  i2cSlaveHandle->callback = callback;
318  i2cSlaveHandle->callbackParam = callbackParam;
319  LPI2C_SlaveTransferCreateHandle(s_i2cBases[i2cSlaveHandle->instance], &i2cSlaveHandle->hardwareHandle,
320  HAL_I2cSlaveCallback, i2cSlaveHandle);
321 
322  return kStatus_HAL_I2cSuccess;
323 }
324 
326 {
327  hal_i2c_slave_t *i2cSlaveHandle;
328 
329  assert(handle);
330 
331  i2cSlaveHandle = (hal_i2c_slave_t *)handle;
332 
334  &i2cSlaveHandle->hardwareHandle, eventMask));
335 }
336 
338 {
339  hal_i2c_slave_t *i2cSlaveHandle;
340 
341  assert(handle);
342 
343  i2cSlaveHandle = (hal_i2c_slave_t *)handle;
344 
345  LPI2C_SlaveTransferAbort(s_i2cBases[i2cSlaveHandle->instance], &i2cSlaveHandle->hardwareHandle);
346 
347  return kStatus_HAL_I2cSuccess;
348 }
349 
351 {
352  hal_i2c_slave_t *i2cSlaveHandle;
353 
354  assert(handle);
355  assert(count);
356 
357  i2cSlaveHandle = (hal_i2c_slave_t *)handle;
358 
359  return HAL_I2cGetStatus(
360  LPI2C_SlaveTransferGetCount(s_i2cBases[i2cSlaveHandle->instance], &i2cSlaveHandle->hardwareHandle, count));
361 }
HAL_I2cGetStatus
static hal_i2c_status_t HAL_I2cGetStatus(status_t status)
Definition: lpi2c_adapter.c:52
fsl_common.h
_hal_i2c_slave
i2c slave state structure.
Definition: lpi2c_adapter.c:28
LPI2C_MasterGetDefaultConfig
void LPI2C_MasterGetDefaultConfig(lpi2c_master_config_t *masterConfig)
Provides a default configuration for the LPI2C master peripheral.
Definition: fsl_lpi2c.c:356
HAL_I2cSlaveCallback
static void HAL_I2cSlaveCallback(LPI2C_Type *base, lpi2c_slave_transfer_t *xfer, void *callbackParam)
Definition: lpi2c_adapter.c:109
_lpi2c_slave_config::enableSlave
bool enableSlave
Definition: fsl_lpi2c.h:304
hal_i2c_master_t
struct _hal_i2c_master hal_i2c_master_t
i2c master state structure.
_hal_i2c_slave_transfer::event
hal_i2c_slave_transfer_event_t event
Definition: i2c.h:116
_lpi2c_master_transfer::data
void * data
Definition: fsl_lpi2c.h:228
s_i2cBases
static LPI2C_Type *const s_i2cBases[]
Pointers to i2c bases for each instance.
Definition: lpi2c_adapter.c:46
HAL_I2cSlaveInit
hal_i2c_status_t HAL_I2cSlaveInit(hal_i2c_slave_handle_t handle, const hal_i2c_slave_config_t *config)
Initializes the HAL I2C peripheral.
Definition: lpi2c_adapter.c:150
_lpi2c_master_config::baudRate_Hz
uint32_t baudRate_Hz
Definition: fsl_lpi2c.h:144
LPI2C_SlaveDeinit
void LPI2C_SlaveDeinit(LPI2C_Type *base)
Deinitializes the LPI2C slave peripheral.
Definition: fsl_lpi2c.c:1582
_lpi2c_master_transfer::subaddress
uint32_t subaddress
Definition: fsl_lpi2c.h:226
_hal_i2c_master::callbackParam
void * callbackParam
Definition: lpi2c_adapter.c:24
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
hal_i2c_slave_transfer_event_t
enum _hal_i2c_slave_transfer_event hal_i2c_slave_transfer_event_t
Set of events sent to the callback for nonblocking slave transfers.
_hal_i2c_slave::callback
hal_i2c_slave_transfer_callback_t callback
Definition: lpi2c_adapter.c:30
_hal_i2c_master_transfer::direction
hal_i2c_direction_t direction
Definition: i2c.h:110
_hal_i2c_master_transfer::slaveAddress
uint8_t slaveAddress
Definition: i2c.h:109
LPI2C_MasterDeinit
void LPI2C_MasterDeinit(LPI2C_Type *base)
Deinitializes the LPI2C master peripheral.
Definition: fsl_lpi2c.c:477
_hal_i2c_master::instance
uint8_t instance
Definition: lpi2c_adapter.c:26
LPI2C_MasterTransferCreateHandle
void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
Creates a new handle for the LPI2C master non-blocking APIs.
Definition: fsl_lpi2c.c:965
_lpi2c_master_transfer::slaveAddress
uint16_t slaveAddress
Definition: fsl_lpi2c.h:224
HAL_I2cSlaveDeinit
hal_i2c_status_t HAL_I2cSlaveDeinit(hal_i2c_slave_handle_t handle)
De-initializes the HAL I2C slave peripheral. Calling this API gates the HAL I2C clock....
Definition: lpi2c_adapter.c:184
HAL_I2cMasterTransferGetCount
hal_i2c_status_t HAL_I2cMasterTransferGetCount(hal_i2c_master_handle_t handle, size_t *count)
Gets the master transfer status during a interrupt non-blocking transfer.
Definition: lpi2c_adapter.c:283
_hal_i2c_slave_config
HAL I2C slave user configuration.
Definition: i2c.h:49
HAL_I2cSlaveWriteBlocking
hal_i2c_status_t HAL_I2cSlaveWriteBlocking(hal_i2c_slave_handle_t handle, const uint8_t *txBuff, size_t txSize)
Performs a polling send transaction on the HAL I2C bus.
Definition: lpi2c_adapter.c:213
LPI2C_SlaveGetDefaultConfig
void LPI2C_SlaveGetDefaultConfig(lpi2c_slave_config_t *slaveConfig)
Provides a default configuration for the LPI2C slave peripheral.
Definition: fsl_lpi2c.c:1490
kStatus_HAL_I2cBusy
@ kStatus_HAL_I2cBusy
Definition: i2c.h:31
_hal_i2c_master_transfer::dataSize
volatile size_t dataSize
Definition: i2c.h:105
_hal_i2c_master_transfer::flags
uint32_t flags
Definition: i2c.h:106
_lpi2c_master_config
Structure with settings to initialize the LPI2C master module.
Definition: fsl_lpi2c.h:137
HAL_I2cSlaveTransferGetCount
hal_i2c_status_t HAL_I2cSlaveTransferGetCount(hal_i2c_slave_handle_t handle, size_t *count)
Gets the slave transfer remaining bytes during a interrupt non-blocking transfer.
Definition: lpi2c_adapter.c:350
_hal_i2c_master::hardwareHandle
lpi2c_master_handle_t hardwareHandle
Definition: lpi2c_adapter.c:25
kStatus_LPI2C_Timeout
@ kStatus_LPI2C_Timeout
Definition: fsl_lpi2c.h:49
kStatus_LPI2C_ArbitrationLost
@ kStatus_LPI2C_ArbitrationLost
Definition: fsl_lpi2c.h:43
_hal_i2c_master_transfer::data
uint8_t *volatile data
Definition: i2c.h:104
_hal_i2c_slave_transfer::transferredCount
size_t transferredCount
Definition: i2c.h:121
_lpi2c_master_handle
Driver handle for master non-blocking APIs.
Definition: fsl_lpi2c.h:236
kStatus_HAL_I2cSuccess
@ kStatus_HAL_I2cSuccess
Definition: i2c.h:29
_hal_i2c_slave_transfer
HAL I2C slave transfer structure.
Definition: i2c.h:114
_hal_i2c_master_config
HAL I2C master user configuration.
Definition: i2c.h:40
_hal_i2c_slave_transfer::dataSize
volatile size_t dataSize
Definition: i2c.h:118
_lpi2c_slave_transfer::dataSize
size_t dataSize
Definition: fsl_lpi2c.h:365
kStatus_HAL_I2cArbitrationLost
@ kStatus_HAL_I2cArbitrationLost
Definition: i2c.h:34
kStatus_HAL_I2cIdle
@ kStatus_HAL_I2cIdle
Definition: i2c.h:32
kLPI2C_Read
@ kLPI2C_Read
Definition: fsl_lpi2c.h:95
HAL_I2cMasterTransferInstallCallback
hal_i2c_status_t HAL_I2cMasterTransferInstallCallback(hal_i2c_master_handle_t handle, hal_i2c_master_transfer_callback_t callback, void *callbackParam)
Installs a callback and callback parameter.
Definition: lpi2c_adapter.c:244
kHAL_I2cRead
@ kHAL_I2cRead
Definition: i2c.h:61
_lpi2c_slave_config::address0
uint8_t address0
Definition: fsl_lpi2c.h:305
kLPI2C_Write
@ kLPI2C_Write
Definition: fsl_lpi2c.h:94
hal_i2c_status_t
enum _hal_i2c_status hal_i2c_status_t
HAL I2C status.
HAL_I2cMasterWriteBlocking
hal_i2c_status_t HAL_I2cMasterWriteBlocking(hal_i2c_master_handle_t handle, const uint8_t *txBuff, size_t txSize, uint32_t flags)
Performs a polling send transaction on the HAL I2C bus.
Definition: lpi2c_adapter.c:197
HAL_I2cSlaveTransferNonBlocking
hal_i2c_status_t HAL_I2cSlaveTransferNonBlocking(hal_i2c_slave_handle_t handle, uint32_t eventMask)
Starts accepting slave transfers.
Definition: lpi2c_adapter.c:325
kStatus_LPI2C_Idle
@ kStatus_LPI2C_Idle
Definition: fsl_lpi2c.h:39
LPI2C_SlaveTransferCreateHandle
void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData)
Creates a new handle for the LPI2C slave non-blocking APIs.
Definition: fsl_lpi2c.c:1818
LPI2C_BASE_PTRS
#define LPI2C_BASE_PTRS
Definition: MIMXRT1052.h:26125
HAL_I2cSlaveTransferInstallCallback
hal_i2c_status_t HAL_I2cSlaveTransferInstallCallback(hal_i2c_slave_handle_t handle, hal_i2c_slave_transfer_callback_t callback, void *callbackParam)
Installs a callback and callback parameter.
Definition: lpi2c_adapter.c:307
kStatus_HAL_I2cNak
@ kStatus_HAL_I2cNak
Definition: i2c.h:33
count
size_t count
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/tests/test_common/ma_test_common.c:31
_lpi2c_slave_transfer::transferredCount
size_t transferredCount
Definition: fsl_lpi2c.h:368
HAL_I2cSlaveReadBlocking
hal_i2c_status_t HAL_I2cSlaveReadBlocking(hal_i2c_slave_handle_t handle, uint8_t *rxBuff, size_t rxSize)
Performs a polling receive transaction on the HAL I2C bus.
Definition: lpi2c_adapter.c:218
_lpi2c_master_transfer::direction
lpi2c_direction_t direction
Definition: fsl_lpi2c.h:225
LPI2C_SlaveInit
void LPI2C_SlaveInit(LPI2C_Type *base, const lpi2c_slave_config_t *slaveConfig, uint32_t sourceClock_Hz)
Initializes the LPI2C slave peripheral.
Definition: fsl_lpi2c.c:1526
kStatus_LPI2C_Nak
@ kStatus_LPI2C_Nak
Definition: fsl_lpi2c.h:40
HAL_I2cMasterInit
hal_i2c_status_t HAL_I2cMasterInit(hal_i2c_master_handle_t handle, const hal_i2c_master_config_t *config)
Initializes the HAL I2C master peripheral.
Definition: lpi2c_adapter.c:129
_lpi2c_master_config::enableMaster
bool enableMaster
Definition: fsl_lpi2c.h:139
HAL_I2cMasterCallback
static void HAL_I2cMasterCallback(LPI2C_Type *base, lpi2c_master_handle_t *handle, status_t status, void *callbackParam)
Definition: lpi2c_adapter.c:96
HAL_I2C_SLAVE_HANDLE_SIZE
#define HAL_I2C_SLAVE_HANDLE_SIZE
HAL I2C slave handle size.
Definition: i2c.h:24
hal_i2c_slave_handle_t
void * hal_i2c_slave_handle_t
HAL I2C slave handle.
Definition: i2c.h:129
_lpi2c_slave_handle
LPI2C slave handle structure.
Definition: fsl_lpi2c.h:390
hal_i2c_slave_t
struct _hal_i2c_slave hal_i2c_slave_t
i2c slave state structure.
_lpi2c_slave_config
Structure with settings to initialize the LPI2C slave module.
Definition: fsl_lpi2c.h:302
HAL_I2cMasterTransferBlocking
hal_i2c_status_t HAL_I2cMasterTransferBlocking(hal_i2c_master_handle_t handle, hal_i2c_master_transfer_t *xfer)
Performs a master polling transfer on the HAL I2C bus.
Definition: lpi2c_adapter.c:223
LPI2C_Type
Definition: MIMXRT1052.h:25094
_hal_i2c_slave_transfer::data
uint8_t *volatile data
Definition: i2c.h:117
_lpi2c_master_transfer::dataSize
size_t dataSize
Definition: fsl_lpi2c.h:229
_hal_i2c_slave::transfer
hal_i2c_slave_transfer_t transfer
Definition: lpi2c_adapter.c:32
LPI2C_MasterTransferNonBlocking
status_t LPI2C_MasterTransferNonBlocking(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_t *transfer)
Performs a non-blocking transaction on the I2C bus.
Definition: fsl_lpi2c.c:1264
kStatus_HAL_I2cError
@ kStatus_HAL_I2cError
Definition: i2c.h:30
LPI2C_MasterTransferGetCount
status_t LPI2C_MasterTransferGetCount(LPI2C_Type *base, lpi2c_master_handle_t *handle, size_t *count)
Returns number of bytes transferred so far.
Definition: fsl_lpi2c.c:1319
HAL_I2cMasterTransferAbort
hal_i2c_status_t HAL_I2cMasterTransferAbort(hal_i2c_master_handle_t handle)
Aborts an interrupt non-blocking transfer early.
Definition: lpi2c_adapter.c:295
HAL_I2cSlaveTransferAbort
hal_i2c_status_t HAL_I2cSlaveTransferAbort(hal_i2c_slave_handle_t handle)
Aborts the slave transfer.
Definition: lpi2c_adapter.c:337
_hal_i2c_master_transfer::subaddress
uint32_t subaddress
Definition: i2c.h:107
LPI2C_SlaveTransferGetCount
status_t LPI2C_SlaveTransferGetCount(LPI2C_Type *base, lpi2c_slave_handle_t *handle, size_t *count)
Gets the slave transfer status during a non-blocking transfer.
Definition: fsl_lpi2c.c:1927
HAL_I2cMasterTransferNonBlocking
hal_i2c_status_t HAL_I2cMasterTransferNonBlocking(hal_i2c_master_handle_t handle, hal_i2c_master_transfer_t *xfer)
Performs a master interrupt non-blocking transfer on the HAL I2C bus.
Definition: lpi2c_adapter.c:262
HAL_I2cMasterDeinit
hal_i2c_status_t HAL_I2cMasterDeinit(hal_i2c_master_handle_t handle)
De-initializes the HAL I2C master peripheral. Call this API to gate the HAL I2C clock....
Definition: lpi2c_adapter.c:171
fsl_lpi2c.h
_lpi2c_slave_transfer::completionStatus
status_t completionStatus
Definition: fsl_lpi2c.h:366
_hal_i2c_master_transfer::subaddressSize
uint8_t subaddressSize
Definition: i2c.h:108
HAL_I2C_MASTER_HANDLE_SIZE
#define HAL_I2C_MASTER_HANDLE_SIZE
HAL I2C master handle size.
Definition: i2c.h:21
_hal_i2c_slave::hardwareHandle
lpi2c_slave_handle_t hardwareHandle
Definition: lpi2c_adapter.c:33
_hal_i2c_master
i2c master state structure.
Definition: lpi2c_adapter.c:19
LPI2C_MasterTransferAbort
void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle)
Terminates a non-blocking LPI2C master transmission early.
Definition: fsl_lpi2c.c:1383
_lpi2c_slave_transfer::event
lpi2c_slave_transfer_event_t event
Definition: fsl_lpi2c.h:362
LPI2C_MasterTransferBlocking
status_t LPI2C_MasterTransferBlocking(LPI2C_Type *base, lpi2c_master_transfer_t *transfer)
Performs a master polling transfer on the I2C bus.
Definition: fsl_lpi2c.c:854
config
static sai_transceiver_t config
Definition: imxrt1050/imxrt1050-evkb/source/pv_audio_rec.c:75
LPI2C_MasterInit
void LPI2C_MasterInit(LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t sourceClock_Hz)
Initializes the LPI2C master peripheral.
Definition: fsl_lpi2c.c:389
_hal_i2c_slave::instance
uint8_t instance
Definition: lpi2c_adapter.c:34
_lpi2c_slave_transfer
LPI2C slave transfer structure.
Definition: fsl_lpi2c.h:360
_lpi2c_master_transfer::flags
uint32_t flags
Definition: fsl_lpi2c.h:222
_hal_i2c_slave_transfer::completionStatus
hal_i2c_status_t completionStatus
Definition: i2c.h:119
hal_i2c_master_transfer_callback_t
void(* hal_i2c_master_transfer_callback_t)(hal_i2c_master_handle_t handle, hal_i2c_status_t completionStatus, void *callbackParam)
Master completion callback function pointer type.
Definition: i2c.h:177
_lpi2c_slave_transfer::data
uint8_t * data
Definition: fsl_lpi2c.h:364
hal_i2c_master_handle_t
void * hal_i2c_master_handle_t
HAL I2C master handle.
Definition: i2c.h:126
kStatus_HAL_I2cTimeout
@ kStatus_HAL_I2cTimeout
Definition: i2c.h:35
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:189
i2c.h
_lpi2c_master_transfer::subaddressSize
size_t subaddressSize
Definition: fsl_lpi2c.h:227
_hal_i2c_master_transfer
HAL I2C master transfer structure.
Definition: i2c.h:102
HAL_I2cMasterReadBlocking
hal_i2c_status_t HAL_I2cMasterReadBlocking(hal_i2c_master_handle_t handle, uint8_t *rxBuff, size_t rxSize, uint32_t flags)
Performs a polling receive transaction on the HAL I2C bus.
Definition: lpi2c_adapter.c:205
kStatus_Success
@ kStatus_Success
Definition: fsl_common.h:179
LPI2C_SlaveTransferAbort
void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Aborts the slave non-blocking transfers.
Definition: fsl_lpi2c.c:1957
_lpi2c_master_transfer
Non-blocking transfer descriptor structure.
Definition: fsl_lpi2c.h:220
_hal_i2c_slave::callbackParam
void * callbackParam
Definition: lpi2c_adapter.c:31
hal_i2c_slave_transfer_callback_t
void(* hal_i2c_slave_transfer_callback_t)(hal_i2c_slave_handle_t handle, hal_i2c_slave_transfer_t *transfer, void *callbackParam)
Slave event callback function pointer type.
Definition: i2c.h:191
kStatus_LPI2C_Busy
@ kStatus_LPI2C_Busy
Definition: fsl_lpi2c.h:38
LPI2C_SlaveTransferNonBlocking
status_t LPI2C_SlaveTransferNonBlocking(LPI2C_Type *base, lpi2c_slave_handle_t *handle, uint32_t eventMask)
Starts accepting slave transfers.
Definition: fsl_lpi2c.c:1875
_hal_i2c_master::callback
hal_i2c_master_transfer_callback_t callback
Definition: lpi2c_adapter.c:23


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:56