avr-fw-modules/core/include/hwo/stack.h

28 lines
500 B
C
Executable File

#pragma once
#include <stdint.h>
// stack flags
#define ST_SYSTEM 0x0001 // System Stack Segment
#define ST_FREE 0x0002 // Stack Segment is not in use, may be reallocated to new thread
#define STACK_TOP(stack) (&stack->base[stack->size - 1])
struct stStack
{
uint8_t *base;
uint16_t size;
uint16_t flags;
struct stStack *next;
};
typedef struct stStack avrStack;
uint16_t stack_system_resize(uint16_t size);
avrStack* stack_alloc(uint16_t size);
void stack_free(avrStack *stack);