/* CAN driver event callback function that gets called each time a CAN message was received.  */
static void XcpTpCanEventMessageReceived(tCanMsg const *msg)
/* CAN driver event callback function that gets called each time a CAN message was received.  */
static void XcpTpCanEventMessageReceived(tCanMsg const *msg)
{
  uint32_t tpCanRxId = tpCanSettings.receiveId;
  if (tpCanSettings.useExtended)
  {
    tpCanRxId |= CAN_MSG_EXT_ID_MASK;
  }
  if (msg->id == tpCanRxId)
  {
    UtilCriticalSectionEnter();
    tpCanResponseMessage.id = msg->id;
    tpCanResponseMessage.dlc = msg->dlc;
    for (uint8_t idx = 0; idx < msg->dlc; idx++)
    {
      tpCanResponseMessage.data[idx] = msg->data[idx];
    }
    tpCanResponseMessageReceived = true;
    UtilCriticalSectionExit();
  }
}