changeset 457:103b06ef644a

os_tim_fl.c: os_TimInit() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 23 Jun 2014 05:33:13 +0000
parents 6e54a3fb01b9
children 705030e1e8b2
files gsm-fw/gpf/osl/os_tim_fl.c
diffstat 1 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gsm-fw/gpf/osl/os_tim_fl.c	Mon Jun 23 04:53:10 2014 +0000
+++ b/gsm-fw/gpf/osl/os_tim_fl.c	Mon Jun 23 05:33:13 2014 +0000
@@ -19,7 +19,7 @@
 extern T_OS_TIMER_ENTRY TimerTable[];
 extern T_OS_TIMER_TABLE_ENTRY *p_list[];
 
-extern void os_Timeout(unsigned t_handle);
+extern void os_Timeout(UNSIGNED t_handle);
 extern void timer_error(int err);
 
 unsigned os_time_to_tick_multiplier = TIME_TO_TICK_TDMA_FRAME_MULTIPLIER;
@@ -65,3 +65,33 @@
 	t_info_read = 1;
 	return(OS_OK);
 }
+
+GLOBAL LONG
+os_TimInit(void)
+{
+	int i;
+
+	if (NU_Create_Semaphore(&TimSemCB, "TIMSEM", 1, NU_PRIORITY)
+			!= NU_SUCCESS)
+		return(OS_ERROR);
+	if (NU_Create_Timer(&os_timer_cb, "OS_TIMER", os_Timeout, 0, 1, 0,
+			    NU_DISABLE_TIMER) != NU_SUCCESS)
+		return(OS_ERROR);
+	used_timers = 0;
+	max_used_timers = 0;
+	next_t_handle = 1;
+	t_list_access = 0;
+	t_start_ticks = 0;
+	p_list[0] = 0;
+	for (i = 1; i < MaxSimultaneousTimer; i++) {
+		TimerTable[i].entry.status = 0;
+		TimerTable[i].entry.next = 0;
+		TimerTable[i].entry.prev = 0;
+		TimerTable[i].next_t_handle = i + 1;
+		p_list[i] = 0;
+	}
+	TimerTable[MaxSimultaneousTimer].entry.status = 0;
+	TimerTable[MaxSimultaneousTimer].next_t_handle = 0;
+	t_running = 0;
+	return(OS_OK);
+}