view gsm-fw/gpf/osx/osx.c @ 497:f11f7cb7c353

osx.c: osx_send_prim() done
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Tue, 01 Jul 2014 13:21:41 +0000
parents 2c16b554d142
children 0be71d13b6e7
line wrap: on
line source

/*
 * This C module is a reconstruction based on the disassembly of
 * osx.obj in osx_na7_db.lib from the Leonardo package.
 */

/* reconstructed set of included headers from COFF symtab: */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "typedefs.h"
#include "vsi.h"
#include "cust_os.h"

int osx_config = 2;
int _caller;
T_OSX_REGISTER _osx_registry[7];

void
int_osx_send_sig(int caller, unsigned long opc, void *signal_ptr,
		 int queue_handle)
{
	T_QMSG Message;
	int status;

	TRACE_ASSERT(queue_handle != 0);
	Message.MsgType = MSG_SIGNAL;
	Message.Msg.Signal.SigOPC = opc;
	Message.Msg.Signal.SigBuffer = signal_ptr;
	Message.Msg.Signal.SigLen = sizeof(xSignalHeaderRec);
	status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO);
	TRACE_ASSERT(status == VSI_OK);
}

void
osx_send_sig(unsigned long opc, void *signal_ptr, T_ENUM_OS_QUEUE queue_type)
{
	int caller, queue_handle;

	caller = _osx_registry[queue_type].caller;
	queue_handle = _osx_registry[queue_type].queue_handle;
	TRACE_ASSERT(queue_handle != 0);
	int_osx_send_sig(caller, opc, signal_ptr, queue_handle);
}

void
int_osx_free_prim(int caller, xSignalHeaderRec *prim_ptr)
{
	vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr FILE_LINE_MACRO);
}

void
int_osx_send_prim(int caller, xSignalHeaderRec *prim_ptr, int queue_handle)
{
	T_QMSG Message;
	int status;

	if (osx_config & 1 && prim_ptr->SignalCode == 0x7D) {
		vsi_c_free(caller, (T_VOID_STRUCT **) &prim_ptr
				FILE_LINE_MACRO);
		return;
	}
	TRACE_ASSERT(queue_handle != 0);
	Message.MsgType = MSG_PRIMITIVE;
	Message.Msg.Primitive.Prim = (T_VOID_STRUCT *) prim_ptr;
	Message.Msg.Primitive.PrimLen = sizeof(xSignalHeaderRec);
	status = vsi_c_send(caller, queue_handle, &Message FILE_LINE_MACRO);
	TRACE_ASSERT(status == VSI_OK);
}

void
osx_send_prim(xSignalHeaderRec *prim_ptr, T_ENUM_OS_QUEUE queue_type)
{
	int_osx_send_prim(_osx_registry[queue_type].caller, prim_ptr,
			  _osx_registry[queue_type].queue_handle);
}