summaryrefslogtreecommitdiff
path: root/tinyusb
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-04-25 11:00:56 +0700
committerhathach <[email protected]>2013-04-25 11:00:56 +0700
commite9dbce5f1bfe193884293e7fb555f963c7f2e649 (patch)
treec4d49b49edafcdb42cb67c24ed7aa7c51d393f34 /tinyusb
parentd4a2600ecc8cdeec26485f8ab564b12de41d6b9b (diff)
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
Diffstat (limited to 'tinyusb')
-rw-r--r--tinyusb/common/errors.c3
-rw-r--r--tinyusb/common/errors.h3
-rw-r--r--tinyusb/hal/hal.h1
-rw-r--r--tinyusb/host/usbh.c2
-rw-r--r--tinyusb/osal/osal_common.h6
-rw-r--r--tinyusb/osal/osal_freeRTOS.h7
-rw-r--r--tinyusb/tusb_option.h4
7 files changed, 12 insertions, 14 deletions
diff --git a/tinyusb/common/errors.c b/tinyusb/common/errors.c
index 2de115697..6c53bd007 100644
--- a/tinyusb/common/errors.c
+++ b/tinyusb/common/errors.c
@@ -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
diff --git a/tinyusb/common/errors.h b/tinyusb/common/errors.h
index 0392865e1..cf10a63fa 100644
--- a/tinyusb/common/errors.h
+++ b/tinyusb/common/errors.h
@@ -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
diff --git a/tinyusb/hal/hal.h b/tinyusb/hal/hal.h
index a79ea4a16..4916aea08 100644
--- a/tinyusb/hal/hal.h
+++ b/tinyusb/hal/hal.h
@@ -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"
diff --git a/tinyusb/host/usbh.c b/tinyusb/host/usbh.c
index 55f3eb771..54f9e7dce 100644
--- a/tinyusb/host/usbh.c
+++ b/tinyusb/host/usbh.c
@@ -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;
diff --git a/tinyusb/osal/osal_common.h b/tinyusb/osal/osal_common.h
index eda859145..6a9965fea 100644
--- a/tinyusb/osal/osal_common.h
+++ b/tinyusb/osal/osal_common.h
@@ -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)
{
diff --git a/tinyusb/osal/osal_freeRTOS.h b/tinyusb/osal/osal_freeRTOS.h
index d92cb374c..cd92812cb 100644
--- a/tinyusb/osal/osal_freeRTOS.h
+++ b/tinyusb/osal/osal_freeRTOS.h
@@ -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
diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h
index 4d20b3049..7773351d2 100644
--- a/tinyusb/tusb_option.h
+++ b/tinyusb/tusb_option.h
@@ -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