AKOS  v1.0.0
Documentation
Loading...
Searching...
No Matches
port.c File Reference

Cortex-M3 port implementation (context switching and tick hook). More...

#include "port.h"
#include "thread.h"
#include "core.h"
#include "config.h"
#include "core_cm3.h"
#include "core_cmFunc.h"
Include dependency graph for port.c:

Go to the source code of this file.

Functions

void akos_port_systick_init_freq (uint32_t cpu_freq)
 Initialize SysTick to generate 1ms OS ticks.
void akos_port_start_first_task (void)
 Start the first thread by restoring the initial exception context.
uint32_t * akos_port_task_stack_init (uint32_t *p_stack, size_t stack_size, void(*pf_task)(void *), void *p_arg)
 Build the initial Cortex-M thread stack frame.
void port_SVCHandler (void)
 SVC handler used to restore the first thread context.
void port_PendSVHandler (void)
 PendSV handler used for context switching between threads.
void port_SysTickHandler ()
 SysTick ISR hook for scheduler tick updates.

Detailed Description

Cortex-M3 port implementation (context switching and tick hook).

Author
Snoopy3921 - AK Foundation
Date
2026/05/08

Definition in file port.c.

Function Documentation

◆ akos_port_start_first_task()

void akos_port_start_first_task ( void )

Start the first thread by restoring the initial exception context.

Definition at line 42 of file port.c.

◆ akos_port_systick_init_freq()

void akos_port_systick_init_freq ( uint32_t cpu_freq)

Initialize SysTick to generate 1ms OS ticks.

Configure SysTick to generate 1ms OS ticks.

Parameters
cpu_freqCore clock frequency in Hz.

Definition at line 25 of file port.c.

◆ akos_port_task_stack_init()

uint32_t * akos_port_task_stack_init ( uint32_t * p_stack,
size_t stack_size,
void(* pf_task )(void *),
void * p_arg )

Build the initial Cortex-M thread stack frame.

Parameters
p_stackBase stack buffer.
stack_sizeStack size in 32-bit words.
pf_taskThread entry function.
p_argTask argument.
Returns
Initial top-of-stack pointer.

Definition at line 67 of file port.c.

◆ port_PendSVHandler()

void port_PendSVHandler ( void )

PendSV handler used for context switching between threads.

Definition at line 119 of file port.c.

◆ port_SVCHandler()

void port_SVCHandler ( void )

SVC handler used to restore the first thread context.

Definition at line 94 of file port.c.

◆ port_SysTickHandler()

void port_SysTickHandler ( )

SysTick ISR hook for scheduler tick updates.

Definition at line 161 of file port.c.