// ----------------------------------------------------------------------------- //! \brief This routine initializes the transport layer and opens the port //! of the device. //! //! \param[in] tRxBuf - pointer to NPI TL Tx Buffer //! \param[in] tTxBuf - pointer to NPI TL Rx Buffer //! \param[in] npiCBack - NPI TL call back function to be invoked at the end of //! a UART transaction //! //! \return void // ----------------------------------------------------------------------------- void NPITLUART_initializeTransport(Char *tRxBuf, Char *tTxBuf, npiCB_t npiCBack) { UART_Params params; TransportRxBuf = tRxBuf; TransportTxBuf = tTxBuf; npiTransmitCB = npiCBack; // Configure UART parameters. UART_Params_init(¶ms); params.baudRate = NPI_UART_BR; params.readDataMode = UART_DATA_BINARY; params.writeDataMode = UART_DATA_BINARY; params.dataLength = UART_LEN_8; params.stopBits = UART_STOP_ONE; params.readMode = UART_MODE_CALLBACK; params.writeMode = UART_MODE_CALLBACK; params.readEcho = UART_ECHO_OFF; params.readCallback = NPITLUART_readCallBack; params.writeCallback = NPITLUART_writeCallBack; // Open / power on the UART. uartHandle = UART_open(Board_UART, ¶ms); //Enable Partial Reads on all subsequent UART_read() UART_control(uartHandle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL); #ifndef POWER_SAVING // This call will start repeated Uart Reads when Power Savings is disabled NPITLUART_readTransport(); #endif //!POWER_SAVING return; }
// ----------------------------------------------------------------------------- //! \brief This routine initializes the transport layer and opens the port //! of the device. //! //! \param[in] tRxBuf - pointer to SDI TL Tx Buffer //! \param[in] tTxBuf - pointer to SDI TL Rx Buffer //! \param[in] sdiCBack - SDI TL call back function to be invoked at the end of //! a UART transaction //! //! \return void // ----------------------------------------------------------------------------- void SDITLUART_initializeTransport(Char *tRxBuf, Char *tTxBuf, sdiCB_t sdiCBack) { // Set UART transport callbacks TransportRxBuf = tRxBuf; TransportTxBuf = tTxBuf; sdiTransmitCB = sdiCBack; // Configure UART parameters. UART_Params_init(¶msUART); paramsUART.baudRate = SDI_UART_BR; paramsUART.readDataMode = UART_DATA_BINARY; paramsUART.writeDataMode = UART_DATA_BINARY; paramsUART.dataLength = UART_LEN_8; paramsUART.stopBits = UART_STOP_ONE; paramsUART.readMode = UART_MODE_CALLBACK; paramsUART.writeMode = UART_MODE_CALLBACK; paramsUART.readEcho = UART_ECHO_OFF; paramsUART.readCallback = SDITLUART_readCallBack; paramsUART.writeCallback = SDITLUART_writeCallBack; //paramsUART.readReturnMode = UART_RETURN_FULL; // Open / power on the UART. uartHandle = UART_open(Board_UART, ¶msUART); if(uartHandle != NULL) { //DEBUG("ERROR in UART_open"); } //Enable Partial Reads on all subsequent UART_read() UART_control(uartHandle, UARTCC26XX_RETURN_PARTIAL_ENABLE, NULL); return; }
uint8 SDITLUART_configureUARTParams(UART_Params *initParams) { uint8 status = SUCCESS; ICall_CSState key; SDITLUART_closeUART(); key = ICall_enterCriticalSection(); // Open / power on the UART. uartHandle = UART_open(Board_UART, ¶msUART); if(uartHandle != NULL) { //DEBUG("UART_open successful"); }else{ //DEBUG("ERROR in UART_open"); status = FAILURE; } //Enable Partial Reads on all subsequent UART_read() status = UART_control(uartHandle, UARTCC26XX_RETURN_PARTIAL_ENABLE, NULL); ICall_leaveCriticalSection(key); #ifndef POWER_SAVING //Initiate first read to start polling UART SDITLUART_readTransport(); #endif //POWER_SAVING return status; }
// ----------------------------------------------------------------------------- //! \brief This routine initializes the transport layer and opens the port //! of the device. //! //! \param[in] portID ID value for board specific UART port //! \param[in] portParams Parameters used to initialize UART port //! \param[in] npiCBack Transport Layer call back function //! //! \return void // ----------------------------------------------------------------------------- void NPITLUART_openTransport(uint8_t portID, UART_Params *portParams, npiCB_t npiCBack) { npiTransmitCB = npiCBack; // Add call backs UART parameters. portParams->readCallback = NPITLUART_readCallBack; portParams->writeCallback = NPITLUART_writeCallBack; // Open / power on the UART. uartHandle = UART_open(portID, portParams); //Enable Partial Reads on all subsequent UART_read() UART_control(uartHandle, UARTCC26XX_CMD_RETURN_PARTIAL_ENABLE, NULL); }
/** * @fn SBL_TL_flushRxBuffer * * @brief Flushes receive buffer * * @param None. * * @return None. */ void SBL_TL_flushRxBuffer(void) { // Flush. UART_control(sblUartHandle, UARTCC26XX_CMD_RX_FIFO_FLUSH, NULL); }