comparison 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
comparison
equal deleted inserted replaced
486:c433cca731a3 487:91e8dac34ada
1 /*
2 * This C module is a reconstruction based on the disassembly of
3 * os_drv.obj in frame_na7_db_fl.lib from the Leonardo package.
4 */
5
6 /* set of included headers from COFF symtab: */
7 #include "gpfconf.h" /* FreeCalypso addition */
8 #include "../../nucleus/nucleus.h"
9 #include "typedefs.h"
10 #include "gdi.h"
11 #include "os.h"
12
13 typedef unsigned char u_char;
14
15 extern OS_HANDLE os_ext_pool_handle;
16
17 static u_char *HISR_Stack;
18 static T_DRV_SIGNAL *SignalID;
19 static void (*DrvCallback)(T_DRV_SIGNAL *);
20 static NU_HISR CallBack_HISR;
21
22 #define CB_HISR_STACK_SIZE 1024
23
24 GLOBAL LONG
25 os_ExecuteCallback(OS_HANDLE Caller, void (*Callback)(T_DRV_SIGNAL *),
26 T_DRV_SIGNAL *Signal)
27 {
28 DrvCallback = Callback;
29 SignalID = Signal;
30 NU_Activate_HISR(&CallBack_HISR);
31 return(OS_OK);
32 }
33
34 static void
35 CallbackFunc(void)
36 {
37 DrvCallback(SignalID);
38 }
39
40 GLOBAL LONG
41 os_CreateCallback(void)
42 {
43 if (os_AllocateMemory(OS_NOTASK, (T_VOID_STRUCT **) &HISR_Stack,
44 CB_HISR_STACK_SIZE, 0xFFFFFFFF,
45 os_ext_pool_handle) == OS_ERROR)
46 return(OS_ERROR);
47 if (NU_Create_HISR(&CallBack_HISR, "CB_HISR", CallbackFunc, 2,
48 HISR_Stack, CB_HISR_STACK_SIZE) == NU_SUCCESS)
49 return(OS_OK);
50 else
51 return(OS_ERROR);
52 }