changeset 365:46bdf41cb019

OSL: os_drv.c finished
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Thu, 29 May 2014 01:18:38 +0000
parents 4a78dc764229
children 227bc7a1c305
files gsm-fw/gpf/osl/os_drv.c
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_drv.c	Thu May 29 00:01:26 2014 +0000
+++ b/gsm-fw/gpf/osl/os_drv.c	Thu May 29 01:18:38 2014 +0000
@@ -19,6 +19,8 @@
 static void (*DrvCallback)(T_DRV_SIGNAL *);
 static NU_HISR CallBack_HISR;
 
+#define	CB_HISR_STACK_SIZE	1024
+
 GLOBAL LONG
 os_ExecuteCallback(OS_HANDLE Caller, void (*Callback)(T_DRV_SIGNAL *),
 			T_DRV_SIGNAL *Signal)
@@ -28,3 +30,23 @@
 	NU_Activate_HISR(&CallBack_HISR);
 	return(OS_OK);
 }
+
+static void
+CallbackFunc(void)
+{
+	DrvCallback(SignalID);
+}
+
+GLOBAL LONG
+os_CreateCallback(void)
+{
+	if (os_AllocateMemory(OS_NOTASK, (T_VOID_STRUCT **) &HISR_Stack,
+				CB_HISR_STACK_SIZE, 0xFFFFFFFF,
+				os_ext_pool_handle) == OS_ERROR)
+		return(OS_ERROR);
+	if (NU_Create_HISR(&CallBack_HISR, "CB_HISR", CallbackFunc, 2,
+				HISR_Stack, CB_HISR_STACK_SIZE) == NU_SUCCESS)
+		return(OS_OK);
+	else
+		return(OS_ERROR);
+}