#include #include #include "atom.h" #include "atomvm.h" #include "atomport.h" // #define UNIT_TESTS #ifdef UNIT_TESTS extern uint32_t test_start (void) ; #endif #define TEST_THREADS 51 #define TEST_STACK_BYTE_SIZE 0x10000 #define IDLE_STACK_BYTE_SIZE 0x10000 #define MONITOR_STACK_BYTE_SIZE 0x10000 static unsigned char idle_stack[IDLE_STACK_BYTE_SIZE] ; static unsigned char monitor_stack[MONITOR_STACK_BYTE_SIZE] ; static unsigned char test_stack[TEST_THREADS+1][TEST_STACK_BYTE_SIZE] ; static unsigned int test_counter[TEST_THREADS+1] = {0} ; static unsigned int test2_counter = 0 ; static unsigned int test3_counter = 0 ; static unsigned int test_isr_count = 0 ; static unsigned char test2_stack[TEST_STACK_BYTE_SIZE] ; static unsigned char test3_stack[TEST_STACK_BYTE_SIZE] ; static unsigned char test_idle_stack[TEST_STACK_BYTE_SIZE] ; static uint8_t test_prio[60] = { 001,010,100,200,250, 200,200,200,200,200, 150,150,150,150,150, 250,250,250,250,250, 101,102,103,104,105, 202,204,206,208,210, 150,150,150,150,150, 250,250,250,250,250, 121,122,123,124,125, 061,063,065,067,061, 150,150,150,150,150, 250,250,250,250,250 }; static uint32_t test_interv[60] = { 001,001,001,001,001, 002,003,004,005,006, 015,015,015,015,015, 025,024,023,022,021, 905,005,005,005,805, 050,051,052,053,054, 015,015,015,015,015, 025,024,023,022,021, 030,030,030,030,030, 070,071,072,073,474, 005,006,007,007,001, 001,001,003,003,005 }; ATOM_TCB test_tcb[TEST_THREADS+1] ; ATOM_TCB monitor_tcb ; ATOM_TCB test2_tcb ; ATOM_TCB test3_tcb ; ATOM_TCB test_idle_tcb ; DWORD WINAPI isr_thread_proc (LPVOID lpParameter) ; static HANDLE isr_thread_1 ; static HANDLE isr_thread_2 ; static HANDLE isr_thread_3 ; static HANDLE isr_thread_4 ; void monitor_thread (uint32_t parm) { CRITICAL_STORE; int i ; int c = 0 ; ATOM_TCB *tcb ; tcb = atomCurrentContext() ; for (;;) { CRITICAL_START(); printf("Monitor # %04d (%08d)\n", c++, atomTimeGet()) ; printf("-------------------------\n") ; for (i=0; i