YAHAL
Yet Another Hardware Abstraction Library
Loading...
Searching...
No Matches
src
MCU
rp2350
task_rp2350.h
1
// ---------------------------------------------
2
// This file is part of
3
// _ _ __ _ _ __ __
4
// ( \/ ) /__\ ( )_( ) /__\ ( )
5
// \ / /(__)\ ) _ ( /(__)\ )(__
6
// (__)(__)(__)(_) (_)(__)(__)(____)
7
//
8
// Yet Another HW Abstraction Library
9
// Copyright (C) Andreas Terstegge
10
// BSD Licensed (see file LICENSE)
11
//
12
// ---------------------------------------------
13
//
14
// Low-level task implementation for RP2350/Cortex M33
15
//
16
#ifndef _TASK_RP2350_H_
17
18
#include <cstdint>
19
#include "task.h"
20
22
// System call API
24
#define sys_call(code) asm volatile ("svc %0":: "I" (code));
25
26
#define SYS_START_SCHEDULER 0
27
#define SYS_YIELD 1
28
30
// The following structure defines a stack
31
// frame without floating-point data. Such
32
// a frame is set up for every Task before
33
// it is started.
35
36
struct
callee_saved_registers
{
37
38
// The following 10 registers have to be saved by
39
// the context switching handler (callee-saved registers)
40
41
uint32_t exc_return;
// the LR value inside the handler
42
uint32_t ctrl;
// the CONTROL register
43
uint32_t r4;
// register R4 ...
44
uint32_t r5;
// .
45
uint32_t r6;
// .
46
uint32_t r7;
// . ...to ...
47
uint32_t r8;
// .
48
uint32_t r9;
// .
49
uint32_t r10;
// .
50
uint32_t r11;
// register R11
51
};
52
53
struct
caller_saved_registers
{
54
55
// The following 8 registers are automatically
56
// saved when handling an exception (caller-saved registers)
57
58
task
* r0;
// register R0 (the 'this' pointer in C++ calls)
59
uint32_t r1;
// .
60
uint32_t r2;
// . ...to ...
61
uint32_t r3;
// register R3
62
uint32_t r12;
// register R12
63
uint32_t lr;
// register R14 (=LR)
64
void (*pc)();
// register R15 (=PC)
65
uint32_t psr;
// PSR
66
};
67
68
struct
Stack_Frame
{
69
callee_saved_registers
cesr;
70
caller_saved_registers
crsr;
71
};
72
73
#endif
// _TASK_RP2350_H_
task
Definition
task.h:39
Stack_Frame
Definition
task_msp432.h:68
callee_saved_registers
Definition
task_msp432.h:36
caller_saved_registers
Definition
task_msp432.h:53
Generated by
1.12.0