📄 gsm_irq.c
字号:
#include <stdio.h>
main()
{
printf("------------------Start-------------------\n " ) ;
int buffer [511:0];
int i;
//gptimer1
*(volatile unsigned int *)(0x80000304) = 0x27;//40M分频最大值是3F,分频1M
*(volatile unsigned int *)(0x80000314) = 0x1206;//1M分频为4.615ms(216.68Hz)
*(volatile unsigned int *)(0x80000318) = 0xE;
/*every 4.615ms gernate a irq and give the irq sign*/
while (1)
{
if (1) //判断起始位
{
*(volatile unsigned int *)(0x80000318) = 0xF;//enable timer
//remain for reading data
/*while (i<the length of data)
{i = i + 1;
//write data to buffer
buffer[ i ] = *(volatile unsigned int *)(0x80000000)
}
*/
if((*(volatile unsigned int *)(0x80000318)&0x10))//达到4.615ms产生中断标志
{
*(volatile unsigned int *)(0x80000318) = 0xE;/*shut down the timer
read interrupt*/
*(volatile unsigned int *)(0x80000318) = *(volatile unsigned int *)(0x80000318) & 0xEF;//clear interrupt
printf("\n the data of buffer \n " ) ;
}
/* printf("%x\t",(*(volatile unsigned int *)(0x80000300)));
printf("%x\t",(*(volatile unsigned int *)(0x80000304)));
printf("%x\t",(*(volatile unsigned int *)(0x80000308)));
printf("%x\t",(*(volatile unsigned int *)(0x80000310)));
printf("%x\t",(*(volatile unsigned int *)(0x80000314)));
printf("%x\t",(*(volatile unsigned int *)(0x80000318)));
printf("%x\t",(*(volatile unsigned int *)(0x80000320)));
printf("%x\t",(*(volatile unsigned int *)(0x80000324)));
printf("%x\t",(*(volatile unsigned int *)(0x80000328)));
printf("\n" ) ;
*/
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -