?? test_func.c
字號:
#include "includes.h"
void myOSTimeDly (INT16U ticks)
{
/*OSTCBCur*/
OS_TCB *p=OSTCBCur;
if( ((OS_TCB*)0)==p)
{
ProgramError();
return;
}
OSTimeDly(ticks);
}
/* flash port*/
void Flash_Port(unsigned char port_,
unsigned char port_foot)
{
OS_ENTER_CRITICAL();
if(PORT_TO_FLASH_B==port_)
{
DDRB = 0xff;
PORTB = port_foot;
}else
{
DDRC = 0xff;
PORTC = port_foot;
}
OS_EXIT_CRITICAL();
Delay(DELAY_COUNT);
OS_ENTER_CRITICAL();
if(PORT_TO_FLASH_B==port_)
{
DDRB = 0xff;
PORTB = 0xff;
}else
{
DDRC = 0xff;
PORTC = 0xff;
}
OS_EXIT_CRITICAL();
Delay(DELAY_COUNT);
}
/* test timer isr,flash PORT C 2*/
void test_OSTickISR0()
{
unsigned char b1;
/*reset timer*/
TCNT0 =256-(7372800/50/1024); /* ; Reload timer to overflow at a rate of 50Hz*/
/*flash port A.2*/
FLASH_PORT_B2();
/*enable global interrupt*/
OS_EXIT_CRITICAL();
}
void Delay(int loop)
{
unsigned char i,j,k;
/* myOSTimeDly(1);return;*/
/* myOSTimeDly(OS_TICKS_PER_SEC); return;*/
for(i=1;i<loop;i++)
{
myOSTimeDly(1);
for(j=1;j;j++)
{
for(k=1;k;k++)
;
}
}
}
void Delay_Real(int loop)
{
unsigned char i,j,k;
for(i=1;i<loop;i++)
{
for(j=1;j;j++)
{
for(k=1;k;k++)
;
}
}
}
void Delay_error(int loop)
{ Delay_Real(loop);}
/*when reset,called
flash PORTA,PORTB,PORTC,PORTD */
void ProgramRest(int times)
{
int i;
for(i=0;i<times;i++)
{
DDRA = 0xff;
DDRB = 0xff;
DDRC = 0xff;
DDRD = 0xff;
PORTA=0;
PORTB=0;
PORTC=0;
PORTD=0;
Delay_Real(DELAY_COUNT_WHEN_RESET);
PORTA=0xff;
PORTB=0xff;
PORTC=0xff;
PORTD=0xff;
Delay_Real(DELAY_COUNT_WHEN_RESET);
}
}
/*when error,dead loop*/
void ProgramError()
{
while(1)
ProgramError_Times(1);
}
/*when reset,called*/
/*flash PORTA,PORTB*/
void ProgramError_Times(int times)
{
int i;
OS_ENTER_CRITICAL();
for(i=0;i<times;i++)
{
DDRA = 0xff;
DDRB = 0xff;
PORTA=0;
PORTB=0;
Delay_error(DELAY_COUNT);
DDRA = 0xff;
DDRB = 0xff;
PORTA=0xff;
PORTB=0xff;
Delay_error(DELAY_COUNT);
}
OS_EXIT_CRITICAL();
}
/*
********************************************************************************
* TASK SWITCH HOOK
*
* Description:
* This function is called when a task switch is performed. This allows you to
* perform other operations during a context switch.
*
* Arguments: none
*
* Note(s):
* 1) Interrupts are disabled during this call.
* 2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB
* of the task that will be 'switched in' (i.e. the highest priority task)
* and, 'OSTCBCur' points to the task being switched out (i.e. the
* preempted task).
********************************************************************************
*/
void OSTaskSwHook (void)
{
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -