fix compilation when USE_USBCDC_FOR_STDIO is disabled

This commit is contained in:
Triss 2021-07-21 02:09:18 +02:00
parent 35a427e8a0
commit 66de0a0bc5
4 changed files with 13 additions and 19 deletions

View File

@ -4,6 +4,7 @@
#include "mode.h" #include "mode.h"
#include "thread.h" #include "thread.h"
#include "usbstdio.h"
#include "vnd_cfg.h" #include "vnd_cfg.h"
#include "m_default/bsp-feature.h" #include "m_default/bsp-feature.h"
@ -11,23 +12,15 @@
/* CMSIS-DAP */ /* CMSIS-DAP */
#include "DAP_config.h" /* ARM code *assumes* this is included prior to DAP.h */ #include "DAP_config.h" /* ARM code *assumes* this is included prior to DAP.h */
#include "DAP.h" #include "DAP.h"
/* I2C */
/* I2C-Tiny-USB */
#include "m_default/i2ctinyusb.h" #include "m_default/i2ctinyusb.h"
/* CDC UART */ /* CDC UART */
#include "m_default/cdc.h" #include "m_default/cdc.h"
/* CDC-Serprog */ /* CDC-Serprog */
#include "m_default/serprog.h" #include "m_default/serprog.h"
/* temperature sensor */ /* temperature sensor */
#include "m_default/tempsensor.h" #include "m_default/tempsensor.h"
// FIXME: this one doesn't work yet!!!!! (kernel usb device cfg fails)
// "usb 1-1: can't set config #1, error -32"
/*#define MODE_ENABLE_I2CTINYUSB*/
enum m_default_cmds { enum m_default_cmds {
mdef_cmd_spi = mode_cmd__specific, mdef_cmd_spi = mode_cmd__specific,
mdef_cmd_i2c, mdef_cmd_i2c,
@ -69,10 +62,10 @@ static void serprog_thread_fn(void) {
} }
#endif #endif
void stdio_usb_set_itf_num(int itf); // TODO: move to a header!
static void enter_cb(void) { static void enter_cb(void) {
#ifdef USE_USBCDC_FOR_STDIO
stdio_usb_set_itf_num(CDC_N_STDIO); stdio_usb_set_itf_num(CDC_N_STDIO);
#endif
vnd_cfg_set_itf_num(VND_N_CFG); vnd_cfg_set_itf_num(VND_N_CFG);
// TODO: CMSISDAP? // TODO: CMSISDAP?
@ -306,7 +299,9 @@ static const char* string_desc_arr[] = {
[STRID_IF_VND_I2CTINYUSB] = "I2C-Tiny-USB interface", [STRID_IF_VND_I2CTINYUSB] = "I2C-Tiny-USB interface",
[STRID_IF_CDC_UART] = "UART CDC interface", [STRID_IF_CDC_UART] = "UART CDC interface",
[STRID_IF_CDC_SERPROG] = "Serprog CDC interface", [STRID_IF_CDC_SERPROG] = "Serprog CDC interface",
#ifdef USE_USBCDC_FOR_STDIO
[STRID_IF_CDC_STDIO] = "stdio CDC interface (debug)", [STRID_IF_CDC_STDIO] = "stdio CDC interface (debug)",
#endif
}; };
// clang-format on // clang-format on

View File

@ -29,10 +29,10 @@ static void sump_thread_fn(void) {
} }
#endif #endif
void stdio_usb_set_itf_num(int itf); // TODO: move to a header!
static void enter_cb(void) { static void enter_cb(void) {
#ifdef USE_USBCDC_FOR_STDIO
stdio_usb_set_itf_num(CDC_N_STDIO); stdio_usb_set_itf_num(CDC_N_STDIO);
#endif
vnd_cfg_set_itf_num(VND_N_CFG); vnd_cfg_set_itf_num(VND_N_CFG);
#ifdef DBOARD_HAS_SUMP #ifdef DBOARD_HAS_SUMP
@ -147,7 +147,9 @@ static const char* string_desc_arr[] = {
// max string length check: ||||||||||||||||||||||||||||||| // max string length check: |||||||||||||||||||||||||||||||
[STRID_IF_VND_CFG ] = "Device cfg/ctl interface", [STRID_IF_VND_CFG ] = "Device cfg/ctl interface",
[STRID_IF_CDC_SUMP ] = "SUMP LA CDC interface", [STRID_IF_CDC_SUMP ] = "SUMP LA CDC interface",
#ifdef USE_USBCDC_FOR_STDIO
[STRID_IF_CDC_STDIO] = "stdio CDC interface (debug)", [STRID_IF_CDC_STDIO] = "stdio CDC interface (debug)",
#endif
}; };
// clang-format on // clang-format on

View File

@ -8,17 +8,12 @@
#include "mode.h" #include "mode.h"
#include "thread.h" #include "thread.h"
#include "usbstdio.h"
#include "vnd_cfg.h" #include "vnd_cfg.h"
static cothread_t vndcfg_thread; static cothread_t vndcfg_thread;
static uint8_t vndcfg_stack[THREAD_STACK_SIZE]; static uint8_t vndcfg_stack[THREAD_STACK_SIZE];
// FIXME: move declaration elsewhere
#ifdef USE_USBCDC_FOR_STDIO
void stdio_usb_init(void);
void stdio_usb_set_itf_num(int itf);
#endif
static void vndcfg_thread_fn(void) { static void vndcfg_thread_fn(void) {
vnd_cfg_init(); vnd_cfg_init();
thread_yield(); thread_yield();

View File

@ -108,7 +108,9 @@ static const char* string_desc_arr[] = {
[STRID_CONFIG] = "Configuration descriptor", [STRID_CONFIG] = "Configuration descriptor",
[STRID_IF_VND_CFG] = "Device cfg/ctl interface", [STRID_IF_VND_CFG] = "Device cfg/ctl interface",
#ifdef USE_USBCDC_FOR_STDIO
[STRID_IF_CDC_STDIO] = "stdio CDC interface (debug)", [STRID_IF_CDC_STDIO] = "stdio CDC interface (debug)",
#endif
}; };
// clang-format on // clang-format on