anyka systerm :
1.如此预编译定义方式
#if defined(SDRAM_8M)
#define SDRAM_SIZE 0x800000 // 8Mbyte
#elif defined(SDRAM_16M)
#define SDRAM_SIZE 0x1000000 // 16Mbyte
#elif defined(SDRAM_32M)
#define SDRAM_SIZE 0x2000000 // 32Mbyte
#else
#define SDRAM_SIZE 0x1000000 // 16Mbyte, default option
#endif
2.如此switch case定义应用方式
#define CASEX_N(i) case i: return eSTANDBY_n_point_##i; break;
#define CASEX_S(i) case i: return eSTANDBY_s_point_##i; break;
int N_TO_IMG_ID(T_U8 i)
{
switch(i)
{
CASEX_N(0);CASEX_N(1);CASEX_N(2);CASEX_N(3);
CASEX_N(4);CASEX_N(5);CASEX_N(6);CASEX_N(7);
CASEX_N(8);CASEX_N(9);CASEX_N(10);CASEX_N(11);
CASEX_N(12);CASEX_N(13);CASEX_N(14);CASEX_N(15);
CASEX_N(16);CASEX_N(17);
default :
break;
}
}
int S_TO_IMG_ID (T_U8 i)
{
switch(i)
{
CASEX_S(0);CASEX_S(1);CASEX_S(2);CASEX_S(3);
CASEX_S(4);CASEX_S(5);CASEX_S(6);CASEX_S(7);
CASEX_S(8);CASEX_S(9);CASEX_S(10);CASEX_S(11);
CASEX_S(12);CASEX_S(13);CASEX_S(14);CASEX_S(15);
CASEX_S(16);CASEX_S(17);
default:
break;
}
}
T_VOID compass_standby_res_init()
{
T_U8 i;
if(N_res==AK_NULL)
{
N_res= (T_U8*)Fwl_Malloc(18*BUFF_SIZE);
AK_ASSERT_PTR_VOID(N_res, "initcall N_res: malloc error");
for(i = 0; i<18; i++)
{
T_AK_BMP bmp;
T_pCDATA p = GetAKBmp(AK_NULL, AK_TRUE, N_TO_IMG_ID(i), AK_NULL);
AkBmpGetFromString(p, &bmp);
memcpy((N_res+i*BUFF_SIZE), bmp.BmpData, BUFF_SIZE);
}
}
if(S_res==AK_NULL)
{
S_res= (T_U8*)Fwl_Malloc(18*BUFF_SIZE);
AK_ASSERT_PTR_VOID(S_res, "initcall S_res: malloc error");
for(i = 0; i<18; i++)
{
T_AK_BMP bmp;
T_pCDATA p = GetAKBmp(AK_NULL, AK_TRUE, S_TO_IMG_ID(i), AK_NULL);
AkBmpGetFromString(p, &bmp);
memcpy((S_res+i*BUFF_SIZE), bmp.BmpData, BUFF_SIZE);
}
}
}
阅读(574) | 评论(0) | 转发(0) |