📄 app.c
字号:
Str_Copy(AppUserIFLine1, " Micrium uC/OS-II ");
Str_Copy(AppUserIFLine2, "on the LuminaryMicro");
Str_Copy(AppUserIFLine3, " EK-LM3S6965 ");
Str_Copy(AppUserIFLine4, " (ARM Cortex-M3) ");
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 8);
OSRAM128x64x4StringDraw((char *)AppUserIFLine3, 0, ROW2_Y, 5);
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 2);
}
static void AppDispScr_VersionTickRateCPU (void)
{
CPU_INT32U value;
Str_Copy(AppUserIFLine1, " uC/OS-II: Vx.yy ");
value = (CPU_INT32U)OSVersion();
AppUserIFLine1[14] = value / 100 + '0';
AppUserIFLine1[16] = (value % 100) / 10 + '0';
AppUserIFLine1[17] = (value % 10) + '0';
Str_Copy(AppUserIFLine2, " TickRate: xxxx Hz ");
value = (CPU_INT32U)OS_TICKS_PER_SEC;
AppFormatDec(&AppUserIFLine2[12], value, 4);
Str_Copy(AppUserIFLine3, " CPU Usage: xxx % ");
value = (CPU_INT32U)OSCPUUsage;
AppUserIFLine3[13] = (value / 100) + '0';
AppUserIFLine3[14] = (value % 100) / 10 + '0';
AppUserIFLine3[15] = (value ) % 10 + '0';
Str_Copy(AppUserIFLine4, " CPU Speed: xx MHz ");
value = (CPU_INT32U)SysCtlClockGet() / 1000000L;
AppUserIFLine4[13] = (value / 10) + '0';
AppUserIFLine4[14] = (value % 10) + '0';
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 8);
OSRAM128x64x4StringDraw((char *)AppUserIFLine3, 0, ROW2_Y, 5);
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 2);
}
static void AppDispScr_CtxSw (void)
{
CPU_INT32U value;
Str_Copy(AppUserIFLine1, " Number of Ticks: ");
Str_Copy(AppUserIFLine2, " xxxxxxxx ");
value = (CPU_INT32U)OSTime;
AppFormatDec(&AppUserIFLine2[6], value, 8);
Str_Copy(AppUserIFLine3, "Num. of Context Sw.:");
Str_Copy(AppUserIFLine4, " xxxxxxxx ");
value = (CPU_INT32U)OSCtxSwCtr;
AppFormatDec(&AppUserIFLine4[6], value, 8);
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine3, 0, ROW2_Y, 8);
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 8);
}
static void AppDispScr_Inputs (void)
{
CPU_INT32U value;
CPU_CHAR str[4];
Str_Copy(AppUserIFLine1, " Button Status: ");
Str_Copy(AppUserIFLine2, " xxx ");
value = (CPU_INT32U)Probe_B2Counts;
AppFormatDec(&AppUserIFLine2[9], value, 3);
Str_Copy(AppUserIFLine3, " yyy xxx zzz ");
value = (CPU_INT32U)Probe_B4Counts;
AppFormatDec(&AppUserIFLine3[3], value, 3);
value = (CPU_INT32U)Probe_B1Counts;
AppFormatDec(&AppUserIFLine3[9], value, 3);
value = (CPU_INT32U)Probe_B5Counts;
AppFormatDec(&AppUserIFLine3[15], value, 3);
Str_Copy(AppUserIFLine4, " xxx ");
value = (CPU_INT32U)Probe_B3Counts;
AppFormatDec(&AppUserIFLine4[9], value, 3);
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 11);
if (Probe_B2 == DEF_TRUE) {
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 11);
} else {
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 2);
}
Str_Copy(str, " ");
value = (CPU_INT32U)Probe_B4Counts;
AppFormatDec(&str[0], value, 3);
if (Probe_B4 == DEF_TRUE) {
OSRAM128x64x4StringDraw((char *)str, 6 * 3, ROW2_Y, 11);
} else {
OSRAM128x64x4StringDraw((char *)str, 6 * 3, ROW2_Y, 2);
}
Str_Copy(str, " ");
value = (CPU_INT32U)Probe_B1Counts;
AppFormatDec(&str[0], value, 3);
if (Probe_B1 == DEF_TRUE) {
OSRAM128x64x4StringDraw((char *)str, 6 * 9, ROW2_Y, 11);
} else {
OSRAM128x64x4StringDraw((char *)str, 6 * 9, ROW2_Y, 2);
}
Str_Copy(str, " ");
value = (CPU_INT32U)Probe_B5Counts;
AppFormatDec(&str[0], value, 3);
if (Probe_B5 == DEF_TRUE) {
OSRAM128x64x4StringDraw((char *)str, 6 * 15, ROW2_Y, 11);
} else {
OSRAM128x64x4StringDraw((char *)str, 6 * 15, ROW2_Y, 2);
}
if (Probe_B3 == DEF_TRUE) {
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 11);
} else {
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 2);
}
}
#if (uC_PROBE_COM_MODULE > 0) && \
(PROBE_COM_STAT_EN > 0)
static void AppDispScr_Probe (void)
{
CPU_INT32U value;
Str_Copy(AppUserIFLine1, " Rx: yyyyyyyyyy ");
value = (CPU_INT32U)ProbeRS232_RxCtr;
AppFormatDec(&AppUserIFLine1[7], value, 10);
Str_Copy(AppUserIFLine2, " RxPkt: xxxxxxxx ");
value = (CPU_INT32U)ProbeCom_RxPktCtr;
AppFormatDec(&AppUserIFLine2[9], value, 8);
Str_Copy(AppUserIFLine3, " Tx: yyyyyyyyyy ");
value = (CPU_INT32U)ProbeRS232_TxCtr;
AppFormatDec(&AppUserIFLine3[7], value, 10);
Str_Copy(AppUserIFLine4, " TxPkt: xxxxxxxx ");
value = (CPU_INT32U)ProbeCom_TxPktCtr;
AppFormatDec(&AppUserIFLine4[9], value, 8);
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine3, 0, ROW2_Y, 8);
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 8);
}
#endif
#if (uC_TCPIP_MODULE > 0)
static void AppDispScr_Tcpip (void)
{
Str_Copy(AppUserIFLine1, " Total TX Packets ");
Str_Copy(AppUserIFLine2, " xxxxxxxx ");
AppFormatDec(&AppUserIFLine2[6], NetNIC_StatTxPktCtr, 8);
Str_Copy(AppUserIFLine3, " Total RX Packets ");
Str_Copy(AppUserIFLine4, " xxxxxxxx ");
AppFormatDec(&AppUserIFLine4[6], NetNIC_StatRxPktCtr, 8);
if (NetNIC_ConnStatus == DEF_OFF) {
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 3);
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 3);
OSRAM128x64x4StringDraw((char *)AppUserIFLine3, 0, ROW2_Y, 3);
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 3);
} else {
OSRAM128x64x4StringDraw((char *)AppUserIFLine1, 0, ROW0_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine2, 0, ROW1_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine3, 0, ROW2_Y, 11);
OSRAM128x64x4StringDraw((char *)AppUserIFLine4, 0, ROW3_Y, 11);
}
}
#endif
/*
*********************************************************************************************************
* FORMAT A DECIMAL VALUE
*
* Description: This function converts a decimal value to ASCII (with leading zeros)
*
* Arguments : s is a pointer to the destination ASCII string
* value is the value to convert (assumes an unsigned value)
* digits is the desired number of digits
*
* Returns : none
*********************************************************************************************************
*/
static void AppFormatDec (CPU_INT08U *s, CPU_INT32U value, CPU_INT08U digits)
{
CPU_INT08U i;
CPU_INT32U mult;
mult = 1;
for (i = 0; i < (digits - 1); i++) {
mult *= 10;
}
while (mult > 0) {
*s++ = value / mult + '0';
value %= mult;
mult /= 10;
}
}
static void AppFormatHex (CPU_INT08U *s, CPU_INT32U value, CPU_INT08U digits)
{
CPU_INT08U i;
CPU_INT32U mult;
CPU_INT32U temp;
mult = 1;
for (i = 0; i < (digits - 1); i++) {
mult *= 16;
}
while (mult > 0) {
temp = value / mult;
switch (temp) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
*s++ = temp + '0';
break;
case 10:
*s++ = 'A';
break;
case 11:
*s++ = 'B';
break;
case 12:
*s++ = 'C';
break;
case 13:
*s++ = 'D';
break;
case 14:
*s++ = 'E';
break;
case 15:
*s++ = 'F';
break;
}
value %= mult;
mult /= 16;
}
}
void __error__(char *pcFilename, unsigned long ulLine)
{
;
}
/*
*********************************************************************************************************
* APPLICATION-DEFINED HOOKS
*
* Description: These functions are called by the hooks in os_cpu_c.c.
*
* Returns : none
*********************************************************************************************************
*/
#if (OS_APP_HOOKS_EN > 0)
void App_TaskCreateHook (OS_TCB *ptcb)
{
#if (uC_PROBE_OS_PLUGIN > 0) && (OS_PROBE_HOOKS_EN > 0)
OSProbe_TaskCreateHook(ptcb);
#endif
}
void App_TaskDelHook (OS_TCB *ptcb)
{
(void)ptcb;
}
#if OS_VERSION >= 251
void App_TaskIdleHook (void)
{
}
#endif
void App_TaskStatHook (void)
{
}
#if OS_TASK_SW_HOOK_EN > 0
void App_TaskSwHook (void)
{
#if (uC_PROBE_OS_PLUGIN > 0) && (OS_PROBE_HOOKS_EN > 0)
OSProbe_TaskSwHook();
#endif
}
#endif
#if OS_VERSION >= 204
void App_TCBInitHook (OS_TCB *ptcb)
{
(void)ptcb;
}
#endif
#if OS_TIME_TICK_HOOK_EN > 0
void App_TimeTickHook (void)
{
#if (uC_PROBE_OS_PLUGIN > 0) && (OS_PROBE_HOOKS_EN > 0)
OSProbe_TickHook();
#endif
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -