用户应用程序入口函数
/* 用户应用程序入口函数 */
static void AppSetupEntry(void)
{
TState state;
TError error;
/* 设置和 KEY 相关的外部中断向量 */
state = TclSetIrqVector(KEY_IRQ_ID, &EvbKeyISR, (TArgument)0,
(TThread*)0, &error);
TCL_ASSERT((state == eSuccess), "");
TCL_ASSERT((error == TCLE_IRQ_NONE), "");/* 初始化用户定时器 */
state = TclInitTimer(&LedTimer, TCLP_TIMER_PERIODIC,
TCL_MLS2TICKS(1000), &Blink, (TArgument)0,
&error);
TCL_ASSERT((state == eSuccess), "");
TCL_ASSERT((error == TCLE_TIMER_NONE), "");
/* 初始化 Led 线程 */
state = TclInitThread(&ThreadLed,
&ThreadLedEntry, (TArgument)0,
ThreadLedStack, THREAD_LED_STACK_BYTES,
THREAD_LED_PRIORITY, THREAD_LED_SLICE,
&error);
TCL_ASSERT((state == eSuccess), "");
TCL_ASSERT((error == TCLE_THREAD_NONE), "");
/* 激活 Led 线程 */
state = TclActivateThread(&ThreadLed, &error);
TCL_ASSERT((state == eSuccess), "");
TCL_ASSERT((error == TCLE_THREAD_NONE), "");
}
|