123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164 |
- /*==================================================================================================
- * Project : RTD AUTOSAR 4.4
- * Platform : CORTEXM
- * Peripheral : FLEXIO
- * Dependencies :
- *
- * Autosar Version : 4.4.0
- * Autosar Revision : ASR_REL_4_4_REV_0000
- * Autosar Conf.Variant :
- * SW Version : 1.0.0
- * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
- *
- * (c) Copyright 2020-2021 NXP Semiconductors
- * All Rights Reserved.
- *
- * NXP Confidential. This software is owned or controlled by NXP and may only be
- * used strictly in accordance with the applicable license terms. By expressly
- * accepting such terms or by downloading, installing, activating and/or otherwise
- * using the software, you are agreeing that you have read, and that you agree to
- * comply with and are bound by, such license terms. If you do not agree to be
- * bound by the applicable license terms, then you may not retain, install,
- * activate or otherwise use the software.
- ==================================================================================================*/
- /**
- * @file
- * @internal
- * @addtogroup UART
- * @{
- */
- #ifdef __cplusplus
- extern "C"
- {
- #endif
- /*==================================================================================================
- * INCLUDE FILES
- * 1) system and project includes
- * 2) needed interfaces from external units
- * 3) internal and external interfaces from this unit
- ==================================================================================================*/
- #include "Uart_Ipw.h"
- #include "Uart_Ipw_Cfg.h"
- #ifdef UART_IPW_LPUART_HW_USING
- #include "Lpuart_Uart_Ip.h"
- #endif
- #ifdef UART_IPW_FLEXIO_HW_USING
- #include "Flexio_Uart_Ip.h"
- #endif
- /*==================================================================================================
- * SOURCE FILE VERSION INFORMATION
- ==================================================================================================*/
- #define UART_IPW_VENDOR_ID_C 43
- #define UART_IPW_AR_RELEASE_MAJOR_VERSION_C 4
- #define UART_IPW_AR_RELEASE_MINOR_VERSION_C 4
- #define UART_IPW_AR_RELEASE_REVISION_VERSION_C 0
- #define UART_IPW_SW_MAJOR_VERSION_C 1
- #define UART_IPW_SW_MINOR_VERSION_C 0
- #define UART_IPW_SW_PATCH_VERSION_C 0
- /*==================================================================================================
- * FILE VERSION CHECKS
- ==================================================================================================*/
- /*Checks against Uart_Ipw.h */
- #if (UART_IPW_VENDOR_ID_C!= UART_IPW_VENDOR_ID)
- #error "Uart_Ipw.c and Uart_Ipw.h have different vendor ids"
- #endif
- #if ((UART_IPW_AR_RELEASE_MAJOR_VERSION_C != UART_IPW_AR_RELEASE_MAJOR_VERSION) || \
- (UART_IPW_AR_RELEASE_MINOR_VERSION_C != UART_IPW_AR_RELEASE_MINOR_VERSION) || \
- (UART_IPW_AR_RELEASE_REVISION_VERSION_C!= UART_IPW_AR_RELEASE_REVISION_VERSION))
- #error "AUTOSAR Version Numbers of Uart_Ipw.c and Uart_Ipw.h are different"
- #endif
- #if ((UART_IPW_SW_MAJOR_VERSION_C!= UART_IPW_SW_MAJOR_VERSION) || \
- (UART_IPW_SW_MINOR_VERSION_C!= UART_IPW_SW_MINOR_VERSION) || \
- (UART_IPW_SW_PATCH_VERSION_C!= UART_IPW_SW_PATCH_VERSION) \
- )
- #error "Software Version Numbers of Uart_Ipw.c and Uart_Ipw.h are different"
- #endif
- /* Checks against Uart_Ipw_Cfg.h */
- #if (UART_IPW_VENDOR_ID_C != UART_IPW_CFG_VENDOR_ID)
- #error "Uart_Ipw.c and Uart_Ipw_Cfg.h have different vendor ids"
- #endif
- #if ((UART_IPW_AR_RELEASE_MAJOR_VERSION_C != UART_IPW_CFG_AR_RELEASE_MAJOR_VERSION) || \
- (UART_IPW_AR_RELEASE_MINOR_VERSION_C != UART_IPW_CFG_AR_RELEASE_MINOR_VERSION) || \
- (UART_IPW_AR_RELEASE_REVISION_VERSION_C != UART_IPW_CFG_AR_RELEASE_REVISION_VERSION))
- #error "AUTOSAR Version Numbers of Uart_Ipw.c and Uart_Ipw_Cfg.h are different"
- #endif
- #if ((UART_IPW_SW_MAJOR_VERSION_C != UART_IPW_CFG_SW_MAJOR_VERSION) || \
- (UART_IPW_SW_MINOR_VERSION_C != UART_IPW_CFG_SW_MINOR_VERSION) || \
- (UART_IPW_SW_PATCH_VERSION_C != UART_IPW_CFG_SW_PATCH_VERSION) \
- )
- #error "Software Version Numbers of Uart_Ipw.c and Uart_Ipw_Cfg.h are different"
- #endif
- #ifdef UART_IPW_LPUART_HW_USING
- /* Checks against Lpuart_Uart_Ip.h */
- #if (UART_IPW_VENDOR_ID_C != LPUART_UART_IP_VENDOR_ID)
- #error "Uart_Ipw.c and Lpuart_Uart_Ip.h have different vendor ids"
- #endif
- #if ((UART_IPW_AR_RELEASE_MAJOR_VERSION_C != LPUART_UART_IP_AR_RELEASE_MAJOR_VERSION) || \
- (UART_IPW_AR_RELEASE_MINOR_VERSION_C != LPUART_UART_IP_AR_RELEASE_MINOR_VERSION) || \
- (UART_IPW_AR_RELEASE_REVISION_VERSION_C != LPUART_UART_IP_AR_RELEASE_REVISION_VERSION))
- #error "AUTOSAR Version Numbers of Uart_Ipw.c and Lpuart_Uart_Ip.h are different"
- #endif
- #if ((UART_IPW_SW_MAJOR_VERSION_C != LPUART_UART_IP_SW_MAJOR_VERSION) || \
- (UART_IPW_SW_MINOR_VERSION_C != LPUART_UART_IP_SW_MINOR_VERSION) || \
- (UART_IPW_SW_PATCH_VERSION_C != LPUART_UART_IP_SW_PATCH_VERSION) \
- )
- #error "Software Version Numbers of Uart_Ipw.c and Lpuart_Uart_Ip.h are different"
- #endif
- #endif
- #ifdef UART_IPW_FLEXIO_HW_USING
- /* Checks against Flexio_Uart_Ip.h */
- #if (UART_IPW_VENDOR_ID_C != FLEXIO_UART_IP_VENDOR_ID)
- #error "Uart_Ipw.c and Flexio_Uart_Ip.h have different vendor ids"
- #endif
- #if ((UART_IPW_AR_RELEASE_MAJOR_VERSION_C != FLEXIO_UART_IP_AR_RELEASE_MAJOR_VERSION) || \
- (UART_IPW_AR_RELEASE_MINOR_VERSION_C != FLEXIO_UART_IP_AR_RELEASE_MINOR_VERSION) || \
- (UART_IPW_AR_RELEASE_REVISION_VERSION_C != FLEXIO_UART_IP_AR_RELEASE_REVISION_VERSION))
- #error "AUTOSAR Version Numbers of Uart_Ipw.c and Flexio_Uart_Ip.h are different"
- #endif
- #if ((UART_IPW_SW_MAJOR_VERSION_C != FLEXIO_UART_IP_SW_MAJOR_VERSION) || \
- (UART_IPW_SW_MINOR_VERSION_C != FLEXIO_UART_IP_SW_MINOR_VERSION) || \
- (UART_IPW_SW_PATCH_VERSION_C != FLEXIO_UART_IP_SW_PATCH_VERSION) \
- )
- #error "Software Version Numbers of Uart_Ipw.c and Flexio_Uart_Ip.h are different"
- #endif
- #endif
- /*==================================================================================================
- * LOCAL TYPEDEFS (STRUCTURES, UNIONS, ENUMS)
- ==================================================================================================*/
- /*==================================================================================================
- * LOCAL MACROS
- ==================================================================================================*/
- /*==================================================================================================
- * LOCAL CONSTANTS
- ==================================================================================================*/
- /*==================================================================================================
- * LOCAL VARIABLES
- ==================================================================================================*/
- /*==================================================================================================
- * GLOBAL CONSTANTS
- ==================================================================================================*/
- #if (UART_CALLBACK_DECLARED == STD_ON)
- #define UART_START_SEC_VAR_INIT_8
- #include "Uart_MemMap.h"
- static sint8 Uart_Ipw_s8HwMapping[UART_NUMBER_OF_INSTANCES] = UART_HW_CHANNELS_MAPPING_FOR_INIT;
- #define UART_STOP_SEC_VAR_INIT_8
- #include "Uart_MemMap.h"
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- #define UART_START_SEC_VAR_CLEARED_UNSPECIFIED
- #include "Uart_MemMap.h"
- const Uart_Ipw_HwConfigType *Uart_Ipw_apChnConfig[UART_CH_MAX_CONFIG];
- #define UART_STOP_SEC_VAR_CLEARED_UNSPECIFIED
- #include "Uart_MemMap.h"
- /*==================================================================================================
- * GLOBAL VARIABLES
- ==================================================================================================*/
- /*==================================================================================================
- * LOCAL FUNCTION PROTOTYPES
- ==================================================================================================*/
- #define UART_START_SEC_CODE
- #include "Uart_MemMap.h"
- #ifdef UART_IPW_LPUART_HW_USING
- /* Convert Lpuart Status type to Standard status type */
- static Uart_StatusType Uart_Ipw_LpuartConvertStatus(Lpuart_Uart_Ip_StatusType Status);
- /* Convert Uart Baudrate type to Ip Baudrate type */
- static Lpuart_Uart_Ip_BaudrateType Uart_Ipw_LpuartConvertBaudrateType(Uart_BaudrateType Baudrate);
- #if (UART_CALLBACK_DECLARED == STD_ON)
- /* Convert HLD Uart Event type to Ip Event type */
- static Uart_EventType Uart_Ipw_LpuartConvertEventType(Lpuart_Uart_Ip_EventType Event);
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- #endif
- #ifdef UART_IPW_FLEXIO_HW_USING
- /* Convert Flexio Status type to Standard status type */
- static Uart_StatusType Uart_Ipw_FlexioConvertStatus(Flexio_Uart_Ip_StatusType Status);
- /* Convert Uart Baudrate type to Ip Baudrate type */
- static Flexio_Uart_Ip_BaudrateType Uart_Ipw_FlexioConvertBaudrateType(Uart_BaudrateType Baudrate);
- #if (UART_CALLBACK_DECLARED == STD_ON)
- /* Convert HLD Uart Event type to Ip Event type */
- static Uart_EventType Uart_Ipw_FlexioConvertEventType(Flexio_Uart_Ip_EventType Event);
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- #endif
- /*==================================================================================================
- * LOCAL FUNCTIONS
- ==================================================================================================*/
- /*==================================================================================================
- * GLOBAL FUNCTIONS
- ==================================================================================================*/
- /**
- * @internal
- * @brief Initialize an Uart channel.
- * @details This function calls a LLD function initializes all hardware registers needed to
- * start the Uart functionality on the selected channel.
- *
- * @param [in] Channel Uart channel to be initialized.
- * [in] Config Configuration pointer containing hardware specific settings.
- *
- * @return void.
- *
- */
- void Uart_Ipw_Init(uint8 Channel, const Uart_Ipw_HwConfigType* Config)
- {
- uint8 HwUnit = Config->UartHwChannel;
- /* Save the mapping between hardware instance and logical channel */
- /* Save the channel settings */
- Uart_Ipw_apChnConfig[Channel] = Config;
- /* Call the LLD Initialization function */
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- #if (UART_CALLBACK_DECLARED == STD_ON)
- Uart_Ipw_s8HwMapping[HwUnit] = (sint8)Channel;
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- Lpuart_Uart_Ip_Init(HwUnit, Config->UserConfig->LpuartUserConfig);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- #if (UART_CALLBACK_DECLARED == STD_ON)
- Uart_Ipw_s8HwMapping[UART_NUMBER_OF_INSTANCES - FLEXIO_UART_IP_NUMBER_OF_SHIFTER_AND_TIMER + HwUnit] = (sint8)Channel;
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- Flexio_Uart_Ip_Init(HwUnit, Config->UserConfig->FlexioUartUserConfig);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- }
- /**
- * @internal
- * @brief De-initialize an Uart channel.
- * @details This function calls a LLD function de-initializes an Uart Hw instance and resets the current
- information regarding the current channel
- *
- * @param[in] Channel Uart channel to be de-initialized.
- *
- * @return void.
- *
- */
- void Uart_Ipw_Deinit(uint8 Channel)
- {
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- #if (UART_CALLBACK_DECLARED == STD_ON)
- /* Remove the current hw to logic mapping */
- Uart_Ipw_s8HwMapping[HwUnit] = -1;
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- Lpuart_Uart_Ip_Deinit(HwUnit);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- #if (UART_CALLBACK_DECLARED == STD_ON)
- /* Remove the current hw to logic mapping */
- Uart_Ipw_s8HwMapping[UART_NUMBER_OF_INSTANCES - FLEXIO_UART_IP_NUMBER_OF_SHIFTER_AND_TIMER + HwUnit] = -1;
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- Flexio_Uart_Ip_Deinit(HwUnit);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- /* Remove refference to the current channel configuration */
- Uart_Ipw_apChnConfig[Channel] = NULL_PTR;
- }
- /**
- * @internal
- * @brief Set a baudrate value for the current channel.
- * @details This function calls a LLD function which sets a baudrate value for a given channel,
- *
- * @param[in] Channel Uart channel where the baudrate shall be configured
- * @param[in] BaudRateValue The baudrate value to be configured.
- * @param[in] ClockFrequency The clock frequency set for the Uart module.
- *
- * @return E_OK: Baud rate successfully configured
- * E_NOT_OK: Baud rate wasn't successfully configured
- *
- */
- Std_ReturnType Uart_Ipw_SetBaudrate(uint8 Channel, Uart_BaudrateType BaudRateValue, uint32 ClockFrequency)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- #ifdef UART_IPW_LPUART_HW_USING
- Lpuart_Uart_Ip_BaudrateType LpuartBaud = Uart_Ipw_LpuartConvertBaudrateType(BaudRateValue);
- #endif
- #ifdef UART_IPW_FLEXIO_HW_USING
- Flexio_Uart_Ip_BaudrateType FlexioBaud = Uart_Ipw_FlexioConvertBaudrateType(BaudRateValue);
- #endif
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- if (LPUART_UART_IP_STATUS_SUCCESS == Lpuart_Uart_Ip_SetBaudRate(HwUnit, LpuartBaud, ClockFrequency))
- {
- TempStatus = (uint8)E_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- if (FLEXIO_UART_IP_STATUS_SUCCESS == Flexio_Uart_Ip_SetBaudRate(HwUnit, FlexioBaud, ClockFrequency))
- {
- TempStatus = (uint8)E_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Retrieves the baudrate value configured for the current channel.
- * @details This function calls a LLD function returns the baudrate value configured for the given channel
- * via a pointer parameter provided by user.
- *
- * @param[in] Channel Uart channel where the baudrate shall be configured
- * @param[out] BaudrateValue The pointer which will contain the baudrate value.
- *
- * @return void
- *
- */
- void Uart_Ipw_GetBaudrate(uint8 Channel, uint32 *BaudrateValue)
- {
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- Lpuart_Uart_Ip_GetBaudRate(HwUnit, BaudrateValue);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- Flexio_Uart_Ip_GetBaudRate(HwUnit, BaudrateValue);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- }
- /**
- * @internal
- * @brief Aborts an on-going transmission.
- * @details This function calls a LLD function which ends a transfer earlier.
- *
- * @param[in] Channel Uart channel where the transmission shall be ended.
- *
- * @return E_OK: The transfer ended successfully
- * E_NOT_OK: The transfer didn't end successfully
- *
- */
- Std_ReturnType Uart_Ipw_AbortSendingData(uint8 Channel)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- if (LPUART_UART_IP_STATUS_SUCCESS == Lpuart_Uart_Ip_AbortSendingData(HwUnit))
- {
- TempStatus = (uint8)E_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- if (FLEXIO_UART_IP_STATUS_SUCCESS == Flexio_Uart_Ip_AbortTransferData(HwUnit))
- {
- TempStatus = (uint8)E_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Aborts an on-going reception.
- * @details This function calls a LLD function which ends a reception earlier.
- *
- * @param[in] Channel Uart channel where the reception shall be ended.
- *
- * @return E_OK: The reception ended successfully
- * E_NOT_OK: The reception didn't end successfully
- *
- */
- Std_ReturnType Uart_Ipw_AbortReceivingData(uint8 Channel)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- if (LPUART_UART_IP_STATUS_SUCCESS == Lpuart_Uart_Ip_AbortReceivingData(HwUnit))
- {
- TempStatus = (uint8)E_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- if (FLEXIO_UART_IP_STATUS_SUCCESS == Flexio_Uart_Ip_AbortTransferData(HwUnit))
- {
- TempStatus = (uint8)E_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Sets a tx buffer.
- * @details This function calls a LLD function which sets a buffer for continuos transmission.
- *
- * @param[in] Channel Uart channel where to set the buffer.
- *
- * @return void
- */
- void Uart_Ipw_SetTxBuffer(uint8 Channel, const uint8 *Buffer, uint32 BufferSize)
- {
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- (void)Lpuart_Uart_Ip_SetTxBuffer(HwUnit, Buffer, BufferSize);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- (void)Flexio_Uart_Ip_SetTxBuffer(HwUnit, Buffer, BufferSize);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- }
- /**
- * @brief Sets a rx buffer.
- * @details This function calls a LLD function which sets a buffer for continuos reception.
- *
- * @param[in] Channel Uart channel where to set the buffer.
- *
- * @return void
- */
- void Uart_Ipw_SetRxBuffer(uint8 Channel, uint8 *Buffer, uint32 BufferSize)
- {
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- (void)Lpuart_Uart_Ip_SetRxBuffer(HwUnit, Buffer, BufferSize);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- (void)Flexio_Uart_Ip_SetRxBuffer(HwUnit, Buffer, BufferSize);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- }
- /**
- * @internal
- * @brief Sends a buffer synchronously.
- * @details This function calls a LLD function which sends BufferSize bytes using polling method.
- *
- * @param[in] Channel Uart channel used for transmission.
- * @param[in] Buffer Buffer to send.
- * @param[in] BufferSize The number of bytes to send.
- * @param[in] Timeout The timeout value in us.
- *
- *
- * @return E_OK: Tranmission ended successfully
- * UART_STATUS_TIMEOUT: Tranmission has timeout
- * E_NOT_OK Tranmission didn't end successfully
- */
- Std_ReturnType Uart_Ipw_SyncSend(uint8 Channel, const uint8 *Buffer, uint32 BufferSize, uint32 Timeout)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- /* LPUART is used */
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- Lpuart_Uart_Ip_StatusType u32LpuartIpStatus;
- u32LpuartIpStatus = Lpuart_Uart_Ip_SyncSend(HwUnit,
- Buffer,
- BufferSize,
- Timeout);
- if (LPUART_UART_IP_STATUS_SUCCESS == u32LpuartIpStatus)
- {
- TempStatus = (uint8)E_OK;
- }
- else if (LPUART_UART_IP_STATUS_TIMEOUT == u32LpuartIpStatus)
- {
- TempStatus = (uint8)UART_STATUS_TIMEOUT;
- }
- else
- {
- TempStatus = (uint8)E_NOT_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- Flexio_Uart_Ip_StatusType u32FlexioIpStatus;
- u32FlexioIpStatus = Flexio_Uart_Ip_SyncSend(HwUnit,
- Buffer,
- BufferSize,
- Timeout);
- if (FLEXIO_UART_IP_STATUS_SUCCESS == u32FlexioIpStatus)
- {
- TempStatus = (uint8)E_OK;
- }
- else if (FLEXIO_UART_IP_STATUS_TIMEOUT == u32FlexioIpStatus)
- {
- TempStatus = (uint8)UART_STATUS_TIMEOUT;
- }
- else
- {
- TempStatus = (uint8)E_NOT_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Receives a buffer synchronously.
- * @details This function calls a LLD function which receives BufferSize bytes using polling method.
- *
- * @param[in] Channel Uart channel used for reception.
- * @param[in] Buffer Buffer to receive.
- * @param[in] BufferSize The number of bytes to receive.
- * @param[in] Timeout The timeout value in us.
- *
- *
- * @return E_OK: Reception ended successfully
- * E_NOT_OK: Reception didn't end successfully
- * UART_STATUS_TIMEOUT: Reception has timeout
- */
- Std_ReturnType Uart_Ipw_SyncReceive(uint8 Channel, uint8 *Buffer, uint32 BufferSize, uint32 Timeout)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- /* LPUART is used */
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- Lpuart_Uart_Ip_StatusType u32LpuartIpStatus;
- u32LpuartIpStatus = Lpuart_Uart_Ip_SyncReceive(HwUnit,
- Buffer,
- BufferSize,
- Timeout);
- if (LPUART_UART_IP_STATUS_SUCCESS == u32LpuartIpStatus)
- {
- TempStatus = (uint8)E_OK;
- }
- else if (LPUART_UART_IP_STATUS_TIMEOUT == u32LpuartIpStatus)
- {
- TempStatus = (uint8)UART_STATUS_TIMEOUT;
- }
- else
- {
- TempStatus = (uint8)E_NOT_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- Flexio_Uart_Ip_StatusType u32FlexioIpStatus;
- u32FlexioIpStatus = Flexio_Uart_Ip_SyncReceive(HwUnit,
- Buffer,
- BufferSize,
- Timeout);
- if (FLEXIO_UART_IP_STATUS_SUCCESS == u32FlexioIpStatus)
- {
- TempStatus = (uint8)E_OK;
- }
- else if (FLEXIO_UART_IP_STATUS_TIMEOUT == u32FlexioIpStatus)
- {
- TempStatus = (uint8)UART_STATUS_TIMEOUT;
- }
- else
- {
- TempStatus = (uint8)E_NOT_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Receives a buffer asynchronously.
- * @details This function calls a LLD function which receives BufferSize bytes using an asynchornous method.
- *
- * @param[in] Channel Uart channel used for reception.
- * @param[in] Buffer Buffer to receive.
- * @param[in] BufferSize The number of bytes to receive.
- *
- *
- * @return E_OK: Reception started successfully
- E_NOT_OK: Reception didn't start successfully
- */
- Std_ReturnType Uart_Ipw_AsyncReceive(uint8 Channel, uint8 *Buffer, uint32 BufferSize)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- /* LPUART is used */
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- if (LPUART_UART_IP_STATUS_SUCCESS == Lpuart_Uart_Ip_AsyncReceive(HwUnit,
- Buffer,
- BufferSize))
- {
- TempStatus = (uint8)E_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- if (FLEXIO_UART_IP_STATUS_SUCCESS == Flexio_Uart_Ip_AsyncReceive(HwUnit,
- Buffer,
- BufferSize))
- {
- TempStatus = (uint8)E_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Sends a buffer asynchronously.
- * @details This function calls a LLD function which sends BufferSize bytes using an asynchornous method.
- *
- * @param[in] Channel Uart channel used for transmission.
- * @param[in] Buffer Buffer to send.
- * @param[in] BufferSize The number of bytes to send.
- *
- *
- * @return E_OK: Transmission started successfully
- E_NOT_OK: Transmission didn't start successfully
- */
- Std_ReturnType Uart_Ipw_AsyncSend(uint8 Channel, const uint8 *Buffer, uint32 BufferSize)
- {
- Std_ReturnType TempStatus = (uint8)E_NOT_OK;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- /* LPUART is used */
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- if (LPUART_UART_IP_STATUS_SUCCESS == Lpuart_Uart_Ip_AsyncSend(HwUnit,
- Buffer,
- BufferSize))
- {
- TempStatus = (uint8)E_OK;
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- if (FLEXIO_UART_IP_STATUS_SUCCESS == Flexio_Uart_Ip_AsyncSend(HwUnit,
- Buffer,
- BufferSize))
- {
- TempStatus = (uint8)E_OK;
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Retrieves the status of the previous transfer.
- * @details This function calls a LLD function which retrieves the status of the previous transfer
- * and the number of the remaining bytes to send.
- *
- * @param[in] Channel Uart channel.
- * @param[out] BytesRemaining The pointer where to write the number of remaining bytes
- *
- *
- * @return UART_NO_ERR0R: The previous transfer ended successfully
- UART_STATUS_OPERATION_ONGOING The transfer is still on going
- UART_STATUS_ABORTED The previous transfer was aborted
- UART_STATUS_TIMEOUT The previous transfer was timeout
- */
- Uart_StatusType Uart_Ipw_GetTransmitStatus(uint8 Channel, uint32 *BytesRemaining)
- {
- Uart_StatusType TempStatus = UART_STATUS_TIMEOUT;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- Lpuart_Uart_Ip_StatusType u32LpuartIpStatus;
- u32LpuartIpStatus = Lpuart_Uart_Ip_GetTransmitStatus(HwUnit, BytesRemaining);
- TempStatus = Uart_Ipw_LpuartConvertStatus(u32LpuartIpStatus);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- Flexio_Uart_Ip_StatusType u32FlexioIpStatus;
- u32FlexioIpStatus = Flexio_Uart_Ip_GetStatus(HwUnit, BytesRemaining);
- TempStatus = Uart_Ipw_FlexioConvertStatus(u32FlexioIpStatus);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- /**
- * @internal
- * @brief Retrieves the status of the previous reception.
- * @details This function calls a LLD function which retrieves the status of the previous reception
- * and the number of the remaining bytes to receive.
- *
- * @param[in] Channel Uart channel.
- * @param[out] BytesRemaining The pointer where to write the number of remaining bytes
- *
- *
- * @return UART_NO_ERR0R: The previous transfer ended successfully
- UART_STATUS_OPERATION_ONGOING The reception is still on going
- UART_STATUS_ABORTED The previous reception was aborted
- UART_STATUS_FRAMING_ERROR Uart framing error
- UART_STATUS_RX_OVERRUN_ERROR Uart overrun error
- UART_STATUS_PARITY_ERROR Uart overrun error
- UART_STATUS_TIMEOUT Uart operation has timeout
- */
- Uart_StatusType Uart_Ipw_GetReceiveStatus(uint8 Channel, uint32 *BytesRemaining)
- {
- Uart_StatusType TempStatus = UART_STATUS_TIMEOUT;
- uint8 HwUnit = Uart_Ipw_apChnConfig[Channel]->UartHwChannel;
- if (LPUART_IP == Uart_Ipw_apChnConfig[Channel]->UartIpType)
- {
- #ifdef UART_IPW_LPUART_HW_USING
- Lpuart_Uart_Ip_StatusType u32LpuartIpStatus;
- u32LpuartIpStatus = Lpuart_Uart_Ip_GetReceiveStatus(HwUnit, BytesRemaining);
- TempStatus = Uart_Ipw_LpuartConvertStatus(u32LpuartIpStatus);
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- }
- #ifdef UART_IPW_FLEXIO_HW_USING
- else
- {
- Flexio_Uart_Ip_StatusType u32FlexioIpStatus;
- u32FlexioIpStatus = Flexio_Uart_Ip_GetStatus(HwUnit, BytesRemaining);
- TempStatus = Uart_Ipw_FlexioConvertStatus(u32FlexioIpStatus);
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- return TempStatus;
- }
- #ifdef UART_IPW_LPUART_HW_USING
- /**
- * @internal
- * @brief Convert Uart IP layer return status to standard return status.
- * @details This function receives Uart IP layer return status and convert to standard return status.
- * @param[in] Status Uart IP status
- *
- *
- * @return Standard status
- * This is not a public API as it is called from other driver functions.
- */
- static Uart_StatusType Uart_Ipw_LpuartConvertStatus(Lpuart_Uart_Ip_StatusType Status)
- {
- Uart_StatusType TempStatus = UART_STATUS_TIMEOUT;
- switch (Status)
- {
- case LPUART_UART_IP_STATUS_SUCCESS:
- TempStatus = UART_STATUS_NO_ERROR;
- break;
- case LPUART_UART_IP_STATUS_BUSY:
- TempStatus = UART_STATUS_OPERATION_ONGOING;
- break;
- case LPUART_UART_IP_STATUS_ABORTED:
- TempStatus = UART_STATUS_ABORTED;
- break;
- case LPUART_UART_IP_STATUS_TIMEOUT:
- TempStatus = UART_STATUS_TIMEOUT;
- break;
- case LPUART_UART_IP_STATUS_FRAMING_ERROR:
- TempStatus = UART_STATUS_FRAMING_ERROR;
- break;
- case LPUART_UART_IP_STATUS_RX_OVERRUN:
- TempStatus = UART_STATUS_RX_OVERRUN_ERROR;
- break;
- case LPUART_UART_IP_STATUS_NOISE_ERROR:
- TempStatus = UART_STATUS_NOISE_ERROR;
- break;
- case LPUART_UART_IP_STATUS_PARITY_ERROR:
- TempStatus = UART_STATUS_PARITY_ERROR;
- break;
- default:
- TempStatus = UART_STATUS_DMA_ERROR;
- break;
- }
- return TempStatus;
- }
- /**
- * @internal
- * @brief Convert Uart HLD baudrate type to IP baudrate type.
- * @details This function receives HLD baudrate and convert to IP baudrate.
- * @param[in] Baudrate Uart HLD Baudrate
- *
- *
- * @return IP baudrate
- * This is not a public API as it is called from other driver functions.
- */
- static Lpuart_Uart_Ip_BaudrateType Uart_Ipw_LpuartConvertBaudrateType(Uart_BaudrateType Baudrate)
- {
- Lpuart_Uart_Ip_BaudrateType TempBaud = LPUART_UART_BAUDRATE_1200;
- switch (Baudrate)
- {
- case UART_BAUDRATE_1200:
- TempBaud = LPUART_UART_BAUDRATE_1200;
- break;
- case UART_BAUDRATE_2400:
- TempBaud = LPUART_UART_BAUDRATE_2400;
- break;
- case UART_BAUDRATE_4800:
- TempBaud = LPUART_UART_BAUDRATE_4800;
- break;
- case UART_BAUDRATE_9600:
- TempBaud = LPUART_UART_BAUDRATE_9600;
- break;
- case UART_BAUDRATE_14400:
- TempBaud = LPUART_UART_BAUDRATE_14400;
- break;
- case UART_BAUDRATE_19200:
- TempBaud = LPUART_UART_BAUDRATE_19200;
- break;
- case UART_BAUDRATE_28800:
- TempBaud = LPUART_UART_BAUDRATE_28800;
- break;
- case UART_BAUDRATE_38400:
- TempBaud = LPUART_UART_BAUDRATE_38400;
- break;
- case UART_BAUDRATE_57600:
- TempBaud = LPUART_UART_BAUDRATE_57600;
- break;
- case UART_BAUDRATE_115200:
- TempBaud = LPUART_UART_BAUDRATE_115200;
- break;
- case UART_BAUDRATE_230400:
- TempBaud = LPUART_UART_BAUDRATE_230400;
- break;
- case UART_BAUDRATE_460800:
- TempBaud = LPUART_UART_BAUDRATE_460800;
- break;
- case UART_BAUDRATE_921600:
- TempBaud = LPUART_UART_BAUDRATE_921600;
- break;
- case UART_BAUDRATE_1843200:
- TempBaud = LPUART_UART_BAUDRATE_1843200;
- break;
- default:
- /* Nothing to do */
- break;
- }
- return TempBaud;
- }
- #if (UART_CALLBACK_DECLARED == STD_ON)
- /**
- * @internal
- * @brief Convert Uart IP Event type to HLD Event type.
- * @details This function receives IP Event and convert to HLD Event.
- * @param[in] Event Uart IP Event
- *
- *
- * @return HLD Event
- * This is not a public API as it is called from other driver functions.
- */
- static Uart_EventType Uart_Ipw_LpuartConvertEventType(Lpuart_Uart_Ip_EventType Event)
- {
- Uart_EventType TempEvent = UART_EVENT_ERROR;
- switch (Event)
- {
- case LPUART_UART_IP_EVENT_RX_FULL:
- TempEvent = UART_EVENT_RX_FULL;
- break;
- case LPUART_UART_IP_EVENT_TX_EMPTY:
- TempEvent = UART_EVENT_TX_EMPTY;
- break;
- case LPUART_UART_IP_EVENT_END_TRANSFER:
- TempEvent = UART_EVENT_END_TRANSFER;
- break;
- case LPUART_UART_IP_EVENT_ERROR:
- TempEvent = UART_EVENT_ERROR;
- break;
- case LPUART_UART_IP_EVENT_RECV_IDLE: //zhengchao
- TempEvent = UART_EVENT_IDLE;
- break;
- default:
- /* Nothing to do */
- break;
- }
- return TempEvent;
- }
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- #ifdef UART_IPW_FLEXIO_HW_USING
- /**
- * @internal
- * @brief Convert Uart IP layer return status to standard return status.
- * @details This function receives Uart IP layer return status and convert to standard return status.
- * @param[in] Status Uart IP status
- *
- *
- * @return Standard status
- * This is not a public API as it is called from other driver functions.
- */
- static Uart_StatusType Uart_Ipw_FlexioConvertStatus(Flexio_Uart_Ip_StatusType Status)
- {
- Uart_StatusType TempStatus = UART_STATUS_TIMEOUT;
- switch (Status)
- {
- case FLEXIO_UART_IP_STATUS_SUCCESS:
- TempStatus = UART_STATUS_NO_ERROR;
- break;
- case FLEXIO_UART_IP_STATUS_BUSY:
- TempStatus = UART_STATUS_OPERATION_ONGOING;
- break;
- case FLEXIO_UART_IP_STATUS_ABORTED:
- TempStatus = UART_STATUS_ABORTED;
- break;
- case FLEXIO_UART_IP_STATUS_TIMEOUT:
- TempStatus = UART_STATUS_TIMEOUT;
- break;
- case FLEXIO_UART_IP_STATUS_RX_OVERRUN:
- TempStatus = UART_STATUS_RX_OVERRUN_ERROR;
- break;
- default:
- TempStatus = UART_STATUS_DMA_ERROR;
- break;
- }
- return TempStatus;
- }
- /**
- * @internal
- * @brief Convert Uart HLD baudrate type to IP baudrate type.
- * @details This function receives HLD baudrate and convert to IP baudrate.
- * @param[in] Baudrate Uart HLD Baudrate
- *
- *
- * @return IP baudrate
- * This is not a public API as it is called from other driver functions.
- */
- static Flexio_Uart_Ip_BaudrateType Uart_Ipw_FlexioConvertBaudrateType(Uart_BaudrateType Baudrate)
- {
- Flexio_Uart_Ip_BaudrateType TempBaud = FLEXIO_UART_BAUDRATE_1200;
- switch (Baudrate)
- {
- case UART_BAUDRATE_1200:
- TempBaud = FLEXIO_UART_BAUDRATE_1200;
- break;
- case UART_BAUDRATE_2400:
- TempBaud = FLEXIO_UART_BAUDRATE_2400;
- break;
- case UART_BAUDRATE_4800:
- TempBaud = FLEXIO_UART_BAUDRATE_4800;
- break;
- case UART_BAUDRATE_9600:
- TempBaud = FLEXIO_UART_BAUDRATE_9600;
- break;
- case UART_BAUDRATE_14400:
- TempBaud = FLEXIO_UART_BAUDRATE_14400;
- break;
- case UART_BAUDRATE_19200:
- TempBaud = FLEXIO_UART_BAUDRATE_19200;
- break;
- case UART_BAUDRATE_28800:
- TempBaud = FLEXIO_UART_BAUDRATE_28800;
- break;
- case UART_BAUDRATE_38400:
- TempBaud = FLEXIO_UART_BAUDRATE_38400;
- break;
- case UART_BAUDRATE_57600:
- TempBaud = FLEXIO_UART_BAUDRATE_57600;
- break;
- case UART_BAUDRATE_115200:
- TempBaud = FLEXIO_UART_BAUDRATE_115200;
- break;
- case UART_BAUDRATE_230400:
- TempBaud = FLEXIO_UART_BAUDRATE_230400;
- break;
- case UART_BAUDRATE_460800:
- TempBaud = FLEXIO_UART_BAUDRATE_460800;
- break;
- case UART_BAUDRATE_921600:
- TempBaud = FLEXIO_UART_BAUDRATE_921600;
- break;
- case UART_BAUDRATE_1843200:
- TempBaud = FLEXIO_UART_BAUDRATE_1843200;
- break;
- default:
- /* Nothing to do */
- break;
- }
- return TempBaud;
- }
- #if (UART_CALLBACK_DECLARED == STD_ON)
- /**
- * @internal
- * @brief Convert Uart IP Event type to HLD Event type.
- * @details This function receives IP Event and convert to HLD Event.
- * @param[in] Event Uart IP Event
- *
- *
- * @return HLD Event
- * This is not a public API as it is called from other driver functions.
- */
- static Uart_EventType Uart_Ipw_FlexioConvertEventType(Flexio_Uart_Ip_EventType Event)
- {
- Uart_EventType TempEvent = UART_EVENT_ERROR;
- switch (Event)
- {
- case FLEXIO_UART_IP_EVENT_RX_FULL:
- TempEvent = UART_EVENT_RX_FULL;
- break;
- case FLEXIO_UART_IP_EVENT_TX_EMPTY:
- TempEvent = UART_EVENT_TX_EMPTY;
- break;
- case FLEXIO_UART_IP_EVENT_END_TRANSFER:
- TempEvent = UART_EVENT_END_TRANSFER;
- break;
- case FLEXIO_UART_IP_EVENT_ERROR:
- TempEvent = UART_EVENT_ERROR;
- break;
- default:
- /* Nothing to do */
- break;
- }
- return TempEvent;
- }
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- #if (UART_CALLBACK_DECLARED == STD_ON)
- #ifdef UART_IPW_LPUART_HW_USING
- /**
- * @internal
- * @internal
- * @brief Low level driver callback for Lpuart
- * @details This function is called by the low level driver in the ISR.
- *
- *
- * This is not a public API as it is called from other driver functions.
- */
- void Uart_Ipw_LpuartCallback(const uint8 HwInstance, const Lpuart_Uart_Ip_EventType Event, void *UserData)
- {
- uint8 Channel = (uint8)Uart_Ipw_s8HwMapping[HwInstance];
- Uart_EventType ConvertEvent = Uart_Ipw_LpuartConvertEventType(Event);
- (void)UserData;
- if (Uart_Ipw_apChnConfig[Channel]->Callback != NULL_PTR)
- {
- Uart_Ipw_apChnConfig[Channel]->Callback(Channel, ConvertEvent);
- }
- }
- #endif /* #ifdef UART_IPW_LPUART_HW_USING */
- #ifdef UART_IPW_FLEXIO_HW_USING
- /**
- * @internal
- * @brief Low level driver Tx or Rx callback for Flexio
- * @details This function is called by the low level driver in the ISR.
- *
- *
- * This is not a public API as it is called from other driver functions.
- */
- void Uart_Ipw_FlexioTransferCallback(const uint32 HwChannel, const Flexio_Uart_Ip_EventType Event, void *UserData)
- {
- uint8 Channel = (uint8)Uart_Ipw_s8HwMapping[UART_NUMBER_OF_INSTANCES - FLEXIO_UART_IP_NUMBER_OF_SHIFTER_AND_TIMER + HwChannel];
- Uart_EventType ConvertEvent = Uart_Ipw_FlexioConvertEventType(Event);
- (void)UserData;
- if (Uart_Ipw_apChnConfig[Channel]->Callback != NULL_PTR)
- {
- Uart_Ipw_apChnConfig[Channel]->Callback(Channel, ConvertEvent);
- }
- }
- #endif /* #ifdef UART_IPW_FLEXIO_HW_USING */
- #endif /* UART_CALLBACK_DECLARED == STD_ON */
- #define UART_STOP_SEC_CODE
- #include "Uart_MemMap.h"
- #ifdef __cplusplus
- }
- /** @} */
- #endif
|