36 #include "esos_pc_stdio.h"
39 #include <sys/select.h>
51 uint32_t randomNumInRange(uint32_t u32_lo, uint32_t u32_hi);
56 volatile uint32_t u32_T2Count;
57 volatile uint32_t u32_T3Count;
58 static uint8_t psz_T2Is[]=
"T2 is ";
59 static uint8_t psz_T3Is[]=
"T3 is ";
60 static uint8_t psz_Enabled[]=
"enabled.";
61 static uint8_t psz_Disabled[]=
"disabled.";
62 static uint8_t psz_CRNL[3]= {0x0D, 0x0A, 0};
66 uint32_t u32_myT1Count = 0;
70 struct stTask* pst_MyTasks[3];
82 static uint32_t u32_count, u32_tick;
88 __esos_tmrSvcsExecute();
95 uint32_t randomNumInRange(uint32_t u32_lo, uint32_t u32_hi) {
96 uint32_t u32_d1, u32_d2, u32_d4, u32_ret;
101 u32_ret = u32_lo + u32_d4;
102 if (u32_ret <= u32_hi)
return u32_ret;
104 U32_temp._uint32_t = u32_d4;
106 u32_ret = u32_lo + u32_d2;
107 if (u32_ret <= u32_hi)
return u32_ret;
110 u32_ret = u32_lo + u32_d1;
111 if (u32_ret <= u32_hi)
return u32_ret;
132 uint32_t u32_cnt1, u32_cnt2, u32_cnt3;
137 printf(
"A:%d\n", u32_cnt1++);
143 printf(
"B:%d\n", u32_cnt2++);
149 printf(
"C:%d\n", u32_cnt3++);
158 u32_rnd = 100*randomNumInRange(1, 30);
159 printf(
"T1 (%d)\n", u32_rnd);
170 u32_rnd = 100*randomNumInRange(1, 30);
171 printf(
"T2 (%d)\n", u32_rnd);
182 u32_rnd = 100*randomNumInRange(1, 30);
183 printf(
"T3 (%d)\n", u32_rnd);
203 static uint32_t u32_RandomNumber;
204 static uint8_t u8_RandomNumber;
256 static uint32_t u32_RandomNumber;
257 static uint8_t u8_RandomNumber;
320 if (tmrhnd_ret == ESOS_TMR_FAILURE) {
351 if ((u8_char >=
'a') && (u8_char <=
'z') )
352 u8_char = u8_char -
'a' +
'A';
374 if ((au8_x[u8_i] >=
'a') && (au8_x[u8_i] <=
'z') )
375 au8_y[u8_i] = au8_x[u8_i] -
'a' +
'A';
377 au8_y[u8_i] = au8_x[u8_i];
378 if (au8_x[u8_i] == 0)
break;
393 static
char* sz_in[257];
394 static char* sz_out[257];
402 reverseString( sz_in, sz_out );
422 void reverseString(
char *psz_s1,
char *psz_s2) {
430 while (*psz_s1end) psz_s1end++;
433 while (psz_s1end != psz_s1) {
434 *psz_s2 = *psz_s1end;
439 *psz_s2 = *psz_s1end;
483 __esos_hw_PutString( HELLO_MSG );