diff options
| author | Alejandro Soto <alejandro@34project.org> | 2023-10-03 23:16:08 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2023-10-03 23:16:08 -0600 |
| commit | 3de42a19661a3d6d24de46ca2920b06e1dc88fe0 (patch) | |
| tree | acdd022a14d43d60dbfec1f4df8c634e0d080ec0 /demo/demo.h | |
| parent | 1094451235282af6a9daba2b2a460577f82d289c (diff) | |
demo: initial commit
Diffstat (limited to 'demo/demo.h')
| -rw-r--r-- | demo/demo.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/demo/demo.h b/demo/demo.h new file mode 100644 index 0000000..1bff8d6 --- /dev/null +++ b/demo/demo.h @@ -0,0 +1,34 @@ +#ifndef DEMO_H +#define DEMO_H + +#define NUM_CPUS 4 + +struct lock +{ + volatile unsigned val; +}; + +struct cpu +{ + unsigned num; +}; + +/* R12 está reservado por la ABI + * https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html + */ +register struct cpu *this_cpu asm("ip"); + +void spin_init(struct lock *lock); +void spin_lock(struct lock *lock, unsigned *irq_save); +void spin_unlock(struct lock *lock, unsigned irq_save); + +void console_init(void); +void print(const char *fmt, ...); + +int cpus_ready(void); +void run_cpu(unsigned num); +void run_cpus(unsigned mask); +void halt_cpu(unsigned num); +void halt_cpus(unsigned mask); + +#endif |
