Updating KEIL port

This commit is contained in:
Joel Bodenmann 2015-10-19 22:07:34 +02:00
parent d4d9a1be98
commit 73b39a7d36
2 changed files with 11 additions and 8 deletions

View File

@ -68,15 +68,16 @@ void gfxSemSignalI(gfxSem* psem)
}
gfxThreadHandle gfxThreadCreate(void* stackarea, size_t stacksz, threadpriority_t prio, DECLARE_THREAD_FUNCTION((*fn),p), void* param)
{
{
osThreadDef_t def;
def.pthread = fn;
(void)stackarea;
def.pthread = (os_pthread)fn;
def.tpriority = prio;
def.instances = 1;
def.stacksize = stacksz;
(void)stackarea;
return osThreadCreate(&def, param);
}

View File

@ -15,6 +15,7 @@
#if GFX_USE_OS_KEIL
#include <stdbool.h>
#include "cmsis_os.h"
#ifndef GFX_OS_HEAP_SIZE
@ -25,7 +26,7 @@
/* Type definitions */
/*===========================================================================*/
typedef uint8_t bool_t;
typedef bool bool_t;
#define TIME_IMMEDIATE 0
#define TIME_INFINITE osWaitForever
@ -52,8 +53,9 @@ typedef struct gfxMutex {
typedef osThreadId gfxThreadHandle;
#define DECLARE_THREAD_STACK(name, sz)
#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void* params)
#define DECLARE_THREAD_STACK(name, sz) uint8_t name[1]; // Some compilers don't allow zero sized arrays. Let's waste one byte
#define DECLARE_THREAD_FUNCTION(fnName, param) threadreturn_t fnName(void* param)
#define THREAD_RETURN(retval)
/*===========================================================================*/
/* Function declarations. */
@ -66,7 +68,7 @@ extern "C" {
#define gfxExit() os_error(0)
#define gfxHalt(msg) os_error(1)
#define gfxSystemTicks() osKernelSysTick()
#define gfxMillisecondsToTicks(ms) osKernelSysTickMicroSec(1000*(ms))
#define gfxMillisecondsToTicks(ms) osKernelSysTickMicroSec(1000*ms)
#define gfxSystemLock() osKernelInitialize()
#define gfxSystemUnlock() osKernelStart()
#define gfxSleepMilliseconds(ms) osDelay(ms)