comparison gpf/osl/os_drv.c @ 0:75a11d740a02

initial import of gsm-fw from freecalypso-sw rev 1033:5ab737ac3ad7
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 09 Jun 2016 00:02:41 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:75a11d740a02
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 }