comparison src/gpf/osl/os_drv.c @ 0:4e78acac3d88

src/{condat,cs,gpf,nucleus}: import from Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Oct 2020 06:23:26 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4e78acac3d88
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 "nucleus.h"
8 #include "typedefs.h"
9 #include "gdi.h"
10 #include "os.h"
11
12 typedef unsigned char u_char;
13
14 extern OS_HANDLE os_ext_pool_handle;
15
16 static u_char *HISR_Stack;
17 static T_DRV_SIGNAL *SignalID;
18 static void (*DrvCallback)(T_DRV_SIGNAL *);
19 static NU_HISR CallBack_HISR;
20
21 #define CB_HISR_STACK_SIZE 1024
22
23 GLOBAL LONG
24 os_ExecuteCallback(OS_HANDLE Caller, void (*Callback)(T_DRV_SIGNAL *),
25 T_DRV_SIGNAL *Signal)
26 {
27 DrvCallback = Callback;
28 SignalID = Signal;
29 NU_Activate_HISR(&CallBack_HISR);
30 return(OS_OK);
31 }
32
33 static void
34 CallbackFunc(void)
35 {
36 DrvCallback(SignalID);
37 }
38
39 GLOBAL LONG
40 os_CreateCallback(void)
41 {
42 if (os_AllocateMemory(OS_NOTASK, (T_VOID_STRUCT **) &HISR_Stack,
43 CB_HISR_STACK_SIZE, 0xFFFFFFFF,
44 os_ext_pool_handle) == OS_ERROR)
45 return(OS_ERROR);
46 if (NU_Create_HISR(&CallBack_HISR, "CB_HISR", CallbackFunc, 2,
47 HISR_Stack, CB_HISR_STACK_SIZE) == NU_SUCCESS)
48 return(OS_OK);
49 else
50 return(OS_ERROR);
51 }