📄 bsp.c
字号:
/*
*********************************************************************************************************
* Atmel AT91
* EB40A Board Support Package
*
* (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
* All Rights Reserved
*
*
* File : BSP.C
* By : Jean J. Labrosse
*********************************************************************************************************
*/
#include "../ucos_ii/includes.h"
/*
*********************************************************************************************************
* BSP INITIALIZATION
*
* Description : This function should be called by your application code before you make use of any of the
* functions found in this module.
*
* Arguments : none
*********************************************************************************************************
*/
void BSP_Init (void)//在这里要禁止一切中断
{
at91_pio_open ( &PIO_DESC, LED_MASK, PIO_OUTPUT );
at91_irq_close(WDI_ID);//add by zxd
Tmr_TickInit();
}
/*
*********************************************************************************************************
* TICKER INITIALIZATION
*
* Description : This function is called to initialize uC/OS-II's tick source (typically a timer generating
* interrupts every 1 to 100 mS).
*
* Arguments : none
*
* Notes : TC0_CMR:
*
* B2 B1 B0 010 MCLK / 32
* B3 0 Counter is incremented on RISING edge
* B5 B4 00 Clock is NOT gated
* B6 0 Counter clock is NOT stopped on RC
* B7 0 Counter clock is NOT disabled on RC
*
* B9 B8 00 No externel event edge selection
* B11 B10 01 No externel event selection
* B12 0 External event has no effect on TIOA
* B14 1 RC Compare resets the counter and starts the counter clock
* B15 1 WAVEFORM mode is enabled
*
* B17 B16 10 Clear TIOA when RA compares
* B19 B18 01 Set TIOA when RC compares
* B21 B20 00 External event has NO effect on TIOA
* B23 B22 00 Software trigger has NO effect on TIOA
*
* B25 B24 10 Clear TIOA when RA compares
* B27 B26 01 Set TIOA when RC compares
* B29 B28 00 External event has NO effect on TIOA
* B31 B30 00 Software trigger has NO effect on TIOA
*********************************************************************************************************
*/
void Tmr_TickInit (void)
{
watchdog_init();
}
/*
*********************************************************************************************************
* TIMER #0 IRQ HANDLER
*
* Description : This function handles the timer interrupt that is used to generate TICKs for uC/OS-II.
*
* Arguments : none
*********************************************************************************************************
*/
void Tmr_TickISR_Handler (void)
{
volatile INT32U sr;
sr = WD_SR;
AIC_ICCR = 0x80;
AIC_EOICR = AIC_EOICR;
WD_CR = WD_RSTKEY ;
OSTimeTick(); /* If the interrupt is from the tick source, call OSTimeTick() */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -