#ifndef __TMPL_H__
#define __TMPL_H__

//By default, program compiled at IBM-compatible PC	has the address alignment issues which don't exist 
//in C51 environment. For convenience of data-handling,we use the compact-pack mode for storing the
//exchanging data-buffer used between PC and SenseLock EL device.For more ,pls refer to sample 17.

#ifdef _WIN32
#pragma pack(push, 1)
#endif 

#define IO_PACKAGE_HEADER_SIZE 2 // IO package header length:tag+len
#define MAX_IO_DATA_SIZE	0xf8 // maximum IO data size

#define SEC_FILE_ID 0x0132 // encrypted data file ID

/* command group definition */
#define CMD_CREATE_SEC_FILE 0x00  // for future use
#define CMD_USE_SEC_FILE 0x01
#define CMD_UPDATE_SEC_FILE 0x02 // for future use


/* en/decryption mode*/
#define DES_ENC_ECB 0x00
#define DES_DEC_ECB 0x01

#define TDES_ENC_ECB 0x04
#define TDES_DEC_ECB 0x05

/* common error code. */
#define ERR_SUCCESS				0x00	// success
#define ERR_SES					0x80	// SES function execution error
#define ERR_INVALID_PARAMETER	0x81	// invalid parameter

/* IO package */
typedef struct _IO_PACKAGE
{	
	unsigned char tag;	
	unsigned char len;
	unsigned char buff[MAX_IO_DATA_SIZE];
} IO_PACKAGE;

#ifdef _WIN32
#pragma pack(pop)
#endif


#endif //__TMPL_H__