在TI的库里面关于TMS570LS0432的串口接收中断,在HALCOGEN的SCI/LIN Global配置接收中断,在初始化时调用sciEnableNotification(UART, SCI_RX_INT );就行了吗?
发生接收中断时,程序调到哪里?有两个函数:第一个能够查询也能够中断接收?中断接收岂不是需要调用了?
第二个 SVE是中断标志,SVE==11是接收中断?在SVE==11下添加自己的中断函数后,当用HALCOGEN重新生成代码,岂不是要把自己的中断函数冲没了?
1
void sciReceive(sciBASE_t *sci, uint32 length, uint8 * data)
{
/* USER CODE BEGIN (17) */
/* USER CODE END */
if ((sci->SETINT & (uint32)SCI_RX_INT) == (uint32)SCI_RX_INT)
{
/* we are in interrupt mode */
/* clear error flags */
sci->FLR = ((uint32) SCI_FE_INT | (uint32) SCI_OE_INT | (uint32) SCI_PE_INT);
g_sciTransfer_t.rx_length = length;
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
g_sciTransfer_t.rx_data = data;
}
else
{
/*SAFETYMCUSW 30 S MR:12.2,12.3 <APPROVED> "Used for data count in Transmit/Receive polling and Interrupt mode" */
while (length > 0U)
{
/*SAFETYMCUSW 28 D MR:NA <APPROVED> "Potentially infinite loop found - Hardware Status check for execution sequence" */
while ((sci->FLR & (uint32)SCI_RX_INT) == 0U)
{
} /* Wait */
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
*data = (uint8)(sci->RD & 0x000000FFU);
/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer operation required." */
data++;
length--;
}
}
2void linHighLevelInterrupt(void)
{
uint32 vec = scilinREG->INTVECT0;
uint8 byte;
/* USER CODE BEGIN (29) */
/* USER CODE END */
switch (vec)
{
case 1U:
sciNotification(scilinREG, (uint32)SCI_WAKE_INT);
break;
case 3U:
sciNotification(scilinREG, (uint32)SCI_PE_INT);
break;
case 6U:
sciNotification(scilinREG, (uint32)SCI_FE_INT);
break;
case 7U:
sciNotification(scilinREG, (uint32)SCI_BREAK_INT);
break;
case 9U:
sciNotification(scilinREG, (uint32)SCI_OE_INT);
break;
case 11U:
/* receive */
byte = (uint8)(scilinREG->RD & 0x000000FFU);
if (g_sciTransfer_t.rx_length > 0U)
{
*g_sciTransfer_t.rx_data = byte;
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
g_sciTransfer_t.rx_data++;
g_sciTransfer_t.rx_length--;
if (g_sciTransfer_t.rx_length == 0U)
{
sciNotification(scilinREG, (uint32)SCI_RX_INT);
}
}
break;
case 12U:
/* transmit */
/*SAFETYMCUSW 30 S MR:12.2,12.3 <APPROVED> "Used for data count in Transmit/Receive polling and Interrupt mode" */
--g_sciTransfer_t.tx_length;
if ((g_sciTransfer_t.tx_length) > 0U)
{
uint8 txdata = *g_sciTransfer_t.tx_data;
scilinREG->TD = (uint32)(txdata);
/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
g_sciTransfer_t.tx_data++;
}
else
{
scilinREG->CLEARINT = SCI_TX_INT;
sciNotification(scilinREG, (uint32)SCI_TX_INT);
}
break;
default:
/* phantom interrupt, clear flags and return */
scilinREG->FLR = ~scilinREG->SETINTLVL & 0x07000303U;
break;
}
/* USER CODE BEGIN (30) */