diff options
Diffstat (limited to 'sw/z80/kernel/include')
-rw-r--r-- | sw/z80/kernel/include/drivers/pio.h | 20 | ||||
-rw-r--r-- | sw/z80/kernel/include/memory.h | 3 | ||||
-rw-r--r-- | sw/z80/kernel/include/process.h | 21 | ||||
-rw-r--r-- | sw/z80/kernel/include/syscall.h | 20 |
4 files changed, 22 insertions, 42 deletions
diff --git a/sw/z80/kernel/include/drivers/pio.h b/sw/z80/kernel/include/drivers/pio.h index 5d289ca..0df2ed0 100644 --- a/sw/z80/kernel/include/drivers/pio.h +++ b/sw/z80/kernel/include/drivers/pio.h @@ -7,25 +7,27 @@ #define PIO_A 0 #define PIO_B 1 -#define PIO_MODE_0 0 -#define PIO_MODE_1 1 -#define PIO_MODE_2 2 -#define PIO_MODE_3 3 +#define PIO_MODE_BYTE_IN 0 +#define PIO_MODE_BYTE_OUT 1 +#define PIO_MODE_BYTE_BI 2 +#define PIO_MODE_BIT_IO 3 #define PIO_INT_ACTIVE_HIGH (1<<5) #define PIO_INT_AND_MODE (1<<6) #define PIO_INT_ENABLE (1<<7) -void _pio_data(int port, uint8_t data); -void _pio_command(int port, uint8_t cmd); +inline void _pio_data(int port, uint8_t data); +inline void _pio_control(int port, uint8_t cmd); + +void pio_set_mode(int port, int mode, uint8_t io); -void pio_set_mode(int port, int mode); void pio_set_interrupts(int port, int control); -void pio_set_interrupts_mask(int port, uint8_t mask); -void pio_set_io(int port, uint8_t io); +void pio_set_interrupts_mask(int port, int control, uint8_t mask); // uint8_t pio_read_data(int port); +uint8_t pio_read(int port); +void pio_write(int port, uint8_t data); inline int pio_read_pin(int port, uint8_t pin); inline void pio_write_pin(int port, uint8_t pin); diff --git a/sw/z80/kernel/include/memory.h b/sw/z80/kernel/include/memory.h index e4352b5..60fc98a 100644 --- a/sw/z80/kernel/include/memory.h +++ b/sw/z80/kernel/include/memory.h @@ -33,8 +33,7 @@ struct page { - uint used :1; - pid_t pid; // process owner of the page + pid_t pid; // process owner of the page (0 if free) uint16_t addr; // physical address }; diff --git a/sw/z80/kernel/include/process.h b/sw/z80/kernel/include/process.h index d7aa7fd..3b0c843 100644 --- a/sw/z80/kernel/include/process.h +++ b/sw/z80/kernel/include/process.h @@ -9,6 +9,12 @@ */ #define PROC_COUNT 2 +/* the pid is defined with a single byte (pid_t is uint8_t), because of that + * there cannot be more than 255 processes open at the same time. this is a + * limitation but for our purposes is more than enough + */ +#define PID_COUNT_MAX 255 + struct executable { void *text; @@ -19,19 +25,12 @@ struct executable struct process { - uint blocked :1; // process is waiting for hardware or locked - uint running :1; // pid is used - struct page pages[4]; // pages used by the process - // TODO: implement quick callback? + uint blocked :1; // process is waiting for hardware or locked + uint running :1; // pid is used + uint pages; // number of pages used by the process + struct page page[4]; // pages used by the process }; -/* the pid is defined with a single byte (pid_t is uint8_t), because of that - * there cannot be more than 255 processes open at the same time. this is a - * limitation but for our purposes is more than enough - */ -extern struct process proc_table[255]; -extern struct process *current_proc; - pid_t newpid(void); int fork(void); diff --git a/sw/z80/kernel/include/syscall.h b/sw/z80/kernel/include/syscall.h deleted file mode 100644 index 29941c9..0000000 --- a/sw/z80/kernel/include/syscall.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef __SYS_CALL_H__ -#define __SYS_CALL_H__ - -/* -* Enable / disable virtual address traslation -*/ - -extern void v_addr(uint8_t flag); - -/* -* Programs execution -*/ - -extern void prog_exec_0(void); -extern void prog_exec_1(void); - -extern void prog_stop_0(void); -extern void prog_stop_1(void); - -#endif
\ No newline at end of file |