#include "m9402.h" #define PST 10 #define SST 3 #define TST 10 #define RET 5 void mmi(int a) /*a:mode number P:honsen Q:sensor test R:kitei)*/ { extern unsigned int mmi_iivseg; extern char mmi_chase; int data[4];/*V kdcnumberREQEPEO*/ int data2[4]; int i; int dat; static int led; switch(a) { case 1:if(mmi_chase != 0) led = 0x80; else led = 0x00; if(sys9(2,5)!=0) led |= 0x40; break; case 2: if(led == 0x80) led = 0x40; else led = 0x80; break; case 3: if(sys9(5,1) > sys9(5,2))/*left_tire > right_tire*/ led=0x80; else led=0x40; if(sys9(5,1)==sys9(5,2)) led=0xc0; break; default: led=0; break; } dat = mmi_iivseg; /* for(i=0;i<4;i++) { data[i]= dat % 10; data[i]=(led | (i<<4) | data[i]); dat= dat / 10; outportb(PADR0,data[i]); }*/ for(i=0;i<4;i++) { data[i]= dat % 10; dat= dat / 10; } data[0]=(led | data[0]); outportb(PADR0,data[0]); for(i=1;i<4;i++) { data2[i]=(led | (i<<4) | data[i-1]); outportb(PADR0,data2[i]); data[i]=(led | (i<<4) | data[i]); outportb(PADR0,data[i]); } } void dsdata(); void wait() { if((inportb(EDRH)&0x80)==0x80) { sys4(6); dsdata(); } } void dsdata() { extern unsigned int mmi_iivseg; int mmi_mode; mmi_mode=(inportb(PBDR0) & 0x0f); sys8(6,1,mmi_mode); switch(mmi_mode){ case 0x00:sys1(0,1,0,0); sys2(1,PST,0,0);/*ps*/ sys2(2,SST,0,0);/*sss*/ sys2(3,TST,0,0);/*ts*/ sys2(5,RET,0,0);/*re*/ break; case 0x01:sys1(7,1,0,0); sys2(1,PST,0,0); sys2(2,SST,0,0); sys2(3,TST,0,0); sys2(5,RET,0,0); break; default:if(mmi_mode>=0x08) { sys1(8,1,0,0); sys2(5,RET,0,0); sys2(3,TST,0,0); } else if((0x07 >= mmi_mode)&&(mmi_mode >= 0x02)) { sys1(9,1,0,0); sys2(1,PST,0,0);/*ps*/ sys2(2,SST,0,0);/*sss*/ sys2(3,TST,0,0);/*ts*/ } break; } }