This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.h
83 lines (56 loc) · 1.54 KB
/
defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* ultimate header file */
#ifndef __DEFS_H__
#define __DEFS_H__
#include "types.h"
#include "asm_defs.h"
#include "syscall.h"
#define TRUE 1
#define FALSE 0
#define NULL 0
#define TODO(void) (panic("TODO")) // Unimplemented panic
// uart.c
extern void uart_init(void);
extern void uart_putchar(char c);
extern void uart_puts(char *s);
extern void uart_print_char_val(uint8 c);
extern uint8 uart_getchar(void);
extern void uart_interrupt(void);
// print.c
extern void kprint_int(int num, int base);
extern void kprint_ptr(uint32 p);
extern void kprintf(char *s, ...);
extern void panic(char *s);
// page.c
extern void page_init(void);
extern void *kalloc(void);
extern void *kalloc_pages(uint32 pg_num);
extern void kfree(void *p);
// sched.c
extern void sched_init(void);
extern int task_create(void *routine_entry);
extern int _num_of_tasks;
extern int _current_task;
extern void task_yield(void);
extern void task_scheduler(void);
// user.c
extern void user_init(void);
// kernel.c
extern void kernel_main(void);
// trap.c
regis trap_handler(regis mepc, regis mcause, Context context);
extern void test_exception(void);
extern void external_interrupt_handler(void);
extern void software_interrupt_handler(void);
// plic.c
extern void plic_init(void);
extern int plic_claim(void);
extern void plic_complete(int irq_id);
// lock.c
void init_lock(SpinLock *lock);
extern void acquire_lock(SpinLock *lock);
void release_lock(SpinLock *lock);
// syscall.c
void syscall_handler(Context *context);
// delay.c
void delay(int time);
#endif // __DEFS_H__