📄 hostif_pc.c
字号:
/* * +-------------------------------------------------------------------+ * | Copyright (c) 1995,1996,1997 by Philips Semiconductors. | * | | * | This software is furnished under a license and may only be used | * | and copied in accordance with the terms and conditions of such a | * | license and with the inclusion of this copyright notice. This | * | software or any other copies of this software may not be provided | * | or otherwise made available to any other person. The ownership | * | and title of this software is not transferred. | * | | * | The information in this software is subject to change without | * | any prior notice and should not be construed as a commitment by | * | Philips Semiconductors. | * | | * | This code and information is provided "as is" without any | * | warranty of any kind, either expressed or implied, including but | * | not limited to the implied warranties of merchantability and/or | * | fitness for any particular purpose. | * +-------------------------------------------------------------------+ * * * Module name : HostIF_pc.c 1.11 * * Last update : 11:05:08 - 99/03/29 * * Title : Low level Win95 communication, TM-1 part * * Reviewed : * * Revision history : * * Description : * * This module is part of an implementation of the HostCall interface. * HostCall is the software component which is required by * the TCS toolset to adapt the programs generated by this toolset * to a specific host (see file HostCall.h in the TCS include dir). * * HostIF is one of two modules which form an implementation of * the HostCall interface (the other one is RPCClient), and provides * the necessary communication layer. * This communication layer consists of functions for sending and * receiving pointer values to/from the RPCServer running on the * host. * * The implementation of HostCall is partitioned between RPCClient * and HostIF as follows: * * - _HostCall_notify is provided in HostIF * - _HostCall_host_send is provided in RPCClient. * - _HostCall_init and -terminate are provided in RPCClient. * - Module RPCClient provides the general implementation strategy * and solves all cache problems. * - HostIF provides a simple communication interface for sending * pointers hence and forth. * - RPCClient communicates with a RPCServer on the host. * * More specific, HostIF should provide for the following: * * 1) It must implement functions _HostIF_init and _HostIF_term, * for whatever initialisation and termination is needed. * 2) It must implement a function _HostIF_send for sending a pointer * (to a command buffer) to the RPCServer on the host. * This function must return a success status. * 3) It must be able to receive similar pointers from the * RPCServer on the host, which must each be passed to a call * to function _RPCClient_notify. * 4) A debug print routine to whatever destination * * This is an HostIF implementation for communicating with * an RPCServer running on a PC under the Windows 95 OS. * This module is implemented on top of the TM Manager. *//*----------------------------includes----------------------------------------*/#include "HostIF.h"#include <stdarg.h>#include <tmlib/tmtypes.h>#include <tmlib/dprintf.h>#include "tmman.h"/*-----------------------------module state-----------------------------------*/#define HostCall_CHANNEL 1 /* Reserved tm manager channel */#define HostCall_CHANNEL_CAPACITY 16 /* This may be small, since the */ /* message will be 'quickly' */ /* taken by the server */static Pointer hostcall_channel; /* Created communication channel *//*----------------------------functions---------------------------------------*/ Bool _HostIF_send( Pointer command ){ TMSTD_PACKET packet; packet.dwCommand= (DWORD)command; return tmMsgSend(hostcall_channel, &packet) == TMOK;} /*--------------------------- Initialisation / Termination -------------------*/ static STATUS notify ( Pointer dummy, Pointer packet ) { Pointer command= *(Pointer*)packet; _RPCClient_notify( command ); return TMOK; }Bool _HostIF_init(){ TMMAN_MESSAGE_DESC MsgCreate; tmTMMANCreate(); MsgCreate.Slots = HostCall_CHANNEL_CAPACITY; MsgCreate.Callback = (DWORD)notify; MsgCreate.pContext = NULL; MsgCreate.ID = HostCall_CHANNEL; if ( tmMsgCreate ( &MsgCreate, &hostcall_channel ) != TMOK ) { return False; }; return True;}void _HostIF_term(){ tmMsgDestroy ( hostcall_channel ); tmTMMANDestroy();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -