123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305 |
- /*==================================================================================================
- * 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.
- ==================================================================================================*/
- #ifndef FLEXIO_UART_IP_H
- #define FLEXIO_UART_IP_H
- /**
- * @file
- * @defgroup flexio_uart_ip Flexio UART IPL
- * @addtogroup flexio_uart_ip Flexio UART IPL
- * @{
- */
- #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 "Flexio_Uart_Ip_Cfg.h"
- #include "Mcal.h"
- /*==================================================================================================
- * SOURCE FILE VERSION INFORMATION
- ==================================================================================================*/
- #define FLEXIO_UART_IP_VENDOR_ID 43
- #define FLEXIO_UART_IP_AR_RELEASE_MAJOR_VERSION 4
- #define FLEXIO_UART_IP_AR_RELEASE_MINOR_VERSION 4
- #define FLEXIO_UART_IP_AR_RELEASE_REVISION_VERSION 0
- #define FLEXIO_UART_IP_SW_MAJOR_VERSION 1
- #define FLEXIO_UART_IP_SW_MINOR_VERSION 0
- #define FLEXIO_UART_IP_SW_PATCH_VERSION 0
- /*==================================================================================================
- * FILE VERSION CHECKS
- ==================================================================================================*/
- /* Checks against Flexio_Uart_Ip_Cfg.h */
- #if (FLEXIO_UART_IP_VENDOR_ID != FLEXIO_UART_IP_CFG_VENDOR_ID)
- #error "Flexio_Uart_Ip.h and Flexio_Uart_Ip_Cfg.h have different vendor ids"
- #endif
- #if ((FLEXIO_UART_IP_AR_RELEASE_MAJOR_VERSION != FLEXIO_UART_IP_CFG_AR_RELEASE_MAJOR_VERSION) || \
- (FLEXIO_UART_IP_AR_RELEASE_MINOR_VERSION != FLEXIO_UART_IP_CFG_AR_RELEASE_MINOR_VERSION) || \
- (FLEXIO_UART_IP_AR_RELEASE_REVISION_VERSION != FLEXIO_UART_IP_CFG_AR_RELEASE_REVISION_VERSION))
- #error "AUTOSAR Version Numbers of Flexio_Uart_Ip.h and Flexio_Uart_Ip_Cfg.h are different"
- #endif
- #if ((FLEXIO_UART_IP_SW_MAJOR_VERSION != FLEXIO_UART_IP_CFG_SW_MAJOR_VERSION) || \
- (FLEXIO_UART_IP_SW_MINOR_VERSION != FLEXIO_UART_IP_CFG_SW_MINOR_VERSION) || \
- (FLEXIO_UART_IP_SW_PATCH_VERSION != FLEXIO_UART_IP_CFG_SW_PATCH_VERSION))
- #error "Software Version Numbers of Flexio_Uart_Ip.h and Flexio_Uart_Ip_Cfg.h are different"
- #endif
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
- /* Checks against Mcal.h */
- #if ((FLEXIO_UART_IP_AR_RELEASE_MAJOR_VERSION != MCAL_AR_RELEASE_MAJOR_VERSION) || \
- (FLEXIO_UART_IP_AR_RELEASE_MINOR_VERSION != MCAL_AR_RELEASE_MINOR_VERSION))
- #error "AUTOSAR Version Numbers of Flexio_Uart_Ip.h and Mcal.h are different"
- #endif
- #endif
- #if (FLEXIO_UART_IP_IS_USING == STD_ON)
- /*==================================================================================================
- * CONSTANTS
- ==================================================================================================*/
- #define UART_START_SEC_CONFIG_DATA_UNSPECIFIED
- #include "Uart_MemMap.h"
- /* Calling the external Configuration symbols defined by FlexIO_Uart_Ip_Cfg.h */
- FLEXIO_UART_IP_CONFIG_EXT
- #define UART_STOP_SEC_CONFIG_DATA_UNSPECIFIED
- #include "Uart_MemMap.h"
- /*==================================================================================================
- * DEFINES AND MACROS
- ==================================================================================================*/
- /*==================================================================================================
- * ENUMS
- ==================================================================================================*/
- /*==================================================================================================
- * STRUCTURES AND OTHER TYPEDEFS
- ==================================================================================================*/
- /*==================================================================================================
- * GLOBAL VARIABLE DECLARATIONS
- ==================================================================================================*/
- /*==================================================================================================
- * FUNCTION PROTOTYPES
- ==================================================================================================*/
- #define UART_START_SEC_CODE
- #include "Uart_MemMap.h"
- /*!
- * @brief Initializes an Flexio UART operation channel.
- *
- * The caller provides memory for the driver state structures during initialization.
- * The user must select the Flexio UART clock source in the application to initialize the Flexio UART.
- *
- * @param Channel FLEXIO peripheral channel number
- * @param UserConfig Pointer to the Flexio over Uart user configuration structure.
- * @return void
- */
- void Flexio_Uart_Ip_Init(const uint8 Channel,
- const Flexio_Uart_Ip_UserConfigType * UserConfig);
- /*!
- * @brief Shuts down the Flexio UART by disabling interrupts and transmitter/receiver.
- *
- * @param Channel FLEXIO peripheral channel number
- * @return void
- */
- void Flexio_Uart_Ip_Deinit(const uint8 Channel);
- /*!
- * @brief Returns the Flexio UART baud rate.
- *
- * This function returns the Flexio UART configured baud rate.
- *
- * @param Channel FLEXIO peripheral channel number
- * @param[out] BaudRate Pointer to location where the baudrate value will be provided
- */
- void Flexio_Uart_Ip_GetBaudRate(const uint8 Channel, uint32 * BaudRate);
- /*!
- * @brief Configures the Flexio Uart baud rate.
- *
- * This function configures the Flexio Uart baud rate.
- * In some Flexio Uart channels the user must disable the transmitter/receiver
- * before calling this function.
- * Generally, this may be applied to all Flexio Uarts to ensure safe operation.
- *
- * @param Channel Flexio Uart channel number.
- * @param DesiredBaudrate Flexio Uart desired baud rate.
- * @param ClockFrequency Clock Frequency of Flexio Uart channel.
- * @return FLEXIO_UART_IP_STATUS_BUSY if called during an on-going transfer, FLEXIO_UART_IP_STATUS_SUCCESS otherwise
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_SetBaudRate(const uint8 Channel,
- const Flexio_Uart_Ip_BaudrateType DesiredBaudrate,
- const uint32 ClockFrequency);
- /*!
- * @brief Perform a Asynchronous UART transmission
- *
- * This function sends a block of data and returns immediately.
- * The rest of the transmission is handled by the interrupt service routine (if the driver
- * is initialized in interrupt mode)
- *
- * @param Channel FLEXIO peripheral channel number
- * @param TxBuff pointer to the data to be transferred
- * @param TxSize length in bytes of the data to be transferred
- * @return Error or success status returned by API
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_AsyncSend(const uint8 Channel,
- const uint8 * TxBuff,
- const uint32 TxSize);
- /*!
- * @brief Transfer multiple bytes of data using polling method.
- * @param Channel FLEXIO peripheral channel number
- * @param TxBuff pointer to the data to be transferred
- * @param TxSize length in bytes of the data to be transferred
- * @param Timeout value in microseconds.
- * @return Error or success status returned by API
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_SyncSend(const uint8 Channel,
- const uint8 * TxBuff,
- const uint32 TxSize,
- const uint32 Timeout);
- /*!
- * @brief Perform a Asynchronous UART reception
- *
- * This function receives a block of data and returns immediately.
- * The rest of the transmission is handled by the interrupt service routine (if the driver
- * is initialized in interrupt mode) or by the Flexio_Uart_Ip_GetStatus() function (if
- * the driver is initialized in polling mode).
- *
- * @param Channel FLEXIO peripheral channel number
- * @param RxBuff source buffer containing 8-bit data chars to receive
- * @param RxSize the number of bytes to receive
- * @return Error or success status returned by API
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_AsyncReceive(const uint8 Channel,
- uint8 * RxBuff,
- const uint32 RxSize);
- /*!
- * @brief Receive multiple bytes of data using polling method.
- *
- * This function receives a block of data and returns immediately.
- * The rest of the transmission is handled by the Flexio_Uart_Ip_GetStatus() function to initialized in polling mode.
- *
- * @param Channel FLEXIO peripheral channel number
- * @param RxBuff buffer pointer where the bytes will be received
- * @param RxSize size of data need to be sent in unit of byte
- * @param Timeout timeout value in microsecond
- * @return Error or success status returned by API
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_SyncReceive(const uint8 Channel,
- uint8 * RxBuff,
- const uint32 RxSize,
- const uint32 Timeout);
- /*FUNCTION**********************************************************************
- *
- * Function Name : Flexio_Uart_Ip_GetStatus
- * Description : Get the status of the current non-blocking UART transaction
- * Implements : Flexio_Uart_Ip_GetStatus_Activity
- *
- *END**************************************************************************/
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_GetStatus(const uint8 Channel, uint32 *BytesRemaining);
- /*FUNCTION**********************************************************************
- *
- * Function Name : Flexio_Uart_Ip_CompleteSendUsingDma
- * Description : Finish up a transmit by completing the process of sending
- * data and disabling the DMA requests. This is a callback for DMA major loop
- * completion, so it must match the DMA callback signature.
- *
- *END**************************************************************************/
- void Flexio_Uart_Ip_CompleteSendUsingDma(uint8 Channel);
- /**
- * @internal
- * @brief : Finish up a receive by completing the process of receiving data
- * and disabling the DMA requests. This is a part of callback for DMA major loop
- * completion, so it must match the DMA callback signature.
- * @param Channel Flexio channel number
- * @return void
- */
- void Flexio_Uart_Ip_CompleteReceiveUsingDma(uint8 Channel);
- /*FUNCTION**********************************************************************
- *
- * Function Name : Flexio_Uart_Ip_AbortTransferData
- * Description : This function terminates an non-blocking FLEXIO transmission
- * early. During a non-blocking FLEXIO transmission, the user has the option to
- * terminate the transmission early if the transmission is still in progress.
- *
- * Implements : Flexio_Uart_Ip_AbortTransferData_Activity
- *END**************************************************************************/
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_AbortTransferData(const uint8 Channel);
- /*!
- * @brief Sets the internal driver reference to the tx buffer.
- *
- * This function can be called from the tx callback to provide the driver
- * with a new buffer, for continuous transmission.
- *
- * @param Channel Flexio Uart channel number
- * @param TxData source buffer containing 8-bit data chars to send
- * @param TxSize the number of bytes to send
- * @return FLEXIO_UART_IP_STATUS_SUCCESS
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_SetTxBuffer(const uint8 Channel,
- const uint8 * TxData,
- const uint32 TxSize);
- /*!
- * @brief Sets the internal driver reference to the rx buffer.
- *
- * This function can be called from the rx callback to provide the driver
- * with a new buffer, for continuous reception.
- *
- * @param Channel FLEXIO channel number
- * @param RxData destination buffer containing 8-bit data chars to receive
- * @param RxSize the number of bytes to receive
- * @return FLEXIO_UART_IP_STATUS_SUCCESS
- */
- Flexio_Uart_Ip_StatusType Flexio_Uart_Ip_SetRxBuffer(const uint8 Channel,
- uint8 * RxData,
- const uint32 RxSize);
- #define UART_STOP_SEC_CODE
- #include "Uart_MemMap.h"
- #endif /* (FLEXIO_UART_IP_IS_USING == STD_ON) */
- #if defined(__cplusplus)
- }
- #endif
- /*! @}*/
- #endif /* FLEXIO_UART_IP_H */
|