Started writing C headers
This commit is contained in:
6
include/kernel.h
Normal file
6
include/kernel.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
struct kernel_t
|
||||
{
|
||||
|
||||
};
|
||||
55
include/priorityqueue.h
Normal file
55
include/priorityqueue.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "process.h"
|
||||
#include <stddef.h>
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
*/
|
||||
struct priority_queue_t
|
||||
{
|
||||
/**
|
||||
* @brief A pointer to the heap described by this structure.
|
||||
*
|
||||
*/
|
||||
struct process_t **heap;
|
||||
|
||||
/**
|
||||
* @brief The current number of elements stored in the heap.
|
||||
*
|
||||
*/
|
||||
size_t size;
|
||||
|
||||
/**
|
||||
* @brief The maximum number of elements that the heap can currently hold.
|
||||
*
|
||||
*/
|
||||
size_t capacity;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param queue
|
||||
* @return struct process_t*
|
||||
*/
|
||||
struct process_t *extract_min(struct priority_queue_t *queue);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param queue
|
||||
* @param process
|
||||
* @return int
|
||||
*/
|
||||
int insert(struct priority_queue_t *queue, struct process_t *process);
|
||||
|
||||
/**
|
||||
* @brief
|
||||
*
|
||||
* @param queue
|
||||
* @param process
|
||||
* @return int
|
||||
*/
|
||||
int remove(struct priority_queue_t *queue, struct process_t *process);
|
||||
12
include/process.h
Normal file
12
include/process.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
struct process_state_t;
|
||||
|
||||
struct process_t
|
||||
{
|
||||
size_t priority;
|
||||
|
||||
struct process_state_t *state;
|
||||
};
|
||||
9
include/types/physaddr.h
Normal file
9
include/types/physaddr.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if defined __i386__ || __arm__
|
||||
typedef uint32_t physaddr_t;
|
||||
#elif defined __x86_64__ || __aarch64__
|
||||
typedef uint64_t physaddr_t;
|
||||
#else
|
||||
typedef uint64_t physaddr_t;
|
||||
#endif
|
||||
8
include/types/status.h
Normal file
8
include/types/status.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
enum status_t
|
||||
{
|
||||
S_OK = 0,
|
||||
S_BAD_SYSCALL,
|
||||
S_OUT_OF_MEMORY
|
||||
};
|
||||
Reference in New Issue
Block a user