Merge branch 'praktikum' of git.ida.ing.tu-bs.de:sdes1/lab_sdes_student into praktikum

This commit is contained in:
sdes1
2026-01-13 19:51:15 +01:00

42
antworten Normal file
View File

@@ -0,0 +1,42 @@
aufgabe 5
CPU_Init()
initialisiert die CPU, zb Stack growth direction
Mem_init() richtet memory partitionen ein für kernel speicher. muss aufgerufen werden laut code commentar
OS_Init erstellt 2 Taks, einen IDLE und einen Monitoring Task
OS_InitMisc() is called to initialize miscellaneous variables. It performs various initialization tasks related to miscellaneous features and options within the uC/OS-II kernel. The actions that are performed are:
a) Clear the 32-bit OS System clock.
b) Clear the interrupt nesting counter.
c) Clear the scheduling lock counter.
d) Clear the number of tasks.
e) Indicate the OS that the multitasking has not started.
f) Clear the context switch counter.
g) Let know the kernel that Statistic task is not ready.
h) Initialize the OSSafetyCriticalStartFlag(Related to windows) to FALSE indicating safety functionality is not yet enabled or active.
i) Initialize the task register ID.
OS_InitRdyList() is called to initialize the ready list. The ready list is the task of priorities maintained by the kernel. It keeps tracks of which tasks are ready to run based on the priority levels. It is called to ensure that the ready list is in clean state before the scheduler starts scheduling. All the values in the ready table is set to 0 by this function. The Ready table size is defined by the macro OS_RDY_TBL_SIZE in uC/OS-II . It is defined as:
#define OS_RDY_TBL_SIZE ((OS_LOWEST/PRIO) / 8u +1u). The OS_LOWEST is 63 that can be found in os_cfg_r.h of uC/OS-II source code.
OS_InitTCBList() is called to initialize the free list of OS_TCBs. The initialization process typically involves setting up the necessary data structures and variables to manage the free list. This includes linking the TCBs together in the list and configuring any associated fields or flags within the TCBs.
OSStart() is then called to start multitasking and give control to µC/OS-II. It is very important that you create at least one task before calling OSStart(). Failure to do this will certainly make your application crash. In fact, you may always want to create only one task if you are planning on using the CPU usage statistic task.
OSTaskCreateExt() komplizierte Fkt um Tasks zu erstellen mit 9 Argumenten, wie Prio und Interrupt foo
OSTaskStackInit() nur OSTaskStckInit() gefunden, which is responsible for setting up the task stack.
OS_TCBInit entnimmt einen OS_TCB aus dem Pool, initialisiert die relevanten Felder abhängig von den aktivierten Features (z. B. erweiterte Task-Felder, Event-Pointer, Delete-Flag) und ruft dabei mit wieder aktivierten Interrupts die Hook-Funktionen OSTCBInitHook und OSTaskCreateHook auf. Anschließend werden die Interrupts kurz deaktiviert, der TCB an den Anfang der verketteten Task-Liste eingefügt und der Task als “ready” markiert. Zuletzt gibt die Funktion einen Statuscode zurück, der den erfolgreichen Abschluss der Initialisierung signalisiert.