void print_ready_queue() { int i = 0; rtx_dbug_outs((CHAR *) "Current Running Process: "); rtx_dbug_out_num(current_running_process->id); rtx_dbug_outs((CHAR *) "("); rtx_dbug_out_num(current_running_process->priority); rtx_dbug_outs((CHAR *) ")"); rtx_dbug_outs((CHAR *) "\r\n"); for (i; i < 5; i++) { rtx_dbug_outs((CHAR *) "Ready Queue Priority: "); rtx_dbug_out_char((CHAR) i + 48); rtx_dbug_outs((CHAR *) "\r\n"); if (ready_queue[i] == NULL) { rtx_dbug_outs((CHAR *) "Empty\r\n"); } else { rtx_dbug_outs((CHAR *) "Processes: "); struct PCB* temp = ready_queue[i]; while (temp != NULL) { rtx_dbug_out_num(temp->id); temp = temp->next; rtx_dbug_outs((CHAR *) ", "); } rtx_dbug_outs((CHAR *) "\r\n"); } rtx_dbug_outs((CHAR *) "\r\n"); } }
void uart() { struct io_message * msg = NULL; while(1) { #ifdef _IO_DEBUG rtx_dbug_outs((CHAR *) "Enter: uart - waiting for message\r\n"); #endif msg = (io_message *)receive_message(NULL); #ifdef _IO_DEBUG rtx_dbug_outs((CHAR *) "Enter: uart - received message\r\n"); #endif char_out = msg->msg[0]; release_memory_block((void *)msg); // irene said this is OK while( !(SERIAL1_UCSR & 4) ) { } // write data to port SERIAL1_WD = char_out; #ifdef _IO_DEBUG rtx_dbug_outs((CHAR *) "Writing data: "); rtx_dbug_out_char(char_out); rtx_dbug_outs((CHAR *) "\r\n"); #endif } }
void test3() { UINT8 tmp3; while (1) { rtx_dbug_out_char('3'); rtx_dbug_outs("\r\n"); g_test_fixture.receive_message(&tmp3); if(tmp3 == 4){ rtx_dbug_outs("3 Received Message From 4 \r\n"); }else{ rtx_dbug_outs("ERROR 34 \r\n"); } g_test_fixture.receive_message(&tmp3); if(tmp3 == 5){ rtx_dbug_outs("3 Received Message From 5 \r\n"); }else{ rtx_dbug_outs("ERROR 35 \r\n"); } // g_test_fixture.release_processor(); } }
void test4() { VOID * tmp41; UINT8 tmp4; while (1) { rtx_dbug_out_char('4'); rtx_dbug_outs("\r\n"); g_test_fixture.receive_message(&tmp4); if(tmp4 == 2){ rtx_dbug_outs("4 Received Message From 2 \r\n"); }else{ rtx_dbug_outs("ERROR 42 \r\n"); } tmp41 = g_test_fixture.request_memory_block(); g_test_fixture.send_message(3, tmp41); // g_test_fixture.release_processor(); } }
int32_t rtx_dbug_int(int32_t num) { if (num < 0) { rtx_dbug_out_char('-'); } return rtx_dbug_uint(abs(num)); }
/* third party dummy test process 4 */ void test4() { int sender; void* msg = g_test_fixture.receive_message(&sender); rtx_dbug_outs("Gid_test: TEST4 receives message from PID"); rtx_dbug_out_char(sender+48); rtx_dbug_outs("\r\n"); int pass = 0; int fail = 0; int state = 1; g_test_fixture.release_memory_block(msg); if (sender != 6) { state = 0; } int priority = g_test_fixture.get_process_priority(6); rtx_dbug_outs("Gid_test: TEST4 get TEST6 priority: "); rtx_dbug_out_char(priority + 48); rtx_dbug_outs("\r\n"); if (priority != 2) { state = 0; } if (state == 1) { pass++; } else { fail++; } void* newMsg = g_test_fixture.request_memory_block(); *((int*)newMsg + 25) = pass; *((int*)newMsg + 26) = fail; *((char*)newMsg + 64) = 'z'; rtx_dbug_outs("Gid_test: TEST4 sends message to PID1\r\n"); g_test_fixture.send_message(1, newMsg); while (1) { g_test_fixture.release_processor(); } }
void test3() { UINT8 tmp3; while (1) { rtx_dbug_out_char('3'); rtx_dbug_outs("\r\n"); g_test_fixture.release_processor(); } }
void test6() { while (1) { rtx_dbug_out_char('6'); rtx_dbug_outs("\r\n"); g_test_fixture.release_processor(); } }
/** * @brief: Prints a C-style null terminated string * @param: s the string to output to janusROM terminal */ SINT32 rtx_dbug_outs( CHAR* s ) { if ( s == NULL ) { return RTX_ERROR; } if (s[12] == '\r' || s[12] == '\n') { rtx_dbug_out_char('\r'); rtx_dbug_out_char('\n'); } else { while ( *s != '\0' ) { rtx_dbug_out_char( *s++ ); } } return RTX_SUCCESS; }
/** * @brief: Prints a C-style null terminated string * @param: s the string to output to janusROM terminal */ int32_t rtx_dbug_outs( char* s ) { if ( s == NULL ) { return RTX_ERROR; } while ( *s != '\0' ) { rtx_dbug_out_char( *s++ ); } return RTX_SUCCESS; }
void test4() { VOID * tmp41; UINT8 tmp4; while (1) { rtx_dbug_out_char('4'); rtx_dbug_outs("\r\n"); g_test_fixture.release_processor(); } }
void test5() { VOID * tmp51; while (1) { rtx_dbug_out_char('5'); rtx_dbug_outs("\r\n"); g_test_fixture.release_processor(); } }
void test1() { VOID * tmp; while (1) { rtx_dbug_out_char('1'); rtx_dbug_outs("\r\n"); UINT8 i; tmp = g_test_fixture.request_memory_block(); g_test_fixture.send_message(2, tmp); g_test_fixture.release_processor(); } }
void test2() { UINT8 tmp2; VOID * tmp21; while (1) { rtx_dbug_out_char('2'); rtx_dbug_outs("\r\n"); tmp21 = g_test_fixture.receive_message(&tmp2); if(tmp2 == 1){ rtx_dbug_outs("2 Received Message From 1 \r\n"); rtx_dbug_outs("Message Data "); rtx_dbug_out_char('0' + *((int *)tmp21 + 100 ) ); rtx_dbug_outs("\r\n"); g_test_fixture.release_memory_block(tmp21); } //g_test_fixture.release_processor(); } }
void test5() { VOID * tmp51; while (1) { rtx_dbug_out_char('5'); rtx_dbug_outs("\r\n"); tmp51 = g_test_fixture.request_memory_block(); g_test_fixture.send_message(3, tmp51); } }
int release_processor() { rtx_dbug_out_char('0' + g_current_process->m_process_ID); rtx_dbug_outs(" is attempting to release itself "); UINT32 *addr = 0; asm("move.l %a7, g_asmBridge"); addr = g_asmBridge + 0x8; g_asmBridge = g_asmBridge + 0xC; asm("move.l g_asmBridge, %a7"); g_asmBridge = *addr; asm("move.l (%a6), %a6"); asm("TRAP #0"); return 0; }
void test1() { VOID * tmp; while (1) { rtx_dbug_out_char('1'); rtx_dbug_outs("\r\n"); tmp = g_test_fixture.request_memory_block(); g_test_fixture.send_message(2, tmp); *((int *)tmp + 100 ) = 4; rtx_dbug_outs("1 Sent Message to 2 \r\n"); UINT8 i; for(i = 0; i < 33; i++){ rtx_dbug_outs("1 REQ MEM \r\n"); tmp = g_test_fixture.request_memory_block(); rtx_dbug_outs("1 GOT MEM \r\n"); } //g_test_fixture.release_processor(); } }
void test2() { UINT8 tmp2; VOID * tmp21; while (1) { rtx_dbug_out_char('2'); rtx_dbug_outs("\r\n"); g_test_fixture.receive_message(&tmp2); if(tmp2 == 1){ rtx_dbug_outs("2 Received Message From 1 \r\n"); tmp21 = g_test_fixture.request_memory_block(); g_test_fixture.send_message(4, tmp21); } //g_test_fixture.release_processor(); } }
/* third party dummy test process 1 */ void test1() { rtx_dbug_outs("Gid_test: START\r\n"); int sender; void* msg = g_test_fixture.receive_message(&sender); int pass = 0; int fail = 0; int state = 1; if (sender != 4) { rtx_dbug_outs("Gid_test: test 1 FAIL!\r\n"); fail = 1; pass = 0; } else { if (*((char*)msg + 64) != 'z') { fail = 1; rtx_dbug_outs("Gid_test: test 1 FAIL!!\r\n"); } else { pass = *((int*)msg+25); fail = *((int*)msg+26); if (pass == 1) { rtx_dbug_outs("Gid_test: test 1 OK\r\n"); } else { rtx_dbug_out_char(pass+48); rtx_dbug_outs("Gid_test: test 1 FAIL!!!\r\n"); } } } g_test_fixture.release_memory_block(msg); msg = g_test_fixture.receive_message(&sender); char content = *((char *)msg+64); if (sender == 2 && content == 'a') { rtx_dbug_outs("Gid_test: TEST1 received message from PID"); rtx_dbug_out_char(sender+48); rtx_dbug_outs("\r\n"); } else { rtx_dbug_outs("Gid_test: TEST1 received message from PID\r\n"); state = 0; } g_test_fixture.release_memory_block(msg); msg = g_test_fixture.receive_message(&sender); content = *((char *)msg+64); if (sender == 3 && content == 'b') { rtx_dbug_outs("Gid_test: TEST1 received message from PID"); rtx_dbug_out_char(sender+48); rtx_dbug_outs("\r\n"); } else { rtx_dbug_outs("Gid_test: TEST1 received message from PID\r\n"); state = 0; } g_test_fixture.release_memory_block(msg); msg = g_test_fixture.receive_message(&sender); content = *((char *)msg+64); if (sender == 2 && content == 'c') { rtx_dbug_outs("Gid_test: TEST1 received message from PID"); rtx_dbug_out_char(sender+48); rtx_dbug_outs("\r\n"); } else { rtx_dbug_outs("Gid_test: TEST1 received message from PID\r\n"); state = 0; } g_test_fixture.release_memory_block(msg); if (state == 1) { pass++; rtx_dbug_outs("Gid_test: test 2 OK\r\n"); } else { fail++; rtx_dbug_outs("Gid_test: test 2 FAIL\r\n"); } rtx_dbug_outs("Gid_test: "); rtx_dbug_out_char(pass+48); rtx_dbug_outs("/2 tests OK\r\n"); rtx_dbug_outs("Gid_test: "); rtx_dbug_out_char(fail+48); rtx_dbug_outs("/2 tests FAIL\r\n"); rtx_dbug_outs("Gid_test: END"); while (1) { g_test_fixture.release_processor(); } }