annotate src/gpf2/frame/cust_os/osx.c @ 655:ba32dc03f550

.../luna/r2d_task_i.c: superfluous #include removed
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 07 May 2020 22:39:59 +0000
parents 5ce1598de1a6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
505
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This C module is a reconstruction based on the disassembly of
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * osx.obj in osx_na7_db.lib from the Leonardo package.
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 /* reconstructed set of included headers from COFF symtab: */
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include "typedefs.h"
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include "vsi.h"
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 #include "cust_os.h"
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 int osx_config = 2;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 int _caller;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 T_OSX_REGISTER _osx_registry[MAX_OSX_QUEUE];
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 int_osx_send_sig(int caller, unsigned long opc, void *signal_ptr,
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 int queue_handle)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 T_QMSG Message;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 int status;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 TRACE_ASSERT(queue_handle != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 Message.MsgType = MSG_SIGNAL;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 Message.Msg.Signal.SigOPC = opc;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 Message.Msg.Signal.SigBuffer = signal_ptr;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 Message.Msg.Signal.SigLen = sizeof(xSignalHeaderRec);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 TRACE_ASSERT(status == VSI_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 osx_send_sig(unsigned long opc, void *signal_ptr, T_ENUM_OS_QUEUE queue_type)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 int caller, queue_handle;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 caller = _osx_registry[queue_type].caller;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 queue_handle = _osx_registry[queue_type].queue_handle;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 TRACE_ASSERT(queue_handle != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 int_osx_send_sig(caller, opc, signal_ptr, queue_handle);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 int_osx_free_prim(int caller, xSignalHeaderRec *prim_ptr)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 int_osx_send_prim(int caller, xSignalHeaderRec *prim_ptr, int queue_handle)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 T_QMSG Message;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 int status;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 if (osx_config & 1 && prim_ptr->SignalCode == 0x7D) {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 return;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 TRACE_ASSERT(queue_handle != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 Message.MsgType = MSG_PRIMITIVE;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 Message.Msg.Primitive.Prim = (T_VOID_STRUCT *) prim_ptr;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 Message.Msg.Primitive.PrimLen = sizeof(xSignalHeaderRec);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 TRACE_ASSERT(status == VSI_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 osx_send_prim(xSignalHeaderRec *prim_ptr, T_ENUM_OS_QUEUE queue_type)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 int_osx_send_prim(_osx_registry[queue_type].caller, prim_ptr,
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 _osx_registry[queue_type].queue_handle);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 xSignalHeaderRec *
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
78 int_osx_receive_prim(int caller, int queue_handle)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 T_QMSG Message;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
81 unsigned opc;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82 xSignalHeaderRec *message;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
83 int status;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
84
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
85 TRACE_ASSERT(queue_handle != OSX_ERROR);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
86 for (;;) {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
87 status = vsi_c_await(caller, queue_handle, &Message,
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
88 0xFFFFFFFF);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
89 TRACE_ASSERT(status == VSI_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
90 /*
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 * Disassembly reveals that the original code expects
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
92 * the received message to be a primitive, rather than
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
93 * a signal or a timeout. If one of the latter comes
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
94 * in, the original code would go haywire. Hence the
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
95 * following TRACE_ASSERT is a FreeCalypso addition.
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
96 */
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
97 TRACE_ASSERT(Message.MsgType == MSG_PRIMITIVE);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
98 message = (xSignalHeaderRec *) Message.Msg.Primitive.Prim;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
99 opc = message->SignalCode & 0xFFFF;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
100 if (opc == 11 && osx_config & 2)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
101 message->SigP = *(DummyStruct **)(message + 1);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
102 else
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
103 message->SigP = (DummyStruct *)(message + 1);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
104 if (opc != 0x8000)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
105 return(message);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
106 vsi_c_primitive(caller, message);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
107 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
108 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
109
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
110 xSignalHeaderRec *
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
111 osx_receive_prim(T_ENUM_OS_QUEUE queue_type)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
112 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
113 return int_osx_receive_prim(_osx_registry[queue_type].caller,
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
114 _osx_registry[queue_type].queue_handle);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
115 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
116
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
117 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
118 osx_free_prim(xSignalHeaderRec *prim_ptr)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
119 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
120 vsi_c_free(_caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
121 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
122
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
123 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
124 int_osx_free_mem(int caller, void *mem_ptr)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
125 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
126 int status;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
127
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
128 TRACE_ASSERT(mem_ptr != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
129 status = D_FREE(mem_ptr);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
130 TRACE_ASSERT(status == VSI_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
131 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
132
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
133 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
134 osx_free_mem(void *mem_ptr)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
135 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
136 int_osx_free_mem(_caller, mem_ptr);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
137 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
138
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
139 xSignalHeaderRec *
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
140 int_osx_alloc_prim(int caller, unsigned long len, int pool_group_handle)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
141 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
142 xSignalHeaderRec *prim_ptr;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
143
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
144 prim_ptr = (xSignalHeaderRec *) vsi_c_new(caller,
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
145 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
146 FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
147 /* This check is a FreeCalypso addition */
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
148 TRACE_ASSERT(prim_ptr != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
149 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
150 return(prim_ptr);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
151 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
152
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
153 xSignalHeaderRec *
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
154 osx_alloc_prim(unsigned long len)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
155 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
156 xSignalHeaderRec *prim_ptr;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
157
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
158 prim_ptr = (xSignalHeaderRec *) vsi_c_new(_caller,
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
159 (len & 0xFFFF) + sizeof(xSignalHeaderRec), 0
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
160 FILE_LINE_MACRO);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
161 /* This check is a FreeCalypso addition */
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
162 TRACE_ASSERT(prim_ptr != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
163 prim_ptr->SigP = (DummyStruct *)(prim_ptr + 1);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
164 return(prim_ptr);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
165 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
166
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
167 void *
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
168 int_osx_alloc_mem(int caller, unsigned long len)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
169 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
170 void *mem_ptr;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
171
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
172 DMALLOC(mem_ptr, len);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
173 TRACE_ASSERT(mem_ptr != 0);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
174 return(mem_ptr);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
175 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
176
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
177 void *
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
178 osx_alloc_mem(unsigned long len)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
179 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
180 return int_osx_alloc_mem(_caller, len);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
181 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
182
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
183 int
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
184 _osx_open(int caller, unsigned short queue_type, int queue_handle)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
185 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
186 if (!queue_type && !queue_handle) {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
187 _caller = caller;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
188 return(OSX_ERROR);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
189 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
190 if (queue_type >= MAX_OSX_QUEUE)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
191 return(OSX_ERROR);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
192 if (_osx_registry[queue_type].queue_handle != queue_handle &&
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
193 _osx_registry[queue_type].queue_handle != -1)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
194 return(OSX_ERROR);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
195 _osx_registry[queue_type].queue_handle = queue_handle;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
196 _osx_registry[queue_type].caller = caller;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
197 return(OSX_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
198 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
199
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
200 void
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
201 _osx_init(void)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
202 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
203 USHORT i;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
204
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
205 for (i = 0; i < MAX_OSX_QUEUE; i++)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
206 _osx_registry[i].queue_handle = -1;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
207 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
208
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
209 int
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
210 _osx_config(const char *config)
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
211 {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
212 if (!strcmp(config, L1S_TRACE_DISABLE)) {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
213 osx_config |= 1;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
214 return(OSX_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
215 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
216 if (!strcmp(config, L1S_TRACE_ENABLE)) {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
217 osx_config &= ~1;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
218 return(OSX_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
219 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
220 if (!strcmp(config, NO_SPECIAL_MPHC_RXLEV_REQ)) {
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
221 osx_config &= ~2;
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
222 return(OSX_OK);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
223 }
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
224 return(OSX_ERROR);
5ce1598de1a6 osx.c reconstructed source integrated, compiles
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
225 }