canbus: Rename canbus_send() to canhw_send()

Rename canbus_send() to canhw_send() and rename canbus_set_filter() to
canhw_set_filter().  This makes it more clear where the code should
reside.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-12-14 14:15:14 -05:00
parent e16a693b1e
commit 52a6bed24e
7 changed files with 17 additions and 17 deletions

View File

@ -85,7 +85,7 @@ static struct fdcan_msg_ram MSG_RAM;
// Transmit a packet
int
canbus_send(struct canbus_msg *msg)
canhw_send(struct canbus_msg *msg)
{
uint32_t txfqs = CANx->TXFQS.reg;
if (txfqs & CAN_TXFQS_TFQF)
@ -120,7 +120,7 @@ can_filter(uint32_t index, uint32_t id)
// Setup the receive packet filter
void
canbus_set_filter(uint32_t id)
canhw_set_filter(uint32_t id)
{
if (!CONFIG_CANBUS_FILTER)
return;
@ -283,7 +283,7 @@ can_init(void)
CANx->CCCR.reg &= ~CAN_CCCR_INIT;
/*##-2- Configure the CAN Filter #######################################*/
canbus_set_filter(0);
canhw_set_filter(0);
/*##-3- Configure Interrupts #################################*/
armcm_enable_irq(CAN_IRQHandler, CANx_IRQn, 1);

View File

@ -5,7 +5,7 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include "autoconf.h" // CONFIG_CANBUS_FREQUENCY
#include "canbus.h" // canbus_send
#include "canbus.h" // canhw_send
#include "canserial.h" // canserial_send
#include "command.h" // DECL_CONSTANT
@ -14,13 +14,13 @@ DECL_CONSTANT("CANBUS_FREQUENCY", CONFIG_CANBUS_FREQUENCY);
int
canserial_send(struct canbus_msg *msg)
{
return canbus_send(msg);
return canhw_send(msg);
}
void
canserial_set_filter(uint32_t id)
{
canbus_set_filter(id);
canhw_set_filter(id);
}
void

View File

@ -18,8 +18,8 @@ struct canbus_msg {
#define CANMSG_DATA_LEN(msg) ((msg)->dlc > 8 ? 8 : (msg)->dlc)
// callbacks provided by board specific code
int canbus_send(struct canbus_msg *msg);
void canbus_set_filter(uint32_t id);
int canhw_send(struct canbus_msg *msg);
void canhw_set_filter(uint32_t id);
// canbus.c
void canbus_notify_tx(void);

View File

@ -205,7 +205,7 @@ usbcan_task(void)
msg.data32[0] = gs->data32[0];
msg.data32[1] = gs->data32[1];
if (host_status & HS_TX_HW) {
ret = canbus_send(&msg);
ret = canhw_send(&msg);
if (ret < 0)
return;
UsbCan.host_status = host_status = host_status & ~HS_TX_HW;

View File

@ -26,7 +26,7 @@ static struct can2040 cbus;
// Transmit a packet
int
canbus_send(struct canbus_msg *msg)
canhw_send(struct canbus_msg *msg)
{
int ret = can2040_transmit(&cbus, (void*)msg);
if (ret < 0)
@ -36,7 +36,7 @@ canbus_send(struct canbus_msg *msg)
// Setup the receive packet filter
void
canbus_set_filter(uint32_t id)
canhw_set_filter(uint32_t id)
{
// Filter not implemented (and not necessary)
}

View File

@ -92,7 +92,7 @@
// Transmit a packet
int
canbus_send(struct canbus_msg *msg)
canhw_send(struct canbus_msg *msg)
{
uint32_t tsr = SOC_CAN->TSR;
if (!(tsr & (CAN_TSR_TME0|CAN_TSR_TME1|CAN_TSR_TME2))) {
@ -129,7 +129,7 @@ canbus_send(struct canbus_msg *msg)
// Setup the receive packet filter
void
canbus_set_filter(uint32_t id)
canhw_set_filter(uint32_t id)
{
/* Select the start slave bank */
SOC_CAN->FMR |= CAN_FMR_FINIT;
@ -268,7 +268,7 @@ can_init(void)
;
/*##-2- Configure the CAN Filter #######################################*/
canbus_set_filter(0);
canhw_set_filter(0);
/*##-3- Configure Interrupts #################################*/
armcm_enable_irq(CAN_IRQHandler, CAN_RX0_IRQn, 0);

View File

@ -101,7 +101,7 @@ struct fdcan_ram_layout {
// Transmit a packet
int
canbus_send(struct canbus_msg *msg)
canhw_send(struct canbus_msg *msg)
{
uint32_t txfqs = SOC_CAN->TXFQS;
if (txfqs & FDCAN_TXFQS_TFQF)
@ -136,7 +136,7 @@ can_filter(uint32_t index, uint32_t id)
// Setup the receive packet filter
void
canbus_set_filter(uint32_t id)
canhw_set_filter(uint32_t id)
{
if (!CONFIG_CANBUS_FILTER)
return;
@ -299,7 +299,7 @@ can_init(void)
SOC_CAN->CCCR &= ~FDCAN_CCCR_INIT;
/*##-2- Configure the CAN Filter #######################################*/
canbus_set_filter(0);
canhw_set_filter(0);
/*##-3- Configure Interrupts #################################*/
armcm_enable_irq(CAN_IRQHandler, CAN_IT0_IRQn, 1);