在线时间201 小时
UID133546
注册时间2009-6-8
NXP金币2
TA的每日心情 | 开心 2020-4-30 08:32 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]初来乍到
金牌会员
 
- 积分
- 1095
- 最后登录
- 2025-6-7
|
这是ksdk 1.2中的代码,在调用UART_DRV_InstallRxCallback函数时,void * callbackParam 参数是什么,
/*!
* @brief Runtime state of the UART driver.
*
* This structure holds data that are used by the UART peripheral driver to
* communicate between the transfer function and the interrupt handler. The
* interrupt handler also uses this information to keep track of its progress.
* The user passes in the memory for the run-time state structure and the
* UART driver fills out the members.
*/
typedef struct UartState {
uint8_t txFifoEntryCount; /*!< Number of data word entries in TX FIFO. */
const uint8_t * txBuff; /*!< The buffer of data being sent.*/
uint8_t * rxBuff; /*!< The buffer of received data. */
volatile size_t txSize; /*!< The remaining number of bytes to be transmitted. */
volatile size_t rxSize; /*!< The remaining number of bytes to be received. */
volatile bool isTxBusy; /*!< True if there is an active transmit. */
volatile bool isRxBusy; /*!< True if there is an active receive. */
volatile bool isTxBlocking; /*!< True if transmit is blocking transaction. */
volatile bool isRxBlocking; /*!< True if receive is blocking transaction. */
semaphore_t txIrqSync; /*!< Used to wait for ISR to complete its TX business. */
semaphore_t rxIrqSync; /*!< Used to wait for ISR to complete its RX business. */
uart_rx_callback_t rxCallback; /*!< Callback to invoke after receiving byte.*/
void * rxCallbackParam; /*!< Receive callback parameter pointer.*/
uart_tx_callback_t txCallback; /*!< Callback to invoke after transmitting byte.*/
void * txCallbackParam; /*!< Transmit callback parameter pointer.*/
} uart_state_t;
/*FUNCTION**********************************************************************
*
* Function Name : UART_DRV_InstallRxCallback
* Description : Install receive data callback function, pass in NULL pointer
* as callback will unistall.
*
*END**************************************************************************/
uart_rx_callback_t UART_DRV_InstallRxCallback(uint32_t instance,
uart_rx_callback_t function,
uint8_t * rxBuff,
void * callbackParam,
bool alwaysEnableRxIrq)
{
assert(instance < UART_INSTANCE_COUNT);
UART_Type * base = g_uartBase[instance];
uart_state_t * uartState = (uart_state_t *)g_uartStatePtr[instance];
uart_rx_callback_t currentCallback = uartState->rxCallback;
uartState->rxCallback = function;
uartState->rxCallbackParam = callbackParam;
uartState->rxBuff = rxBuff;
/* Enable/Disable the receive data full interrupt */
uartState->isRxBusy = true;
UART_BWR_C2_RIE(base, alwaysEnableRxIrq);
return currentCallback;
}
void uartCom0_RxCallback(uint32_t instance, void * uartState)
{
/* Write your code here ... */
}
UART_DRV_InstallRxCallback(FSL_UARTCOM0, uartCom0_RxCallback, uartCom0_RxBuffer, (void *)???, false);
请问???处传递的是什么,应如何填写参数?
|
|