ardix/include/arch-generic/sched.h

50 lines
1.3 KiB
C
Raw Normal View History

/* See the end of this file for copyright, license, and warranty information. */
2020-06-12 12:29:27 +02:00
#pragma once
2020-06-17 20:42:41 +02:00
#include <arch/hardware.h>
2020-11-29 20:23:27 +01:00
#include <toolchain.h>
2021-08-04 03:25:04 +02:00
struct task; /* see include/ardix/sched.h */
2020-06-17 20:42:41 +02:00
2020-06-12 12:29:27 +02:00
/**
* Initialize a hardware timer for schduling.
*
* @param freq: The timer frequency in Hertz.
*/
2020-11-29 20:23:27 +01:00
int arch_sched_hwtimer_init(unsigned int freq);
2020-06-12 12:29:27 +02:00
/**
2020-11-29 20:23:27 +01:00
* Initialize a new process.
* This requires the process' `stack_base` field to be initialized as the
* initial register values are written to the stack.
2020-06-17 20:42:41 +02:00
*
2020-11-29 20:23:27 +01:00
* @param process: The process.
2020-06-17 20:42:41 +02:00
* @param entry: The process entry point.
2020-06-12 12:29:27 +02:00
*/
2021-08-04 03:25:04 +02:00
void arch_task_init(struct task *task, void (*entry)(void));
int arch_idle_task_init(struct task *task);
2020-11-29 20:23:27 +01:00
2021-08-05 16:14:18 +02:00
/**
* @brief Convert milliseconds to system ticks, rounding to zero.
*
* @param ms Amount of milliseconds
* @returns Equivalent time in system ticks
*/
unsigned long int ms_to_ticks(unsigned long ms);
2020-10-11 19:35:30 +02:00
/*
* This file is part of Ardix.
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
2020-10-11 19:35:30 +02:00
*
* Ardix is non-violent software: you may only use, redistribute,
* and/or modify it under the terms of the CNPLv6+ as found in
* the LICENSE file in the source code root directory or at
* <https://git.pixie.town/thufie/CNPL>.
2020-10-11 19:35:30 +02:00
*
* Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
* permitted by applicable law. See the CNPLv6+ for details.
2020-10-11 19:35:30 +02:00
*/