annotate gsm-fw/gpf/osl/os_isr.c @ 951:eb27543ce18e

c139explore: elementary operation commands lcdcmd and lcdpix added
author Mychaela Falconia <falcon@ivan.Harhan.ORG>
date Wed, 04 Nov 2015 03:03:38 +0000
parents 6e6d4c1ec733
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
346
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This C module is a reconstruction based on the disassembly of
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * os_isr.obj in frame_na7_db_fl.lib from the Leonardo package.
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 /* set of included headers from COFF symtab: */
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <string.h>
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include "gpfconf.h" /* FreeCalypso addition */
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "../../nucleus/nucleus.h"
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "typedefs.h"
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "os.h"
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include "gdi.h"
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #include "os_types.h"
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "os_glob.h"
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15
348
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
16 typedef unsigned char u_char;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
17
346
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 extern T_OS_OSISR_TABLE_ENTRY OSISRTable[];
348
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
19 extern OS_HANDLE os_int_pool_handle;
346
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 GLOBAL LONG
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 os_isr_init(void)
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 {
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 USHORT i;
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 for (i = 1; i <= MaxOSISRs; i++)
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 OSISRTable[i].name[0] = 0;
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 return(OS_OK);
fdeea3d6582d OSL: reconstruction of os_isr.c (_fl only) started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 }
347
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
30
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
31 GLOBAL LONG
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
32 os_SetInterruptState(OS_INT_STATE new_state, OS_INT_STATE *old_state)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
33 {
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
34 INT state;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
35
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
36 if (new_state)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
37 state = NU_ENABLE_INTERRUPTS;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
38 else
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
39 state = NU_DISABLE_INTERRUPTS;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
40 state = NU_Control_Interrupts(state);
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
41 if (state & 0xFF)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
42 *old_state = 0;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
43 else
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
44 *old_state = 1;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
45 return(OS_OK);
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
46 }
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
47
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
48 GLOBAL LONG
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
49 os_EnableInterrupts(OS_INT_STATE *old_state)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
50 {
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
51 INT state;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
52
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
53 state = NU_Control_Interrupts(NU_ENABLE_INTERRUPTS);
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
54 if (state & 0xFF)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
55 *old_state = 0;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
56 else
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
57 *old_state = 1;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
58 return(OS_OK);
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
59 }
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
60
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
61 GLOBAL LONG
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
62 os_DisableInterrupts(OS_INT_STATE *old_state)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
63 {
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
64 INT state;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
65
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
66 state = NU_Control_Interrupts(NU_DISABLE_INTERRUPTS);
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
67 if (state & 0xFF)
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
68 *old_state = 0;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
69 else
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
70 *old_state = 1;
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
71 return(OS_OK);
c9dfa0e20640 OSL reconstruction: os_isr.c: interrupt control functions done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 346
diff changeset
72 }
348
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
73
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
74 GLOBAL LONG
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
75 os_DeleteOSISR(OS_HANDLE hisr_handle)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
76 {
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
77 OS_INT_STATE old_state, state;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
78
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
79 if (hisr_handle <= 0 || hisr_handle > MaxOSISRs)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
80 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
81 if (OSISRTable[hisr_handle].hisr_cb.tc_activation_count)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
82 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
83 os_DisableInterrupts(&old_state);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
84 if (os_DeallocateMemory(os_MyHandle(), OSISRTable[hisr_handle].stack)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
85 == OS_ERROR) {
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
86 error: os_SetInterruptState(old_state, &state);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
87 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
88 }
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
89 if (NU_Delete_HISR(&OSISRTable[hisr_handle].hisr_cb) != NU_SUCCESS)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
90 goto error;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
91 OSISRTable[hisr_handle].name[0] = 0;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
92 os_SetInterruptState(old_state, &state);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
93 return(OS_OK);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
94 }
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
95
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
96 GLOBAL LONG
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
97 os_CreateOSISR(char *name, void (*OSISR_entry)(void),
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
98 int stacksize, int priority,
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
99 int flags, OS_HANDLE *hisr_handle)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
100 {
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
101 OS_HANDLE handle;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
102 T_VOID_STRUCT *hisr_stack;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
103 OS_INT_STATE old_state, state;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
104
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
105 if (priority < 0 || priority > 2)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
106 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
107 priority = 2 - priority;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
108 os_DisableInterrupts(&old_state);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
109 for (handle = 1; handle <= MaxOSISRs; handle++)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
110 if (!strncmp(OSISRTable[handle].name, name,
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
111 RESOURCE_NAMELEN - 1)) {
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
112 error: os_SetInterruptState(old_state, &state);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
113 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
114 }
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
115 for (handle = 1; handle <= MaxOSISRs; handle++)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
116 if (!OSISRTable[handle].name[0])
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
117 break;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
118 if (handle > MaxOSISRs)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
119 goto error;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
120 if (os_AllocateMemory(os_MyHandle(), &hisr_stack, stacksize,
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
121 0xFFFFFFFF, os_int_pool_handle) == OS_ERROR)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
122 goto error;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
123 memset((u_char *)hisr_stack, INITIAL_STACK_VALUE, stacksize);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
124 *hisr_stack = GUARD_PATTERN;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
125 if (NU_Create_HISR(&OSISRTable[handle].hisr_cb, name, OSISR_entry,
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
126 priority, (VOID *)hisr_stack, stacksize)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
127 != NU_SUCCESS)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
128 goto error;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
129 strncpy(OSISRTable[handle].name, name, RESOURCE_NAMELEN);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
130 OSISRTable[handle].name[RESOURCE_NAMELEN-1] = 0;
474
6e6d4c1ec733 os_isr.c: os_CreateOSISR(): missed the assignment to .stack
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 348
diff changeset
131 OSISRTable[handle].stack = hisr_stack;
348
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
132 *hisr_handle = handle;
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
133 os_SetInterruptState(old_state, &state);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
134 return(OS_OK);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
135 }
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
136
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
137 GLOBAL LONG
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
138 os_ActivateOSISR(OS_HANDLE hisr_handle)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
139 {
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
140 if (hisr_handle <= 0 || hisr_handle > MaxOSISRs)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
141 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
142 if (NU_Activate_HISR(&OSISRTable[hisr_handle].hisr_cb) == NU_SUCCESS)
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
143 return(OS_OK);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
144 else
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
145 return(OS_ERROR);
e63ab4a97e24 OSL: os_isr.c done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 347
diff changeset
146 }