📄 main.c
字号:
#include "System.h"
#include <stdio.h>
#include "main.h"
#include "sdi.h"
unsigned char MIDI_flg;
unsigned char *MIDIaddress;
unsigned long file_length;
//extern tHANDLE hFile;
unsigned t;
unsigned char tt[512];
void Main(void)
{
System_initial();
SDI_CardEnable();
//F_ReadSector(t,0,1,tt);
//Uart_Printf("[1:%x][2:%x][3:%x][4:%x]\n",tt[0],tt[1],tt[2],tt[3]);
Uart_Printf("MDT System Test=================================\n");
Uart_Printf("MDT EV Board Initial OK-------------------------------------\n");
while(1)
{
while(MIDI_flg==0)
{
System_Waiting();
}
if(MIDI_flg==1)
{
MIDIaddress = (U8 *)Sys_GetDownloadAddress();
file_length = Sys_GetDownloadFileSize();
MIDI_flg = 0;
}
}
}
void __irq IsrTimer0(void)
{
Uart_Printf("TTTT\n");
ClearPending(BIT_TIMER0);
Uart_Printf("Timer Interrupt!\n");
// MDT_ISR();
}
void __irq Isr_Eint0(void)
{
ClearPending(BIT_EINT0);//Clear INT2 flag.
//Uart_Printf("INT0 Interrupt!\n");
}
void __irq Isr_Eint4_23(void) // ARM Key S1
{
U8 i=0;
U32 fifo_size;
switch(rEINTPEND)
{
case 0x000010: // Function Selection, Key S1, EINT 4
Delay(3000);
Uart_Printf("S1\n");
rEINTPEND=(1<<4);
break;
case 0x000020://Function stop, Key S2, EINT 5
Delay(3000);
Uart_Printf("S2\n");
rEINTPEND=(1<<5);
break;
case 0x000040://Function Execution, Key S3, EINT 6
Delay(3000);
Uart_Printf("S3\n");
rEINTPEND=(1<<6);
break;
case 0x000080://Function Execution, Key S4, EINT 7
Uart_Printf("S4\n");
rEINTPEND=(1<<7);
break;
case 0x000100: // Function Selection
Delay(3000);
Uart_Printf("S5\n");
rEINTPEND=(1<<8);
break;
case 0x010000://Vol down
Delay(3000);
Uart_Printf("S6\n");
//Delay(3000);
rEINTPEND=(1<<16);
break;
case 0x020000://Vol down
Delay(3000);
Uart_Printf("S7\n");
rEINTPEND=(1<<17);
break;
case 0x040000://Vol down
Delay(3000);
Uart_Printf("S8\n");
rEINTPEND=(1<<18);
break;
default:
Uart_Printf("rEINTPEND == %06X \n",rEINTPEND);
rEINTPEND = 0xFFFFF0; //Clear External Interrupt Pending Register .
break;
}
ClearPending(BIT_EINT8_23);
ClearPending(BIT_EINT4_7);
}
void ARM_MaskISR(void)
{
rINTMSK |= BIT_EINT2;
}
void ARM_UnMaskISR(void)
{
rINTMSK &= (~BIT_EINT2);
}
void ARM_SetGPB(U8 bitno, U8 hilo)
{
U32 output;
output = 1<<bitno;
if(hilo)
{
rGPBDAT |= output;
}else{
rGPBDAT &= (~output);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -