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);
64 static uint8_t psz_CRNL[3]= {0x0D, 0x0A, 0};
68 uint32_t u32_myT1Count = 0;
72 struct stTask* pst_MyTasks[3];
85 __esos_tmrSvcsExecute();
105 uint32_t randomNumInRange(uint32_t u32_lo, uint32_t u32_hi) {
106 uint32_t u32_d1, u32_d2, u32_d4, u32_ret;
111 u32_ret = u32_lo + u32_d4;
112 if (u32_ret <= u32_hi)
return u32_ret;
116 u32_ret = u32_lo + u32_d2;
117 if (u32_ret <= u32_hi)
return u32_ret;
120 u32_ret = u32_lo + u32_d1;
121 if (u32_ret <= u32_hi)
return u32_ret;
148 static MAILMESSAGE st_Message;
159 ESOS_TASK_MAKE_MSG_UINT8(st_Message, u8_cnt);
168 printf(
"B0 sending MESSAGE %d\n", u8_cnt);
169 ESOS_TASK_SEND_MESSAGE(hTask, &st_Message);
171 printf(
"B0 doing useful work instead of mailing. Discarding MESSAGE %d.\n", u8_cnt );
175 if (u8_cnt>50) u8_cnt=0;
191 static MAILMESSAGE stMsg;
210 __esos_ReadMailMessage(__pstSelf, &stMsg );
211 printf(
"Got a message from ");
212 if ( ESOS_IS_TASK_SENDER( hSenderB0, stMsg) ) {
217 printf (
" containing %d enroute time = %d ms\n", stMsg.au8_Contents[0],
esos_GetSystemTick()-stMsg.u32_Postmark );
263 __esos_unsafe_PutString( HELLO_MSG );