|
@@ -288,7 +288,7 @@ inline static n_rslt n_pci_unpack(addr_md mode, n_pdu_t* n_pdu, uint8_t dlc, ui
|
|
|
if (n_pdu != NULL && dt != NULL)
|
|
if (n_pdu != NULL && dt != NULL)
|
|
|
{
|
|
{
|
|
|
uint8_t offs = (addr_mode & 0x01); //固定为1.
|
|
uint8_t offs = (addr_mode & 0x01); //固定为1.
|
|
|
- n_pdu->n_pci.pt = (dt[0 + offs] & 0xF0) >> 4; //判断是首帧流控帧?
|
|
|
|
|
|
|
+ n_pdu->n_pci.pt = (pci_type)((dt[0 + offs] & 0xF0) >> 4); //判断是首帧流控帧?
|
|
|
#if DEBUG_LOG_EN
|
|
#if DEBUG_LOG_EN
|
|
|
LOG_D("n_pdu->n_pci.pt:0x%x", n_pdu->n_pci.pt);
|
|
LOG_D("n_pdu->n_pci.pt:0x%x", n_pdu->n_pci.pt);
|
|
|
#endif
|
|
#endif
|
|
@@ -478,7 +478,7 @@ inline static n_rslt n_pdu_pack(addr_md mode, n_pdu_t* n_pdu, uint32_t* id, uint
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
return N_ERROR;
|
|
return N_ERROR;
|
|
|
- break;
|
|
|
|
|
|
|
+ // break;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
n_pci_pack(mode, n_pdu, dt);
|
|
n_pci_pack(mode, n_pdu, dt);
|
|
@@ -507,18 +507,18 @@ inline static n_rslt n_pdu_unpack(addr_md mode, n_pdu_t* n_pdu, uint32_t id, uin
|
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x700U) >> 8);
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x700U) >> 8);
|
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x38U) >> 3);
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x38U) >> 3);
|
|
|
n_pdu->n_ai.n_sa = (uint8_t)(id & 0x07U);
|
|
n_pdu->n_ai.n_sa = (uint8_t)(id & 0x07U);
|
|
|
- n_pdu->n_ai.n_tt = (uint8_t)(((id & 0x40U) >> 6) == 1 ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
|
|
|
|
+ n_pdu->n_ai.n_tt = (ta_type)(((id & 0x40U) >> 6) == 1 ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
break;
|
|
break;
|
|
|
case N_ADM_MIXED29:
|
|
case N_ADM_MIXED29:
|
|
|
n_pdu->n_ai.n_ae = dt[0];
|
|
n_pdu->n_ai.n_ae = dt[0];
|
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x1C000000) >> 26);
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x1C000000) >> 26);
|
|
|
- n_pdu->n_ai.n_tt = (uint8_t)(((id & 0x00FF0000) >> 16) == 0xCE ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
|
|
|
|
+ n_pdu->n_ai.n_tt = (ta_type)(((id & 0x00FF0000) >> 16) == 0xCE ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x0000FF00) >> 8);
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x0000FF00) >> 8);
|
|
|
n_pdu->n_ai.n_sa = (uint8_t)((id & 0x000000FF) >> 0);
|
|
n_pdu->n_ai.n_sa = (uint8_t)((id & 0x000000FF) >> 0);
|
|
|
break;
|
|
break;
|
|
|
case N_ADM_FIXED:
|
|
case N_ADM_FIXED:
|
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x1C000000) >> 26);
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x1C000000) >> 26);
|
|
|
- n_pdu->n_ai.n_tt = (uint8_t)(((id & 0x00FF0000) >> 16) == 0xDA ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
|
|
|
|
+ n_pdu->n_ai.n_tt = (ta_type)(((id & 0x00FF0000) >> 16) == 0xDA ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x0000FF00) >> 8);
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x0000FF00) >> 8);
|
|
|
n_pdu->n_ai.n_sa = (uint8_t)((id & 0x000000FF) >> 0);
|
|
n_pdu->n_ai.n_sa = (uint8_t)((id & 0x000000FF) >> 0);
|
|
|
break;
|
|
break;
|
|
@@ -526,14 +526,14 @@ inline static n_rslt n_pdu_unpack(addr_md mode, n_pdu_t* n_pdu, uint32_t id, uin
|
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x700U) >> 8);
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x700U) >> 8);
|
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x38U) >> 3);
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0x38U) >> 3);
|
|
|
n_pdu->n_ai.n_sa = (uint8_t)(id & 0x07U);
|
|
n_pdu->n_ai.n_sa = (uint8_t)(id & 0x07U);
|
|
|
- n_pdu->n_ai.n_tt = (uint8_t)((id & 0x40U) >> 6 == 1 ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
|
|
|
|
+ n_pdu->n_ai.n_tt = (ta_type)((id & 0x40U) >> 6 == 1 ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
n_pdu->n_ai.n_ae = dt[0];
|
|
n_pdu->n_ai.n_ae = dt[0];
|
|
|
break;
|
|
break;
|
|
|
case N_ADM_BMW:
|
|
case N_ADM_BMW:
|
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x700U) >> 8);
|
|
n_pdu->n_ai.n_pr = (uint8_t)((id & 0x700U) >> 8);
|
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0xFF));
|
|
n_pdu->n_ai.n_ta = (uint8_t)((id & 0xFF));
|
|
|
n_pdu->n_ai.n_sa = (uint8_t)((id >> 8) & 0xFF);
|
|
n_pdu->n_ai.n_sa = (uint8_t)((id >> 8) & 0xFF);
|
|
|
- n_pdu->n_ai.n_tt = (uint8_t)((id & 0x40U) >> 6 == 1 ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
|
|
|
|
+ n_pdu->n_ai.n_tt = (ta_type)((id & 0x40U) >> 6 == 1 ? N_TA_T_PHY : N_TA_T_FUNC);
|
|
|
n_pdu->n_ai.n_ae = dt[0];
|
|
n_pdu->n_ai.n_ae = dt[0];
|
|
|
#if DEBUG_LOG_EN
|
|
#if DEBUG_LOG_EN
|
|
|
LOG_D("n_pr:0x%x,n_ta:0x%x,n_sa:0x%x,n_tt:0x%x,n_ae:0x%x", n_pdu->n_ai.n_pr,n_pdu->n_ai.n_ta,n_pdu->n_ai.n_sa,n_pdu->n_ai.n_tt,n_pdu->n_ai.n_ae);
|
|
LOG_D("n_pr:0x%x,n_ta:0x%x,n_sa:0x%x,n_tt:0x%x,n_ae:0x%x", n_pdu->n_ai.n_pr,n_pdu->n_ai.n_ta,n_pdu->n_ai.n_sa,n_pdu->n_ai.n_tt,n_pdu->n_ai.n_ae);
|
|
@@ -646,7 +646,7 @@ static n_rslt send_N_PCI_T_FC(iso15765_t* ih)
|
|
|
#endif //DEBUG_LOG_EN
|
|
#endif //DEBUG_LOG_EN
|
|
|
if (n_pdu_pack(ih->addr_md, &ih->fl_pdu, &id, ih->out.msg) != N_OK)
|
|
if (n_pdu_pack(ih->addr_md, &ih->fl_pdu, &id, ih->out.msg) != N_OK)
|
|
|
{
|
|
{
|
|
|
- ih->out.sts = (ih->out.sts & (~N_S_TX_BUSY));
|
|
|
|
|
|
|
+ ih->out.sts = (stream_sts)(ih->out.sts & (~N_S_TX_BUSY));
|
|
|
return N_ERROR;
|
|
return N_ERROR;
|
|
|
}
|
|
}
|
|
|
#if DEBUG_LOG_EN
|
|
#if DEBUG_LOG_EN
|
|
@@ -880,7 +880,7 @@ static n_rslt process_in_fc(iso15765_t* ih, canbus_frame_t* frame)
|
|
|
inline static n_rslt iso15765_process_in(iso15765_t* ih, canbus_frame_t* frame)
|
|
inline static n_rslt iso15765_process_in(iso15765_t* ih, canbus_frame_t* frame)
|
|
|
{
|
|
{
|
|
|
/* Converting the canbus frame to PDU format and process it by its PCI Type */
|
|
/* Converting the canbus frame to PDU format and process it by its PCI Type */
|
|
|
- ih->in.fr_fmt = frame->fr_format;
|
|
|
|
|
|
|
+ ih->in.fr_fmt = (cbus_fr_format)frame->fr_format;
|
|
|
#if DEBUG_LOG_EN
|
|
#if DEBUG_LOG_EN
|
|
|
LOG_D("process_frame:0x%x", frame->fr_format);
|
|
LOG_D("process_frame:0x%x", frame->fr_format);
|
|
|
LOG_D("can_frame_id:0x%x", frame->id);
|
|
LOG_D("can_frame_id:0x%x", frame->id);
|
|
@@ -942,13 +942,14 @@ static n_rslt iso15765_process_out(iso15765_t* ih)
|
|
|
{
|
|
{
|
|
|
addr_mode = N_ADM_EXTENDED;
|
|
addr_mode = N_ADM_EXTENDED;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ pci_type tmp_type = N_PCI_T_UN;
|
|
|
/* Find the PCI type of the pending outbound stream */
|
|
/* Find the PCI type of the pending outbound stream */
|
|
|
ih->out.pdu.n_pci.pt = n_out_frame_type(ih);
|
|
ih->out.pdu.n_pci.pt = n_out_frame_type(ih);
|
|
|
|
|
+ tmp_type = n_out_frame_type(ih);
|
|
|
#if DEBUG_LOG_EN
|
|
#if DEBUG_LOG_EN
|
|
|
LOG_D("ih->out.pdu.n_pci.pt:0x%x", ih->out.pdu.n_pci.pt);
|
|
LOG_D("ih->out.pdu.n_pci.pt:0x%x", ih->out.pdu.n_pci.pt);
|
|
|
#endif //DEBUG_LOG_EN
|
|
#endif //DEBUG_LOG_EN
|
|
|
- switch (ih->out.pdu.n_pci.pt)
|
|
|
|
|
|
|
+ switch (tmp_type)
|
|
|
{
|
|
{
|
|
|
case N_PCI_T_SF:
|
|
case N_PCI_T_SF:
|
|
|
/* Copy all the data of the SF to the outbound stream, pack and send the canbus frame */
|
|
/* Copy all the data of the SF to the outbound stream, pack and send the canbus frame */
|
|
@@ -964,7 +965,7 @@ static n_rslt iso15765_process_out(iso15765_t* ih)
|
|
|
|
|
|
|
|
rslt = ih->clbs.send_frame(ih->fr_id_type, id, ih->out.fr_fmt, n_get_closest_can_dl(ih->out.pdu.sz + n_get_dt_offset(addr_mode, N_PCI_T_SF, ih->out.pdu.sz), ih->out.fr_fmt), ih->out.pdu.dt) == 0 ? N_OK : N_ERROR;
|
|
rslt = ih->clbs.send_frame(ih->fr_id_type, id, ih->out.fr_fmt, n_get_closest_can_dl(ih->out.pdu.sz + n_get_dt_offset(addr_mode, N_PCI_T_SF, ih->out.pdu.sz), ih->out.fr_fmt), ih->out.pdu.dt) == 0 ? N_OK : N_ERROR;
|
|
|
goto iso15765_process_out_cfm;
|
|
goto iso15765_process_out_cfm;
|
|
|
- break;
|
|
|
|
|
|
|
+ // break;
|
|
|
|
|
|
|
|
case N_PCI_T_FF:
|
|
case N_PCI_T_FF:
|
|
|
/* Copy all the data of the FF to the outbound stream for transmission and prepare the service
|
|
/* Copy all the data of the FF to the outbound stream for transmission and prepare the service
|