aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Palm/Platform/Core/System/IncsPrv/SerialLinkPrv.h
blob: b40614e1eb2d6ea39b9882c6835562374196be8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/******************************************************************************
 *
 * Copyright (c) 1994-1999 Palm Computing, Inc. or its subsidiaries.
 * All rights reserved.
 *
 * File: SerialLinkPrv.h
 *
 * Description:
 *		Private Serial Link includes
 *
 * History:
 *   	2/6/95 replaces DSerial.h from Debugger 
 *
 *****************************************************************************/

#ifdef	NON_PORTABLE

#ifndef __SERIALLINKPRV_H
#define __SERIALLINKPRV_H

#include <SerialLinkMgr.h>


//*************************************************************************
//  Misc Constants
//*************************************************************************
// Default timeout  value once into receiving a packet in ticks
#define		slkDefaultInPktTimeout		(sysTicksPerSecond*2)




/*******************************************************************
 * Serial Link Globals
 *
 *******************************************************************/
#define	slkMaxSockets		6						// max # of sockets
#define	slkMaxRefNums		slkMaxSockets		// max # of refNums in use at any one time
#define	slkAnySocket		0xFF		

#define	slkEmptyRefNum		0xFF					// used to track empty refInfos
#define	slkSendBufferSize	252

// We keep an array of these (slkMaxSockets in size) to track which
//  librarie's we've received packet headers for. Since we can have up
//  to slkMaxSockets unique refNums in use at any one time, we must make
//  the array at least that size.
typedef struct SlkRefInfoType {
	UInt16	refNum;									// refNum of library, or 0xFF if empty
	Int8		destID;									// dest socketID, or -1 if none
	UInt8 		padding;
	} SlkRefInfoType;
typedef SlkRefInfoType *SlkRefInfoPtr;	

typedef struct SlkGlobalsType {
	UInt16					openCount;
	
	UInt16					socketRefNum[slkMaxSockets];
	Boolean					socketOpen[slkMaxSockets];
	SlkSocketListenPtr	socketListenP[slkMaxSockets];
	UInt16					socketTimeout[slkMaxSockets];		// inPacket timeout
	
	
	// We can keep track of packets coming in for up to slkMaxRefNums libraries.
	//  This array holds the destination socket ID for packets received from
	//  each library.
	SlkRefInfoType			refInfo[slkMaxRefNums];
	
	UInt8						transId;					// next transaction ID
	UInt8 					padding;
	UInt32					xmitSemaphoreID;		// Semaphore ID for transmitting
	UInt16					numReceived;			// # of packets received since serial link
															// was opened.
	// New fields to buffer sends to prevent
	// the header, body and checksum from being
	// sent out as three distinct send requests.
	Boolean					socketWantsBuffering[slkMaxSockets];

	UInt8						*sendBufferP;				// Send buffer
	UInt16					sendBufferSize;			// Size of the allocated send buffer
	
	} SlkGlobalsType;

typedef SlkGlobalsType*	SlkGlobalsPtr;


	
#endif	//__SERIALLINKPRV_H

#endif 	//NON_PORTABLE