Files
diplomarbeit/Tester/SW/lib/BusProtocol/BpMessageFormat.h
T
Matthias 373a8c32b2 Added Software projects
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
2008-12-23 10:34:08 +00:00

103 lines
3.9 KiB
C

/* ---------------------------------------------------------------------------
* BpMessageFormat.h - v0.1 (c) 2008 Micro-key bv
* ---------------------------------------------------------------------------
* Micro-key bv
* Industrieweg 28, 9804 TG Noordhorn
* Postbus 92, 9800 AB Zuidhorn
* The Netherlands
* Tel: +31 594 503020
* Fax: +31 594 505825
* Email: support@microkey.nl
* Web: www.microkey.nl
* ---------------------------------------------------------------------------
* Description:
* ---------------------------------------------------------------------------
* Version(s): 0.1, Jan 29, 2008, FSc
* Creation.
* ---------------------------------------------------------------------------
*/
#ifndef __BPMESSAGEFORMAT_H__
#define __BPMESSAGEFORMAT_H__
/** \file BpMessageFormat.h
\brief
*/
/* ---------------------------------------------------------------------------
* System include files.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Application include files.
* ---------------------------------------------------------------------------
*/
#include "types.h"
/* ---------------------------------------------------------------------------
* Constant and macro definitions.
* ---------------------------------------------------------------------------
*/
#define BPMSG_STARTBYTE (0xAA)
#define BPMSG_MSGID_PASSTURN (0x00)
#define BPMSG_MSGID_RESETCLIENT (0x01)
#define BPMSG_MSGID_GIVEELECTRONICSTATUS (0x02)
#define BPMSG_MSGID_SETDACVALUE (0x03)
#define BPMSG_MSGID_SETDIGITALOUTVALUE (0x04)
#define BPMSG_MSGID_SETADCMODE (0x05)
#define BPMSG_MSGID_SETALLDIGITALOUT (0x06)
#define BPMSG_MSGID_SETALLDACVALUES (0x07)
#define BPMSG_MSGID_SETALLDOUTPUT (0x08)
#define BPMSG_MSGID_CALLRPC (0x10)
#define BPMSG_MSGID_GIVERPCRESULTS (0x11)
#define BPMSG_BROADCAST_ID (0xFF)
#define BPMSG_MASTER_DEVID (0x01)
#define BPMSG_STATUS_FINISHEDSENDING (0xC0)
#define BPMSG_STATUS_BUSYSENDING (0x40)
#define BPMSG_DACMODE_VOLTAGE (0x00)
#define BPMSG_DACMODE_CURRENT (0x01)
#define BPMSG_ADCMODE_VOLTAGE (0x00)
#define BPMSG_ADCMODE_CURRENT (0x01)
#define BPMSG_RPC_ERRORRESULT (0xFF)
#define BPMSG_UINT32_SIZE (4)
#define BPMSG_UINT16_SIZE (2)
#define BPMSG_UINT8_SIZE (1)
/* ---------------------------------------------------------------------------
* Type definitions.
* ---------------------------------------------------------------------------
*/
typedef struct t_BPMSG_MESSAGE {
UINT8 uniqueStartByte;
UINT8 senderId;
UINT8 targetId;
UINT8 packetNr;
UINT8 status;
UINT8 messageId;
UINT8 payloadSize;
UINT8 *payload;
UINT16 crc;
} t_bpmsg_message;
/* ---------------------------------------------------------------------------
* Variable declarations.
* ---------------------------------------------------------------------------
*/
/* ---------------------------------------------------------------------------
* Function declarations.
* ---------------------------------------------------------------------------
*/
/** \brief Calculates the CRC over payload and sets unique start byte */
void bpmsgEncodeMessage( t_bpmsg_message * msg );
void bpmsgAdd16bit(UINT8 *payloadlocation, UINT16 data);
void bpmsgAdd32bit(UINT8 *payloadlocation, UINT32 data);
UINT8 bpmsgGet8bit(UINT8 *payload, UINT8 *payloadIndex);
UINT16 bpmsgGet16bit(UINT8 *payload, UINT8 *payloadIndex);
UINT32 bpmsgGet32bit(UINT8 *payload, UINT8 *payloadIndex);
#endif /* __BPMESSAGEFORMAT_H__ */