FreeCalypso > hg > freecalypso-sw
comparison gsm-fw/gpf/osx/osx.c @ 498:0be71d13b6e7
osx.c: int_osx_receive_prim() done
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Tue, 01 Jul 2014 18:12:50 +0000 |
parents | f11f7cb7c353 |
children | 4d2c0430851a |
comparison
equal
deleted
inserted
replaced
497:f11f7cb7c353 | 498:0be71d13b6e7 |
---|---|
71 osx_send_prim(xSignalHeaderRec *prim_ptr, T_ENUM_OS_QUEUE queue_type) | 71 osx_send_prim(xSignalHeaderRec *prim_ptr, T_ENUM_OS_QUEUE queue_type) |
72 { | 72 { |
73 int_osx_send_prim(_osx_registry[queue_type].caller, prim_ptr, | 73 int_osx_send_prim(_osx_registry[queue_type].caller, prim_ptr, |
74 _osx_registry[queue_type].queue_handle); | 74 _osx_registry[queue_type].queue_handle); |
75 } | 75 } |
76 | |
77 xSignalHeaderRec * | |
78 int_osx_receive_prim(int caller, int queue_handle) | |
79 { | |
80 T_QMSG Message; | |
81 unsigned opc, len; | |
82 xSignalHeaderRec *message; | |
83 int status; | |
84 | |
85 TRACE_ASSERT(queue_handle != OSX_ERROR); | |
86 for (;;) { | |
87 status = vsi_c_await(caller, queue_handle, &Message, | |
88 0xFFFFFFFF); | |
89 TRACE_ASSERT(status == VSI_OK); | |
90 /* | |
91 * Disassembly reveals that the original code expects | |
92 * the received message to be a primitive, rather than | |
93 * a signal or a timeout. If one of the latter comes | |
94 * in, the original code would go haywire. Hence the | |
95 * following TRACE_ASSERT is a FreeCalypso addition. | |
96 */ | |
97 TRACE_ASSERT(Message.MsgType == MSG_PRIMITIVE); | |
98 message = (xSignalHeaderRec *) Message.Msg.Primitive.Prim; | |
99 opc = message->SignalCode & 0xFFFF; | |
100 if (opc == 11 && osx_config & 2) | |
101 len = *(unsigned *)(message + 1); | |
102 else | |
103 len = sizeof(xSignalHeaderRec); | |
104 message->SigP = (DummyStruct *)((char *)message + len); | |
105 if (opc != 0x8000) | |
106 return(message); | |
107 vsi_c_primitive(caller, message); | |
108 } | |
109 } |