fix build for lpcxpreso host

This commit is contained in:
hathach 2014-03-24 16:07:17 +07:00
parent bfd6c8bc1e
commit 6c9d03905e
18 changed files with 106 additions and 107 deletions

View File

@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_CDCD_APP_H_
#define _TUSB_CDCD_APP_H_
#ifndef _TUSB_CDCD_DEVICE_APP_H_
#define _TUSB_CDCD_DEVICE_APP_H_
#include "board.h"
#include "tusb.h"
@ -70,6 +70,6 @@ OSAL_TASK_FUNCTION( cdcd_serial_app_task , p_task_para);
}
#endif
#endif /* _TUSB_CDCD_APP_H_ */
#endif /* _TUSB_CDCD_DEVICE_APP_H_ */
/** @} */

View File

@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_KEYBOARDD_APP_H_
#define _TUSB_KEYBOARDD_APP_H_
#ifndef _TUSB_KEYBOARDD_DEVICE_APP_H_
#define _TUSB_KEYBOARDD_DEVICE_APP_H_
#include "board.h"
#include "tusb.h"
@ -69,6 +69,6 @@ OSAL_TASK_FUNCTION( keyboard_device_app_task , p_task_para);
}
#endif
#endif /* _TUSB_KEYBOARDD_APP_H_ */
#endif /* _TUSB_KEYBOARDD_DEVICE_APP_H_ */
/** @} */

View File

@ -79,6 +79,10 @@ void os_none_start_scheduler(void)
int main(void)
{
#if TUSB_CFG_OS == TUSB_OS_CMSIS_RTX
osKernelInitialize(); // CMSIS RTX requires kernel init before any other OS functions
#endif
board_init();
print_greeting();
@ -98,10 +102,7 @@ int main(void)
#elif TUSB_CFG_OS == TUSB_OS_NONE
os_none_start_scheduler();
#elif TUSB_CFG_OS == TUSB_OS_CMSIS_RTX
while(1)
{
osDelay(osWaitForever); // CMSIS RTX osKernelStart already started, main() is a task
}
osKernelStart();
#else
#error need to start RTOS schduler
#endif
@ -109,8 +110,6 @@ int main(void)
return 0;
}
//--------------------------------------------------------------------+
// HELPER FUNCTION
//--------------------------------------------------------------------+

View File

@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_MOUSED_APP_H_
#define _TUSB_MOUSED_APP_H_
#ifndef _TUSB_MOUSED_DEVICE_APP_H_
#define _TUSB_MOUSED_DEVICE_APP_H_
#include "board.h"
#include "tusb.h"
@ -69,6 +69,6 @@ OSAL_TASK_FUNCTION( mouse_device_app_task , p_task_para);
}
#endif
#endif /* _TUSB_MOUSED_APP_H_ */
#endif /* _TUSB_MOUSED_DEVICE_APP_H_ */
/** @} */

View File

@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_MSCD_APP_H_
#define _TUSB_MSCD_APP_H_
#ifndef _TUSB_MSCD_DEVICE_APP_H_
#define _TUSB_MSCD_DEVICE_APP_H_
#include "board.h"
#include "tusb.h"
@ -88,6 +88,6 @@ extern scsi_sense_fixed_data_t mscd_sense_data;
}
#endif
#endif /* _TUSB_MSCD_APP_H_ */
#endif /* _TUSB_MSCD_DEVICE_APP_H_ */
/** @} */

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file cdc_serial_app.c
@file cdc_serial_host_app.c
@author hathach (tinyusb.org)
@section LICENSE
@ -36,7 +36,7 @@
*/
/**************************************************************************/
#include "cdc_serial_app.h"
#include "cdc_serial_host_app.h"
#include "app_os_prio.h"
#if TUSB_CFG_HOST_CDC
@ -46,7 +46,7 @@
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
OSAL_TASK_DEF(cdc_serial_app_task, 128, CDC_SERIAL_APP_TASK_PRIO);
OSAL_TASK_DEF(cdc_serial_host_app_task, 128, CDC_SERIAL_APP_TASK_PRIO);
OSAL_SEM_DEF(serial_semaphore);
static osal_semaphore_handle_t sem_hdl;
@ -110,16 +110,16 @@ void tusbh_cdc_xfer_isr(uint8_t dev_addr, tusb_event_t event, cdc_pipeid_t pipe_
//--------------------------------------------------------------------+
// APPLICATION
//--------------------------------------------------------------------+
void cdc_serial_app_init(void)
void cdc_serial_host_app_init(void)
{
sem_hdl = osal_semaphore_create( OSAL_SEM_REF(serial_semaphore) );
ASSERT_PTR( sem_hdl, VOID_RETURN);
ASSERT( TUSB_ERROR_NONE == osal_task_create(OSAL_TASK_REF(cdc_serial_app_task)), VOID_RETURN);
ASSERT( TUSB_ERROR_NONE == osal_task_create(OSAL_TASK_REF(cdc_serial_host_app_task)), VOID_RETURN);
}
//------------- main task -------------//
OSAL_TASK_FUNCTION( cdc_serial_app_task, p_task_para)
OSAL_TASK_FUNCTION( cdc_serial_host_app_task, p_task_para)
{
(void) p_task_para;

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file cdc_serial_app.h
@file cdc_serial_host_app.h
@author hathach (tinyusb.org)
@section LICENSE
@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_CDC_SERIAL_APP_H_
#define _TUSB_CDC_SERIAL_APP_H_
#ifndef _TUSB_CDC_SERIAL_HOST_APP_H_
#define _TUSB_CDC_SERIAL_HOST_APP_H_
#include "board.h"
#include "tusb.h"
@ -55,13 +55,13 @@
#if TUSB_CFG_HOST_CDC
void cdc_serial_app_init(void);
OSAL_TASK_FUNCTION( cdc_serial_app_task, p_task_para);
void cdc_serial_host_app_init(void);
OSAL_TASK_FUNCTION( cdc_serial_host_app_task, p_task_para);
#else
#define cdc_serial_app_init()
#define cdc_serial_app_task(x)
#define cdc_serial_host_app_init()
#define cdc_serial_host_app_task(x)
#endif
@ -69,6 +69,6 @@ OSAL_TASK_FUNCTION( cdc_serial_app_task, p_task_para);
}
#endif
#endif /* _TUSB_CDC_SERIAL_APP_H_ */
#endif /* _TUSB_CDC_SERIAL_HOST_APP_H_ */
/** @} */

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file keyboard_app.c
@file keyboard_host_app.c
@author hathach (tinyusb.org)
@section LICENSE
@ -39,7 +39,7 @@
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
#include "keyboard_app.h"
#include "keyboard_host_app.h"
#include "app_os_prio.h"
#if TUSB_CFG_HOST_HID_KEYBOARD
@ -52,7 +52,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
OSAL_TASK_DEF(keyboard_app_task, 128, KEYBOARD_APP_TASK_PRIO);
OSAL_TASK_DEF(keyboard_host_app_task, 128, KEYBOARD_APP_TASK_PRIO);
OSAL_QUEUE_DEF(queue_kbd_def, QUEUE_KEYBOARD_REPORT_DEPTH, hid_keyboard_report_t);
static osal_queue_handle_t queue_kbd_hdl;
@ -100,19 +100,19 @@ void tusbh_hid_keyboard_isr(uint8_t dev_addr, tusb_event_t event)
//--------------------------------------------------------------------+
// APPLICATION
//--------------------------------------------------------------------+
void keyboard_app_init(void)
void keyboard_host_app_init(void)
{
memclr_(&usb_keyboard_report, sizeof(hid_keyboard_report_t));
queue_kbd_hdl = osal_queue_create( OSAL_QUEUE_REF(queue_kbd_def) );
ASSERT_PTR( queue_kbd_hdl, VOID_RETURN );
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(keyboard_app_task) ) ,
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(keyboard_host_app_task) ) ,
VOID_RETURN);
}
//------------- main task -------------//
OSAL_TASK_FUNCTION( keyboard_app_task, p_task_para)
OSAL_TASK_FUNCTION( keyboard_host_app_task, p_task_para)
{
(void) p_task_para;

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file keyboard_app.h
@file keyboard_host_app.h
@author hathach (tinyusb.org)
@section LICENSE
@ -49,8 +49,8 @@
* @{
*/
#ifndef _TUSB_KEYBOARD_APP_H_
#define _TUSB_KEYBOARD_APP_H_
#ifndef _TUSB_KEYBOARD_HOST_APP_H_
#define _TUSB_KEYBOARD_HOST_APP_H_
#include "board.h"
#include "tusb.h"
@ -61,13 +61,13 @@
#if TUSB_CFG_HOST_HID_KEYBOARD
void keyboard_app_init(void);
OSAL_TASK_FUNCTION( keyboard_app_task, p_task_para);
void keyboard_host_app_init(void);
OSAL_TASK_FUNCTION( keyboard_host_app_task, p_task_para);
#else
#define keyboard_app_init()
#define keyboard_app_task(x)
#define keyboard_host_app_init()
#define keyboard_host_app_task(x)
#endif
@ -75,6 +75,6 @@ OSAL_TASK_FUNCTION( keyboard_app_task, p_task_para);
}
#endif
#endif /* _TUSB_KEYBOARD_APP_H_ */
#endif /* _TUSB_KEYBOARD_HOST_APP_H_ */
/** @} */

View File

@ -47,11 +47,11 @@
#include "tusb.h"
#include "app_os_prio.h"
#include "mouse_app.h"
#include "keyboard_app.h"
#include "msc_app.h"
#include "cdc_serial_app.h"
#include "rndis_app.h"
#include "mouse_host_app.h"
#include "keyboard_host_app.h"
#include "msc_host_app.h"
#include "cdc_serial_host_app.h"
#include "rndis_host_app.h"
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
@ -75,11 +75,11 @@ void os_none_start_scheduler(void)
tusb_task_runner();
led_blinking_task(NULL);
keyboard_app_task(NULL);
mouse_app_task(NULL);
msc_app_task(NULL);
cdc_serial_app_task(NULL);
rndis_app_task(NULL);
keyboard_host_app_task(NULL);
mouse_host_app_task(NULL);
msc_host_app_task(NULL);
cdc_serial_host_app_task(NULL);
rndis_host_app_task(NULL);
}
}
#endif
@ -98,11 +98,11 @@ int main(void)
//------------- application task init -------------//
led_blinking_init();
keyboard_app_init();
mouse_app_init();
msc_app_init();
cdc_serial_app_init();
rndis_app_init();
keyboard_host_app_init();
mouse_host_app_init();
msc_host_app_init();
cdc_serial_host_app_init();
rndis_host_app_init();
//------------- start OS scheduler (never return) -------------//
#if TUSB_CFG_OS == TUSB_OS_FREERTOS

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file mouse_app.c
@file mouse_host_app.c
@author hathach (tinyusb.org)
@section LICENSE
@ -39,7 +39,7 @@
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
#include "mouse_app.h"
#include "mouse_host_app.h"
#include "app_os_prio.h"
#if TUSB_CFG_HOST_HID_MOUSE
@ -52,7 +52,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
OSAL_TASK_DEF(mouse_app_task, 128, MOUSE_APP_TASK_PRIO);
OSAL_TASK_DEF(mouse_host_app_task, 128, MOUSE_APP_TASK_PRIO);
OSAL_QUEUE_DEF(queue_mouse_def, QUEUE_MOUSE_REPORT_DEPTH, hid_mouse_report_t);
static osal_queue_handle_t queue_mouse_hdl;
@ -101,19 +101,19 @@ void tusbh_hid_mouse_isr(uint8_t dev_addr, tusb_event_t event)
// NOTICE: MOUSE REPORT IS NOT CORRECT UNTIL A DECENT HID PARSER IS
// IMPLEMENTED, MEANWHILE IT CAN MISS DISPLAY BUTTONS OR X,Y etc
//--------------------------------------------------------------------+
void mouse_app_init(void)
void mouse_host_app_init(void)
{
memclr_(&usb_mouse_report, sizeof(hid_mouse_report_t));
queue_mouse_hdl = osal_queue_create( OSAL_QUEUE_REF(queue_mouse_def) );
ASSERT_PTR( queue_mouse_hdl, VOID_RETURN);
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(mouse_app_task) ),
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(mouse_host_app_task) ),
VOID_RETURN );
}
//------------- main task -------------//
OSAL_TASK_FUNCTION( mouse_app_task, p_task_para)
OSAL_TASK_FUNCTION( mouse_host_app_task, p_task_para)
{
(void) p_task_para;

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file mouse_app.h
@file mouse_host_app.h
@author hathach (tinyusb.org)
@section LICENSE
@ -49,8 +49,8 @@
* @{
*/
#ifndef _TUSB_MOUSE_APP_H_
#define _TUSB_MOUSE_APP_H_
#ifndef _TUSB_MOUSE_HOST_APP_H_
#define _TUSB_MOUSE_HOST_APP_H_
#include <stdint.h>
#include <stdbool.h>
@ -64,13 +64,13 @@
#if TUSB_CFG_HOST_HID_MOUSE
void mouse_app_init(void);
OSAL_TASK_FUNCTION( mouse_app_task, p_task_para);
void mouse_host_app_init(void);
OSAL_TASK_FUNCTION( mouse_host_app_task, p_task_para);
#else
#define mouse_app_init()
#define mouse_app_task(x)
#define mouse_host_app_init()
#define mouse_host_app_task(x)
#endif
@ -78,6 +78,6 @@ OSAL_TASK_FUNCTION( mouse_app_task, p_task_para);
}
#endif
#endif /* _TUSB_MOUSE_APP_H_ */
#endif /* _TUSB_MOUSE_HOST_APP_H_ */
/** @} */

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file cli.c
@file msc_cli.c
@author hathach (tinyusb.org)
@section LICENSE
@ -34,7 +34,7 @@
*/
/**************************************************************************/
#include "cli.h"
#include "msc_cli.h"
#include "ctype.h"
#if TUSB_CFG_HOST_MSC

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file cli.h
@file msc_cli.h
@author hathach (tinyusb.org)
@section LICENSE
@ -33,8 +33,8 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**************************************************************************/
#ifndef _TUSB_CLI_H_
#define _TUSB_CLI_H_
#ifndef _TUSB_MSC_CLI_H_
#define _TUSB_MSC_CLI_H_
#include "board.h"
#include "tusb.h"

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file msc_app.c
@file msc_host_app.c
@author hathach (tinyusb.org)
@section LICENSE
@ -39,12 +39,12 @@
//--------------------------------------------------------------------+
// INCLUDE
//--------------------------------------------------------------------+
#include "msc_app.h"
#include "msc_host_app.h"
#include "app_os_prio.h"
#if TUSB_CFG_HOST_MSC
#include "cli.h"
#include "msc_cli.h"
#include "ff.h"
#include "diskio.h"
@ -55,7 +55,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
OSAL_TASK_DEF(msc_app_task, 512, MSC_APP_TASK_PRIO);
OSAL_TASK_DEF(msc_host_app_task, 512, MSC_APP_TASK_PRIO);
TUSB_CFG_ATTR_USBRAM static FATFS fatfs[TUSB_CFG_HOST_DEVICE_MAX];
@ -140,14 +140,14 @@ void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes)
//--------------------------------------------------------------------+
// IMPLEMENTATION
//--------------------------------------------------------------------+
void msc_app_init(void)
void msc_host_app_init(void)
{
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(msc_app_task) ), VOID_RETURN );
ASSERT( TUSB_ERROR_NONE == osal_task_create( OSAL_TASK_REF(msc_host_app_task) ), VOID_RETURN );
diskio_init();
}
//------------- main task -------------//
OSAL_TASK_FUNCTION( msc_app_task, p_task_para)
OSAL_TASK_FUNCTION( msc_host_app_task, p_task_para)
{
(void) p_task_para;

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file msc_app.h
@file msc_host_app.h
@author hathach (tinyusb.org)
@section LICENSE
@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_MSC_APP_H_
#define _TUSB_MSC_APP_H_
#ifndef _TUSB_MSC_HOST_APP_H_
#define _TUSB_MSC_HOST_APP_H_
#include "board.h"
#include "tusb.h"
@ -56,13 +56,13 @@
#if TUSB_CFG_HOST_MSC
void msc_app_init(void);
OSAL_TASK_FUNCTION( msc_app_task, p_task_para);
void msc_host_app_init(void);
OSAL_TASK_FUNCTION( msc_host_app_task, p_task_para);
#else
#define msc_app_init()
#define msc_app_task(x)
#define msc_host_app_init()
#define msc_host_app_task(x)
#endif
@ -70,6 +70,6 @@ OSAL_TASK_FUNCTION( msc_app_task, p_task_para);
}
#endif
#endif /* _TUSB_MSC_APP_H_ */
#endif /* _TUSB_MSC_HOST_APP_H_ */
/** @} */

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file rndis_app.c
@file rndis_host_app.c
@author hathach (tinyusb.org)
@section LICENSE
@ -36,7 +36,7 @@
*/
/**************************************************************************/
#include "rndis_app.h"
#include "rndis_host_app.h"
#include "app_os_prio.h"
#if TUSB_CFG_HOST_CDC && TUSB_CFG_HOST_CDC_RNDIS
@ -62,12 +62,12 @@ void tusbh_cdc_rndis_unmounted_cb(uint8_t dev_addr)
printf("\nan RNDIS device is unmounted\n");
}
void rndis_app_init(void)
void rndis_host_app_init(void)
{
}
OSAL_TASK_FUNCTION( rndis_app_task ) (void* p_task_para)
OSAL_TASK_FUNCTION( rndis_host_app_task, p_task_para)
{
OSAL_TASK_LOOP_BEGIN
OSAL_TASK_LOOP_END

View File

@ -1,6 +1,6 @@
/**************************************************************************/
/*!
@file rndis_app.h
@file rndis_host_app.h
@author hathach (tinyusb.org)
@section LICENSE
@ -43,8 +43,8 @@
* @{
*/
#ifndef _TUSB_RNDIS_APP_H_
#define _TUSB_RNDIS_APP_H_
#ifndef _TUSB_RNDIS_HOST_APP_H_
#define _TUSB_RNDIS_HOST_APP_H_
#include "board.h"
#include "tusb.h"
@ -55,13 +55,13 @@
#if TUSB_CFG_HOST_CDC && TUSB_CFG_HOST_CDC_RNDIS
void rndis_app_init(void);
OSAL_TASK_FUNCTION( rndis_app_task ) (void* p_task_para);
void rndis_host_app_init(void);
OSAL_TASK_FUNCTION( rndis_host_app_task, p_task_para);
#else
#define rndis_app_init()
#define rndis_app_task(x)
#define rndis_host_app_init()
#define rndis_host_app_task(x)
#endif
@ -70,6 +70,6 @@ OSAL_TASK_FUNCTION( rndis_app_task ) (void* p_task_para);
}
#endif
#endif /* _TUSB_RNDIS_APP_H_ */
#endif /* _TUSB_RNDIS_HOST_APP_H_ */
/** @} */