From 52a6bed24e312a595f5569bab19db67f68cc055a Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Wed, 14 Dec 2022 14:15:14 -0500 Subject: [PATCH] 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 --- src/atsamd/fdcan.c | 6 +++--- src/generic/canbus.c | 6 +++--- src/generic/canbus.h | 4 ++-- src/generic/usb_canbus.c | 2 +- src/rp2040/can.c | 4 ++-- src/stm32/can.c | 6 +++--- src/stm32/fdcan.c | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/atsamd/fdcan.c b/src/atsamd/fdcan.c index c12d91db..758cb4f2 100644 --- a/src/atsamd/fdcan.c +++ b/src/atsamd/fdcan.c @@ -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); diff --git a/src/generic/canbus.c b/src/generic/canbus.c index 941ccd00..0c7fc82d 100644 --- a/src/generic/canbus.c +++ b/src/generic/canbus.c @@ -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 diff --git a/src/generic/canbus.h b/src/generic/canbus.h index 8032611a..cd592b74 100644 --- a/src/generic/canbus.h +++ b/src/generic/canbus.h @@ -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); diff --git a/src/generic/usb_canbus.c b/src/generic/usb_canbus.c index 1a4ac869..10f23ab9 100644 --- a/src/generic/usb_canbus.c +++ b/src/generic/usb_canbus.c @@ -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; diff --git a/src/rp2040/can.c b/src/rp2040/can.c index 9c42cf36..6cae2a7f 100644 --- a/src/rp2040/can.c +++ b/src/rp2040/can.c @@ -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) } diff --git a/src/stm32/can.c b/src/stm32/can.c index 665338ad..9167d0d8 100644 --- a/src/stm32/can.c +++ b/src/stm32/can.c @@ -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); diff --git a/src/stm32/fdcan.c b/src/stm32/fdcan.c index 9017ef85..3b01b482 100644 --- a/src/stm32/fdcan.c +++ b/src/stm32/fdcan.c @@ -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);