add TUSB_CFG_OS_TASK_PRIO to mandatory option for using an RTOS

using plain char for error enum character
increase freeRTOS configMAX_PRIORITIES to 16
house keeping & clean up compiler warning
This commit is contained in:
hathach
2013-04-25 11:00:56 +07:00
parent d4a2600ecc
commit e9dbce5f1b
13 changed files with 34 additions and 17 deletions
+1 -2
View File
@@ -35,12 +35,11 @@
* This file is part of the tinyUSB stack.
*/
#include "primitive_types.h"
#include "errors.h"
#if TUSB_CFG_DEBUG == 3
uint8_t const* const TUSB_ErrorStr[] =
char const* const TUSB_ErrorStr[] =
{
ERROR_TABLE(ERROR_STRING)
0
+1 -2
View File
@@ -49,7 +49,6 @@
#ifndef _TUSB_ERRORS_H_
#define _TUSB_ERRORS_H_
#include "primitive_types.h"
#include "tusb_option.h"
#ifdef __cplusplus
@@ -87,7 +86,7 @@ typedef enum {
#if TUSB_CFG_DEBUG == 3
/// Enum to String for debugging purposes. Only available if \ref TUSB_CFG_DEBUG > 0
extern uint8_t const* const TUSB_ErrorStr[];
extern char const* const TUSB_ErrorStr[];
#endif
#ifdef __cplusplus
+1
View File
@@ -52,6 +52,7 @@
#define _TUSB_HAL_H_
#include "tusb_option.h"
#include "common/primitive_types.h"
#include "common/errors.h"
#include "common/compiler/compiler.h"
+1 -1
View File
@@ -89,7 +89,7 @@ static host_class_driver_t const usbh_class_drivers[TUSB_CLASS_MAX_CONSEC_NUMBER
usbh_device_info_t usbh_devices[TUSB_CFG_HOST_DEVICE_MAX+1] TUSB_CFG_ATTR_USBRAM; // including zero-address
//------------- Enumeration Task Data -------------//
OSAL_TASK_DEF(enum_task, usbh_enumeration_task, 128, OSAL_PRIO_HIGH);
OSAL_TASK_DEF(enum_task, usbh_enumeration_task, 128, TUSB_CFG_OS_TASK_PRIO);
OSAL_QUEUE_DEF(enum_queue, ENUM_QUEUE_DEPTH, uint32_t);
osal_queue_handle_t enum_queue_hdl;
STATIC_ uint8_t enum_data_buffer[TUSB_CFG_HOST_ENUM_BUFFER_SIZE] TUSB_CFG_ATTR_USBRAM;
-6
View File
@@ -64,12 +64,6 @@ enum
OSAL_TIMEOUT_WAIT_FOREVER = 0x0EEEEEEE
};
typedef enum {
OSAL_PRIO_LOW,
OSAL_PRIO_NORMAL,
OSAL_PRIO_HIGH
}osal_prio_t;
static inline uint32_t osal_tick_from_msec(uint32_t msec) ATTR_CONST ATTR_ALWAYS_INLINE;
static inline uint32_t osal_tick_from_msec(uint32_t msec)
{
+4 -3
View File
@@ -75,7 +75,7 @@ extern "C" {
void task_func
typedef struct {
signed portCHAR const * name;
char const * name;
pdTASK_CODE code;
unsigned portSHORT stack_depth;
unsigned portBASE_TYPE prio;
@@ -92,7 +92,7 @@ typedef struct {
static inline tusb_error_t osal_task_create(osal_task_t *task) ATTR_ALWAYS_INLINE;
static inline tusb_error_t osal_task_create(osal_task_t *task)
{
return pdPASS == xTaskCreate(task->code, task->name, task->stack_depth, NULL, task->prio, NULL) ?
return pdPASS == xTaskCreate(task->code, (signed portCHAR const *) task->name, task->stack_depth, NULL, task->prio, NULL) ?
TUSB_ERROR_NONE : TUSB_ERROR_OSAL_TASK_CREATE_FAILED;
}
@@ -104,7 +104,8 @@ static inline tusb_error_t osal_task_create(osal_task_t *task)
//------------- Sub Task -------------//
#define OSAL_SUBTASK_BEGIN // TODO refractor move
#define OSAL_SUBTASK_END
#define OSAL_SUBTASK_END \
return TUSB_ERROR_NONE;
#define OSAL_SUBTASK_INVOKED_AND_WAIT(subtask, status) \
status = subtask
+4
View File
@@ -114,6 +114,10 @@
#ifndef TUSB_CFG_OS_TICKS_PER_SECOND
#error TUSB_CFG_OS_TICKS_PER_SECOND is required to use with OS_NONE
#endif
#else
#ifndef TUSB_CFG_OS_TASK_PRIO
#error TUSB_CFG_OS_TASK_PRIO need to be defined (hint: use the highest if possible)
#endif
#endif
#ifndef TUSB_CFG_CONFIGURATION_MAX