-
Notifications
You must be signed in to change notification settings - Fork 3
/
OS_CPU_C.C
88 lines (70 loc) · 2.42 KB
/
OS_CPU_C.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#define OS_CPU_GLOBALS
#include "includes.h"
/* extern INT16U c_int0; */
OS_STK *OSTaskStkInit (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT16U opt)
{
INT16U *stk;
opt=opt;
stk=(INT16U*)ptos;
*stk++ = (INT16U) pdata; /* arg 0 */
stk++; /* next word for use. Task assembly code will pop return address to here. */
*stk++ = (INT16U) 0x21EC; /* ST1 =21ECh; ARB = AR1.*/
*stk++ = (INT16U) 0x2600; /* ST0 =2600h; AR1 is current Aux. Reg, Interrupts are disabled, DP is zero. */
*stk++ = (INT16U) 0x0000; /* Accumulator high is 0 */
*stk++ = (INT16U) 0x0000; /* Accumulator low is 0. */
*stk++ = (INT16U) 0x0000; /* Product High is 0. */
*stk++ = (INT16U) 0x0000; /* T is 0. */
*stk++ = (INT16U) 0x0000; /* Product Low is 0. */
ptos=stk;
*stk++ = (INT16U) 0x0000; /* AR0 = 0. */
*stk++ = (INT16U) 0x0000; /* AR2 = 0 */
*stk++ = (INT16U) 0x0000; /* AR3 = 0 */
*stk++ = (INT16U) 0x0000; /* AR4 = 0 */
*stk++ = (INT16U) 0x0000; /* AR5 = 0 */
*stk++ = (INT16U) 0x0000; /* AR6 = 0 */
*stk++ = (INT16U) 0x0000; /* AR7 = 0 */
*stk++ = (INT16U) task; /* Interrupt return address = start of task */
/**stk++ = (INT16U) c_int0;
*stk++ = (INT16U) c_int0;
*stk++ = (INT16U) c_int0;
*stk++ = (INT16U) c_int0; /* Initialize the h/w stack. */
/**stk++ = (INT16U) c_int0;
*stk++ = (INT16U) c_int0; /* reset if an unbalanced return. */
stk+=6;
* (INT16U *)ptos=(INT16U)stk; /* now set frame pointer. */
return ((OS_STK *)stk);
}
#if OS_CPU_HOOKS_EN
void OSTaskCreateHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
void OSTaskDelHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
void OSTaskSwHook (void)
{
}
void OSTaskIdleHook(void)
{
/* printf("This is Idletask.\n");
printf("OSIdleCtr is %ld\n",OSIdleCtr); */
}
void OSTaskStatHook (void)
{
}
void OSTimeTickHook (void)
{
}
void OSInitHookBegin(void)
{
}
void OSInitHookEnd(void)
{
}
void OSTCBInitHook(OS_TCB *ptcb)
{
ptcb=ptcb;
}
#endif