Select Page

Atomkernel.c File Reference

Application-callable initialisation functions:

  • atomOSInit(): Initialises the operating system.
  • atomOSStart(): Starts the OS running (with the highest priority thread).

Application-callable general functions:

  • atomThreadCreate(): Thread creation API.
  • atomCurrentContext(): Used by kernel and application code to check whether the thread is currently running at thread or interrupt context. This is very useful for implementing safety checks and preventing interrupt handlers from making kernel calls that would block.
  • AtomIntEnter() / atomIntExit(): Must be called by any interrupt handlers.

Internal kernel functions:

  • atomSched(): Core scheduler.
  • atomThreadSwitch(): Context-switch routine.
  • atomIdleThread(): Simple thread to be run when no other threads ready.
  • tcbEnqueuePriority(): Enqueues TCBs (task control blocks) on lists.
  • tcbDequeueHead(): Dequeues the head of a TCB list.
  • tcbDequeueEntry(): Dequeues a particular entry from a TCB list.
  • tcbDequeuePriority(): Dequeues an entry from a TCB list using priority.
#include <stddef.h>
#include "atom.h"

Defines

#define STACK_CHECK_BYTE 0x5A

Variables

ATOM_TCB * tcbReadyQ = NULL
uint8_t atomOSStarted = FALSE

Functions

void atomSched(uint8_t timer_tick)
uint8_t atomThreadCreate(ATOM_TCB *tcb_ptr, uint8_t priority, void(*entry_point)(uint32_t), uint32_t entry_param, void *stack_top, uint32_t stack_size)
void atomIntEnter(void)
void atomIntExit(uint8_t timer_tick)
ATOM_TCB * atomCurrentContext(void)
uint8_t atomOSInit(void *idle_thread_stack_top, uint32_t idle_thread_stack_size)
void atomOSStart(void)
uint8_t cbEnqueuePriority(ATOM_TCB **tcb_queue_ptr, ATOM_TCB *tcb_ptr)
ATOM_TCB * tcbDequeueHead(ATOM_TCB **tcb_queue_ptr)
ATOM_TCB * cbDequeueHead(ATOM_TCB **tcb_queue_ptr, ATOM_TCB *tcb_ptr)
ATOM_TCB * tcbDequeuePriority(ATOM_TCB **tcb_queue_ptr, uint8_t priority)