modules: canopennode: rename header and Kconfig options
Rename the top-level header file from <canbus/canopen.h> to <canopennode.h>. Rename CANopenNode related Kconfig options from CONFIG_CANOPEN* to CONFIG_CANOPENNODE*. Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
parent
613f1cde4a
commit
4216b9f622
13 changed files with 53 additions and 54 deletions
|
@ -28,9 +28,9 @@ if(CONFIG_CANOPENNODE)
|
|||
CO_driver.c
|
||||
)
|
||||
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPEN_SYNC_THREAD canopen_sync.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPEN_STORAGE canopen_storage.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPEN_LEDS canopen_leds.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPEN_PROGRAM_DOWNLOAD canopen_program.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPENNODE_SYNC_THREAD canopen_sync.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPENNODE_STORAGE canopen_storage.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPENNODE_LEDS canopen_leds.c)
|
||||
zephyr_library_sources_ifdef(CONFIG_CANOPENNODE_PROGRAM_DOWNLOAD canopen_program.c)
|
||||
|
||||
endif()
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#include <init.h>
|
||||
#include <sys/util.h>
|
||||
|
||||
#include <canbus/canopen.h>
|
||||
#include <canopennode.h>
|
||||
|
||||
#define LOG_LEVEL CONFIG_CANOPEN_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(canopen_driver);
|
||||
|
||||
K_KERNEL_STACK_DEFINE(canopen_tx_workq_stack,
|
||||
CONFIG_CANOPEN_TX_WORKQUEUE_STACK_SIZE);
|
||||
CONFIG_CANOPENNODE_TX_WORKQUEUE_STACK_SIZE);
|
||||
|
||||
struct k_work_q canopen_tx_workq;
|
||||
|
||||
|
@ -474,7 +474,7 @@ static int canopen_init(const struct device *dev)
|
|||
|
||||
k_work_queue_start(&canopen_tx_workq, canopen_tx_workq_stack,
|
||||
K_KERNEL_STACK_SIZEOF(canopen_tx_workq_stack),
|
||||
CONFIG_CANOPEN_TX_WORKQUEUE_PRIORITY, NULL);
|
||||
CONFIG_CANOPENNODE_TX_WORKQUEUE_PRIORITY, NULL);
|
||||
|
||||
k_work_init(&canopen_tx_queue.work, canopen_tx_retry);
|
||||
|
||||
|
|
|
@ -30,12 +30,12 @@ extern "C" {
|
|||
#define CO_USE_OWN_CRC16
|
||||
|
||||
/* Use SDO buffer size from Kconfig */
|
||||
#define CO_SDO_BUFFER_SIZE CONFIG_CANOPEN_SDO_BUFFER_SIZE
|
||||
#define CO_SDO_BUFFER_SIZE CONFIG_CANOPENNODE_SDO_BUFFER_SIZE
|
||||
|
||||
/* Use trace buffer size from Kconfig */
|
||||
#define CO_TRACE_BUFFER_SIZE_FIXED CONFIG_CANOPEN_TRACE_BUFFER_SIZE
|
||||
#define CO_TRACE_BUFFER_SIZE_FIXED CONFIG_CANOPENNODE_TRACE_BUFFER_SIZE
|
||||
|
||||
#ifdef CONFIG_CANOPEN_LEDS
|
||||
#ifdef CONFIG_CANOPENNODE_LEDS
|
||||
#define CO_USE_LEDS 1
|
||||
#endif
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ config CANOPENNODE
|
|||
|
||||
if CANOPENNODE
|
||||
|
||||
config CANOPEN_SDO_BUFFER_SIZE
|
||||
config CANOPENNODE_SDO_BUFFER_SIZE
|
||||
int "CANopen SDO buffer size"
|
||||
default 32
|
||||
range 7 889
|
||||
|
@ -25,27 +25,27 @@ config CANOPEN_SDO_BUFFER_SIZE
|
|||
not limited to the SDO buffer size. If block transfer is
|
||||
implemented, value should be set to 889.
|
||||
|
||||
config CANOPEN_TRACE_BUFFER_SIZE
|
||||
config CANOPENNODE_TRACE_BUFFER_SIZE
|
||||
int "CANopen trace buffer size"
|
||||
default 100
|
||||
help
|
||||
Size of the CANopen trace buffer in bytes.
|
||||
|
||||
config CANOPEN_TX_WORKQUEUE_STACK_SIZE
|
||||
config CANOPENNODE_TX_WORKQUEUE_STACK_SIZE
|
||||
int "Stack size for the CANopen transmit workqueue"
|
||||
default 320
|
||||
help
|
||||
Size of the stack used for the internal CANopen transmit
|
||||
workqueue.
|
||||
|
||||
config CANOPEN_TX_WORKQUEUE_PRIORITY
|
||||
config CANOPENNODE_TX_WORKQUEUE_PRIORITY
|
||||
int "Priority for CANopen transmit workqueue"
|
||||
default 0 if !COOP_ENABLED
|
||||
default -1
|
||||
help
|
||||
Priority level of the internal CANopen transmit workqueue.
|
||||
|
||||
config CANOPEN_STORAGE
|
||||
config CANOPENNODE_STORAGE
|
||||
bool "CANopen object dictionary storage"
|
||||
depends on SETTINGS
|
||||
default y
|
||||
|
@ -53,29 +53,29 @@ config CANOPEN_STORAGE
|
|||
Enable support for storing the CANopen object dictionary to
|
||||
non-volatile storage.
|
||||
|
||||
config CANOPEN_STORAGE_HANDLER_ERASES_EEPROM
|
||||
config CANOPENNODE_STORAGE_HANDLER_ERASES_EEPROM
|
||||
bool "Erase CANopen object dictionary EEPROM entries in storage handler"
|
||||
depends on CANOPEN_STORAGE
|
||||
depends on CANOPENNODE_STORAGE
|
||||
help
|
||||
Erase CANopen object dictionary EEPROM entries upon write to
|
||||
object dictionary index 0x1011 subindex 1.
|
||||
|
||||
config CANOPEN_LEDS
|
||||
config CANOPENNODE_LEDS
|
||||
bool "CANopen LED indicators"
|
||||
default y
|
||||
help
|
||||
Enable support for CANopen LED indicators according to the CiA
|
||||
303-3 specification.
|
||||
|
||||
config CANOPEN_LEDS_BICOLOR
|
||||
config CANOPENNODE_LEDS_BICOLOR
|
||||
bool "CANopen bicolor LED indicator"
|
||||
depends on CANOPEN_LEDS
|
||||
depends on CANOPENNODE_LEDS
|
||||
help
|
||||
Handle CANopen LEDs as one bicolor LED, favoring the red LED
|
||||
over the green LED in accordance with the CiA 303-3
|
||||
specification.
|
||||
|
||||
config CANOPEN_SYNC_THREAD
|
||||
config CANOPENNODE_SYNC_THREAD
|
||||
bool "CANopen SYNC thread"
|
||||
default y
|
||||
help
|
||||
|
@ -83,24 +83,24 @@ config CANOPEN_SYNC_THREAD
|
|||
TPDOs. Application layer must take care of SYNC RPDO and
|
||||
TPDO processing on its own if this is disabled.
|
||||
|
||||
config CANOPEN_SYNC_THREAD_STACK_SIZE
|
||||
config CANOPENNODE_SYNC_THREAD_STACK_SIZE
|
||||
int "Stack size for the CANopen SYNC thread"
|
||||
depends on CANOPEN_SYNC_THREAD
|
||||
depends on CANOPENNODE_SYNC_THREAD
|
||||
default 256
|
||||
help
|
||||
Size of the stack used for the internal thread which
|
||||
processes CANopen SYNC RPDOs and TPDOs.
|
||||
|
||||
config CANOPEN_SYNC_THREAD_PRIORITY
|
||||
config CANOPENNODE_SYNC_THREAD_PRIORITY
|
||||
int "Priority for CANopen SYNC thread"
|
||||
depends on CANOPEN_SYNC_THREAD
|
||||
depends on CANOPENNODE_SYNC_THREAD
|
||||
default 0 if !COOP_ENABLED
|
||||
default -5
|
||||
help
|
||||
Priority level of the internal thread which processes
|
||||
CANopen SYNC RPDOs and TPDOs.
|
||||
|
||||
config CANOPEN_PROGRAM_DOWNLOAD
|
||||
config CANOPENNODE_PROGRAM_DOWNLOAD
|
||||
bool "CANopen program download"
|
||||
depends on BOOTLOADER_MCUBOOT
|
||||
select IMG_MANAGER
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
|
||||
#include <CANopen.h>
|
||||
#include <canbus/canopen.h>
|
||||
#include <canopennode.h>
|
||||
|
||||
struct canopen_leds_state {
|
||||
CO_NMT_t *nmt;
|
||||
|
@ -37,7 +37,7 @@ static void canopen_leds_update(struct k_timer *timer_id)
|
|||
|
||||
red = LED_RED_ERROR(canopen_leds.nmt);
|
||||
|
||||
#ifdef CONFIG_CANOPEN_LEDS_BICOLOR
|
||||
#ifdef CONFIG_CANOPENNODE_LEDS_BICOLOR
|
||||
if (red && canopen_leds.red_cb) {
|
||||
green = false;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include <CANopen.h>
|
||||
|
||||
#include <canbus/canopen.h>
|
||||
#include <canopennode.h>
|
||||
#include <dfu/flash_img.h>
|
||||
#include <dfu/mcuboot.h>
|
||||
#include <storage/flash_map.h>
|
||||
|
@ -101,7 +101,7 @@ static CO_SDO_abortCode_t canopen_odf_1f50(CO_ODF_arg_t *odf_arg)
|
|||
return CO_SDO_AB_HW;
|
||||
}
|
||||
ctx.flash_status = FLASH_STATUS_IN_PROGRESS;
|
||||
if (IS_ENABLED(CONFIG_CANOPEN_LEDS)) {
|
||||
if (IS_ENABLED(CONFIG_CANOPENNODE_LEDS)) {
|
||||
canopen_leds_program_download(true);
|
||||
}
|
||||
ctx.total = odf_arg->dataLengthTotal;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <CO_Emergency.h>
|
||||
#include <CO_SDO.h>
|
||||
|
||||
#include <canbus/canopen.h>
|
||||
#include <canopennode.h>
|
||||
|
||||
#define LOG_LEVEL CONFIG_CANOPEN_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
|
@ -100,7 +100,7 @@ static CO_SDO_abortCode_t canopen_odf_1011(CO_ODF_arg_t *odf_arg)
|
|||
LOG_DBG("deleted object dictionary ROM entries");
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CANOPEN_STORAGE_HANDLER_ERASES_EEPROM
|
||||
#ifdef CONFIG_CANOPENNODE_STORAGE_HANDLER_ERASES_EEPROM
|
||||
err = canopen_storage_erase(CANOPEN_STORAGE_EEPROM);
|
||||
if (err == -ENOENT) {
|
||||
LOG_DBG("no object dictionary EEPROM entries to delete");
|
||||
|
|
|
@ -45,6 +45,6 @@ static void canopen_sync_thread(void *p1, void *p2, void *p3)
|
|||
}
|
||||
}
|
||||
|
||||
K_THREAD_DEFINE(canopen_sync, CONFIG_CANOPEN_SYNC_THREAD_STACK_SIZE,
|
||||
K_THREAD_DEFINE(canopen_sync, CONFIG_CANOPENNODE_SYNC_THREAD_STACK_SIZE,
|
||||
canopen_sync_thread, NULL, NULL, NULL,
|
||||
CONFIG_CANOPEN_SYNC_THREAD_PRIORITY, 0, 1);
|
||||
CONFIG_CANOPENNODE_SYNC_THREAD_PRIORITY, 0, 1);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @defgroup CAN CAN BUS
|
||||
* @{
|
||||
|
@ -18,8 +17,8 @@
|
|||
* @{
|
||||
*/
|
||||
|
||||
#ifndef ZEPHYR_INCLUDE_CANOPEN_H_
|
||||
#define ZEPHYR_INCLUDE_CANOPEN_H_
|
||||
#ifndef ZEPHYR_MODULES_CANOPENNODE_CANOPENNODE_H_
|
||||
#define ZEPHYR_MODULES_CANOPENNODE_CANOPENNODE_H_
|
||||
|
||||
#include <CANopen.h>
|
||||
#include <CO_Emergency.h>
|
||||
|
@ -153,4 +152,4 @@ void canopen_leds_program_download(bool in_progress);
|
|||
* @}
|
||||
*/
|
||||
|
||||
#endif /* ZEPHYR_INCLUDE_CANOPEN_H_ */
|
||||
#endif /* ZEPHYR_MODULES_CANOPENNODE_CANOPENNODE_H_ */
|
|
@ -1,2 +1,2 @@
|
|||
CONFIG_MPU_ALLOW_FLASH_WRITE=y
|
||||
CONFIG_CANOPEN_LEDS_BICOLOR=y
|
||||
CONFIG_CANOPENNODE_LEDS_BICOLOR=y
|
||||
|
|
|
@ -11,8 +11,8 @@ CONFIG_SETTINGS=y
|
|||
CONFIG_SETTINGS_NVS=y
|
||||
|
||||
CONFIG_CANOPEN=y
|
||||
CONFIG_CANOPEN_SYNC_THREAD=y
|
||||
CONFIG_CANOPEN_STORAGE=y
|
||||
CONFIG_CANOPEN_LEDS=y
|
||||
CONFIG_CANOPENNODE_SYNC_THREAD=y
|
||||
CONFIG_CANOPENNODE_STORAGE=y
|
||||
CONFIG_CANOPENNODE_LEDS=y
|
||||
|
||||
CONFIG_REBOOT=y
|
||||
|
|
|
@ -5,7 +5,7 @@ CONFIG_CAN=y
|
|||
CONFIG_CAN_MAX_FILTER=13
|
||||
|
||||
CONFIG_CANOPEN=y
|
||||
CONFIG_CANOPEN_SYNC_THREAD=y
|
||||
CONFIG_CANOPEN_LEDS=y
|
||||
CONFIG_CANOPENNODE_SYNC_THREAD=y
|
||||
CONFIG_CANOPENNODE_LEDS=y
|
||||
|
||||
CONFIG_REBOOT=y
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <drivers/gpio.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <settings/settings.h>
|
||||
#include <canbus/canopen.h>
|
||||
#include <canopennode.h>
|
||||
|
||||
#define LOG_LEVEL CONFIG_CANOPEN_LOG_LEVEL
|
||||
#include <logging/log.h>
|
||||
|
@ -206,9 +206,9 @@ void main(void)
|
|||
uint16_t timeout;
|
||||
uint32_t elapsed;
|
||||
int64_t timestamp;
|
||||
#ifdef CONFIG_CANOPEN_STORAGE
|
||||
#ifdef CONFIG_CANOPENNODE_STORAGE
|
||||
int ret;
|
||||
#endif /* CONFIG_CANOPEN_STORAGE */
|
||||
#endif /* CONFIG_CANOPENNODE_STORAGE */
|
||||
|
||||
can.dev = device_get_binding(CAN_INTERFACE);
|
||||
if (!can.dev) {
|
||||
|
@ -216,7 +216,7 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CANOPEN_STORAGE
|
||||
#ifdef CONFIG_CANOPENNODE_STORAGE
|
||||
ret = settings_subsys_init();
|
||||
if (ret) {
|
||||
LOG_ERR("failed to initialize settings subsystem (err = %d)",
|
||||
|
@ -229,7 +229,7 @@ void main(void)
|
|||
LOG_ERR("failed to load settings (err = %d)", ret);
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_CANOPEN_STORAGE */
|
||||
#endif /* CONFIG_CANOPENNODE_STORAGE */
|
||||
|
||||
OD_powerOnCounter++;
|
||||
|
||||
|
@ -246,15 +246,15 @@ void main(void)
|
|||
|
||||
LOG_INF("CANopen stack initialized");
|
||||
|
||||
#ifdef CONFIG_CANOPEN_STORAGE
|
||||
#ifdef CONFIG_CANOPENNODE_STORAGE
|
||||
canopen_storage_attach(CO->SDO[0], CO->em);
|
||||
#endif /* CONFIG_CANOPEN_STORAGE */
|
||||
#endif /* CONFIG_CANOPENNODE_STORAGE */
|
||||
|
||||
config_leds(CO->NMT);
|
||||
CO_OD_configure(CO->SDO[0], OD_2102_buttonPressCounter,
|
||||
odf_2102, NULL, 0U, 0U);
|
||||
|
||||
if (IS_ENABLED(CONFIG_CANOPEN_PROGRAM_DOWNLOAD)) {
|
||||
if (IS_ENABLED(CONFIG_CANOPENNODE_PROGRAM_DOWNLOAD)) {
|
||||
canopen_program_download_attach(CO->NMT, CO->SDO[0],
|
||||
CO->em);
|
||||
}
|
||||
|
@ -275,13 +275,13 @@ void main(void)
|
|||
OD_buttonPressCounter = counter;
|
||||
CO_UNLOCK_OD();
|
||||
|
||||
#ifdef CONFIG_CANOPEN_STORAGE
|
||||
#ifdef CONFIG_CANOPENNODE_STORAGE
|
||||
ret = canopen_storage_save(
|
||||
CANOPEN_STORAGE_EEPROM);
|
||||
if (ret) {
|
||||
LOG_ERR("failed to save EEPROM");
|
||||
}
|
||||
#endif /* CONFIG_CANOPEN_STORAGE */
|
||||
#endif /* CONFIG_CANOPENNODE_STORAGE */
|
||||
/*
|
||||
* Try to sleep for as long as the
|
||||
* stack requested and calculate the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue