📄 mms_clib.h.new
字号:
#ifndef _MMS_CLIB_H_
#define _MMS_CLIB_H_
#include <string.h>
#include "mmscfg.h"
#ifdef _EASTCOM_MMS_SIMULATOR_
#include <stdio.h>
#include <stdlib.h>
#else
#ifdef NUCLEUS_MNT
#include <stdio.h>
#include <stdlib.h>
#else
#ifdef _CMS_VIRTUAL_FILE_SYSTEM_
#else
#ifndef MI_PC_SIMU
#include <ffs.h>
#else
#define TARGET 0
#include "ffs.h"
#endif
#ifndef __cplusplus
#ifndef MI_PC_SIMU
#define __cplusplus 0
#endif
#endif
#endif
#endif
#endif /* _EASTCOM_MMS_SIMULATOR_ */
#ifndef NEW_TIMER_INTERFACE
#define NEW_TIMER_INTERFACE //chenjun, use new timer i terface 20040213
#endif
/* BASIC DATA TYPE DEFINES */
typedef unsigned char MMS_U8; /*=== unsigned 8 bit data ===*/
typedef unsigned short MMS_U16; /*=== unsigned 16 bit data ===*/
typedef unsigned int MMS_U32; /*=== unsigned 32 bit data ===*/
//typedef unsigned long MMS_U64; /*=== unsigned 64 bit data ===*/
typedef char MMS_S8; /*=== signed 8 bit data ===*/
typedef short MMS_S16; /*=== signed 16 bit data ===*/
typedef int MMS_S32; /*=== signed 32 bit data ===*/
//typedef long MMS_S64; /*=== signed 64 bit data ===*/
//typedef long MMS_S64; /*=== signed 64 bit data ===*/
//typedef long MMS_S32; /*=== signed 64 bit data ===*/
typedef void MMS_VOID; /*=== MMS_VOID ===*/
typedef MMS_S32 MMS_BOOL;
typedef MMS_S32 MMS_COLOR;
#ifdef _EASTCOM_MMS_SIMULATOR_
typedef FILE* MMS_FILE;
#define MMS_SEEK_SET SEEK_SET
#define MMS_SEEK_CUR SEEK_CUR
#define MMS_SEEK_END SEEK_END
#else
#ifndef NUCLEUS_MNT
#ifdef _CMS_VIRTUAL_FILE_SYSTEM_
typedef FILE_HANDLE MMS_FILE;
#define MMS_SEEK_SET CMS_SEEK_SET
#define MMS_SEEK_CUR CMS_SEEK_CUR
#define MMS_SEEK_END CMS_SEEK_END
#else
typedef T_FFS_FD MMS_FILE;
#define MMS_SEEK_SET FFS_SEEK_SET
#define MMS_SEEK_CUR FFS_SEEK_CUR
#define MMS_SEEK_END FFS_SEEK_END
#endif
#else
typedef FILE* MMS_FILE;
#define MMS_SEEK_SET SEEK_SET
#define MMS_SEEK_CUR SEEK_CUR
#define MMS_SEEK_END SEEK_END
#endif
#endif/* _EASTCOM_MMS_SIMULATOR_ */
//added by JeffreyYao, 1-14-2004
#define MAX_STR_LEN 256
//#define MMS_RGB(r, g ,b) (MMS_U16)(((r/8)<<11)+((g/4)<<5)+(b/8))
#if __cplusplus
extern "C" {
#endif
/* define string process functions */
MMS_U32 MMS_strlen (const MMS_S8* str);
MMS_S8 *MMS_strstr (const MMS_S8 *str, const MMS_S8 *find);
MMS_S8 *MMS_strcpy (MMS_S8 *dst, const MMS_S8 *src);
MMS_S8 *MMS_strncpy (MMS_S8 *dst, const MMS_S8 *src, MMS_U32 num);
MMS_S32 MMS_strcmp (MMS_S8 *str1, const MMS_S8* str2);
MMS_S32 MMS_strncmp (MMS_S8 *str1, const MMS_S8 *str2, MMS_U32 num);
MMS_S32 MMS_strcasecmp (MMS_S8 *str1, MMS_S8 *str2);
MMS_S8 *MMS_strcat (MMS_S8 *str, const MMS_S8 *append);
MMS_S8 *MMS_strncat (MMS_S8 *str, const MMS_S8 *append, MMS_U32 num);
/* define memory process functions */
MMS_VOID *MMS_malloc_big(MMS_S32 line, MMS_U32 size);
MMS_VOID MMS_free_big(MMS_S32 line, MMS_VOID *ptr);
MMS_VOID MMS_memset(MMS_VOID *ptr, MMS_U8 value, MMS_U32 size);
MMS_VOID MMS_memcpy(MMS_VOID *dptr, MMS_VOID *sptr, MMS_U32 size);
MMS_VOID *MMS_remalloc(MMS_VOID *address, MMS_U16 oldsize, MMS_U16 size );
//MMS_VOID *MMS_malloc_big(MMS_S32 line, MMS_U32 size);
//MMS_VOID MMS_free_big(MMS_S32 line, MMS_VOID *ptr/*, MMS_S32 size*/);
MMS_VOID MMS_free_big2(MMS_VOID *ptr, MMS_S32 size);
/* define file process functions */
MMS_FILE MMS_fopen(MMS_S8 *filename, const MMS_S8 *option);
MMS_BOOL MMS_fclose(MMS_FILE fp);
MMS_U32 MMS_fread(MMS_VOID *buf, MMS_U32 size, MMS_U32 times, MMS_FILE fp);
MMS_U32 MMS_fwrite(MMS_VOID *buf, MMS_U32 size, MMS_U32 times, MMS_FILE fp);
MMS_S32 MMS_fseek(MMS_FILE fp, MMS_S32 size, MMS_S32 base);
MMS_S32 MMS_ftell(MMS_FILE fp);
MMS_S32 MMS_fstat(MMS_S8 *filename);
MMS_S32 MMS_deletefile(MMS_S8 *filename, MMS_S8 *pathname);
MMS_S32 MMS_deletefiles(MMS_S8 *pathname);
/* define other ansi c functions */
MMS_S8 *MMS_itoa (MMS_U32 value, MMS_S8 *buf, MMS_U32 radix);
MMS_S32 MMS_atol (MMS_S8 *str);
MMS_S32 MMS_getms();
MMS_S32 MMS_getrandstr(MMS_S8 *str);
MMS_S32 MMS_time_ltoa(MMS_U32 datetime, char *timestr);
MMS_S32 MMS_getsystemtime();
MMS_U8 sys_getcharwidth(MMS_U8 ch);
MMS_S32 MMS_char2utf8(MMS_S8 *strin, MMS_S8 *strout, MMS_S32 length);
MMS_S32 MMS_utf82char(MMS_S8 *strin, MMS_S8 *strout, MMS_S32 length);
MMS_U8 ECC_MidiStop(MMS_S8 *filename);//MMS_clib
MMS_U8 ECC_MidiPlay(MMS_S8 *filename, MMS_U8 loop);//MMS_clib.h
#ifndef _RELEASE_VERSION_
MMS_VOID ECC_Sleep(MMS_U32 ms);
#endif
MMS_VOID MMSSetImageData(MMS_U8 value);
#ifndef SUPPORT_JPEG//使用Eastcom库
MMS_S32 JPEGDrawE(MMS_S8 *filename, MMS_U32 x, MMS_U32 y, MMS_U32 w, MMS_U32 h);
MMS_S32 JPEGGetDimensionE(MMS_S8 *filename, MMS_S32 *w, MMS_S32 *h);
#endif
/*
Function:
MMSSaveImageData
History:
chenjun add for mobilesoft to save bmp data decoded from jpg or gif, 2004-01-12
INPUT:
pixelData: the bmp data need to be saved to buffer, format: if 24bits data, R(8 bits), G(8Bits), B(8Bits),
R(8 bits), G(8Bits), B(8Bits)...; if 8bits gray scale data, 8bits value, 8bits value....
pixelNum: pixel number need to be saved to buffer
pixelPos: the pixel's position in the buffer, begin from 0
pixelType:
0: RGB 24Bits bmp data;
1: 8 bits gray scale bmp data.
OUTPUT :
if return 0, the buffer is too small to save the BmpData, or the input pixelType is not defined;
if return 1, copy is OK
*/
MMS_U8 MMSSaveImageData(MMS_S8 *pixelData, MMS_U32 pixelNum, MMS_U32 pixelPos, MMS_U8 pixelType);
/*
Function:
MMSGetImageData
History:
chenjun add for mobilesoft to save bmp data decoded from jpg or gif, 2004-01-12
INPUT:
pixelPos: the first pixel's position in the buffer, begin from 0
pixelNum: pixel number need get
OUTPUT :
if return 0, there is not pixelNum pixels after pixelPos
else return the first pixel's poiter at the pixelPos
*/
MMS_S8 * MMSGetImageData(MMS_S32 pixelPos, MMS_U32 pixelNum);
/*
Function:
MMSBitBlt
History:
chenjun add for mobilesoft to draw bmp in the LCD, 2004-01-12
INPUT:
posX: where to draw
posY: where to draw
width:the width of the bmp
height:the height of the bmp
BmpPtr: the poitor to the bmp buffer
OUTPUT :
if return 0, the input par is wrong
if return 1, OK
*/
MMS_U8 MMSBitBlt( MMS_U32 posX,
MMS_U32 posY,
MMS_U32 width,
MMS_U32 height,
/*MMS_U32 in_Index,*/
MMS_VOID * BmpPtr
/*USHORT in_Rop*/);
/*
The following is ther timer interface to control autoplaying and GIF movie
*/
/*
Function:
MMS_settimer
History:
chenjun add and implement this function to create a timer and start it, 20040210
input:
value: timeout value
callback:the call back function to call when timeout
output: if success, return the timer's poiter andautomatically start it, else return NULL
*/
MMS_VOID *MMS_settimer(MMS_S32 value, MMS_VOID * callback);
/*
Function:
MMS_restarttimer
History:
chenjun implement this function 20040210
input:
timer: the timer want to be restarted
output:
0 if success
a value bigger than 0 if error occurs
*/
MMS_S32 MMS_restarttimer(MMS_VOID *timer); //chenjun, FIXME for timer
/*
Function:
MMS_resettimervalue
History:
chenjun implement this function 20040210
usage: to reset the timeout time for a timer and restart it, don't call stop before this function,
and don't call start after this function
input:
timer:the timer want to be reset
fast: the new timeout value
the timer will be reset and restarted after the call
output:
0 if success,
a value bigger than 0 if error occur,
*/
MMS_S32 MMS_resettimervalue(MMS_VOID *timer, MMS_S32 fast); //chenjun, FIXME for timer
/*
Function:
MMS_killtimer
History:
chenjun implement this function to delete a timer, 20040210
usage:
delete the timer and free the memory
input:
timer: the timer's poiter
output:
0 if success, the timer is set to NULL
a value bigger than iff error occur,
*/
MMS_S32 MMS_killtimer(MMS_VOID *timer); //chenjun, FIXME for timer
MMS_U8 IsMMSLoseFocus(MMS_VOID);
/*
Longqiang Liu 2004-03-03
type: int\char\char*\etc
size:
intent: in out inout
Variable(type,size,intent)
filename: (char* , filenamelen, in)
p_buffer: (char* , max_w*max_h, inout)
max_w: (int , 1, in) The maximum size that the "p_buffer" can hold
max_h: (int , 1, in) The maximum size that the "p_buffer" can hold
*width: (int* , 1, out)The actuaral size of the GIF,less or equal than max_w
*height: (int* , 1, out)The actuaral size of the GIF,less or equal than max_h
*/
MMS_S32 Get_Gif_First_Slide_Data(MMS_S8 *filename,
MMS_U8 *p_buffer,
MMS_S32 max_w,
MMS_S32 max_h,
MMS_S32 *width,
MMS_S32 *height);
MMS_VOID MMSDrawTitleBar(MMS_U8 curSlide, MMS_U8 slideNum, MMS_U8 audioFlag);
MMS_VOID MMSDrawScrollBar(MMS_U8 curPage, MMS_U8 pageNum);
/*
Longqiang Liu 2004-03-19
Adding the routine MMS_Get_Free_Space to retrieve the available Flash space size
*/
MMS_S32 MMS_Get_Free_Space(MMS_VOID);
/*
Longqiang Liu 2004-03-25
Adding the routine Eastcom_Jpeg_Delay to feed the Watchdog, because decoding JPEG
is much time-consuming.
returning 1 for success
and 0 for failure
*/
//MMS_S8 Eastcom_Jpeg_Delay();
//MMS_S8 Eastcom_Jpeg_Delay(MMS_U32 pos, MMS_U32 width);//解码的时候解一部分放一点
//MMS_S8 Eastcom_Jpeg_Delay(MMS_U32 pos, MMS_U32 line, MMS_U32 width);
MMS_S8 Eastcom_Jpeg_Delay(MMS_U32 pos, MMS_U32 line, MMS_U32 saved_line, MMS_U32 width, MMS_U32 height);
#if __cplusplus
}
#endif
#endif /* _MMS_CLIB_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -