/*************************************************
Function name: 这是基础实验的一个模版
Parameter : 无
Description : 做基础实验,直接调用该模板即可
Return : 无
Argument : 无
Autor & date : Daniel
**************************************************/
#define GLOBAL_CLK 1
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "2440slib.h"
#include "mmu.h"
#include "profile.h"
#include "memtest.h"
#define LED1_ON ~(1<<5)
#define LED2_ON ~(1<<6)
#define LED3_ON ~(1<<7)
#define LED4_ON ~(1<<8)
#define LED1_OFF (1<<5)
#define LED2_OFF (1<<6)
#define LED3_OFF (1<<7)
#define LED4_OFF (1<<8)
void delay(int times)
{
int i;
for(;times>0;times--)
for(i=0;i<400;i++);
}
void set_gpio_led(void)
{
rGPBCON &=~((3<<10)|(3<<12)|(3<<14)|(3<<16));
rGPBCON |= (1<<10)|(1<<12)|(1<<14)|(1<<16);
}
void Led_on_all(void)
{
rGPBDAT = rGPBDAT &(LED1_ON)&(LED1_ON)&(LED2_ON)&(LED3_ON)&(LED4_ON);
}
void Led_off_all(void)
{
rGPBDAT = rGPBDAT|(LED1_OFF)|(LED2_OFF)|(LED3_OFF)|(LED4_OFF);
}
void Main(void)
{
set_gpio_led();
while(1)
{
delay(1000);
Led_on_all();
delay(1000);
Led_off_all();
}
}
|