You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.1 KiB

#ifndef KERNEL_IO_H
#define KERNEL_IO_H
#include <stdint.h>
/**
* Wrapper function that reads a byte from the specified I/O port.
*
* "=a" (result) - put al register in the `result` var when finished
* "d" (port) - load edx with the specified `port`
*
* @param port
* @return the read byte
*/
uint8_t io_byte_in(uint16_t port);
/**
* Wrapper function that writes a byte to the specified I/O port.
*
* "a" (data) - load eal with `data`
* "d" (port) - load edx with `port`
*
* @param port
* @param data
*/
void io_byte_out(uint16_t port, uint8_t data);
/**
* Wrapper function that reads a word from the specified I/O port.
*
* "=a" (result) - put eax register in the `result` var when finished
* "d" (port) - load edx with the specified `port`
*
* @param port
* @return the read word
*/
uint16_t io_word_in(uint16_t port);
/**
* Wrapper function that writes a word to the specified I/O port.
*
* "a" (data) - load eax with `data`
* "d" (port) - load edx with `port`
*
* @param port
* @param data
*/
void io_word_out(uint16_t port, uint16_t data);
#endif //KERNEL_IO_H