annotate src/gpf2/osl/os_drv.c @ 487:91e8dac34ada

src/gpf2/osl: initial import from old freecalypso-sw tree
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 22 Jun 2018 05:56:16 +0000
parents
children 045d641c9bfa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
487
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This C module is a reconstruction based on the disassembly of
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * os_drv.obj in frame_na7_db_fl.lib from the Leonardo package.
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 /* set of included headers from COFF symtab: */
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include "gpfconf.h" /* FreeCalypso addition */
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include "../../nucleus/nucleus.h"
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include "typedefs.h"
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "gdi.h"
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "os.h"
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 typedef unsigned char u_char;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 extern OS_HANDLE os_ext_pool_handle;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 static u_char *HISR_Stack;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 static T_DRV_SIGNAL *SignalID;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 static void (*DrvCallback)(T_DRV_SIGNAL *);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 static NU_HISR CallBack_HISR;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 #define CB_HISR_STACK_SIZE 1024
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 GLOBAL LONG
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 os_ExecuteCallback(OS_HANDLE Caller, void (*Callback)(T_DRV_SIGNAL *),
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 T_DRV_SIGNAL *Signal)
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 {
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 DrvCallback = Callback;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 SignalID = Signal;
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 NU_Activate_HISR(&CallBack_HISR);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 return(OS_OK);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 static void
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 CallbackFunc(void)
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 {
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 DrvCallback(SignalID);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 }
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 GLOBAL LONG
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 os_CreateCallback(void)
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 {
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 if (os_AllocateMemory(OS_NOTASK, (T_VOID_STRUCT **) &HISR_Stack,
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 CB_HISR_STACK_SIZE, 0xFFFFFFFF,
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 os_ext_pool_handle) == OS_ERROR)
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 return(OS_ERROR);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 if (NU_Create_HISR(&CallBack_HISR, "CB_HISR", CallbackFunc, 2,
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 HISR_Stack, CB_HISR_STACK_SIZE) == NU_SUCCESS)
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 return(OS_OK);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 else
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 return(OS_ERROR);
91e8dac34ada src/gpf2/osl: initial import from old freecalypso-sw tree
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 }