aboutsummaryrefslogtreecommitdiff
path: root/os1.cpp
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-01-02 20:53:42 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2016-01-02 20:53:42 +0100
commit9129af503c8211d713c8a160a3b6f3f86b328639 (patch)
tree3cd9ff26f4d323fc553b2a99d56be9b81a57a4c4 /os1.cpp
parentaae314fead54dab7b258f3a6c7ac1615833f9987 (diff)
downloadstm32f103-playground-9129af503c8211d713c8a160a3b6f3f86b328639.tar.gz
stm32f103-playground-9129af503c8211d713c8a160a3b6f3f86b328639.tar.bz2
stm32f103-playground-9129af503c8211d713c8a160a3b6f3f86b328639.tar.xz
stm32f103-playground-9129af503c8211d713c8a160a3b6f3f86b328639.zip
o Adding a utility to dump segment sizes from the generated ELF files.
o Adding os2 with support for critical sections. More to come. o Adding dma1 to test DMA + SPI.
Diffstat (limited to 'os1.cpp')
-rw-r--r--os1.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/os1.cpp b/os1.cpp
index c2060ff..9c87a3d 100644
--- a/os1.cpp
+++ b/os1.cpp
@@ -122,9 +122,9 @@ void idle_task(const void *const) {
}
static
-void create_thread(void (task)(void const *const), bool create_sw);
+void os_create_thread(void (task)(void const *const), bool create_sw);
-void osKernelInitialize() {
+void os_init() {
NVIC_SetPriority(SysTick_IRQn, 0xff);
NVIC_SetPriority(PendSV_IRQn, 0xff);
@@ -142,16 +142,16 @@ void osKernelInitialize() {
tasks[i].flags = 0;
}
- create_thread(idle_task, false);
+ os_create_thread(idle_task, false);
current_task = 0;
}
-void create_thread(void (task)(void const *const)) {
- create_thread(task, true);
+void os_create_thread(void (task)(void const *const)) {
+ os_create_thread(task, true);
}
static
-void create_thread(void (task)(void const *const), bool create_sw) {
+void os_create_thread(void (task)(void const *const), bool create_sw) {
uint8_t *s = stacks[task_count] + stack_size;
s -= sizeof(hardware_frame_t);
@@ -224,7 +224,7 @@ volatile bool run;
extern "C" void do_first_context_switch(uint8_t *user_stack, void (task)(const void *const arg));
-void osKernelStart() {
+void os_start() {
run = true;
task_t &t = tasks[0];
@@ -276,10 +276,10 @@ int main(void) {
init.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_8;
GPIO_Init(GPIOB, &init);
- osKernelInitialize();
- create_thread(job1);
- create_thread(job2);
- osKernelStart();
+ os_init();
+ os_create_thread(job1);
+ os_create_thread(job2);
+ os_start();
return 0;
}