1 #define _IFXMIPS_ADSL_APP
2 #define u32 unsigned int
3 #define IFXMIPS_MEI_DEV "/dev/ifxmips/mei"
12 #include <sys/types.h>
13 #include <sys/ioctl.h>
16 #include <asm/ifxmips/ifxmips_mei_app_ioctl.h>
17 #include <asm/ifxmips/ifxmips_mei_app.h>
18 #include <asm/ifxmips/ifxmips_mei_ioctl.h>
20 u16 Message[16]__attribute__ ((aligned(4)));
22 void makeCMV(u8 opcode, u8 group, u16 address, u16 index, int size, u16 * data);
23 void makeCMV(u8 opcode, u8 group, u16 address, u16 index, int size, u16 * data)
25 memset(Message, 0, 16*2);
26 Message[0]= (opcode<<4) + (size&0xf);
27 if(opcode == H2D_DEBUG_WRITE_DM)
28 Message[1]= (group&0x7f);
30 Message[1]= (((index==0)?0:1)<<7) + (group&0x7f);
33 if((opcode == H2D_CMV_WRITE)||(opcode == H2D_DEBUG_WRITE_DM))
34 memcpy(Message+4, data, size*2);
39 int main(int argc, char **argv)
43 u16 rt_buildcode_lsw=0, rt_buildcode_msw=0;
46 fd=open(IFXMIPS_MEI_DEV, O_RDWR);
48 printf("\n\n autoboot open device fail");
53 makeCMV(H2D_CMV_READ, INFO, 55, 0, 1, &temp);
54 if(ioctl(fd, IFXMIPS_MEI_CMV_WINHOST, &Message)<0){
55 printf("\n\n read INFO 55 0 fail");
58 rt_buildcode_lsw = Message[4];
60 makeCMV(H2D_CMV_READ, INFO, 55, 1, 1, &temp);
61 if(ioctl(fd, IFXMIPS_MEI_CMV_WINHOST, &Message)<0){
62 printf("\n\n read INFO 55 1 fail");
65 rt_buildcode_msw = Message[4];
67 rt_buildcode = rt_buildcode_lsw + (rt_buildcode_msw << 16);
68 printf("date: %d, month: %d, hour: %d, minute: %d\n",
69 (rt_buildcode >> 0) & 0xFF,
70 (rt_buildcode >> 8) & 0xFF,
71 (rt_buildcode >> 16) & 0xFF,
72 (rt_buildcode >> 25) & 0xFF