#ifndef __TRAKR_H__ #define __TRAKR_H__ #include "svt.h" #include "JAPI.h" typedef long SVT_FileHandle; #define WIDTH 160 #define HEIGHT 120 typedef char * va_list; #define _INTSIZEOF(n) ((sizeof(n)+sizeof(int)-1)&~(sizeof(int)-1)) #define va_start(ap,v) (ap=(va_list)&v+_INTSIZEOF(v)) #define va_arg(ap,t) (*(t*)((ap+=_INTSIZEOF(t))-_INTSIZEOF(t))) #define va_end(ap) (ap=(va_list)0) // // Define routines // void SVT_PrepareApp( void ); void SVT_UnprepareApp( void ); // Time void SVT_Sleep( uint32 us ); void SVT_ResetTimer( void ); uint16 SVT_GetTimer( void ); // IR void SVT_OpenIRControl(); void SVT_SetIRState( bool state ); void SVT_CloseIRControl(); // Get Voltage / Current uint16 SVT_GetBatteryVoltage(); // // OSD // void SVT_Graphics_Open(); int SVT_Graphics_GetFrameCount(); void SVT_Graphics_DrawRectangle( uint8 x, uint8 y, uint8 w, uint8 h, Color c ); void SVT_Graphics_DrawBitmap( uint8 index, uint8 x, uint8 y ); void SVT_Graphics_Clear( ); void SVT_Graphics_Show( ); void SVT_Graphics_Close(); #define SVT_KEY_RUN (1<<0) #define SVT_KEY_SELECT (1<<0) #define SVT_KEY_MENU (1<<1) #define SVT_KEY_INPUT1 (1<<2) #define SVT_KEY_INPUT2 (1<<3) #define SVT_KEY_RIGHT_BACK (1<<4) #define SVT_KEY_RIGHT_FORWARD (1<<5) #define SVT_KEY_LEFT_BACK (1<<7) #define SVT_KEY_LEFT_FORWARD (1<<6) #define SVT_KEY_HOME (1<<8) int SVT_Key_GetStatus(); // Motor control void SVT_Motor_Open(); void SVT_Motor_SetLeft( int speed ); void SVT_Motor_SetRight( int speed ); void SVT_Motor_Close(); uint16 SVT_Motor_GetLeftCurrent(); uint16 SVT_Motor_GetRightCurrent(); // Logging void SVT_Log_Open(); void SVT_Log(String text, ... ); void SVT_Log_Close(); // File IO void SVT_FileSystem_Open(); void SVT_FileSystem_Close(); long SVT_File_Create( char* pathName ); long SVT_File_Delete( char* pathName ); SVT_FileHandle SVT_File_Open( char* filename ); void SVT_File_Close( SVT_FileHandle fh ); long SVT_File_Seek(SVT_FileHandle fh, long pos); long SVT_File_Read( SVT_FileHandle fh, void* buffer, uint32 bufferLength, uint32* bytesRead ); long SVT_File_Write( SVT_FileHandle fh, void* buffer, uint32 bufferLength, uint32* bytesRead ); long SVT_File_Flush( SVT_FileHandle fh ); //some of standar functions.. extern char stdout[]; /*********************************************************************** Name: SVT_Memory_Set_W Created: Kim Date: 2010.04.26 Limited: None Input: pDest:Save Buffer's pointer Data: The pointer's buffer need to be set's data. size:the Length of the buffer need to be copied Output: none Description: set memory by WORD. ***********************************************************************/ extern void SVT_Memory_Set_W(unsigned int *pDest, unsigned int Data,unsigned int size); /*********************************************************************** Name: SVT_Memory_Set_HW Created: Kim Date: 2010.04.26 Limited: None Input: pDest:Save Buffer's pointer Data: The pointer's buffer need to be set's data. size:the Length of the buffer need to be copied Output: none Description: set memory bye HALF WORD. ***********************************************************************/ extern void SVT_Memory_Set_HW(unsigned short *pDest, unsigned short Data,unsigned int size); /*********************************************************************** Name: SVT_Memory_Set Created: Kim Date: 2010.04.26 Limited: None Input: pDest:Save Buffer's pointer Data: The pointer's buffer need to be set's data. size:the Length of the buffer need to be copied Output: none Description: set memory. ***********************************************************************/ extern void SVT_Memory_Set(unsigned char *pDest,unsigned char Data,unsigned int size); /*********************************************************************** Name: SVT_Memory_Copy Created: Kim Date: 2010.04.26 Limited: None Input: pDest:Save Buffer's pointer psrc:Source Buffer's pointer size:the Length of the buffer need to be copied Output: none Description: Copy memory by BYTE. ***********************************************************************/ extern void SVT_Memory_Copy(unsigned char *pDest, const unsigned char *pSrc,unsigned int size); /*********************************************************************** Name: SVT_Mask_YUV Created: Kim Date: 2010.04.24 Limited: 1. just can mask YUV(W*H=160*120) Input: YUV: the source need to be masked. Cb_Factor: Cb's value will be equal Cb=Cb*Cb_Factor/64 Cr_Factor: Cr's value will be equal Cr=Cr*Cr_Factor/64 Output: None Description: Change Source YUV's Colors. ***********************************************************************/ extern void SVT_Mask_YUV(char * YUV, unsigned int Cb_Factor,unsigned int Cr_Factor); /*********************************************************************** Name: SVT_Print Created: Kim Date: 2010.04.24 Limited: 1. can't output floating(%f or %F) 2. can't output HEX more than (0x1<<31)(0x%x) 3. THE LENGTH MUST NOT MORE THAN 1024 Input: src:the pointer of char which is need to be calculated. Output: The length of the new String. Description: as the standar C's functions. ***********************************************************************/ extern int SVT_Print(char *string, ...); /*********************************************************************** Name: SVT_Char_To_WChar Created: Kim Date: 2010.04.24 Limited: THE LENGTH MUST NOT MORE THAN 512. Input: str:the char buffer pointer which need to translate. Output: the buffer pointer of new WString. Description: Translate the char to widechar. ***********************************************************************/ extern unsigned short* SVT_Char_To_WChar(const char* str); /*********************************************************************** Name: SVT_Str_Cmp Created: Kim Date: 2010.04.24 Limited: None. Input: cmp1:the 1st pointer of char which need to be compared. cmp2:the 2nd pointer of char which need to be compared. Output: false=not equal true=equal. Description: Compare 2 String whether they are equal. ***********************************************************************/ extern bool SVT_Str_Cmp(const char* cmp1, const char* cmp2); /*********************************************************************** Name: SVT_Str_Cpos Created: Kim Date: 2010.04.24 Limited: None. Input: dest:the pointer of char which is searched at its buffer. pos: the char which be searched. Output: -1. can't find it. other, the first position of pos@dest. Description: find the first char of pos@dest. ***********************************************************************/ extern int SVT_Str_Cpos(char *dest, char pos); /*********************************************************************** Name: SVT_Str_Pos Created: Kim Date: 2010.04.24 Limited: None. Input: dest:the pointer of char which is searched at its buffer. pos: the pointer of char which be searched. Output: -1. can't find it. other, the first position of pos@dest. Description: find the String of pos@dest. ***********************************************************************/ extern int SVT_Str_Pos(const char *dest, char *pos); /*********************************************************************** Name: SVT_Str_Length Created: Kim Date: 2010.04.24 Limited: None. Input: src:the pointer of char which is need to be calculated. Output: the length of the String. Description: calculate the length of the String. ***********************************************************************/ extern int SVT_Str_Length(const char * src); /*********************************************************************** ############### OSD(On Screen Display) ############### ***********************************************************************/ #define OSD_SENT 0x80000000 #define OSD_FAIL 0x80000001 #define OSD_NONE 0x80000002 #define OSD_OVER_FILE_SIZE 0x80000003 #define OSD_OVER_FILE_BUFFER_SIZE 0x80000003 typedef struct { unsigned char R; unsigned char G; unsigned char B; unsigned char Transparent; }TAG_COLOR; /*********************************************************************** Name: SVT_Osd_Pack_Bmps_Open Created: Kim Date: 2010.05.05 Limited: None Input: None Output: None Description: Open the function of pack bmps. should call this before using the function SVT_Osd_Draw_Bitmap. ***********************************************************************/ extern void SVT_Osd_Pack_Bmps_Open(void); /*********************************************************************** Name: SVT_Osd_Pack_Bmps Created: Kim Date: 2010.05.05 Limited: The count of files should be less than 256. Input: pFile_Addr: the address of the file's buffer. File_Size: the size of the file. Output: the Count of current files which are save in the Buffer. Description: save the address and size of the file into buffer. ***********************************************************************/ extern int SVT_Osd_Pack_Bmps(char *pFile_Addr, unsigned int File_Size); /*********************************************************************** Name: SVT_Osd_Pack_Bmps_Send Created: Kim Date: 2010.05.05 Limited: the buffer size should be less than 48K bytes. Input: None. Output: the Count of files which are save in the buffer. the bmp's Index equal this Count-1. Description: Pack the files into the buffer. ***********************************************************************/ extern int SVT_Osd_Pack_Bmps_Send(void); /*********************************************************************** Name: SVT_Osd_Pack_Bmps_Close Created: Kim Date: 2010.05.05 Limited: None Input: None. Output: OSD_NONE:no files in the buffer. OSD_FAIL:fail. OSD_SENT:successful Description: should call this code after using SVT_Osd_Pack_Bmps_Send ***********************************************************************/ extern void SVT_Osd_Pack_Bmps_Close(void); /*********************************************************************** Name: SVT_Osd_Open Created: Kim Date: 2010.05.05 Limited: None Input: None. Output: None. Description: Open the function On Screen Display(on car to draw); ***********************************************************************/ extern void SVT_Osd_Open(void); /*********************************************************************** Name: SVT_Osd_Close Created: Kim Date: 2010.05.05 Limited: None Input: None. Output: None. Description: Close the function On Screen Display(on car to draw); ***********************************************************************/ extern void SVT_Osd_Close(void); /*********************************************************************** Name: SVT_Osd_Set_Linewidth Created: Kim Date: 2010.05.05 Limited: the width should be from 1~10. Input: the Linewidth of the Draw_Rectangle's. Output: None. Description: set the Linewidth of the Draw_Rectangle's. ***********************************************************************/ extern void inline SVT_Osd_Set_Linewidth(unsigned int w); /*********************************************************************** Name: SVT_Osd_Get_Linewidth Created: Kim Date: 2010.05.05 Limited: none Input: None. Output: the Linewidth of the Draw_Rectangle's. Description: get the Linewidth of the Draw_Rectangle's. ***********************************************************************/ extern unsigned char inline SVT_Osd_Get_Linewidth(void); /*********************************************************************** Name: SVT_Osd_Draw_Rectangle Created: Kim Date: 2010.05.05 Limited: none Input: lx, left x ty, top y rx, right x by, bottom y. rgba the color of the Rectangle Output: none. Description: Draw the Rectangle to the buffer. ***********************************************************************/ extern void SVT_Osd_Draw_Rectangle( int lx, int ty, int rx, int by, TAG_COLOR *rgba); /*********************************************************************** Name: SVT_Osd_Clear_Rectangle Created: Kim Date: 2010.05.05 Limited: none Input: lx, left x ty, top y rx, right x by, bottom y. Output: none. Description: clear a Rectangle at drawing page's area(lx,ty,rx,by). ***********************************************************************/ extern void SVT_Osd_Clear_Rectangle( int lx, int ty, int rx, int by); /*********************************************************************** Name: SVT_Osd_Draw_Bitmap Created: Kim Date: 2010.05.05 Limited: none Input: BmpIndex, Index of the bmp file which need to be drew x, the position x y, the position y cTransparent, RGB is used for transparent's color. the Transparent is ignored. Output: none. Description: Draw a Bitmap to the buffer. ***********************************************************************/ extern void SVT_Osd_Draw_Bitmap( char BmpIndex, int x, int y, TAG_COLOR *cTransparent); /*********************************************************************** Name: SVT_Osd_Set_Text_Boundary Created: Kim Date: 2010.05.05 Limited: none Input: lx, the Left Boundary rx, the Right Boundary Output: none. Description: set the Boundary of the draw text. ***********************************************************************/ extern void SVT_Osd_Set_Text_Boundary(unsigned int lx,unsigned int rx); /*********************************************************************** Name: SVT_Osd_Set_Text_Interval Created: Kim Date: 2010.05.05 Limited: none Input: ci, the interval between the Characters at the same line li, the interval of the line. Output: none. Description: set the Intervals of the draw text. ***********************************************************************/ extern void SVT_Osd_Set_Text_Interval(unsigned int ci,unsigned int li); /*********************************************************************** Name: SVT_Osd_Set_Text_Color Created: Kim Date: 2010.05.05 Limited: none Input: c, the color of the String. Output: none. Description: set the color of the draw text. ***********************************************************************/ extern void SVT_Osd_Set_Text_Color(TAG_COLOR *c); /*********************************************************************** Name: SVT_Osd_Set_Text_Font Created: Kim Date: 2010.05.05 Limited: { unsigned int Count; //the first word is the count of Font's bitmap. unsigned int Offset[Count]; //the address offset of each bitmap. unsigned char Bitmap_s_binary[Count]; //bitmap's binary. } all of the bitmap are 1bit picture. Input: pcb, the address of the character bitmap's struct. clen, the length of the character bitmap's struct. Output: none. Description: must be set before using the SVT_Osd_Draw_Text function. ***********************************************************************/ extern void SVT_Osd_Set_Text_Font(char *pcb, unsigned int clen); /*********************************************************************** Name: SVT_Osd_Draw_Text Created: Kim Date: 2010.05.05 Limited: none Input: x, the position x y, the position y fmt, as the STD printf Output: none. Description: draw text from the position(x,y). ***********************************************************************/ extern int SVT_Osd_Draw_Text(int x, int y, char * fmt,...); /*********************************************************************** Name: SVT_Osd_Show Created: Kim Date: 2010.05.05 Limited: none Input: None. Output: none. Description: show the buffer to the screen. ***********************************************************************/ extern void SVT_Osd_Show(void); /*********************************************************************** Name: SVT_Osd_Yuv_Mask_Open Created: Kim Date: 2010.05.05 Limited: 1. just can mask YUV(W*H=160*120) Input: Cb_Factor: Cb's value will be equal Cb=Cb*Cb_Factor/64 Cr_Factor: Cr's value will be equal Cr=Cr*Cr_Factor/64 Output: none. Description: Change Source YUV's Colors. ***********************************************************************/ extern void SVT_Osd_Yuv_Mask_Open(unsigned int Cb, unsigned int Cr); /*********************************************************************** Name: SVT_Osd_Yuv_Mask_Close Created: Kim Date: 2010.05.05 Limited: none Input: None. Output: none. Description: Disable the function of function SVT_Osd_Yuv_Mask_Open. ***********************************************************************/ extern void SVT_Osd_Yuv_Mask_Close(void); /*********************************************************************** Name: SVT_Osd_Set_Screen Created: Kim Date: 2010.05.10 Limited: rgba the color of the screen. Input: None. Output: none. Description: set the drawing page's color ***********************************************************************/ extern void SVT_Osd_Set_Screen(TAG_COLOR *rgba); /*********************************************************************** Name: SVT_Osd_Clear_Screen Created: Kim Date: 2010.05.10 Limited: rgba the color of the screen. Input: None. Output: none. Description: clear the drawing page's ***********************************************************************/ extern void SVT_Osd_Clear_Screen(void); /*********************************************************************** Name: SVT_Osd_Set_Rectangle Created: Kim Date: 2010.05.10 Limited: lx, left x ty, top y rx, right x by, bottom y. rgba, the Rectangle(lx,ty,rx,by)'s color Input: None. Output: none. Description: Draw A Rectangle at drawing page's area(lx,ty,rx,by) with color rgba. ***********************************************************************/ extern void SVT_Osd_Set_Rectangle( int lx, int ty, int rx, int by, TAG_COLOR *rgba); extern void SVT_Osd_ScrollRectangle( int lx,int ty,int rx,int by, int mx,int my); /*********************************************************************** the same as OSD, R is short for remote. ***********************************************************************/ extern void SVT_ROsd_Pack_Bmps_Open(void); extern int SVT_ROsd_Pack_Bmps(char *pFile_Addr, unsigned int File_Size); extern int SVT_ROsd_Pack_Bmps_Send(void); extern void SVT_ROsd_Pack_Bmps_Close(void); extern void SVT_ROsd_Yuv_Mask_Open(unsigned int Cb, unsigned int Cr); extern void SVT_ROsd_Yuv_Mask_Close(void); extern void SVT_ROsd_Open(void); extern void SVT_ROsd_Show(void); extern void SVT_ROsd_Close(void); extern void SVT_ROsd_Draw_Rectangle( int lx, int ty, int rx, int by, TAG_COLOR *rgba); extern void SVT_ROsd_Clear_Rectangle( int lx, int ty, int rx, int by); extern int SVT_ROsd_Draw_Text(int x, int y, char * fmt,...); extern void SVT_ROsd_Draw_Bitmap( char BmpIndex, int x, int y, TAG_COLOR *cTransparent); extern void SVT_ROsd_Set_Screen(TAG_COLOR *rgba); extern void SVT_ROsd_Clear_Screen(void); extern void SVT_ROsd_Set_Rectangle( int lx, int ty, int rx, int by, TAG_COLOR *rgba); /*********************************************************************** Name: SVT_ROsd_Is_Cmd_Sent Created: Kim Date: 2010.05.24 Limited: none Input: None. Output: true the command has been sent. false is on the other side. Description: check the status of the command which is sent to the remoter. ***********************************************************************/ extern bool SVT_ROsd_Is_Cmd_Sent(void); /*********************************************************************** Name: SVT_ROsd_Send_Cmd Created: Kim Date: 2010.05.24 Limited: none Input: None. Output: none. Description: send the command to Remoter, it will NOT wait, only send 1 time. ***********************************************************************/ extern void SVT_ROsd_Send_Cmd(void); /*********************************************************************** Name: SVT_ROsd_Send_Cmd_Times Created: Kim Date: 2010.05.24 Limited: none Input: time: the repeat times of sending the same command to remote. Output: true: the command has been send to remote successful whitin the repeat(time). false:fail. Description: send the command to Remoter, it will WAIT, send (time)times. ***********************************************************************/ extern bool SVT_ROsd_Send_Cmd_Times(unsigned int time); extern void SVT_ROsd_ScrollRectangle( int lx,int ty,int rx,int by, int mx,int my); #define SVT_ROsd_Set_Linewidth(a) SVT_Osd_Set_Linewidth(a) #define SVT_ROsd_Get_Linewidth() SVT_Osd_Get_Linewidth() #define SVT_ROsd_Set_Text_Boundary(lx,rx) SVT_Osd_Set_Text_Boundary(lx,rx) #define SVT_ROsd_Set_Text_Interval(ci,li) SVT_Osd_Set_Text_Interval(ci,li) #define SVT_ROsd_Set_Text_Color(a) SVT_Osd_Set_Text_Color(a) #endif