#ifndef __HX_TYPES_H__
#define __HX_TYPES_H__

#define HX_BYTE		unsigned char
#define HX_VOID		void
#define HX_HEX			unsigned int
#define HX_PTR			unsigned int
#define HX_BOOL		unsigned int
#define HX_TRUE		1
#define HX_FALSE		0
#define HX_FILE		int

#define HX_INT			signed int
#define HX_UINT		unsigned int

#define HX_INT8		signed char
#define HX_INT16		signed short
#define HX_INT32		signed long
#define HX_INT64		signed long long
#define HX_UINT8		unsigned char
#define HX_UINT16		unsigned short
#define HX_UINT32		unsigned long
#define HX_UINT64		unsigned long long

#define HX_STATUS		signed int
#define HX_OK			0
#define HX_DONE		0
#define HX_PASS		(-1)

#define HX_ERROR		(-1)
#define HX_STOP		(-2)
#define HX_WARN		(-4)

#define LIMITED_EVENT_LOCK				0x00
#define LIMITED_EVENT_UNLOCK			0x01

#define LIMITED_NONE	0
#define LIMITED_CHANNEL 1 //102
#define LIMITED_AGE 2	//96
#define PPV_PURCHASABLE	3

//================================================================================
#define MAX_NAME_COUNT	1

//#define MAX_SAT_NAME_LEN         32
#define MAX_SAT_NAME_LEN         64
#define MAX_GROUP_NAME_LENGTH    (32/*directory*/ + 32)
#define MAX_SERVICE_NAME_LEN		96 //DM_SI spec // Don't touch 
//#define MAX_SERVICE_NAME_LEN		32
#define MAX_PROVIDER_NAME_LEN		32	

#define MAX_TIME_REPRESENTATION_LEN	32

#define NTSC_WIDTH 	720
#define NTSC_HEIGHT	480

#define PRIVATE_DATA_MAX	3

#define SET_BIT_ONE(n,a)	( n | a )
#define SET_BIT_ZERO(n,a)	( n & (~(a)))

#define SAME_FREQUENCY_GAP	2500

#define is_same_frequency(f1, f2) \
	(((f1 > f2) ? (f1 - f2) : (f2 - f1)) < SAME_FREQUENCY_GAP ? HX_TRUE : HX_FALSE)	\

typedef struct _name_st {
	HX_UINT8 type;
	HX_UINT8 data[MAX_SERVICE_NAME_LEN+1];
	HX_INT16 len; 
} name_st;

typedef struct _name_list_st {
	name_st name[MAX_NAME_COUNT];
	HX_INT16 cnt;
} name_list_st;

typedef struct _private_data_st {
	HX_UINT8 tag;
	HX_UINT8 component_tag;
	HX_UINT16 pid;
	HX_UINT16 ecm_pid;
} private_data_st;

struct text_info_st {
	char table_type;
	short len;
	char *text;
};
//=======================================================

#endif

