// os.h // Runs on MSPM0 // A very simple real time operating system with minimal features. // Jonathan Valvano // June 8, 2025 /* Copyright 2025 by Jonathan W. Valvano, valvano@mail.utexas.edu You may use, edit, run or distribute this file as long as the above copyright notice remains THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. VALVANO SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. For more information about my classes, my research, and my books, see http://users.ece.utexas.edu/~valvano/ */ #ifndef __OS_H #define __OS_H 1 // fill these depending on your clock #define TIME_1MS 80000 #define TIME_2MS 2*TIME_1MS #define TIME_5MS 5*TIME_1MS // function definitions in osasmSimple.s void OS_DisableInterrupts(void); // Disable interrupts void OS_EnableInterrupts(void); // Enable interrupts void StartOS(void); // ******** OS_Init ************ // initialize operating system, disable interrupts until OS_Launch // initialize OS controlled I/O: systick, 50 MHz PLL // input: none // output: none void OS_Init(void); //******** OS_AddThread *************** // add three foregound threads to the scheduler // Inputs: three pointers to a void/void foreground tasks // Outputs: 1 if successful, 0 if this thread can not be added void OS_AddThreads(void(*task0)(void), void(*task1)(void), void(*task2)(void),void(*task3)(void)); //******** OS_Launch *************** // start the scheduler, enable interrupts // Inputs: number of 20ns clock cycles for each time slice // (maximum of 24 bits) // Outputs: none (does not return) void OS_Launch(uint32_t theTimeSlice); #endif