Вот пример CAN device FIFO mode example . This application uses the CAN controller in FIFO mode to communicate with the CAN FIFO mode example program that is running on the main board .
Так вот. При каких условиях он переходит к обработке
- Код: Выделить всё • Развернуть
CANIntHandler()
Код в скрепке.
Тут лишь приведу код для интересующей функции
- Код: Выделить всё • Развернуть
//*****************************************************************************
//
// The CAN controller interrupt handler.
//
//*****************************************************************************
void
CANIntHandler(void)
{
unsigned long ulStatus;
//
// Find the cause of the interrupt, if it is a status interrupt then just
// acknowledge the interrupt by reading the status register.
//
ulStatus = CANIntStatus(CAN0_BASE, CAN_INT_STS_CAUSE);
//
// The first eight message objects make up the Transmit message FIFO.
//
if(ulStatus <= 8)
{
//
// Increment the number of bytes transmitted.
//
g_sCAN.ulBytesTransmitted += 8;
}
//
// The second eight message objects make up the Receive message FIFO.
//
else if((ulStatus > 8) && (ulStatus <= 16))
{
//
// Read the data out and acknowledge that it was read.
//
CANMessageGet(CAN0_BASE, ulStatus, &g_sCAN.MsgObjectRx, 1);
//
// Advance the read pointer.
//
g_sCAN.MsgObjectRx.pucMsgData += 8;
//
// Decrement the expected bytes remaining.
//
g_sCAN.ulBytesRemaining -= 8;
}
else
{
//
// This was a status interrupt so read the current status to
// clear the interrupt and return.
//
CANStatusGet(CAN0_BASE, CAN_STS_CONTROL);
}
//
// Acknowledge the CAN controller interrupt has been handled.
//
CANIntClear(CAN0_BASE, ulStatus);
}