From d2d0d0a6d528bd44c73ceeea6fbf1093dc339786 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 21 Mar 2014 16:32:39 +0700 Subject: [PATCH] clean up some device warnings move led_blinking_task and led_blinking_set_interval to board.c --- boards/board.c | 40 ++++++ boards/board.h | 7 +- demos/device/device_os_none/.cproject | 170 ++++++++++++++------------ demos/device/src/WinCDCdriver.inf | 4 +- demos/device/src/cdcd_app.c | 4 +- demos/device/src/main.c | 34 +----- demos/device/src/tusb_config.h | 4 +- demos/device/src/tusb_descriptors.h | 2 +- tinyusb/class/cdc_device.c | 4 +- tinyusb/class/hid_device.c | 4 +- tinyusb/device/dcd_lpc_11uxx_13uxx.c | 10 ++ 11 files changed, 156 insertions(+), 127 deletions(-) diff --git a/boards/board.c b/boards/board.c index 06ed9f0f..fac6077b 100644 --- a/boards/board.c +++ b/boards/board.c @@ -38,6 +38,7 @@ #include "board.h" + #if TUSB_CFG_OS == TUSB_OS_NONE volatile uint32_t system_ticks = 0; @@ -53,6 +54,45 @@ uint32_t tusb_tick_get(void) #endif +//--------------------------------------------------------------------+ +// BLINKING TASK +//--------------------------------------------------------------------+ +OSAL_TASK_DEF(led_blinking_task, 128, LED_BLINKING_APP_TASK_PRIO); +static uint32_t led_blink_interval_ms = 1000; // default is 1 second + +void led_blinking_init(void) +{ + (void) osal_task_create( OSAL_TASK_REF(led_blinking_task) ); +} + +void led_blinking_set_interval(uint32_t ms) +{ + led_blink_interval_ms = ms; +} + +OSAL_TASK_FUNCTION( led_blinking_task , p_task_para) +{ + OSAL_TASK_LOOP_BEGIN + + static uint32_t led_on_mask = 0; + + osal_task_delay(led_blink_interval_ms); + + board_leds(led_on_mask, 1 - led_on_mask); + led_on_mask = 1 - led_on_mask; // toggle + +// uint32_t btn_mask; +// btn_mask = board_buttons(); +// +// for(uint8_t i=0; i<32; i++) +// { +// if ( BIT_TEST_(btn_mask, i) ) printf("button %d is pressed\n", i); +// } + + OSAL_TASK_LOOP_END +} + +// TODO remove legacy cmsis code void check_failed(uint8_t *file, uint32_t line) { (void) file; diff --git a/boards/board.h b/boards/board.h index 9c7facac..d1bc0cc0 100644 --- a/boards/board.h +++ b/boards/board.h @@ -115,13 +115,16 @@ void board_init(void); void board_leds(uint32_t on_mask, uint32_t off_mask); +uint32_t board_buttons(void); uint8_t board_uart_getchar(void); void board_uart_putchar(uint8_t c); -uint32_t board_buttons(void); +//------------- Board Application -------------// +OSAL_TASK_FUNCTION( led_blinking_task , p_task_para); -extern volatile uint32_t system_ticks; +void led_blinking_init(void); +void led_blinking_set_interval(uint32_t ms); #ifdef __cplusplus } diff --git a/demos/device/device_os_none/.cproject b/demos/device/device_os_none/.cproject index 8f871ad4..2cdd9dff 100644 --- a/demos/device/device_os_none/.cproject +++ b/demos/device/device_os_none/.cproject @@ -1,23 +1,25 @@ - + + + - + + + - - @@ -72,7 +74,7 @@ - + + + - - @@ -163,7 +166,7 @@ - + + + - - @@ -255,7 +259,7 @@ - + + + - - @@ -346,7 +351,7 @@ - + + + - - @@ -439,7 +445,7 @@ - + + + - - @@ -533,7 +540,7 @@ @@ -560,7 +568,7 @@ <?xml version="1.0" encoding="UTF-8"?> <TargetConfig> -<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="1"/> +<Properties property_0="" property_2="LPC18x7_43x7_2x512_BootA.cfx" property_3="NXP" property_4="LPC4357" property_count="5" version="60100"/> <infoList vendor="NXP"><info chip="LPC4357" flash_driver="LPC18x7_43x7_2x512_BootA.cfx" match_id="0x0" name="LPC4357" resetscript="LPC18LPC43InternalFLASHBootResetscript.scp" stub="crt_emu_lpc18_43_nxp"><chip><name>LPC4357</name> <family>LPC43xx</family> <vendor>NXP (formerly Philips)</vendor> @@ -580,61 +588,61 @@ <prog_flash blocksz="0x10000" location="0x1a010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/> <prog_flash blocksz="0x2000" location="0x1b000000" maxprgbuff="0x400" progwithcode="TRUE" size="0x10000"/> <prog_flash blocksz="0x10000" location="0x1b010000" maxprgbuff="0x400" progwithcode="TRUE" size="0x70000"/> -<peripheralInstance derived_from="V7M_MPU" id="MPU" location="0xe000ed90"/> -<peripheralInstance derived_from="V7M_NVIC" id="NVIC" location="0xe000e000"/> -<peripheralInstance derived_from="V7M_DCR" id="DCR" location="0xe000edf0"/> -<peripheralInstance derived_from="V7M_ITM" id="ITM" location="0xe0000000"/> -<peripheralInstance derived_from="SCT" id="SCT" location="0x40000000"/> -<peripheralInstance derived_from="GPDMA" id="GPDMA" location="0x40002000"/> -<peripheralInstance derived_from="SPIFI" id="SPIFI" location="0x40003000"/> -<peripheralInstance derived_from="SDMMC" id="SDMMC" location="0x40004000"/> -<peripheralInstance derived_from="EMC" id="EMC" location="0x40005000"/> -<peripheralInstance derived_from="USB0" id="USB0" location="0x40006000"/> -<peripheralInstance derived_from="USB1" id="USB1" location="0x40007000"/> -<peripheralInstance derived_from="LCD" id="LCD" location="0x40008000"/> -<peripheralInstance derived_from="EEPROM" id="EEPROM" location="0x4000e000"/> -<peripheralInstance derived_from="ETHERNET" id="ETHERNET" location="0x40010000"/> -<peripheralInstance derived_from="ATIMER" id="ATIMER" location="0x40040000"/> -<peripheralInstance derived_from="REGFILE" id="REGFILE" location="0x40041000"/> -<peripheralInstance derived_from="PMC" id="PMC" location="0x40042000"/> -<peripheralInstance derived_from="CREG" id="CREG" location="0x40043000"/> -<peripheralInstance derived_from="EVENTROUTER" id="EVENTROUTER" location="0x40044000"/> -<peripheralInstance derived_from="RTC" id="RTC" location="0x40046000"/> -<peripheralInstance derived_from="CGU" id="CGU" location="0x40050000"/> -<peripheralInstance derived_from="CCU1" id="CCU1" location="0x40051000"/> -<peripheralInstance derived_from="CCU2" id="CCU2" location="0x40052000"/> -<peripheralInstance derived_from="RGU" id="RGU" location="0x40053000"/> -<peripheralInstance derived_from="WWDT" id="WWDT" location="0x40080000"/> -<peripheralInstance derived_from="USART0" id="USART0" location="0x40081000"/> -<peripheralInstance derived_from="USART2" id="USART2" location="0x400c1000"/> -<peripheralInstance derived_from="USART3" id="USART3" location="0x400c2000"/> -<peripheralInstance derived_from="UART1" id="UART1" location="0x40082000"/> -<peripheralInstance derived_from="SSP0" id="SSP0" location="0x40083000"/> -<peripheralInstance derived_from="SSP1" id="SSP1" location="0x400c5000"/> -<peripheralInstance derived_from="TIMER0" id="TIMER0" location="0x40084000"/> -<peripheralInstance derived_from="TIMER1" id="TIMER1" location="0x40085000"/> -<peripheralInstance derived_from="TIMER2" id="TIMER2" location="0x400c3000"/> -<peripheralInstance derived_from="TIMER3" id="TIMER3" location="0x400c4000"/> -<peripheralInstance derived_from="SCU" id="SCU" location="0x40086000"/> -<peripheralInstance derived_from="GPIO-PIN-INT" id="GPIO-PIN-INT" location="0x40087000"/> -<peripheralInstance derived_from="GPIO-GROUP-INT0" id="GPIO-GROUP-INT0" location="0x40088000"/> -<peripheralInstance derived_from="GPIO-GROUP-INT1" id="GPIO-GROUP-INT1" location="0x40089000"/> -<peripheralInstance derived_from="MCPWM" id="MCPWM" location="0x400a0000"/> -<peripheralInstance derived_from="I2C0" id="I2C0" location="0x400a1000"/> -<peripheralInstance derived_from="I2C1" id="I2C1" location="0x400e0000"/> -<peripheralInstance derived_from="I2S0" id="I2S0" location="0x400a2000"/> -<peripheralInstance derived_from="I2S1" id="I2S1" location="0x400a3000"/> -<peripheralInstance derived_from="C-CAN1" id="C-CAN1" location="0x400a4000"/> -<peripheralInstance derived_from="RITIMER" id="RITIMER" location="0x400c0000"/> -<peripheralInstance derived_from="QEI" id="QEI" location="0x400c6000"/> -<peripheralInstance derived_from="GIMA" id="GIMA" location="0x400c7000"/> -<peripheralInstance derived_from="DAC" id="DAC" location="0x400e1000"/> -<peripheralInstance derived_from="C-CAN0" id="C-CAN0" location="0x400e2000"/> -<peripheralInstance derived_from="ADC0" id="ADC0" location="0x400e3000"/> -<peripheralInstance derived_from="ADC1" id="ADC1" location="0x400e4000"/> -<peripheralInstance derived_from="GPIO-PORT" id="GPIO-PORT" location="0x400f4000"/> -<peripheralInstance derived_from="SPI" id="SPI" location="0x40100000"/> -<peripheralInstance derived_from="SGPIO" id="SGPIO" location="0x40101000"/> +<peripheralInstance derived_from="V7M_MPU" determined="infoFile" id="MPU" location="0xe000ed90"/> +<peripheralInstance derived_from="V7M_NVIC" determined="infoFile" id="NVIC" location="0xe000e000"/> +<peripheralInstance derived_from="V7M_DCR" determined="infoFile" id="DCR" location="0xe000edf0"/> +<peripheralInstance derived_from="V7M_ITM" determined="infoFile" id="ITM" location="0xe0000000"/> +<peripheralInstance derived_from="SCT" determined="infoFile" id="SCT" location="0x40000000"/> +<peripheralInstance derived_from="GPDMA" determined="infoFile" id="GPDMA" location="0x40002000"/> +<peripheralInstance derived_from="SPIFI" determined="infoFile" id="SPIFI" location="0x40003000"/> +<peripheralInstance derived_from="SDMMC" determined="infoFile" id="SDMMC" location="0x40004000"/> +<peripheralInstance derived_from="EMC" determined="infoFile" id="EMC" location="0x40005000"/> +<peripheralInstance derived_from="USB0" determined="infoFile" id="USB0" location="0x40006000"/> +<peripheralInstance derived_from="USB1" determined="infoFile" id="USB1" location="0x40007000"/> +<peripheralInstance derived_from="LCD" determined="infoFile" id="LCD" location="0x40008000"/> +<peripheralInstance derived_from="EEPROM" determined="infoFile" id="EEPROM" location="0x4000e000"/> +<peripheralInstance derived_from="ETHERNET" determined="infoFile" id="ETHERNET" location="0x40010000"/> +<peripheralInstance derived_from="ATIMER" determined="infoFile" id="ATIMER" location="0x40040000"/> +<peripheralInstance derived_from="REGFILE" determined="infoFile" id="REGFILE" location="0x40041000"/> +<peripheralInstance derived_from="PMC" determined="infoFile" id="PMC" location="0x40042000"/> +<peripheralInstance derived_from="CREG" determined="infoFile" id="CREG" location="0x40043000"/> +<peripheralInstance derived_from="EVENTROUTER" determined="infoFile" id="EVENTROUTER" location="0x40044000"/> +<peripheralInstance derived_from="RTC" determined="infoFile" id="RTC" location="0x40046000"/> +<peripheralInstance derived_from="CGU" determined="infoFile" id="CGU" location="0x40050000"/> +<peripheralInstance derived_from="CCU1" determined="infoFile" id="CCU1" location="0x40051000"/> +<peripheralInstance derived_from="CCU2" determined="infoFile" id="CCU2" location="0x40052000"/> +<peripheralInstance derived_from="RGU" determined="infoFile" id="RGU" location="0x40053000"/> +<peripheralInstance derived_from="WWDT" determined="infoFile" id="WWDT" location="0x40080000"/> +<peripheralInstance derived_from="USART0" determined="infoFile" id="USART0" location="0x40081000"/> +<peripheralInstance derived_from="USART2" determined="infoFile" id="USART2" location="0x400c1000"/> +<peripheralInstance derived_from="USART3" determined="infoFile" id="USART3" location="0x400c2000"/> +<peripheralInstance derived_from="UART1" determined="infoFile" id="UART1" location="0x40082000"/> +<peripheralInstance derived_from="SSP0" determined="infoFile" id="SSP0" location="0x40083000"/> +<peripheralInstance derived_from="SSP1" determined="infoFile" id="SSP1" location="0x400c5000"/> +<peripheralInstance derived_from="TIMER0" determined="infoFile" id="TIMER0" location="0x40084000"/> +<peripheralInstance derived_from="TIMER1" determined="infoFile" id="TIMER1" location="0x40085000"/> +<peripheralInstance derived_from="TIMER2" determined="infoFile" id="TIMER2" location="0x400c3000"/> +<peripheralInstance derived_from="TIMER3" determined="infoFile" id="TIMER3" location="0x400c4000"/> +<peripheralInstance derived_from="SCU" determined="infoFile" id="SCU" location="0x40086000"/> +<peripheralInstance derived_from="GPIO-PIN-INT" determined="infoFile" id="GPIO-PIN-INT" location="0x40087000"/> +<peripheralInstance derived_from="GPIO-GROUP-INT0" determined="infoFile" id="GPIO-GROUP-INT0" location="0x40088000"/> +<peripheralInstance derived_from="GPIO-GROUP-INT1" determined="infoFile" id="GPIO-GROUP-INT1" location="0x40089000"/> +<peripheralInstance derived_from="MCPWM" determined="infoFile" id="MCPWM" location="0x400a0000"/> +<peripheralInstance derived_from="I2C0" determined="infoFile" id="I2C0" location="0x400a1000"/> +<peripheralInstance derived_from="I2C1" determined="infoFile" id="I2C1" location="0x400e0000"/> +<peripheralInstance derived_from="I2S0" determined="infoFile" id="I2S0" location="0x400a2000"/> +<peripheralInstance derived_from="I2S1" determined="infoFile" id="I2S1" location="0x400a3000"/> +<peripheralInstance derived_from="C-CAN1" determined="infoFile" id="C-CAN1" location="0x400a4000"/> +<peripheralInstance derived_from="RITIMER" determined="infoFile" id="RITIMER" location="0x400c0000"/> +<peripheralInstance derived_from="QEI" determined="infoFile" id="QEI" location="0x400c6000"/> +<peripheralInstance derived_from="GIMA" determined="infoFile" id="GIMA" location="0x400c7000"/> +<peripheralInstance derived_from="DAC" determined="infoFile" id="DAC" location="0x400e1000"/> +<peripheralInstance derived_from="C-CAN0" determined="infoFile" id="C-CAN0" location="0x400e2000"/> +<peripheralInstance derived_from="ADC0" determined="infoFile" id="ADC0" location="0x400e3000"/> +<peripheralInstance derived_from="ADC1" determined="infoFile" id="ADC1" location="0x400e4000"/> +<peripheralInstance derived_from="GPIO-PORT" determined="infoFile" id="GPIO-PORT" location="0x400f4000"/> +<peripheralInstance derived_from="SPI" determined="infoFile" id="SPI" location="0x40100000"/> +<peripheralInstance derived_from="SGPIO" determined="infoFile" id="SGPIO" location="0x40101000"/> </chip> <processor><name gcc_name="cortex-m4">Cortex-M4</name> <family>Cortex-M</family> diff --git a/demos/device/src/WinCDCdriver.inf b/demos/device/src/WinCDCdriver.inf index c3662e2f..b2ef6ba9 100644 --- a/demos/device/src/WinCDCdriver.inf +++ b/demos/device/src/WinCDCdriver.inf @@ -86,11 +86,11 @@ ServiceBinary=%12%\%DRIVERFILENAME%.sys [SourceDisksFiles] [SourceDisksNames] [DeviceList] -%DESCRIPTION%=DriverInstall, USB\VID_1FC9&PID_4001&MI_00, USB\VID_1FC9&PID_4003&MI_00, USB\VID_1FC9&PID_4005&MI_00, USB\VID_1FC9&PID_4007&MI_00, USB\VID_1FC9&PID_4009&MI_00, USB\VID_1FC9&PID_400b&MI_00, USB\VID_1FC9&PID_400d&MI_00, USB\VID_1FC9&PID_400f&MI_00, USB\VID_1FC9&PID_4011&MI_00, USB\VID_1FC9&PID_4013&MI_00, USB\VID_1FC9&PID_4015&MI_00, USB\VID_1FC9&PID_4017&MI_00, USB\VID_1FC9&PID_4019&MI_00, USB\VID_1FC9&PID_401b&MI_00, USB\VID_1FC9&PID_401d&MI_00, USB\VID_1FC9&PID_401f&MI_00, USB\VID_1FC9&PID_4021&MI_00, USB\VID_1FC9&PID_4023&MI_00, USB\VID_1FC9&PID_4025&MI_00, USB\VID_1FC9&PID_4027&MI_00, USB\VID_1FC9&PID_4029&MI_00, USB\VID_1FC9&PID_402b&MI_00, USB\VID_1FC9&PID_402d&MI_00, USB\VID_1FC9&PID_402f&MI_00, USB\VID_1FC9&PID_4031&MI_00, USB\VID_1FC9&PID_4033&MI_00, USB\VID_1FC9&PID_4035&MI_00, USB\VID_1FC9&PID_4037&MI_00, USB\VID_1FC9&PID_4039&MI_00, USB\VID_1FC9&PID_403b&MI_00, USB\VID_1FC9&PID_403d&MI_00, USB\VID_1FC9&PID_403f&MI_00 +%DESCRIPTION%=DriverInstall, USB\VID_CAFE&PID_4001&MI_00, USB\VID_CAFE&PID_4003&MI_00, USB\VID_CAFE&PID_4005&MI_00, USB\VID_CAFE&PID_4007&MI_00, USB\VID_CAFE&PID_4009&MI_00, USB\VID_CAFE&PID_400b&MI_00, USB\VID_CAFE&PID_400d&MI_00, USB\VID_CAFE&PID_400f&MI_00, USB\VID_CAFE&PID_4011&MI_00, USB\VID_CAFE&PID_4013&MI_00, USB\VID_CAFE&PID_4015&MI_00, USB\VID_CAFE&PID_4017&MI_00, USB\VID_CAFE&PID_4019&MI_00, USB\VID_CAFE&PID_401b&MI_00, USB\VID_CAFE&PID_401d&MI_00, USB\VID_CAFE&PID_401f&MI_00, USB\VID_CAFE&PID_4021&MI_00, USB\VID_CAFE&PID_4023&MI_00, USB\VID_CAFE&PID_4025&MI_00, USB\VID_CAFE&PID_4027&MI_00, USB\VID_CAFE&PID_4029&MI_00, USB\VID_CAFE&PID_402b&MI_00, USB\VID_CAFE&PID_402d&MI_00, USB\VID_CAFE&PID_402f&MI_00, USB\VID_CAFE&PID_4031&MI_00, USB\VID_CAFE&PID_4033&MI_00, USB\VID_CAFE&PID_4035&MI_00, USB\VID_CAFE&PID_4037&MI_00, USB\VID_CAFE&PID_4039&MI_00, USB\VID_CAFE&PID_403b&MI_00, USB\VID_CAFE&PID_403d&MI_00, USB\VID_CAFE&PID_403f&MI_00 [DeviceList.NTamd64] -%DESCRIPTION%=DriverInstall, USB\VID_1FC9&PID_4001&MI_00, USB\VID_1FC9&PID_4003&MI_00, USB\VID_1FC9&PID_4005&MI_00, USB\VID_1FC9&PID_4007&MI_00, USB\VID_1FC9&PID_4009&MI_00, USB\VID_1FC9&PID_400b&MI_00, USB\VID_1FC9&PID_400d&MI_00, USB\VID_1FC9&PID_400f&MI_00, USB\VID_1FC9&PID_4011&MI_00, USB\VID_1FC9&PID_4013&MI_00, USB\VID_1FC9&PID_4015&MI_00, USB\VID_1FC9&PID_4017&MI_00, USB\VID_1FC9&PID_4019&MI_00, USB\VID_1FC9&PID_401b&MI_00, USB\VID_1FC9&PID_401d&MI_00, USB\VID_1FC9&PID_401f&MI_00, USB\VID_1FC9&PID_4021&MI_00, USB\VID_1FC9&PID_4023&MI_00, USB\VID_1FC9&PID_4025&MI_00, USB\VID_1FC9&PID_4027&MI_00, USB\VID_1FC9&PID_4029&MI_00, USB\VID_1FC9&PID_402b&MI_00, USB\VID_1FC9&PID_402d&MI_00, USB\VID_1FC9&PID_402f&MI_00, USB\VID_1FC9&PID_4031&MI_00, USB\VID_1FC9&PID_4033&MI_00, USB\VID_1FC9&PID_4035&MI_00, USB\VID_1FC9&PID_4037&MI_00, USB\VID_1FC9&PID_4039&MI_00, USB\VID_1FC9&PID_403b&MI_00, USB\VID_1FC9&PID_403d&MI_00, USB\VID_1FC9&PID_403f&MI_00 +%DESCRIPTION%=DriverInstall, USB\VID_CAFE&PID_4001&MI_00, USB\VID_CAFE&PID_4003&MI_00, USB\VID_CAFE&PID_4005&MI_00, USB\VID_CAFE&PID_4007&MI_00, USB\VID_CAFE&PID_4009&MI_00, USB\VID_CAFE&PID_400b&MI_00, USB\VID_CAFE&PID_400d&MI_00, USB\VID_CAFE&PID_400f&MI_00, USB\VID_CAFE&PID_4011&MI_00, USB\VID_CAFE&PID_4013&MI_00, USB\VID_CAFE&PID_4015&MI_00, USB\VID_CAFE&PID_4017&MI_00, USB\VID_CAFE&PID_4019&MI_00, USB\VID_CAFE&PID_401b&MI_00, USB\VID_CAFE&PID_401d&MI_00, USB\VID_CAFE&PID_401f&MI_00, USB\VID_CAFE&PID_4021&MI_00, USB\VID_CAFE&PID_4023&MI_00, USB\VID_CAFE&PID_4025&MI_00, USB\VID_CAFE&PID_4027&MI_00, USB\VID_CAFE&PID_4029&MI_00, USB\VID_CAFE&PID_402b&MI_00, USB\VID_CAFE&PID_402d&MI_00, USB\VID_CAFE&PID_402f&MI_00, USB\VID_CAFE&PID_4031&MI_00, USB\VID_CAFE&PID_4033&MI_00, USB\VID_CAFE&PID_4035&MI_00, USB\VID_CAFE&PID_4037&MI_00, USB\VID_CAFE&PID_4039&MI_00, USB\VID_CAFE&PID_403b&MI_00, USB\VID_CAFE&PID_403d&MI_00, USB\VID_CAFE&PID_403f&MI_00 ;------------------------------------------------------------------------------ ; String Definitions diff --git a/demos/device/src/cdcd_app.c b/demos/device/src/cdcd_app.c index b35883da..e29590a2 100644 --- a/demos/device/src/cdcd_app.c +++ b/demos/device/src/cdcd_app.c @@ -104,8 +104,7 @@ void tusbd_cdc_xfer_cb(uint8_t coreid, tusb_event_t event, cdc_pipeid_t pipe_id, case TUSB_EVENT_XFER_STALLED: default : - ASSERT(false, VOID_RETURN); - break; + break; } break; @@ -123,6 +122,7 @@ OSAL_TASK_FUNCTION( cdcd_serial_app_task , p_task_para) tusb_error_t error; osal_semaphore_wait(sem_hdl, OSAL_TIMEOUT_WAIT_FOREVER, &error); + (void) error; // suppress compiler's warnings if ( tusbd_is_configured(0) ) { diff --git a/demos/device/src/main.c b/demos/device/src/main.c index dc80ed5e..4423262a 100644 --- a/demos/device/src/main.c +++ b/demos/device/src/main.c @@ -58,9 +58,6 @@ //--------------------------------------------------------------------+ // INTERNAL OBJECT & FUNCTION DECLARATION //--------------------------------------------------------------------+ -OSAL_TASK_FUNCTION( led_blinking_task , p_task_para); -OSAL_TASK_DEF(led_blinking_task, 128, LED_BLINKING_APP_TASK_PRIO); - void print_greeting(void); #if TUSB_CFG_OS == TUSB_OS_NONE @@ -87,7 +84,7 @@ int main(void) tusb_init(); //------------- application task init -------------// - (void) osal_task_create( OSAL_TASK_REF(led_blinking_task) ); + led_blinking_init(); msc_dev_app_init(); keyboardd_app_init(); @@ -111,36 +108,7 @@ int main(void) return 0; } -//--------------------------------------------------------------------+ -// BLINKING TASK -//--------------------------------------------------------------------+ -static uint32_t led_blink_interval_ms = 1000; // default is 1 seconda -void led_blinking_set_interval(uint32_t ms) -{ - led_blink_interval_ms = ms; -} -OSAL_TASK_FUNCTION( led_blinking_task , p_task_para) -{ - OSAL_TASK_LOOP_BEGIN - - static uint32_t led_on_mask = 0; - - osal_task_delay(led_blink_interval_ms); - - board_leds(led_on_mask, 1 - led_on_mask); - led_on_mask = 1 - led_on_mask; // toggle - - uint32_t btn_mask; - btn_mask = board_buttons(); - - for(uint8_t i=0; i<32; i++) - { - if ( BIT_TEST_(btn_mask, i) ) printf("button %d is pressed\n", i); - } - - OSAL_TASK_LOOP_END -} //--------------------------------------------------------------------+ // HELPER FUNCTION diff --git a/demos/device/src/tusb_config.h b/demos/device/src/tusb_config.h index a425a729..295e3d69 100644 --- a/demos/device/src/tusb_config.h +++ b/demos/device/src/tusb_config.h @@ -53,7 +53,7 @@ //--------------------------------------------------------------------+ // DEVICE CONFIGURATION //--------------------------------------------------------------------+ -#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64 // TODO refractor remove +#define TUSB_CFG_DEVICE_CONTROL_ENDOINT_SIZE 64 #define TUSB_CFG_DEVICE_STRING_DESCRIPTOR_COUNT 4 #define TUSB_CFG_DEVICE_FULLSPEED 1 // TODO refractor, remove @@ -62,7 +62,7 @@ #define TUSB_CFG_DEVICE_HID_KEYBOARD 1 #define TUSB_CFG_DEVICE_HID_MOUSE 1 #define TUSB_CFG_DEVICE_HID_GENERIC 0 // not supported yet -#define TUSB_CFG_DEVICE_MSC 1 +#define TUSB_CFG_DEVICE_MSC 0 #define TUSB_CFG_DEVICE_CDC 1 //--------------------------------------------------------------------+ diff --git a/demos/device/src/tusb_descriptors.h b/demos/device/src/tusb_descriptors.h index 31b98de0..ad472ac6 100644 --- a/demos/device/src/tusb_descriptors.h +++ b/demos/device/src/tusb_descriptors.h @@ -44,7 +44,7 @@ //--------------------------------------------------------------------+ // Descriptors Value (calculated by enabled Classes) //--------------------------------------------------------------------+ -#define CFG_VENDORID 0x1FC9 // NXP +#define CFG_VENDORID 0xCAFE //#define CFG_PRODUCTID 0x4567 // use auto product id to prevent conflict with pc's driver // each combination of interfaces need to have a unique productid, as windows will bind & remember device driver after the first plug. diff --git a/tinyusb/class/cdc_device.c b/tinyusb/class/cdc_device.c index 247c7218..332e33ea 100644 --- a/tinyusb/class/cdc_device.c +++ b/tinyusb/class/cdc_device.c @@ -190,12 +190,12 @@ tusb_error_t cdcd_control_request_subtask(uint8_t coreid, tusb_control_request_t switch(p_request->bRequest) { case CDC_REQUEST_GET_LINE_CODING: - dcd_pipe_control_xfer(coreid, p_request->bmRequestType_bit.direction, + dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) &cdcd_line_coding[coreid], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false ); break; case CDC_REQUEST_SET_LINE_CODING: - dcd_pipe_control_xfer(coreid, p_request->bmRequestType_bit.direction, + dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, (uint8_t*) &cdcd_line_coding[coreid], min16_of(sizeof(cdc_line_coding_t), p_request->wLength), false ); // TODO notify application on xfer completea break; diff --git a/tinyusb/class/hid_device.c b/tinyusb/class/hid_device.c index 3a8f3127..1adf035b 100644 --- a/tinyusb/class/hid_device.c +++ b/tinyusb/class/hid_device.c @@ -222,7 +222,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t &p_buffer, p_request->wLength); SUBTASK_ASSERT( p_buffer != NULL && actual_length > 0 ); - dcd_pipe_control_xfer(coreid, p_request->bmRequestType_bit.direction, p_buffer, actual_length, false); + dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, p_buffer, actual_length, false); } else if ( (HID_REQUEST_CONTROL_SET_REPORT == p_request->bRequest) && (p_driver->set_report_cb != NULL) ) { @@ -230,7 +230,7 @@ tusb_error_t hidd_control_request_subtask(uint8_t coreid, tusb_control_request_t // wValue = Report Type | Report ID tusb_error_t error; - dcd_pipe_control_xfer(coreid, p_request->bmRequestType_bit.direction, m_control_data, p_request->wLength, true); + dcd_pipe_control_xfer(coreid, (tusb_direction_t) p_request->bmRequestType_bit.direction, m_control_data, p_request->wLength, true); osal_semaphore_wait(usbd_control_xfer_sem_hdl, OSAL_TIMEOUT_NORMAL, &error); // wait for control xfer complete SUBTASK_ASSERT_STATUS(error); diff --git a/tinyusb/device/dcd_lpc_11uxx_13uxx.c b/tinyusb/device/dcd_lpc_11uxx_13uxx.c index 51719af6..8ff68281 100644 --- a/tinyusb/device/dcd_lpc_11uxx_13uxx.c +++ b/tinyusb/device/dcd_lpc_11uxx_13uxx.c @@ -66,11 +66,19 @@ enum { DCD_11U_13U_MAX_BYTE_PER_TD = (TUSB_CFG_MCU == MCU_LPC11UXX ? 64 : 1023) }; +#ifdef __CC_ARM +#pragma diag_suppress 66 // Suppress Keil warnings #66-D: enumeration value is out of "int" range +#endif + enum { INT_MASK_SOF = BIT_(30), INT_MASK_DEVICE_STATUS = BIT_(31) }; +#ifdef __CC_ARM +#pragma diag_suppress 66 // Suppress Keil warnings #66-D: enumeration value is out of "int" range +#endif + enum { CMDSTAT_DEVICE_ADDR_MASK = BIT_(7 )-1, CMDSTAT_DEVICE_ENABLE_MASK = BIT_(7 ), @@ -399,11 +407,13 @@ static inline uint8_t edpt_addr2phy(uint8_t endpoint_addr) return 2*(endpoint_addr & 0x0F) + ((endpoint_addr & TUSB_DIR_DEV_TO_HOST_MASK) ? 1 : 0); } +#if 0 static inline uint8_t edpt_phy2log(uint8_t physical_endpoint) ATTR_CONST ATTR_ALWAYS_INLINE; static inline uint8_t edpt_phy2log(uint8_t physical_endpoint) { return physical_endpoint/2; } +#endif //--------------------------------------------------------------------+ // BULK/INTERRUPT/ISOCHRONOUS PIPE API