annotate gsm-fw/gpf/osl/os_pro_fl.c @ 338:42bc1d7068ac

OSL reconstruction: os_pro_fl.c started
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 02 May 2014 06:36:17 +0000
parents
children 2f88c5b89113
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
338
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 /*
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 * This C module is a reconstruction based on the disassembly of
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3 * os_pro.obj in frame_na7_db_fl.lib from the Leonardo package.
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 */
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 /* set of included headers from COFF symtab: */
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #include <stdio.h>
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #include <string.h>
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #include "gpfconf.h" /* FreeCalypso addition */
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #include "../../nucleus/nucleus.h"
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #include "typedefs.h"
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #include "os.h"
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #include "gdi.h"
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #include "os_types.h"
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 #include "os_glob.h"
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17 typedef unsigned char u_char;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 extern T_OS_TASK_TABLE_ENTRY TaskTable[];
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 /* .bss */
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 static NU_SEMAPHORE ProSemCB;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 static int
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 os_GetTaskEntry(USHORT Index, OS_HANDLE *Handle)
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 {
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 static USHORT Idx;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 if (Index == FIRST_ENTRY)
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 Idx = 0;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 if (Index == FIRST_ENTRY || Index == NEXT_ENTRY) {
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32 while (++Idx <= MaxTasks && !TaskTable[Idx].Name[0])
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 ;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 } else
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 Idx = Index;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 if (Idx <= MaxTasks && TaskTable[Idx].Name[0]) {
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 *Handle = Idx;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38 return(0);
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 } else
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 return(-1);
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 }
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 GLOBAL LONG
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 os_TaskInformation(USHORT Index, char *Buffer)
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 {
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 DATA_ELEMENT TaskStatus;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 OPTION Prio, Preempt;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48 UNSIGNED Count, TimeSlice, Size, MinStack;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 OS_HANDLE Handle;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50 CHAR Name[NU_MAX_NAME];
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 u_char *StackBase, *sp;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 USHORT Untouched;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 if (os_GetTaskEntry(Index, &Handle) < 0)
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 return(-1);
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 if (NU_Task_Information(&TaskTable[Handle].TaskCB.TCB, Name,
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 &TaskStatus, &Count, &Prio, &Preempt,
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 &TimeSlice, (VOID **) &StackBase,
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 &Size, &MinStack) != NU_SUCCESS)
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60 return(-1);
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 Untouched = 0;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 for (sp = StackBase; sp < StackBase + Size; sp++) {
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 if (*sp != 0xFE)
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 break;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 Untouched++;
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 }
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 sprintf(Buffer,
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 "Name:%s Stat:%d Count:%ld Prio:%d Stack:%lx Size:%ld Untouched:%d",
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 Name, TaskStatus, Count, 255 - Prio, (ULONG) StackBase,
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 (ULONG) Size, Untouched);
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 return(0);
42bc1d7068ac OSL reconstruction: os_pro_fl.c started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 }