Espresso 0.0.2c
This commit is contained in:
11
include/drivers/audio/pcspeaker.h
Normal file
11
include/drivers/audio/pcspeaker.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef ESPRESSO_PC_SPEAKER_H
|
||||
#define ESPRESSO_PC_SPEAKER_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void play_sound(uint32_t nfrequence);
|
||||
void stop_sound(void);
|
||||
|
||||
void beep(void);
|
||||
|
||||
#endif
|
||||
@ -9,35 +9,37 @@
|
||||
#define PT_LOAD 1
|
||||
|
||||
typedef struct {
|
||||
unsigned char e_ident[EI_NIDENT];
|
||||
uint16_t e_type;
|
||||
uint16_t e_machine;
|
||||
uint32_t e_version;
|
||||
uint32_t e_entry;
|
||||
uint32_t e_phoff;
|
||||
uint32_t e_shoff;
|
||||
uint32_t e_flags;
|
||||
uint16_t e_ehsize;
|
||||
uint16_t e_phentsize;
|
||||
uint16_t e_phnum;
|
||||
uint16_t e_shentsize;
|
||||
uint16_t e_shnum;
|
||||
uint16_t e_shstrndx;
|
||||
unsigned char e_ident[EI_NIDENT];
|
||||
uint16_t e_type;
|
||||
uint16_t e_machine;
|
||||
uint32_t e_version;
|
||||
uint32_t e_entry;
|
||||
uint32_t e_phoff;
|
||||
uint32_t e_shoff;
|
||||
uint32_t e_flags;
|
||||
uint16_t e_ehsize;
|
||||
uint16_t e_phentsize;
|
||||
uint16_t e_phnum;
|
||||
uint16_t e_shentsize;
|
||||
uint16_t e_shnum;
|
||||
uint16_t e_shstrndx;
|
||||
} Elf32_Ehdr;
|
||||
|
||||
typedef struct {
|
||||
uint32_t p_type;
|
||||
uint32_t p_offset;
|
||||
uint32_t p_vaddr;
|
||||
uint32_t p_paddr;
|
||||
uint32_t p_filesz;
|
||||
uint32_t p_memsz;
|
||||
uint32_t p_flags;
|
||||
uint32_t p_align;
|
||||
uint32_t p_type;
|
||||
uint32_t p_offset;
|
||||
uint32_t p_vaddr;
|
||||
uint32_t p_paddr;
|
||||
uint32_t p_filesz;
|
||||
uint32_t p_memsz;
|
||||
uint32_t p_flags;
|
||||
uint32_t p_align;
|
||||
} Elf32_Phdr;
|
||||
|
||||
typedef int (*elf_entry_t)(void);
|
||||
|
||||
typedef struct {
|
||||
void* entry_point;
|
||||
elf_entry_t entry_point;
|
||||
} elf_executable_t;
|
||||
|
||||
elf_executable_t* load_elf32(void* elf_data);
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
#ifndef _IDT_H
|
||||
#define _IDT_H
|
||||
|
||||
#include <drivers/irq.h>
|
||||
|
||||
#include <types.h>
|
||||
|
||||
|
||||
void idt_init(void);
|
||||
|
||||
void pic_remap(void);
|
||||
|
||||
void idt_set_descriptor(uint8_t vector, void* isr, uint8_t flags);
|
||||
void exception_dispatcher(uint32_t int_no, uint32_t err_code);
|
||||
|
||||
void exception_handler(registers_t* regs);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,13 +3,28 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef void (*irq_func_t)(void);
|
||||
typedef struct {
|
||||
uint32_t ds, es, fs, gs;
|
||||
|
||||
uint32_t edi, esi, ebp, esp, ebx, edx, ecx, eax;
|
||||
|
||||
uint32_t int_no;
|
||||
uint32_t err_code;
|
||||
|
||||
uint32_t eip;
|
||||
uint32_t cs;
|
||||
uint32_t eflags;
|
||||
} registers_t;
|
||||
|
||||
typedef registers_t* (*irq_func_t)(registers_t*);
|
||||
|
||||
void irq_init(void);
|
||||
|
||||
void irq_handler(uint8_t irq_number);
|
||||
registers_t* irq_handler(uint32_t irq, registers_t* regs);
|
||||
|
||||
void set_irq_handler(uint32_t num, irq_func_t* handler);
|
||||
void add_irq_handler(uint32_t num, irq_func_t* handler);
|
||||
void set_irq_handler(uint32_t num, irq_func_t handler);
|
||||
/*void add_irq_handler(uint32_t num, irq_func_t* handler);*/
|
||||
|
||||
uint32_t get_interrupts_missed(void);
|
||||
|
||||
#endif
|
||||
|
||||
10
include/drivers/keyboard.h
Normal file
10
include/drivers/keyboard.h
Normal file
@ -0,0 +1,10 @@
|
||||
#ifndef _KEYBOARD_DRIVER_H
|
||||
#define _KEYBOARD_DRIVER_H
|
||||
|
||||
#include <drivers/irq.h>
|
||||
|
||||
int init_keyboard(void);
|
||||
|
||||
registers_t* keyboard_handler(registers_t* regs);
|
||||
|
||||
#endif
|
||||
@ -3,10 +3,11 @@
|
||||
|
||||
#include <types.h>
|
||||
|
||||
extern volatile uint64_t pit_ticks;
|
||||
|
||||
#include <drivers/irq.h>
|
||||
|
||||
void pit_init(void);
|
||||
void pit_handler(void);
|
||||
registers_t* pit_handler(registers_t* regs);
|
||||
void pit_sleep(uint64_t ms);
|
||||
|
||||
#endif
|
||||
|
||||
@ -23,7 +23,9 @@ typedef enum {
|
||||
typedef void (*ps2_hook_t)(char);
|
||||
|
||||
void keyboard_init(void);
|
||||
void keyboard_handler(void);
|
||||
registers_t* ps2_keyboard_handler(registers_t* regs);
|
||||
|
||||
void set_use_new_tty(bool t);
|
||||
|
||||
char get_char(void);
|
||||
uint16_t get_key(void);
|
||||
|
||||
Reference in New Issue
Block a user