annotate gsm-fw/gpf/osx/osx.c @ 825:f8eaff87563f

gsm-fw: replaced strtok() from newlib with 4.3BSD-Tahoe version newlib version uses malloc which is not allowed
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 06 Apr 2015 00:24:07 +0000
parents a92cf1059894
children c4da570dca83
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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;
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
81 unsigned opc, len;
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)
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
101 len = *(unsigned *)(message + 1);
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
102 else
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
103 len = sizeof(xSignalHeaderRec);
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
104 message->SigP = (DummyStruct *)((char *)message + len);
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
105 if (opc != 0x8000)
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
106 return(message);
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
107 vsi_c_primitive(caller, message);
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
108 }
0be71d13b6e7 osx.c: int_osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 497
diff changeset
109 }
499
4d2c0430851a osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 498
diff changeset
110
4d2c0430851a osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 498
diff changeset
111 xSignalHeaderRec *
4d2c0430851a osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 498
diff changeset
112 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
113 {
4d2c0430851a osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 498
diff changeset
114 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
115 _osx_registry[queue_type].queue_handle);
4d2c0430851a osx.c: osx_receive_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 498
diff changeset
116 }
500
5293cac7f423 osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 499
diff changeset
117
5293cac7f423 osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 499
diff changeset
118 void
5293cac7f423 osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 499
diff changeset
119 osx_free_prim(xSignalHeaderRec *prim_ptr)
5293cac7f423 osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 499
diff changeset
120 {
5293cac7f423 osx.c: osx_free_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 499
diff changeset
121 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
122 }
501
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
123
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
124 void
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
125 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
126 {
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
127 int status;
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
128
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
129 TRACE_ASSERT(mem_ptr != 0);
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
130 status = D_FREE(mem_ptr);
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
131 TRACE_ASSERT(status == VSI_OK);
da8248e23aca osx.c: int_osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 500
diff changeset
132 }
502
cff42ff57c60 osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 501
diff changeset
133
cff42ff57c60 osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 501
diff changeset
134 void
cff42ff57c60 osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 501
diff changeset
135 osx_free_mem(void *mem_ptr)
cff42ff57c60 osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 501
diff changeset
136 {
cff42ff57c60 osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 501
diff changeset
137 int_osx_free_mem(_caller, mem_ptr);
cff42ff57c60 osx.c: osx_free_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 501
diff changeset
138 }
503
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
139
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
140 xSignalHeaderRec *
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
141 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
142 {
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
143 xSignalHeaderRec *prim_ptr;
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
144
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
145 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
146 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
147 FILE_LINE_MACRO);
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
148 /* This check is a FreeCalypso addition */
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
149 TRACE_ASSERT(prim_ptr != 0);
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
150 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
151 return(prim_ptr);
5dac5a17159a osx.c: int_osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 502
diff changeset
152 }
504
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
153
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
154 xSignalHeaderRec *
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
155 osx_alloc_prim(unsigned long len)
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
156 {
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
157 xSignalHeaderRec *prim_ptr;
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
158
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
159 prim_ptr = (xSignalHeaderRec *) vsi_c_new(_caller,
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
160 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
161 FILE_LINE_MACRO);
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
162 /* This check is a FreeCalypso addition */
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
163 TRACE_ASSERT(prim_ptr != 0);
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
164 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1);
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
165 return(prim_ptr);
7b2ceea92a2e osx.c: osx_alloc_prim() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 503
diff changeset
166 }
505
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
167
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
168 void *
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
169 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
170 {
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
171 void *mem_ptr;
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
172
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
173 DMALLOC(mem_ptr, len);
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
174 TRACE_ASSERT(mem_ptr != 0);
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
175 return(mem_ptr);
19afa1be1d30 osx.c: int_osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 504
diff changeset
176 }
506
65c9bd2eed85 osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 505
diff changeset
177
65c9bd2eed85 osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 505
diff changeset
178 void *
65c9bd2eed85 osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 505
diff changeset
179 osx_alloc_mem(unsigned long len)
65c9bd2eed85 osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 505
diff changeset
180 {
65c9bd2eed85 osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 505
diff changeset
181 return int_osx_alloc_mem(_caller, len);
65c9bd2eed85 osx.c: osx_alloc_mem() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 505
diff changeset
182 }
507
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
183
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
184 int
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
185 _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
186 {
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
187 if (!queue_type && !queue_handle) {
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
188 _caller = caller;
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
189 return(OSX_ERROR);
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
190 }
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
191 if (queue_type >= MAX_OSX_QUEUE)
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
192 return(OSX_ERROR);
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
193 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
194 _osx_registry[queue_type].queue_handle != -1)
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
195 return(OSX_ERROR);
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
196 _osx_registry[queue_type].queue_handle = queue_handle;
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
197 _osx_registry[queue_type].caller = caller;
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
198 return(OSX_OK);
8fdcb8e01bbf osx.c: _osx_open() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 506
diff changeset
199 }
508
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
200
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
201 void
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
202 _osx_init(void)
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
203 {
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
204 USHORT i;
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
205
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
206 for (i = 0; i < MAX_OSX_QUEUE; i++)
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
207 _osx_registry[i].queue_handle = -1;
e3b597f858ce osx.c: _osx_init() done
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 507
diff changeset
208 }
509
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
209
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
210 int
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
211 _osx_config(const char *config)
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
212 {
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
213 if (!strcmp(config, L1S_TRACE_DISABLE)) {
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
214 osx_config |= 1;
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
215 return(OSX_OK);
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
216 }
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
217 if (!strcmp(config, L1S_TRACE_ENABLE)) {
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
218 osx_config &= ~1;
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
219 return(OSX_OK);
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
220 }
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
221 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
222 osx_config &= ~2;
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
223 return(OSX_OK);
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
224 }
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
225 return(OSX_ERROR);
a92cf1059894 osx.c: _osx_config() done, module complete
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents: 508
diff changeset
226 }