Hello,
Is everyone already configure uart interface using UART_CB_ON_RX_COMPLETE ?
Do you know where I can find a sample using this configuration?
The only sample, I found, is “Uart access” using On_RX_DATA_AVAILABLE.
My pb is that the RX callback function is never awakened.
My code is as following:
static const sGCbDesc_t uart1CbTab[] =
{
/* user data / / callbacks /
{ (void)UART_CB_ON_TX_COMPLETE, (pGEvtNotif_t)&uart1_OnTxComplete },
{ (void*)-1L, NULL },
{ (void*)-1L, NULL },
{ (void*)UART_CB_ON_SIG_STATE_CHANGE, (pGEvtNotif_t)&uart1_OnSigStateChange },
{ (void*)UART_CB_ON_ERROR, &uart1_OnError },
{ (void*)-1L, (pGEvtNotif_t)&uart1_OnRxComplete }
};
//function to configure the port
s32 uart1_open( eUartRate_t speed )
{
s32 handle;
sUartSettings_t Settings;
psGItfCont_t pinterface;
sUartEvent_t events;
sUartLc_t lc;
sUartFlowCtrl_t Fc;
/* Device */
Settings.identity = “UART1”;
Settings.role = UART_ROLE_NM;
/* Events /
events.user_data = (void)0;
events.valid_cb = UART_CB_ON_TX_COMPLETE|UART_CB_ON_ERROR|UART_CB_ON_SIG_STATE_CHANGE|UART_CB_ON_RX_COMPLETE;//UART_CB_ON_ALL;
memcpy((u8*)events.cb_list, (u8*)uart1CbTab, 6*sizeof(sGCbDesc_t));
Settings.event_handlers = &events;
Settings.capabilities = NULL;
/* To retrieve the UART SP Interface */
Settings.interface = &pinterface;
/* Line Coding */
lc.op = G_IOC_OP_SET;
lc.valid_fields = UART_LC_ALL;
lc.rate = speed;
lc.stop = UART_STOP_BIT_1;
lc.parity = UART_PARITY_NONE;
lc.data = UART_DATALENGTH_8;
Settings.line_coding = &lc;
/------------------/
/* open UART device /
/------------------*/
handle = adl_OpenDevice( DF_UART_CLID, &Settings);
if( handle > 0 )
{
/* Locally store the uart1 interface */
uart1_itf = *pinterface;
/* Flow control IO control setting */
Fc.op = G_IOC_OP_SET;
Fc.type = UART_FC_NONE;
if( uart1_itf.io_control( handle, IOC_UART_FC, (void*) &Fc) )
{
uart1_itf.close( handle );
handle = 0;
}
}
return handle;
}
/**************************************************************************/
/ Uart1 Callbacks /
/************************************************************************/
void uart1_OnTxComplete( void user_data, psUartCbOtxC_t psOnTxParam )
{
/ reset all : no more data to be send here */
psOnTxParam->buf = NULL;
psOnTxParam->len = 0;
/* set Tx event */
adl_eventSet( uart1EventHandle, TX_COMPLETE_EVENT_WAIT_MASK );
}
void uart1_OnRxComplete( void* user_data, psGData_t ev_param)
{
ev_param->buf =NULL;
ev_param->len = 0;
/* set Rx event */
adl_eventSet(uart1EventHandle, RX_EVENT_WAIT_MASK);
}
void uart1_OnSigStateChange (void* user_data, psUartCbOssc_t psSigState)
{
//TRACE ((1, “EVENT : SIG CHANGE delta %x state %x”,psSigState->delta,psSigState->state));
}
void uart1_OnError (void* user_data, void* ev_param)
{
//TRACE ((1, “EVENT : ERROR %x”,(u32)ev_param));
}
Do you see any trouble in my code?
thanks for your help.
Regards,
Fabrice.