can: Add g_ prefix to can_dlc_to_len and len_to_can_dlc.
detail: Add g_ prefix to can_dlc_to_len and len_to_can_dlc to follow NuttX coding style conventions for global symbols, improving code readability and maintainability. Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
This commit is contained in:
parent
3cce16dd0c
commit
f76c2ed83b
@ -696,7 +696,7 @@ static int imxrt_transmit(struct imxrt_driver_s *priv)
|
||||
|
||||
cs.rtr = frame->can_id & FLAGRTR ? 1 : 0;
|
||||
|
||||
cs.dlc = len_to_can_dlc[frame->len];
|
||||
cs.dlc = g_len_to_can_dlc[frame->len];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
@ -877,7 +877,7 @@ static void imxrt_receive(struct imxrt_driver_s *priv,
|
||||
frame->can_id |= FLAGRTR;
|
||||
}
|
||||
|
||||
frame->len = can_dlc_to_len[rf->cs.dlc];
|
||||
frame->len = g_can_dlc_to_len[rf->cs.dlc];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
|
@ -724,7 +724,7 @@ static int kinetis_transmit(struct kinetis_driver_s *priv)
|
||||
|
||||
cs.rtr = frame->can_id & FLAGRTR ? 1 : 0;
|
||||
|
||||
cs.dlc = len_to_can_dlc[frame->len];
|
||||
cs.dlc = g_len_to_can_dlc[frame->len];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
@ -877,7 +877,7 @@ static void kinetis_receive(struct kinetis_driver_s *priv,
|
||||
frame->can_id |= FLAGRTR;
|
||||
}
|
||||
|
||||
frame->len = can_dlc_to_len[rf->cs.dlc];
|
||||
frame->len = g_can_dlc_to_len[rf->cs.dlc];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
|
@ -728,7 +728,7 @@ static int s32k1xx_transmit(struct s32k1xx_driver_s *priv)
|
||||
|
||||
cs.rtr = frame->can_id & FLAGRTR ? 1 : 0;
|
||||
|
||||
cs.dlc = len_to_can_dlc[frame->len];
|
||||
cs.dlc = g_len_to_can_dlc[frame->len];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
@ -881,7 +881,7 @@ static void s32k1xx_receive(struct s32k1xx_driver_s *priv,
|
||||
frame->can_id |= FLAGRTR;
|
||||
}
|
||||
|
||||
frame->len = can_dlc_to_len[rf->cs.dlc];
|
||||
frame->len = g_can_dlc_to_len[rf->cs.dlc];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
|
@ -890,7 +890,7 @@ static int s32k3xx_transmit(struct s32k3xx_driver_s *priv)
|
||||
|
||||
cs.rtr = frame->can_id & FLAGRTR ? 1 : 0;
|
||||
|
||||
cs.dlc = len_to_can_dlc[frame->len];
|
||||
cs.dlc = g_len_to_can_dlc[frame->len];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
@ -1041,7 +1041,7 @@ static void s32k3xx_receive(struct s32k3xx_driver_s *priv, uint32_t flags)
|
||||
frame->can_id |= FLAGRTR;
|
||||
}
|
||||
|
||||
frame->len = can_dlc_to_len[rf->cs.dlc];
|
||||
frame->len = g_can_dlc_to_len[rf->cs.dlc];
|
||||
|
||||
frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
|
@ -1749,7 +1749,7 @@ static int fdcan_send(struct stm32_fdcan_s *priv)
|
||||
|
||||
/* Set DLC */
|
||||
|
||||
txbuffer[1] |= BUFFER_R1_DLC(len_to_can_dlc[frame->len]);
|
||||
txbuffer[1] |= BUFFER_R1_DLC(g_len_to_can_dlc[frame->len]);
|
||||
|
||||
/* Set flags */
|
||||
|
||||
@ -2467,7 +2467,7 @@ static void fdcan_receive(struct stm32_fdcan_s *priv,
|
||||
|
||||
/* Word R1 contains the DLC and timestamp */
|
||||
|
||||
frame->len = can_dlc_to_len[((rxbuffer[1] & BUFFER_R1_DLC_MASK) >>
|
||||
frame->len = g_can_dlc_to_len[((rxbuffer[1] & BUFFER_R1_DLC_MASK) >>
|
||||
BUFFER_R1_DLC_SHIFT)];
|
||||
|
||||
/* Get CANFD flags */
|
||||
|
@ -880,7 +880,7 @@ static int fdcan_transmit(struct fdcan_driver_s *priv)
|
||||
|
||||
header.id.esi = (frame->can_id & CAN_ERR_FLAG) ? 1 : 0;
|
||||
header.id.rtr = (frame->can_id & CAN_RTR_FLAG) ? 1 : 0;
|
||||
header.dlc = len_to_can_dlc[frame->len];
|
||||
header.dlc = g_len_to_can_dlc[frame->len];
|
||||
header.brs = brs; /* Bitrate switching */
|
||||
header.fdf = 1; /* CAN-FD frame */
|
||||
header.efc = 0; /* Don't store Tx events */
|
||||
@ -1161,7 +1161,7 @@ static void fdcan_receive_work(void *arg)
|
||||
frame->can_id |= CAN_RTR_FLAG;
|
||||
}
|
||||
|
||||
frame->len = can_dlc_to_len[rf->header.dlc];
|
||||
frame->len = g_can_dlc_to_len[rf->header.dlc];
|
||||
|
||||
uint32_t *frame_data_word = (uint32_t *)&frame->data[0];
|
||||
|
||||
|
@ -52,6 +52,7 @@
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_NET_CAN_CANFD
|
||||
# define NET_CAN_PKTSIZE sizeof(struct canfd_frame)
|
||||
#else
|
||||
@ -70,8 +71,8 @@
|
||||
|
||||
/* Lookup tables convert can_dlc <-> payload len */
|
||||
|
||||
extern const uint8_t can_dlc_to_len[16];
|
||||
extern const uint8_t len_to_can_dlc[65];
|
||||
extern const uint8_t g_can_dlc_to_len[16];
|
||||
extern const uint8_t g_len_to_can_dlc[65];
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
const uint8_t can_dlc_to_len[16] =
|
||||
const uint8_t g_can_dlc_to_len[16] =
|
||||
{
|
||||
0,
|
||||
1,
|
||||
@ -59,7 +59,7 @@ const uint8_t can_dlc_to_len[16] =
|
||||
48,
|
||||
64,
|
||||
};
|
||||
const uint8_t len_to_can_dlc[65] =
|
||||
const uint8_t g_len_to_can_dlc[65] =
|
||||
{
|
||||
0,
|
||||
1,
|
||||
|
Loading…
Reference in New Issue
Block a user