Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

io.h (370B)


      1 #include <stdint.h>
      2 
      3 #pragma once
      4 
      5 #ifndef IO_H
      6 #define IO_H
      7 
      8 static inline void outb (uint16_t port, uint8_t val) {
      9     __asm__ volatile( "outb %b0, %w1" : : "a"(val), "Nd"(port) : "memory");
     10 }
     11 
     12 static inline uint8_t inb (uint16_t port) {
     13     uint8_t ret_val;
     14     __asm__ volatile("inb %w1, %b0" : "=a"(ret_val) : "Nd" (port) : "memory");
     15     return ret_val;
     16 }
     17 
     18 #endif