FreeCalypso > hg > freecalypso-sw
annotate gsm-fw/gpf/osx/osx.c @ 889:1b1683cda154
fc-shell: implemented poweroff and tgtreset commands
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Sun, 28 Jun 2015 16:52:06 +0000 |
parents | c4da570dca83 |
children |
rev | line source |
---|---|
491
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
1 /* |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
2 * This C module is a reconstruction based on the disassembly of |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
3 * osx.obj in osx_na7_db.lib from the Leonardo package. |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
4 */ |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
5 |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
6 /* reconstructed set of included headers from COFF symtab: */ |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
7 #include <stdio.h> |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
8 #include <stdlib.h> |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
9 #include <string.h> |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
10 #include "typedefs.h" |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
11 #include "vsi.h" |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
12 #include "cust_os.h" |
886cd11bc45f
OSX reconstruction started
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff
changeset
|
13 |
492
517cde3e238e
osx.c: global data done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
491
diff
changeset
|
14 int osx_config = 2; |
517cde3e238e
osx.c: global data done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
491
diff
changeset
|
15 int _caller; |
507
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
16 T_OSX_REGISTER _osx_registry[MAX_OSX_QUEUE]; |
493
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
17 |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
18 void |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
19 int_osx_send_sig(int caller, unsigned long opc, void *signal_ptr, |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
20 int queue_handle) |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
21 { |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
22 T_QMSG Message; |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
23 int status; |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
24 |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
25 TRACE_ASSERT(queue_handle != 0); |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
26 Message.MsgType = MSG_SIGNAL; |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
27 Message.Msg.Signal.SigOPC = opc; |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
28 Message.Msg.Signal.SigBuffer = signal_ptr; |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
29 Message.Msg.Signal.SigLen = sizeof(xSignalHeaderRec); |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
30 status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO); |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
31 TRACE_ASSERT(status == VSI_OK); |
4775ba17ba05
osx.c: int_osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
492
diff
changeset
|
32 } |
494
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
33 |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
34 void |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
35 osx_send_sig(unsigned long opc, void *signal_ptr, T_ENUM_OS_QUEUE queue_type) |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
36 { |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
37 int caller, queue_handle; |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
38 |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
39 caller = _osx_registry[queue_type].caller; |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
40 queue_handle = _osx_registry[queue_type].queue_handle; |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
41 TRACE_ASSERT(queue_handle != 0); |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
42 int_osx_send_sig(caller, opc, signal_ptr, queue_handle); |
a8799459110c
osx.c: osx_send_sig() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
493
diff
changeset
|
43 } |
495
34303faf4620
osx.c: int_osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
494
diff
changeset
|
44 |
34303faf4620
osx.c: int_osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
494
diff
changeset
|
45 void |
34303faf4620
osx.c: int_osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
494
diff
changeset
|
46 int_osx_free_prim(int caller, xSignalHeaderRec *prim_ptr) |
34303faf4620
osx.c: int_osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
494
diff
changeset
|
47 { |
34303faf4620
osx.c: int_osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
494
diff
changeset
|
48 vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO); |
34303faf4620
osx.c: int_osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
494
diff
changeset
|
49 } |
496
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
50 |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
51 void |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
52 int_osx_send_prim(int caller, xSignalHeaderRec *prim_ptr, int queue_handle) |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
53 { |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
54 T_QMSG Message; |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
55 int status; |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
56 |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
57 if (osx_config & 1 && prim_ptr->SignalCode == 0x7D) { |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
58 vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
59 FILE_LINE_MACRO); |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
60 return; |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
61 } |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
62 TRACE_ASSERT(queue_handle != 0); |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
63 Message.MsgType = MSG_PRIMITIVE; |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
64 Message.Msg.Primitive.Prim = (T_VOID_STRUCT *) prim_ptr; |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
65 Message.Msg.Primitive.PrimLen = sizeof(xSignalHeaderRec); |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
66 status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO); |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
67 TRACE_ASSERT(status == VSI_OK); |
2c16b554d142
osx.c: int_osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
495
diff
changeset
|
68 } |
497
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
69 |
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
70 void |
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
71 osx_send_prim(xSignalHeaderRec *prim_ptr, T_ENUM_OS_QUEUE queue_type) |
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
72 { |
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
73 int_osx_send_prim(_osx_registry[queue_type].caller, prim_ptr, |
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
74 _osx_registry[queue_type].queue_handle); |
f11f7cb7c353
osx.c: osx_send_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
496
diff
changeset
|
75 } |
498
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
76 |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
77 xSignalHeaderRec * |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
78 int_osx_receive_prim(int caller, int queue_handle) |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
79 { |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
80 T_QMSG Message; |
867
c4da570dca83
int_osx_receive_prim() in gsm-fw/gpf/osx/osx.c: there was an error in the
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
509
diff
changeset
|
81 unsigned opc; |
498
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
82 xSignalHeaderRec *message; |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
83 int status; |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
84 |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
85 TRACE_ASSERT(queue_handle != OSX_ERROR); |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
86 for (;;) { |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
87 status = vsi_c_await(caller, queue_handle, &Message, |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
88 0xFFFFFFFF); |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
89 TRACE_ASSERT(status == VSI_OK); |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
90 /* |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
91 * Disassembly reveals that the original code expects |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
92 * the received message to be a primitive, rather than |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
93 * a signal or a timeout. If one of the latter comes |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
94 * in, the original code would go haywire. Hence the |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
95 * following TRACE_ASSERT is a FreeCalypso addition. |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
96 */ |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
97 TRACE_ASSERT(Message.MsgType == MSG_PRIMITIVE); |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
98 message = (xSignalHeaderRec *) Message.Msg.Primitive.Prim; |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
99 opc = message->SignalCode & 0xFFFF; |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
100 if (opc == 11 && osx_config & 2) |
867
c4da570dca83
int_osx_receive_prim() in gsm-fw/gpf/osx/osx.c: there was an error in the
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
509
diff
changeset
|
101 message->SigP = *(DummyStruct **)(message + 1); |
498
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
102 else |
867
c4da570dca83
int_osx_receive_prim() in gsm-fw/gpf/osx/osx.c: there was an error in the
Space Falcon <falcon@ivan.Harhan.ORG>
parents:
509
diff
changeset
|
103 message->SigP = (DummyStruct *)(message + 1); |
498
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
104 if (opc != 0x8000) |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
105 return(message); |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
106 vsi_c_primitive(caller, message); |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
107 } |
0be71d13b6e7
osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
497
diff
changeset
|
108 } |
499
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
109 |
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
110 xSignalHeaderRec * |
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
111 osx_receive_prim(T_ENUM_OS_QUEUE queue_type) |
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
112 { |
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
113 return int_osx_receive_prim(_osx_registry[queue_type].caller, |
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
114 _osx_registry[queue_type].queue_handle); |
4d2c0430851a
osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
498
diff
changeset
|
115 } |
500
5293cac7f423
osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
499
diff
changeset
|
116 |
5293cac7f423
osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
499
diff
changeset
|
117 void |
5293cac7f423
osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
499
diff
changeset
|
118 osx_free_prim(xSignalHeaderRec *prim_ptr) |
5293cac7f423
osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
499
diff
changeset
|
119 { |
5293cac7f423
osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
499
diff
changeset
|
120 vsi_c_free(_caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO); |
5293cac7f423
osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
499
diff
changeset
|
121 } |
501
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
122 |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
123 void |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
124 int_osx_free_mem(int caller, void *mem_ptr) |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
125 { |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
126 int status; |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
127 |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
128 TRACE_ASSERT(mem_ptr != 0); |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
129 status = D_FREE(mem_ptr); |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
130 TRACE_ASSERT(status == VSI_OK); |
da8248e23aca
osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
500
diff
changeset
|
131 } |
502
cff42ff57c60
osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
501
diff
changeset
|
132 |
cff42ff57c60
osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
501
diff
changeset
|
133 void |
cff42ff57c60
osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
501
diff
changeset
|
134 osx_free_mem(void *mem_ptr) |
cff42ff57c60
osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
501
diff
changeset
|
135 { |
cff42ff57c60
osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
501
diff
changeset
|
136 int_osx_free_mem(_caller, mem_ptr); |
cff42ff57c60
osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
501
diff
changeset
|
137 } |
503
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
138 |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
139 xSignalHeaderRec * |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
140 int_osx_alloc_prim(int caller, unsigned long len, int pool_group_handle) |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
141 { |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
142 xSignalHeaderRec *prim_ptr; |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
143 |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
144 prim_ptr = (xSignalHeaderRec *) vsi_c_new(caller, |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
145 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0 |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
146 FILE_LINE_MACRO); |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
147 /* This check is a FreeCalypso addition */ |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
148 TRACE_ASSERT(prim_ptr != 0); |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
149 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1); |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
150 return(prim_ptr); |
5dac5a17159a
osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
502
diff
changeset
|
151 } |
504
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
152 |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
153 xSignalHeaderRec * |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
154 osx_alloc_prim(unsigned long len) |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
155 { |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
156 xSignalHeaderRec *prim_ptr; |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
157 |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
158 prim_ptr = (xSignalHeaderRec *) vsi_c_new(_caller, |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
159 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0 |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
160 FILE_LINE_MACRO); |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
161 /* This check is a FreeCalypso addition */ |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
162 TRACE_ASSERT(prim_ptr != 0); |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
163 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1); |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
164 return(prim_ptr); |
7b2ceea92a2e
osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
503
diff
changeset
|
165 } |
505
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
166 |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
167 void * |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
168 int_osx_alloc_mem(int caller, unsigned long len) |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
169 { |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
170 void *mem_ptr; |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
171 |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
172 DMALLOC(mem_ptr, len); |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
173 TRACE_ASSERT(mem_ptr != 0); |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
174 return(mem_ptr); |
19afa1be1d30
osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
504
diff
changeset
|
175 } |
506
65c9bd2eed85
osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
505
diff
changeset
|
176 |
65c9bd2eed85
osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
505
diff
changeset
|
177 void * |
65c9bd2eed85
osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
505
diff
changeset
|
178 osx_alloc_mem(unsigned long len) |
65c9bd2eed85
osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
505
diff
changeset
|
179 { |
65c9bd2eed85
osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
505
diff
changeset
|
180 return int_osx_alloc_mem(_caller, len); |
65c9bd2eed85
osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
505
diff
changeset
|
181 } |
507
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
182 |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
183 int |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
184 _osx_open(int caller, unsigned short queue_type, int queue_handle) |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
185 { |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
186 if (!queue_type && !queue_handle) { |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
187 _caller = caller; |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
188 return(OSX_ERROR); |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
189 } |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
190 if (queue_type >= MAX_OSX_QUEUE) |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
191 return(OSX_ERROR); |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
192 if (_osx_registry[queue_type].queue_handle != queue_handle && |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
193 _osx_registry[queue_type].queue_handle != -1) |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
194 return(OSX_ERROR); |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
195 _osx_registry[queue_type].queue_handle = queue_handle; |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
196 _osx_registry[queue_type].caller = caller; |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
197 return(OSX_OK); |
8fdcb8e01bbf
osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
506
diff
changeset
|
198 } |
508
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
199 |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
200 void |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
201 _osx_init(void) |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
202 { |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
203 USHORT i; |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
204 |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
205 for (i = 0; i < MAX_OSX_QUEUE; i++) |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
206 _osx_registry[i].queue_handle = -1; |
e3b597f858ce
osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
507
diff
changeset
|
207 } |
509
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
208 |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
209 int |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
210 _osx_config(const char *config) |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
211 { |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
212 if (!strcmp(config, L1S_TRACE_DISABLE)) { |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
213 osx_config |= 1; |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
214 return(OSX_OK); |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
215 } |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
216 if (!strcmp(config, L1S_TRACE_ENABLE)) { |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
217 osx_config &= ~1; |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
218 return(OSX_OK); |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
219 } |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
220 if (!strcmp(config, NO_SPECIAL_MPHC_RXLEV_REQ)) { |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
221 osx_config &= ~2; |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
222 return(OSX_OK); |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
223 } |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
224 return(OSX_ERROR); |
a92cf1059894
osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
508
diff
changeset
|
225 } |