RTEMS 6.1-rc1
fsl_lpi2c.h
1/*
2 * Copyright (c) 2015, Freescale Semiconductor, Inc.
3 * Copyright 2016-2022 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_LPI2C_H_
9#define _FSL_LPI2C_H_
10
11#include <stddef.h>
12#include "fsl_device_registers.h"
13#include "fsl_common.h"
14
15/*******************************************************************************
16 * Definitions
17 ******************************************************************************/
18
27#define FSL_LPI2C_DRIVER_VERSION (MAKE_VERSION(2, 4, 1))
31#ifndef I2C_RETRY_TIMES
32#define I2C_RETRY_TIMES 0U /* Define to zero means keep waiting until the flag is assert/deassert. */
33#endif
34
36enum
37{
50};
51
77{
78 kLPI2C_MasterTxReadyFlag = LPI2C_MSR_TDF_MASK,
79 kLPI2C_MasterRxReadyFlag = LPI2C_MSR_RDF_MASK,
80 kLPI2C_MasterEndOfPacketFlag = LPI2C_MSR_EPF_MASK,
81 kLPI2C_MasterStopDetectFlag = LPI2C_MSR_SDF_MASK,
82 kLPI2C_MasterNackDetectFlag = LPI2C_MSR_NDF_MASK,
83 kLPI2C_MasterArbitrationLostFlag = LPI2C_MSR_ALF_MASK,
84 kLPI2C_MasterFifoErrFlag = LPI2C_MSR_FEF_MASK,
85 kLPI2C_MasterPinLowTimeoutFlag = LPI2C_MSR_PLTF_MASK,
86 kLPI2C_MasterDataMatchFlag = LPI2C_MSR_DMF_MASK,
87 kLPI2C_MasterBusyFlag = LPI2C_MSR_MBF_MASK,
88 kLPI2C_MasterBusBusyFlag = LPI2C_MSR_BBF_MASK,
102
105{
107 kLPI2C_Read = 1U
109
112{
118 0x4U,
120 0x5U,
122 0x6U,
125
128{
132
135{
139
150{
156 uint32_t baudRate_Hz;
161 struct
162 {
163 bool enable;
168
171{
176 0x4U,
178 0x5U,
180 0x6U,
182 0x7U
184
187{
190 uint32_t match0;
191 uint32_t match1;
193
194/* Forward declaration of the transfer descriptor and handle typedefs. */
197
209 lpi2c_master_handle_t *handle,
210 status_t completionStatus,
211 void *userData);
212
220{
225};
226
233{
234 uint32_t flags;
236 uint16_t slaveAddress;
238 uint32_t subaddress;
240 void *data;
241 size_t dataSize;
242};
243
249{
250 uint8_t state;
251 uint16_t remainingBytes;
252 uint8_t *buf;
253 uint16_t commandBuffer[6];
257 void *userData;
258};
259
262typedef void (*lpi2c_master_isr_t)(LPI2C_Type *base, void *handle);
263
286{
287 kLPI2C_SlaveTxReadyFlag = LPI2C_SSR_TDF_MASK,
288 kLPI2C_SlaveRxReadyFlag = LPI2C_SSR_RDF_MASK,
289 kLPI2C_SlaveAddressValidFlag = LPI2C_SSR_AVF_MASK,
290 kLPI2C_SlaveTransmitAckFlag = LPI2C_SSR_TAF_MASK,
292 kLPI2C_SlaveStopDetectFlag = LPI2C_SSR_SDF_MASK,
293 kLPI2C_SlaveBitErrFlag = LPI2C_SSR_BEF_MASK,
294 kLPI2C_SlaveFifoErrFlag = LPI2C_SSR_FEF_MASK,
295 kLPI2C_SlaveAddressMatch0Flag = LPI2C_SSR_AM0F_MASK,
296 kLPI2C_SlaveAddressMatch1Flag = LPI2C_SSR_AM1F_MASK,
297 kLPI2C_SlaveGeneralCallFlag = LPI2C_SSR_GCF_MASK,
298 kLPI2C_SlaveBusyFlag = LPI2C_SSR_SBF_MASK,
299 kLPI2C_SlaveBusBusyFlag = LPI2C_SSR_BBF_MASK,
310
313{
318
329{
331 uint8_t address0;
332 uint8_t address1;
337 struct
338 {
345 bool enableTx;
347 bool enableRx;
350 } sclStall;
360
372{
386
389{
392 uint8_t *data;
393 size_t dataSize;
398
399/* Forward declaration. */
401
413
419{
421 bool isBusy;
423 uint32_t eventMask;
426 void *userData;
427};
428
431/*******************************************************************************
432 * Variables
433 ******************************************************************************/
436extern IRQn_Type const kLpi2cIrqs[];
437
441
444extern void *s_lpi2cMasterHandle[];
445
446/*******************************************************************************
447 * API
448 ******************************************************************************/
449
450#if defined(__cplusplus)
451extern "C" {
452#endif
453
463uint32_t LPI2C_GetInstance(LPI2C_Type *base);
464
472
498
512void LPI2C_MasterInit(LPI2C_Type *base, const lpi2c_master_config_t *masterConfig, uint32_t sourceClock_Hz);
513
523
531
532/* Not static so it can be used from fsl_lpi2c_edma.c. */
534
535/* Not static so it can be used from fsl_lpi2c_edma.c. */
537
545static inline void LPI2C_MasterReset(LPI2C_Type *base)
546{
547 base->MCR = LPI2C_MCR_RST_MASK;
548 base->MCR = 0;
549}
550
557static inline void LPI2C_MasterEnable(LPI2C_Type *base, bool enable)
558{
559 base->MCR = (base->MCR & ~LPI2C_MCR_MEN_MASK) | LPI2C_MCR_MEN(enable);
560}
561
566
579static inline uint32_t LPI2C_MasterGetStatusFlags(LPI2C_Type *base)
580{
581 return base->MSR;
582}
583
604static inline void LPI2C_MasterClearStatusFlags(LPI2C_Type *base, uint32_t statusMask)
605{
606 base->MSR = statusMask;
607}
608
613
624static inline void LPI2C_MasterEnableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
625{
626 base->MIER |= interruptMask;
627}
628
639static inline void LPI2C_MasterDisableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
640{
641 base->MIER &= ~interruptMask;
642}
643
651static inline uint32_t LPI2C_MasterGetEnabledInterrupts(LPI2C_Type *base)
652{
653 return base->MIER;
654}
655
660
668static inline void LPI2C_MasterEnableDMA(LPI2C_Type *base, bool enableTx, bool enableRx)
669{
670 base->MDER = LPI2C_MDER_TDDE(enableTx) | LPI2C_MDER_RDDE(enableRx);
671}
672
679static inline uint32_t LPI2C_MasterGetTxFifoAddress(LPI2C_Type *base)
680{
681 return (uint32_t)&base->MTDR;
682}
683
690static inline uint32_t LPI2C_MasterGetRxFifoAddress(LPI2C_Type *base)
691{
692 return (uint32_t)&base->MRDR;
693}
694
699
711static inline void LPI2C_MasterSetWatermarks(LPI2C_Type *base, size_t txWords, size_t rxWords)
712{
713 base->MFCR = LPI2C_MFCR_TXWATER(txWords) | LPI2C_MFCR_RXWATER(rxWords);
714}
715
725static inline void LPI2C_MasterGetFifoCounts(LPI2C_Type *base, size_t *rxCount, size_t *txCount)
726{
727 if (NULL != txCount)
728 {
729 *txCount = (base->MFSR & LPI2C_MFSR_TXCOUNT_MASK) >> LPI2C_MFSR_TXCOUNT_SHIFT;
730 }
731 if (NULL != rxCount)
732 {
733 *rxCount = (base->MFSR & LPI2C_MFSR_RXCOUNT_MASK) >> LPI2C_MFSR_RXCOUNT_SHIFT;
734 }
735}
736
741
756void LPI2C_MasterSetBaudRate(LPI2C_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Hz);
757
767static inline bool LPI2C_MasterGetBusIdleState(LPI2C_Type *base)
768{
769 return ((base->MSR & LPI2C_MSR_BBF_MASK) >> LPI2C_MSR_BBF_SHIFT) == 1U ? true : false;
770}
771
787status_t LPI2C_MasterStart(LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir);
788
805static inline status_t LPI2C_MasterRepeatedStart(LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
806{
807 return LPI2C_MasterStart(base, address, dir);
808}
809
827status_t LPI2C_MasterSend(LPI2C_Type *base, void *txBuff, size_t txSize);
828
842status_t LPI2C_MasterReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize);
843
858
875
880
899 lpi2c_master_handle_t *handle,
901 void *userData);
902
914 lpi2c_master_handle_t *handle,
915 lpi2c_master_transfer_t *transfer);
916
926
939
944
952void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, void *lpi2cMasterHandle);
953
965
998
1011void LPI2C_SlaveInit(LPI2C_Type *base, const lpi2c_slave_config_t *slaveConfig, uint32_t sourceClock_Hz);
1012
1021void LPI2C_SlaveDeinit(LPI2C_Type *base);
1022
1028static inline void LPI2C_SlaveReset(LPI2C_Type *base)
1029{
1030 base->SCR = LPI2C_SCR_RST_MASK;
1031 base->SCR = 0;
1032}
1033
1040static inline void LPI2C_SlaveEnable(LPI2C_Type *base, bool enable)
1041{
1042 base->SCR = (base->SCR & ~LPI2C_SCR_SEN_MASK) | LPI2C_SCR_SEN(enable);
1043}
1044
1049
1062static inline uint32_t LPI2C_SlaveGetStatusFlags(LPI2C_Type *base)
1063{
1064 return base->SSR;
1065}
1066
1084static inline void LPI2C_SlaveClearStatusFlags(LPI2C_Type *base, uint32_t statusMask)
1085{
1086 base->SSR = statusMask;
1087}
1088
1093
1104static inline void LPI2C_SlaveEnableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
1105{
1106 base->SIER |= interruptMask;
1107}
1108
1119static inline void LPI2C_SlaveDisableInterrupts(LPI2C_Type *base, uint32_t interruptMask)
1120{
1121 base->SIER &= ~interruptMask;
1122}
1123
1130static inline uint32_t LPI2C_SlaveGetEnabledInterrupts(LPI2C_Type *base)
1131{
1132 return base->SIER;
1133}
1134
1139
1149static inline void LPI2C_SlaveEnableDMA(LPI2C_Type *base, bool enableAddressValid, bool enableRx, bool enableTx)
1150{
1151 base->SDER = (base->SDER & ~(LPI2C_SDER_AVDE_MASK | LPI2C_SDER_RDDE_MASK | LPI2C_SDER_TDDE_MASK)) |
1152 LPI2C_SDER_AVDE(enableAddressValid) | LPI2C_SDER_RDDE(enableRx) | LPI2C_SDER_TDDE(enableTx);
1153}
1154
1159
1169static inline bool LPI2C_SlaveGetBusIdleState(LPI2C_Type *base)
1170{
1171 return ((base->SSR & LPI2C_SSR_BBF_MASK) >> LPI2C_SSR_BBF_SHIFT) == 1U ? true : false;
1172}
1173
1184static inline void LPI2C_SlaveTransmitAck(LPI2C_Type *base, bool ackOrNack)
1185{
1186 base->STAR = LPI2C_STAR_TXNACK(!ackOrNack);
1187}
1188
1198static inline uint32_t LPI2C_SlaveGetReceivedAddress(LPI2C_Type *base)
1199{
1200 return base->SASR & LPI2C_SASR_RADDR_MASK;
1201}
1202
1212status_t LPI2C_SlaveSend(LPI2C_Type *base, void *txBuff, size_t txSize, size_t *actualTxSize);
1213
1223status_t LPI2C_SlaveReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize, size_t *actualRxSize);
1224
1229
1247 lpi2c_slave_handle_t *handle,
1249 void *userData);
1250
1276
1287
1297
1302
1311
1316#if defined(__cplusplus)
1317}
1318#endif
1319
1320#endif /* _FSL_LPI2C_H_ */
#define LPI2C_SDER_AVDE(x)
Definition: MIMXRT1052.h:30199
#define LPI2C_MDER_TDDE(x)
Definition: MIMXRT1052.h:29603
#define LPI2C_MDER_RDDE(x)
Definition: MIMXRT1052.h:29611
#define LPI2C_SDER_RDDE(x)
Definition: MIMXRT1052.h:30191
#define LPI2C_SDER_TDDE(x)
Definition: MIMXRT1052.h:30183
#define LPI2C_MFCR_RXWATER(x)
Definition: MIMXRT1052.h:29845
#define LPI2C_STAR_TXNACK(x)
Definition: MIMXRT1052.h:30373
#define LPI2C_MCR_MEN(x)
Definition: MIMXRT1052.h:29383
#define LPI2C_SCR_SEN(x)
Definition: MIMXRT1052.h:29915
#define LPI2C_MFCR_TXWATER(x)
Definition: MIMXRT1052.h:29839
IRQn_Type
STM32H7XX Interrupt Number Definition, according to the selected device in Library_configuration_sect...
Definition: stm32h723xx.h:49
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_LPI2C
Definition: fsl_common.h:92
void LPI2C_MasterConfigureDataMatch(LPI2C_Type *base, const lpi2c_data_match_config_t *matchConfig)
Configures LPI2C master data match feature.
Definition: fsl_lpi2c.c:560
void LPI2C_MasterDeinit(LPI2C_Type *base)
Deinitializes the LPI2C master peripheral.
Definition: fsl_lpi2c.c:535
void LPI2C_MasterTransferHandleIRQ(LPI2C_Type *base, void *lpi2cMasterHandle)
Reusable routine to handle master interrupts.
Definition: fsl_lpi2c.c:1644
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:1480
enum _lpi2c_master_pin_config lpi2c_master_pin_config_t
LPI2C pin configuration.
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:434
_lpi2c_direction
Direction of master and slave transfers.
Definition: fsl_lpi2c.h:105
status_t LPI2C_MasterCheckAndClearError(LPI2C_Type *base, uint32_t status)
Convert provided flags to status code, and clear any errors if present.
Definition: fsl_lpi2c.c:262
enum _lpi2c_direction lpi2c_direction_t
Direction of master and slave transfers.
_lpi2c_host_request_source
LPI2C master host request selection.
Definition: fsl_lpi2c.h:128
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:1546
status_t LPI2C_MasterStop(LPI2C_Type *base)
Sends a STOP signal on the I2C bus.
Definition: fsl_lpi2c.c:767
_lpi2c_host_request_polarity
LPI2C master host request pin polarity configuration.
Definition: fsl_lpi2c.h:135
status_t LPI2C_CheckForBusyBus(LPI2C_Type *base)
Make sure the bus isn't already busy.
Definition: fsl_lpi2c.c:364
status_t LPI2C_MasterReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize)
Performs a polling receive transfer on the I2C bus.
Definition: fsl_lpi2c.c:828
_lpi2c_master_transfer_flags
Transfer option flags.
Definition: fsl_lpi2c.h:220
_lpi2c_data_match_config_mode
LPI2C master data match configuration modes.
Definition: fsl_lpi2c.h:171
void LPI2C_MasterSetBaudRate(LPI2C_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Hz)
Sets the I2C bus frequency for master transactions.
Definition: fsl_lpi2c.c:591
void(* lpi2c_master_isr_t)(LPI2C_Type *base, void *handle)
Typedef for master interrupt handler, used internally for LPI2C master interrupt and EDMA transaction...
Definition: fsl_lpi2c.h:262
_lpi2c_master_flags
LPI2C master peripheral flags.
Definition: fsl_lpi2c.h:77
enum _lpi2c_host_request_source lpi2c_host_request_source_t
LPI2C master host request selection.
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:969
struct _lpi2c_master_config lpi2c_master_config_t
Structure with settings to initialize the LPI2C master module.
enum _lpi2c_host_request_polarity lpi2c_host_request_polarity_t
LPI2C master host request pin polarity configuration.
void(* lpi2c_master_transfer_callback_t)(LPI2C_Type *base, lpi2c_master_handle_t *handle, status_t completionStatus, void *userData)
Master completion callback function pointer type.
Definition: fsl_lpi2c.h:208
enum _lpi2c_data_match_config_mode lpi2c_data_match_config_mode_t
LPI2C master data match configuration modes.
struct _lpi2c_match_config lpi2c_data_match_config_t
LPI2C master data match configuration structure.
status_t LPI2C_MasterStart(LPI2C_Type *base, uint8_t address, lpi2c_direction_t dir)
Sends a START signal and slave address on the I2C bus.
Definition: fsl_lpi2c.c:730
_lpi2c_master_pin_config
LPI2C pin configuration.
Definition: fsl_lpi2c.h:112
void LPI2C_MasterTransferAbort(LPI2C_Type *base, lpi2c_master_handle_t *handle)
Terminates a non-blocking LPI2C master transmission early.
Definition: fsl_lpi2c.c:1614
status_t LPI2C_MasterSend(LPI2C_Type *base, void *txBuff, size_t txSize)
Performs a polling send transfer on the I2C bus.
Definition: fsl_lpi2c.c:930
void LPI2C_MasterGetDefaultConfig(lpi2c_master_config_t *masterConfig)
Provides a default configuration for the LPI2C master peripheral.
Definition: fsl_lpi2c.c:401
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:1091
@ kLPI2C_Write
Definition: fsl_lpi2c.h:106
@ kLPI2C_Read
Definition: fsl_lpi2c.h:107
@ kLPI2C_HostRequestInputTrigger
Definition: fsl_lpi2c.h:130
@ kLPI2C_HostRequestExternalPin
Definition: fsl_lpi2c.h:129
@ kLPI2C_HostRequestPinActiveHigh
Definition: fsl_lpi2c.h:137
@ kLPI2C_HostRequestPinActiveLow
Definition: fsl_lpi2c.h:136
@ kLPI2C_TransferRepeatedStartFlag
Definition: fsl_lpi2c.h:223
@ kLPI2C_TransferDefaultFlag
Definition: fsl_lpi2c.h:221
@ kLPI2C_TransferNoStopFlag
Definition: fsl_lpi2c.h:224
@ kLPI2C_TransferNoStartFlag
Definition: fsl_lpi2c.h:222
@ kLPI2C_MatchDisabled
Definition: fsl_lpi2c.h:172
@ kLPI2C_1stWordAndM1EqualsM0AndM1
Definition: fsl_lpi2c.h:179
@ kLPI2C_1stWordEqualsM0And2ndWordEqualsM1
Definition: fsl_lpi2c.h:175
@ kLPI2C_AnyWordAndM1EqualsM0AndM1
Definition: fsl_lpi2c.h:181
@ kLPI2C_AnyWordEqualsM0AndNextWordEqualsM1
Definition: fsl_lpi2c.h:177
@ kLPI2C_1stWordEqualsM0OrM1
Definition: fsl_lpi2c.h:173
@ kLPI2C_AnyWordEqualsM0OrM1
Definition: fsl_lpi2c.h:174
@ kLPI2C_MasterIrqFlags
Definition: fsl_lpi2c.h:95
@ kLPI2C_MasterPinLowTimeoutFlag
Definition: fsl_lpi2c.h:85
@ kLPI2C_MasterNackDetectFlag
Definition: fsl_lpi2c.h:82
@ kLPI2C_MasterBusBusyFlag
Definition: fsl_lpi2c.h:88
@ kLPI2C_MasterArbitrationLostFlag
Definition: fsl_lpi2c.h:83
@ kLPI2C_MasterDataMatchFlag
Definition: fsl_lpi2c.h:86
@ kLPI2C_MasterFifoErrFlag
Definition: fsl_lpi2c.h:84
@ kLPI2C_MasterStopDetectFlag
Definition: fsl_lpi2c.h:81
@ kLPI2C_MasterBusyFlag
Definition: fsl_lpi2c.h:87
@ kLPI2C_MasterClearFlags
Definition: fsl_lpi2c.h:91
@ kLPI2C_MasterEndOfPacketFlag
Definition: fsl_lpi2c.h:80
@ kLPI2C_MasterRxReadyFlag
Definition: fsl_lpi2c.h:79
@ kLPI2C_MasterTxReadyFlag
Definition: fsl_lpi2c.h:78
@ kLPI2C_MasterErrorFlags
Definition: fsl_lpi2c.h:99
@ kLPI2C_2PinOutputOnlyWithSeparateSlave
Definition: fsl_lpi2c.h:119
@ kLPI2C_2PinPushPull
Definition: fsl_lpi2c.h:115
@ kLPI2C_2PinPushPullWithSeparateSlave
Definition: fsl_lpi2c.h:121
@ kLPI2C_4PinPushPull
Definition: fsl_lpi2c.h:116
@ kLPI2C_2PinOutputOnly
Definition: fsl_lpi2c.h:114
@ kLPI2C_4PinPushPullWithInvertedOutput
Definition: fsl_lpi2c.h:123
@ kLPI2C_2PinOpenDrainWithSeparateSlave
Definition: fsl_lpi2c.h:117
@ kLPI2C_2PinOpenDrain
Definition: fsl_lpi2c.h:113
uint16_t remainingBytes
Definition: fsl_lpi2c.h:251
lpi2c_master_pin_config_t pinConfig
Definition: fsl_lpi2c.h:155
uint16_t slaveAddress
Definition: fsl_lpi2c.h:236
size_t dataSize
Definition: fsl_lpi2c.h:393
_lpi2c_slave_address_match
LPI2C slave address match options.
Definition: fsl_lpi2c.h:313
bool enableReceivedAddressRead
Definition: fsl_lpi2c.h:352
status_t LPI2C_SlaveTransferNonBlocking(LPI2C_Type *base, lpi2c_slave_handle_t *handle, uint32_t eventMask)
Starts accepting slave transfers.
Definition: fsl_lpi2c.c:2130
uint8_t address1
Definition: fsl_lpi2c.h:332
lpi2c_slave_address_match_t addressMatchMode
Definition: fsl_lpi2c.h:333
bool enable
Definition: fsl_lpi2c.h:163
void * userData
Definition: fsl_lpi2c.h:426
status_t LPI2C_SlaveReceive(LPI2C_Type *base, void *rxBuff, size_t rxSize, size_t *actualRxSize)
Performs a polling receive transfer on the I2C bus.
Definition: fsl_lpi2c.c:1979
_lpi2c_slave_transfer_event
Set of events sent to the callback for non blocking slave transfers.
Definition: fsl_lpi2c.h:372
uint32_t eventMask
Definition: fsl_lpi2c.h:423
bool isBusy
Definition: fsl_lpi2c.h:421
uint8_t receivedAddress
Definition: fsl_lpi2c.h:391
bool enableDoze
Definition: fsl_lpi2c.h:152
bool ignoreAck
Definition: fsl_lpi2c.h:154
bool enableRx
Definition: fsl_lpi2c.h:347
uint32_t pinLowTimeout_ns
Definition: fsl_lpi2c.h:158
uint8_t sdaGlitchFilterWidth_ns
Definition: fsl_lpi2c.h:159
bool enableTx
Definition: fsl_lpi2c.h:345
uint8_t address0
Definition: fsl_lpi2c.h:331
lpi2c_slave_transfer_t transfer
Definition: fsl_lpi2c.h:420
bool enableAck
Definition: fsl_lpi2c.h:339
void * data
Definition: fsl_lpi2c.h:240
size_t subaddressSize
Definition: fsl_lpi2c.h:239
size_t transferredCount
Definition: fsl_lpi2c.h:396
uint32_t sclGlitchFilterWidth_ns
Definition: fsl_lpi2c.h:355
bool enableGeneralCall
Definition: fsl_lpi2c.h:336
uint8_t sclGlitchFilterWidth_ns
Definition: fsl_lpi2c.h:160
uint32_t flags
Definition: fsl_lpi2c.h:234
uint32_t match1
Definition: fsl_lpi2c.h:191
uint32_t transferredCount
Definition: fsl_lpi2c.h:424
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:2073
lpi2c_master_transfer_t transfer
Definition: fsl_lpi2c.h:255
lpi2c_slave_transfer_event_t event
Definition: fsl_lpi2c.h:390
void LPI2C_SlaveTransferHandleIRQ(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Reusable routine to handle slave interrupts.
Definition: fsl_lpi2c.c:2253
uint32_t busIdleTimeout_ns
Definition: fsl_lpi2c.h:157
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:2190
bool enableMaster
Definition: fsl_lpi2c.h:151
bool wasTransmit
Definition: fsl_lpi2c.h:422
lpi2c_master_transfer_callback_t completionCallback
Definition: fsl_lpi2c.h:256
uint8_t * buf
Definition: fsl_lpi2c.h:252
bool enableAddress
Definition: fsl_lpi2c.h:349
uint16_t commandBuffer[6]
Definition: fsl_lpi2c.h:253
void LPI2C_SlaveTransferAbort(LPI2C_Type *base, lpi2c_slave_handle_t *handle)
Aborts the slave non-blocking transfers.
Definition: fsl_lpi2c.c:2225
uint32_t dataValidDelay_ns
Definition: fsl_lpi2c.h:357
lpi2c_host_request_source_t source
Definition: fsl_lpi2c.h:164
enum _lpi2c_slave_address_match lpi2c_slave_address_match_t
LPI2C slave address match options.
uint32_t match0
Definition: fsl_lpi2c.h:190
bool rxDataMatchOnly
Definition: fsl_lpi2c.h:189
enum _lpi2c_slave_transfer_event lpi2c_slave_transfer_event_t
Set of events sent to the callback for non blocking slave transfers.
void LPI2C_SlaveDeinit(LPI2C_Type *base)
Deinitializes the LPI2C slave peripheral.
Definition: fsl_lpi2c.c:1825
lpi2c_slave_transfer_callback_t callback
Definition: fsl_lpi2c.h:425
bool filterDozeEnable
Definition: fsl_lpi2c.h:334
uint32_t sdaGlitchFilterWidth_ns
Definition: fsl_lpi2c.h:353
uint8_t state
Definition: fsl_lpi2c.h:250
struct _lpi2c_slave_transfer lpi2c_slave_transfer_t
LPI2C slave transfer structure.
_lpi2c_slave_flags
LPI2C slave peripheral flags.
Definition: fsl_lpi2c.h:286
bool filterEnable
Definition: fsl_lpi2c.h:335
bool enableSlave
Definition: fsl_lpi2c.h:330
lpi2c_host_request_polarity_t polarity
Definition: fsl_lpi2c.h:165
void * userData
Definition: fsl_lpi2c.h:257
status_t LPI2C_SlaveSend(LPI2C_Type *base, void *txBuff, size_t txSize, size_t *actualTxSize)
Performs a polling send transfer on the I2C bus.
Definition: fsl_lpi2c.c:1892
uint32_t baudRate_Hz
Definition: fsl_lpi2c.h:156
uint32_t subaddress
Definition: fsl_lpi2c.h:238
lpi2c_direction_t direction
Definition: fsl_lpi2c.h:237
bool debugEnable
Definition: fsl_lpi2c.h:153
void(* lpi2c_slave_transfer_callback_t)(LPI2C_Type *base, lpi2c_slave_transfer_t *transfer, void *userData)
Slave event callback function pointer type.
Definition: fsl_lpi2c.h:412
void LPI2C_SlaveGetDefaultConfig(lpi2c_slave_config_t *slaveConfig)
Provides a default configuration for the LPI2C slave peripheral.
Definition: fsl_lpi2c.c:1714
struct _lpi2c_master_config::@371 hostRequest
uint8_t * data
Definition: fsl_lpi2c.h:392
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:1753
bool ignoreAck
Definition: fsl_lpi2c.h:351
lpi2c_data_match_config_mode_t matchMode
Definition: fsl_lpi2c.h:188
size_t dataSize
Definition: fsl_lpi2c.h:241
struct _lpi2c_slave_config lpi2c_slave_config_t
Structure with settings to initialize the LPI2C slave module.
uint32_t clockHoldTime_ns
Definition: fsl_lpi2c.h:358
status_t completionStatus
Definition: fsl_lpi2c.h:394
@ kLPI2C_MatchAddress0OrAddress1
Definition: fsl_lpi2c.h:315
@ kLPI2C_MatchAddress0ThroughAddress1
Definition: fsl_lpi2c.h:316
@ kLPI2C_MatchAddress0
Definition: fsl_lpi2c.h:314
@ kLPI2C_SlaveCompletionEvent
Definition: fsl_lpi2c.h:380
@ kLPI2C_SlaveAddressMatchEvent
Definition: fsl_lpi2c.h:373
@ kLPI2C_SlaveTransmitAckEvent
Definition: fsl_lpi2c.h:378
@ kLPI2C_SlaveTransmitEvent
Definition: fsl_lpi2c.h:374
@ kLPI2C_SlaveReceiveEvent
Definition: fsl_lpi2c.h:376
@ kLPI2C_SlaveRepeatedStartEvent
Definition: fsl_lpi2c.h:379
@ kLPI2C_SlaveAllEvents
Definition: fsl_lpi2c.h:383
@ kLPI2C_SlaveRxReadyFlag
Definition: fsl_lpi2c.h:288
@ kLPI2C_SlaveBusBusyFlag
Definition: fsl_lpi2c.h:299
@ kLPI2C_SlaveTransmitAckFlag
Definition: fsl_lpi2c.h:290
@ kLPI2C_SlaveBitErrFlag
Definition: fsl_lpi2c.h:293
@ kLPI2C_SlaveRepeatedStartDetectFlag
Definition: fsl_lpi2c.h:291
@ kLPI2C_SlaveAddressMatch1Flag
Definition: fsl_lpi2c.h:296
@ kLPI2C_SlaveClearFlags
Definition: fsl_lpi2c.h:301
@ kLPI2C_SlaveGeneralCallFlag
Definition: fsl_lpi2c.h:297
@ kLPI2C_SlaveFifoErrFlag
Definition: fsl_lpi2c.h:294
@ kLPI2C_SlaveTxReadyFlag
Definition: fsl_lpi2c.h:287
@ kLPI2C_SlaveAddressMatch0Flag
Definition: fsl_lpi2c.h:295
@ kLPI2C_SlaveStopDetectFlag
Definition: fsl_lpi2c.h:292
@ kLPI2C_SlaveIrqFlags
Definition: fsl_lpi2c.h:304
@ kLPI2C_SlaveErrorFlags
Definition: fsl_lpi2c.h:308
@ kLPI2C_SlaveAddressValidFlag
Definition: fsl_lpi2c.h:289
@ kLPI2C_SlaveBusyFlag
Definition: fsl_lpi2c.h:298
void * s_lpi2cMasterHandle[]
Pointers to master handles for each instance, used internally for LPI2C master interrupt and EDMA tra...
Definition: fsl_lpi2c.c:176
lpi2c_master_isr_t s_lpi2cMasterIsr
Pointer to master IRQ handler for each instance, used internally for LPI2C master interrupt and EDMA ...
Definition: fsl_lpi2c.c:172
IRQn_Type const kLpi2cIrqs[]
Array to map LPI2C instance number to IRQ number, used internally for LPI2C master interrupt and EDMA...
Definition: fsl_lpi2c.c:157
uint32_t LPI2C_GetInstance(LPI2C_Type *base)
Returns an instance number given a base address.
Definition: fsl_lpi2c.c:197
@ kStatus_LPI2C_Timeout
Definition: fsl_lpi2c.h:49
@ kStatus_LPI2C_DmaRequestFail
Definition: fsl_lpi2c.h:48
@ kStatus_LPI2C_ArbitrationLost
Definition: fsl_lpi2c.h:43
@ kStatus_LPI2C_FifoError
Definition: fsl_lpi2c.h:41
@ kStatus_LPI2C_Idle
Definition: fsl_lpi2c.h:39
@ kStatus_LPI2C_Nak
Definition: fsl_lpi2c.h:40
@ kStatus_LPI2C_BitError
Definition: fsl_lpi2c.h:42
@ kStatus_LPI2C_NoTransferInProgress
Definition: fsl_lpi2c.h:46
@ kStatus_LPI2C_PinLowTimeout
Definition: fsl_lpi2c.h:44
@ kStatus_LPI2C_Busy
Definition: fsl_lpi2c.h:38
Definition: MIMXRT1052.h:29282
Structure with settings to initialize the LPI2C master module.
Definition: fsl_lpi2c.h:150
Driver handle for master non-blocking APIs.
Definition: fsl_lpi2c.h:249
Non-blocking transfer descriptor structure.
Definition: fsl_lpi2c.h:233
LPI2C master data match configuration structure.
Definition: fsl_lpi2c.h:187
Structure with settings to initialize the LPI2C slave module.
Definition: fsl_lpi2c.h:329
LPI2C slave handle structure.
Definition: fsl_lpi2c.h:419
LPI2C slave transfer structure.
Definition: fsl_lpi2c.h:389