My Project
support.h
Go to the documentation of this file.
00001 
00002 
00006 //----------------------------------------------------------------------------
00007 // R T L   K E R N E L   S U P P O R T
00008 //----------------------------------------------------------------------------
00009 // Name:    SYKAM/RTL/SUPPORT.H
00010 // Purpose: RTL KERNEL SUPPORT
00011 // Author:  hschoettner
00012 //----------------------------------------------------------------------------
00013 // Copyright (c) 2008-2011 Sykam GmbH. All rights reserved.
00014 //----------------------------------------------------------------------------
00015 
00016 #ifndef SYKAM_RTL_SUPPORT_H
00017 #define SYKAM_RTL_SUPPORT_H 1
00018 
00019 
00020 // Includes
00021 #include <c55x.h>
00022 #include <string.h>
00023 
00024 #include <RTL.h>
00025 
00026 // Suppress warning for "#111-D: statement is unreachable" to allow ALWAYS the macro DETACH at tasks end
00027 #pragma diag_remark 111
00028 
00029 // Suppress warning for "550-D: variable was set but never used" for debugging
00030 #ifdef DEBUG
00031 #pragma diag_remark 550
00032 #endif
00033 
00034 
00035 // Externals
00036 
00037 extern U32 const os_clockrate;
00038 extern U32 os_timernum;
00039 extern BIT irq_lock;
00040 extern BIT force_irq_enable;
00041 
00042 
00043 // Definitions
00044 
00045 
00046 // Task priorities
00047 
00049 #define OS_P_MAX           255
00050 
00052 #define OS_P_REALTIME      240
00053 
00055 #define OS_P_ABOVEHIGH     210
00056 
00058 #define OS_P_HIGH          180
00059 
00061 #define OS_P_ABOVENORMAL   150
00062 
00064 #define OS_P_NORMAL        120
00065 
00067 #define OS_P_BELOWNORMAL   90
00068 
00070 #define OS_P_LOW           60
00071 
00073 #define OS_P_BELOWLOW      30
00074 
00076 #define OS_P_IDLE          0
00077 
00078 
00079 // Booleans
00080 
00082 #ifndef TRUE
00083    #define TRUE 1
00084 #endif
00085 
00087 #ifndef FALSE
00088    #define FALSE 0
00089 #endif
00090 
00091 
00092 // SSemaphore
00093 
00095 #define SSEM_TAKE(s) os_sem_take(s.oiID, s.u16To)
00096 
00098 #define SSEM_TAKEUSR(s, to) os_sem_take(s.oiID, to)
00099 
00101 #define SSEM_GIVE(s) os_sem_give(s.oiID)
00102 
00103 
00105 #define SSEM_READ(sem, loc, var) SSEM_READVAR(sem, loc, var, var)
00106 
00108 #define SSEM_READVAR(sem, loc, var, dst) OS_SEM_TAKE_CHK(SSEM_TAKE(loc.sem)) ? (dst)= loc.var, SSEM_GIVE(loc.sem), TRUE : FALSE
00109 
00110 
00112 #define SSEM_WRITE(sem, loc, var) SSEM_WRITEVAR(sem, loc, var, var)
00113 
00115 #define SSEM_WRITEVAR(sem, loc, var, src) OS_SEM_TAKE_CHK(SSEM_TAKE(loc.sem)) ? loc.var= (src), SSEM_GIVE(loc.sem), TRUE : FALSE
00116 
00117 
00119 #define SSEM_LOCK(sem, loc) OS_SEM_TAKE_CHK(SSEM_TAKE(loc.sem))
00120 
00122 #define SSEM_LOCKUSR(sem, loc, to) OS_SEM_TAKE_CHK(SSEM_TAKEUSR(loc.sem, to))
00123 
00125 #define SSEM_UNLOCK(sem, loc) SSEM_GIVE(loc.sem)
00126 
00127 #endif
 All Files Functions Variables Defines