NetBurner 3.5.6
PDF Version
coldfire/include/nbrtoscpu.h
1
/*NB_REVISION*/
2
3
/*NB_COPYRIGHT*/
4
5
#ifndef NBRTOS_CPU_COLDFIRE
6
#define NB_NBRTOS_CPU_H
7
#define NBRTOS_CPU_COLDFIRE 1
8
/********************************************************************/
18
/********************************************************************/
19
20
/********************************************************************/
23
extern
volatile
unsigned
long
critical_count;
24
extern
"C"
25
{
26
void
NBRtosSetup();
27
void
OSIntCtxSw(
void
);
28
}
29
void
NBRtosBegin();
30
31
#include <constants.h>
32
33
/********************************************************************/
38
#define NBRTOS_ENTER_CRITICAL() \
39
{ \
40
asm volatile(" nop"); \
41
asm volatile(" move.w #0x2700,%sr "); \
42
}
43
44
#define NBRTOS_EXIT_CRITICAL() \
45
{ \
46
asm volatile(".extern critical_count"); \
47
asm volatile(".extern OSISRLevel32"); \
48
asm volatile(" nop"); \
49
if (critical_count == 0) \
50
{ \
51
asm volatile(" move.l OSISRLevel32,%%d1 \n\t" :
/* out */
:
/* input */
: "%%d1"
/*modified */
); \
52
asm volatile(" move.w %d1, %sr"); \
53
} \
54
}
55
68
#define USER_ENTER_CRITICAL() \
69
{ \
70
asm volatile(".extern critical_count"); \
71
asm volatile(" nop"); \
72
asm volatile(" move.w #0x2700,%sr "); \
73
asm volatile(" addq.l #1,critical_count "); \
74
}
75
84
#define USER_EXIT_CRITICAL() \
85
{ \
86
asm volatile(".extern critical_count"); \
87
asm volatile(".extern OSISRLevel32"); \
88
asm volatile(" nop"); \
89
asm volatile(" subq.l #1,critical_count "); \
90
if (critical_count == 0) \
91
{ \
92
asm volatile(" move.l OSISRLevel32,%%d1 \n\t" :
/* out */
:
/* input */
: "%%d1"
/*Modified */
); \
93
asm volatile(" move.w %d1, %sr"); \
94
} \
95
}
96
97
#define RAW_OS_TASK_SW() asm volatile(" trap #14 ");
98
99
#define OS_TASK_SW() \
100
asm volatile(" trap #14 "); \
101
asm(".global RTOSWAITS_HERE"); \
102
asm("RTOSWAITS_HERE:");
103
104
#define OS_IDLE_LOOP() asm volatile(" stop #0x2000 ");
105
106
#define MASK_ALL_ISR() asm volatile("move.w #0x2700,%sr ")
107
108
#define NOP() asm volatile(" nop")
109
#define CACHE_FLUSH() asm volatile(" nop")
110
111
#define FORCE_TRAP() asm volatile("illegal")
112
113
#define ARCH_STK_ALIGN_SIZ (4)
114
#define ARCH_ALIGN_STK __attribute__((aligned(ARCH_STK_ALIGN_SIZ)))
115
116
/*
117
***********************************************************
118
* NBRTOS CPU Specific TASK CONTROL BLOCK CLASS
119
***********************************************************
120
*/
121
122
class
cpu_tcb
123
{
124
public
:
125
void
*OSTCBStkPtr;
126
long
*OSTCBStkBot;
127
long
*OSTCBStkTop;
128
};
129
130
#endif