Lazuli
Loading...
Searching...
No Matches
arch.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-only
3 * This file is part of Lazuli.
4 */
5
18#ifndef LAZULI_SYS_ARCH_ARCH_H
19#define LAZULI_SYS_ARCH_ARCH_H
20
21#include <stdint.h>
22
23#include <Lazuli/common.h>
24#include <Lazuli/list.h>
25#include <Lazuli/serial.h>
26#include <Lazuli/sys/compiler.h>
27
29
33NORETURN void
35
39void
41
53void
55
68void
69Arch_StartRunning(void *stackPointer, size_t offsetOfPc);
70
78void
79Arch_LoadFromProgmem(const void * source,
80 void * destination,
81 const size_t size);
82
93Arch_LoadU8FromProgmem(const void *source);
94
105Arch_LoadU16FromProgmem(const void *source);
106
115void *
116Arch_LoadPointerFromProgmem(const void *source);
117
133void (*Arch_LoadFunctionPointerFromProgmem(const void *source)) (void);
134
138void
140
144void
146
147/* TODO: This is machine specific!!! */
155
163
169void
171
178bool
180
184void
186
190void
191Arch_CpuSleep(void);
192
196void
198
205void
207
211void
213
228bool
229Arch_TryAcquireLock(volatile uint8_t * const lock);
230
242void
244
252void
253Arch_SetSerialConfiguration(const Lz_SerialConfiguration * const configuration);
254
258void
259Arch_InitSerial(void);
260
268
284Arch_Divide_U16(uint16_t numerator, uint16_t denominator);
285
289
290#endif /* LAZULI_SYS_ARCH_ARCH_H */
unsigned int uint16_t
Represents a unsigned integer type with width of exactly 16 bits.
Definition stdint.h:94
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition stdint.h:89
void Arch_InitIdleCpuMode(void)
Initialize idle CPU modes.
Definition arch.c:27
U16DivisionResult Arch_Divide_U16(uint16_t numerator, uint16_t denominator)
Perform the Euclidean division between two uint16_t operands.
void Arch_DisableInterrupts(void)
Disable all interrupts.
void * Arch_LoadPointerFromProgmem(const void *source)
Return a pointer stored in program memory.
void Arch_CpuSleep(void)
Put the CPU to sleep according to the sleep settings.
Definition arch.c:60
void Arch_InitSystemTimer(void)
Initialize the system timer.
void Arch_ResetSystem(void)
Reset the whole system.
void Arch_StartSystemTimer(void)
Start the system timer.
void Arch_InfiniteLoop(void)
Function that loops forever, never returns.
void Arch_LoadFromProgmem(const void *source, void *destination, const size_t size)
Copy bytes from program memory to RAM.
void Arch_GetSerialConfiguration(Lz_SerialConfiguration *const configuration)
Retrieve the current configuration of the serial line.
Definition usart.c:441
void Arch_SetSerialConfiguration(const Lz_SerialConfiguration *const configuration)
Configure the serial line according to the parameter.
Definition usart.c:451
void(*)(void) Arch_LoadFunctionPointerFromProgmem(const void *source)
Return a function pointer stored in program memory.
Definition arch.h:133
void Arch_RestoreContextAndReturnFromInterrupt(void *stackPointer)
Restore the context of a previously saved task, and run it by returning from interrupt.
InterruptsStatus Arch_DisableInterruptsGetStatus(void)
Disable all interrupts and return the previous interrupts status.
bool Arch_AreInterruptsEnabled(void)
Obtain a value indicating if global interrupts are enabled.
bool Arch_TryAcquireLock(volatile uint8_t *const lock)
Try to acquire a lock by atomically changing the value pointed by the lock parameter.
void Arch_RestoreInterruptsStatus(const InterruptsStatus interruptsStatus)
Restore a previously saved interrupts status.
uint8_t Arch_LoadU8FromProgmem(const void *source)
Return a byte stored in program memory.
void Arch_InitSerial(void)
Initialize serial line with default configuration at system startup.
Definition usart.c:480
uint8_t InterruptsStatus
Define the type used to store interrupts status.
Definition arch.h:154
void Arch_EnableInterrupts(void)
Enable all interrupts.
uint16_t Arch_LoadU16FromProgmem(const void *source)
Return a double-byte word stored in program memory.
void Arch_InitInstrumentation(void)
Initialize the context switch instrumentation.
Definition arch.c:69
void Arch_StartRunning(void *stackPointer, size_t offsetOfPc)
Start running the scheduler for the first time with the specified context.
Basic type definitions and useful macros.
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition common.h:39
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition common.h:44
Macro aliases on compiler facilities.
Doubly linked lists interface.
Serial port configuration interface.
Represents the configuration of a serial interface.
Definition serial.h:222
Represents the result of a uin16_t division.
Definition arch.h:264
uint16_t quotient
The quotient of the division
Definition arch.h:266
uint16_t remainder
The remainder of the division.
Definition arch.h:265