📄 main.c
字号:
*/
static void AppTask4 (void *pdata)
{
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task4Ctr++;
#ifdef LOGGING
printf("App4\r\n");
#endif
OSTimeDly(1000); /* Delay task execution for one clock tick */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #5
*
* Description : This is an example of a task.
* Arguments : pdata is the argument passed to 'AppTask2()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'pdata' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTask5 (void *pdata)
{
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task5Ctr++;
#ifdef LOGGING
printf("App5\r\n");
#endif
OSTimeDly(500); /* Delay task execution for one clock tick */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #6
*
* Description : This is an example of a task.
* Arguments : pdata is the argument passed to 'AppTask2()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'pdata' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTask6 (void *pdata)
{
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task6Ctr++;
#ifdef LOGGING
printf("App6\r\n");
#endif
OSTimeDly(100); /* Delay task execution for one clock tick */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #7
*
* Description : This is an example of a task.
* Arguments : pdata is the argument passed to 'AppTask2()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'pdata' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTask7 (void *pdata)
{
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task7Ctr++;
#ifdef LOGGING
printf("App7\r\n");
#endif
OSTimeDly(150); /* Delay task execution for one clock tick */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #8
*
* Description : This is an example of a task.
* Arguments : pdata is the argument passed to 'AppTask2()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'pdata' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTask8 (void *pdata)
{
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task8Ctr++;
#ifdef LOGGING
printf("App8\r\n");
#endif
OSTimeDly(750); /* Delay task execution for one clock tick */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #9
*
* Description : This is an example of a task.
* Arguments : pdata is the argument passed to 'AppTask2()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'pdata' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTask9 (void *pdata)
{
#ifdef LOGGING
char temp[40];
#endif
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task9Ctr++;
#ifdef LOGGING
printf("App9\r\n");
#endif
OSTimeDly(200); /* Delay task execution for one clock tick */
}
}
/*$PAGE*/
/*
*********************************************************************************************************
* TASK #10
*
* Description : This is an example of a task.
* Arguments : pdata is the argument passed to 'AppTask2()' by 'OSTaskCreate()'.
* Notes : 1) The first line of code is used to prevent a compiler warning because 'pdata' is not
* used. The compiler should not generate any code for this statement.
* 2) Interrupts are enabled once the task start because the I-bit of the CCR register was
* set to 0 by 'OSTaskCreate()'.
*********************************************************************************************************
*/
static void AppTask10 (void *pdata)
{
#ifdef SEM_TEST
INT8U err;
#endif
pdata = pdata;
/*---- Task initialization code goes HERE! --------------------------------------------------------*/
while (TRUE) { /* Task body, always written as an infinite loop. */
/*---- Task code goes HERE! -------------------------------------------------------------------*/
Task10Ctr++;
#ifdef LOGGING
printf("App10*******\r\n");
#endif
OSTimeDly(500); /* Delay task execution for one clock tick */
}
}
/*******************************************************************************/
/* Function name:
/*
/* timerInit
/*
/* Description:
/*
/* Initialize ColdFire hardware timer. There are two available timers,
/* although one timer will be allocated to the RTOS.
/*
/*******************************************************************************/
void timerInit(uint32 ticksPerSec,
void *pTimerISR)
{
// write uart ISR into vector tbl.
pEVT->Level[EVT_LEVEL_6] = (uint32)pTimerISR;
// TIMER 1: autovectored, level 6, priority 1
pIMM->sim.ICR9 = ( 0
| mcf5206e_SIM_ICR_AVEC
| mcf5206e_SIM_ICR_IL(6)
| mcf5206e_SIM_ICR_IP(1));
//Setup Timer
pIMM->timer.TMR1 = mcf5206e_TIMER_TMR_CLK_STOP; // input clock bits = 00 to stop timer
pIMM->timer.TMR1 |= mcf5206e_TIMER_TMR_RST; // enable timer
pIMM->timer.TMR1 |= mcf5206e_TIMER_TMR_PS(0xff); // Set prescale to 1/256
//Set ORI and FRR bits
pIMM->timer.TMR1 |= mcf5206e_TIMER_TMR_ORI;
pIMM->timer.TMR1 |= mcf5206e_TIMER_TMR_FRR;
// set reference counter to produce specified tick rate
pIMM->timer.TRR1 = (uint16)(SYSCLK/(16*256*ticksPerSec));
// Reset counter
pIMM->timer.TCN1 = 0;
// Set Master_Clk/16 and start
pIMM->timer.TMR1 |= mcf5206e_TIMER_TMR_CLK_DIV16;
// unmask the timer interrupt in IMR
pIMM->sim.IMR &= (uint16)~mcf5206e_SIM_IMR_T1;
return;
}
/*******************************************************************************/
/* Function name:
/*
/* evtInit
/*
/* Description:
/*
/* Initialize CPU's Exception Vector Table.
/*
/*******************************************************************************/
void evtInit(void)
{
uint32 *vector = 0;
// move VBR to start of RAM address space
asm {
MOVE.L #EVT_ADDRESS,D0
MOVEC D0, VBR
}
for (vector = (uint32 *)pEVT;
(uint32)vector < ((uint32)pEVT + 1024);
(uint32)vector++) {
// *vector = (uint32) // TODO: insert default exception handler here!!!;
}
/* Setup the context switch exception */
pEVT->Trap[15] = (uint32)&OSCtxSw;
return;
}
/*******************************************************************************/
/* Function name:
/*
/* isrGeneric
/*
/* Description:
/*
/* Generic ISR processing routine, called by assembly ISR stub.
/*
/*******************************************************************************/
void isrGeneric(void)
{
// this is where you do your ISR-specific processing
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -