diff --git a/index.html b/index.html new file mode 100644 index 0000000..7fdf81a --- /dev/null +++ b/index.html @@ -0,0 +1,82 @@ + + + + + + + kelvinlawson/atomthreads @ GitHub + + + + + + + Fork me on GitHub + +
+ +
+ + + + +
+ +

atomthreads + by kelvinlawson

+ +
+ Lightweight, Portable RTOS Scheduler +
+ +

License

+

BSD

+

Authors

+

Kelvin Lawson (kelvinl@users.sf.net)

+

Contact

+

Kelvin Lawson (kelvinl@users.sf.net)

+ + +

Download

+

+ You can download this project in either + zip or + tar formats. +

+

You can also clone the project with Git + by running: +

$ git clone git://github.com/kelvinlawson/atomthreads
+

+ + + +
+ + + + diff --git a/ports/atomvm/atomvm.c b/ports/atomvm/atomvm.c index 8367d8d..c01c28d 100644 --- a/ports/atomvm/atomvm.c +++ b/ports/atomvm/atomvm.c @@ -554,9 +554,9 @@ atomvmEnterCritical () * \ingroup atomvm * \b atomvmCriticalCount * -* Rerurns the critical cont of the current context. +* Rerurns the critical count of the current context. * -* @return the critical cont of the current context. +* @return the critical count of the current context. */ int32_t atomvmCriticalCount () @@ -898,6 +898,7 @@ atomvmEventSend () uint32_t callbackInterruptWait (PATOMVM patomvm, PATOMVM_CALLBACK callback) { + //WaitForSingleObject (patomvm->atomvm_int_complete, INFINITE) ; return WaitForSingleObject (patomvm->atomvm_int, INFINITE) == WAIT_OBJECT_0 ; } @@ -942,12 +943,13 @@ callbackScheduleIpi (PATOMVM patomvm, PATOMVM_CALLBACK callback) PATOMVM_CALLBACK_IPI callback_ipi = (PATOMVM_CALLBACK_IPI)callback ; uint32_t res = 0 ; - if ((callback_ipi->target < ATOMVM_MAX_VM) && - (g_vms[callback_ipi->target] != patomvm) ) { + if (callback_ipi->target < ATOMVM_MAX_VM) { + if (g_vms[callback_ipi->target] != patomvm) { - atomvmCtrlIntRequest ((HATOMVM)g_vms[callback_ipi->target], callback_ipi->isr) ; - res = 1 ; + atomvmCtrlIntRequest ((HATOMVM)g_vms[callback_ipi->target], callback_ipi->isr) ; + res = 1 ; + } } return res ; diff --git a/ports/atomvm/test/main.c b/ports/atomvm/test/main.c index d991614..9a7eb99 100644 --- a/ports/atomvm/test/main.c +++ b/ports/atomvm/test/main.c @@ -65,6 +65,12 @@ static HANDLE isr_thread_2 ; static HANDLE isr_thread_3 ; static HANDLE isr_thread_4 ; +void +ipi_sr() +{ + printf("ipi\r\n") ; +} + void monitor_thread (uint32_t parm) { @@ -72,6 +78,8 @@ monitor_thread (uint32_t parm) int i ; int c = 0 ; ATOM_TCB *tcb ; + static unsigned int idle_1 = 0, idle_2 = 0, int_count = 0 ; + unsigned int delta_idle_1 , delta_idle_2 , delta_int_count ; tcb = atomCurrentContext() ; @@ -88,13 +96,24 @@ monitor_thread (uint32_t parm) printf("Thr %.2d cnt %08d\t",i+TEST_THREADS/3,test_counter[i+TEST_THREADS/3]); printf("Thr %.2d cnt %08d\n",i+TEST_THREADS*2/3,test_counter[i+TEST_THREADS*2/3]); } - printf("\nIdle Threadd 1 Counter = %d\nIdle Theadrd 2 Counter = %d\nInterrupt Counter = %d",test2_counter,test3_counter,test_isr_count); + + delta_idle_1 = test2_counter - idle_1 ; + delta_idle_2 = test3_counter - idle_2 ; + delta_int_count = test_isr_count - int_count ; + printf("\nIdle Threadd 1 Counter = %d %d %d\nIdle Theadrd 2 Counter = %d %d %d\nInterrupt Counter = %d %d %d", + test2_counter, delta_idle_1, (unsigned int)(test2_counter / c), + test3_counter, delta_idle_2, (unsigned int)(test3_counter / c), + test_isr_count, delta_int_count, (unsigned int)(test_isr_count / c)); printf ("\n\n") ; + idle_1 = test2_counter ; + idle_2 = test3_counter ; + int_count = test_isr_count ; CRITICAL_END(); //for (i=0; i<100;i++) { // atomvmInterruptWait () ; //} atomTimerDelay (150) ; + //atomvmScheduleIpi (atomvmGetVmId(), (uint32_t) ipi_sr) ; } }