37 #include "esos_pc_stdio.h"
45 #include <sys/select.h>
55 void reverseString(
char *psz_s1,
char *psz_s2);
56 uint32_t randomNumInRange(uint32_t u32_lo, uint32_t u32_hi);
63 static uint8_t psz_CRNL[3]= {0x0D, 0x0A, 0};
67 uint32_t u32_myT1Count = 0;
71 struct stTask* pst_MyTasks[3];
84 __esos_tmrSvcsExecute();
104 uint32_t randomNumInRange(uint32_t u32_lo, uint32_t u32_hi) {
105 uint32_t u32_d1, u32_d2, u32_d4, u32_ret;
110 u32_ret = u32_lo + u32_d4;
111 if (u32_ret <= u32_hi)
return u32_ret;
115 u32_ret = u32_lo + u32_d2;
116 if (u32_ret <= u32_hi)
return u32_ret;
119 u32_ret = u32_lo + u32_d1;
120 if (u32_ret <= u32_hi)
return u32_ret;
148 static MAILMESSAGE st_Message;
158 ESOS_TASK_MAKE_MSG_UINT8(st_Message, u8_cnt);
166 printf(
"sender_A sending MESSAGE %d\n", u8_cnt);
167 ESOS_TASK_SEND_MESSAGE(hTask, &st_Message);
175 if (u8_cnt>50) u8_cnt=0;
187 static MAILMESSAGE stMsg;
200 __esos_ReadMailMessage(__pstSelf, &stMsg );
204 printf(
"Got a message from ");
205 if ( ESOS_IS_TASK_SENDER(hSenderA, stMsg) ) {
208 printf(
"UNKNOWN task: (%d)", ESOS_GET_MSG_FROMTASK(stMsg) );
210 printf (
" containing %d enroute time = %d ms\n", stMsg.au8_Contents[0],
esos_GetSystemTick()-stMsg.u32_Postmark );
256 __esos_unsafe_PutString( HELLO_MSG );