POK
ioports.c
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by laurent on Sun Jun 07 18:39:49 2009
15  */
16 
17 
18 #ifdef POK_NEEDS_IO
19 
20 # include <arch/x86/ioports.h>
21 # include <libc/stdio.h>
22 
23 pok_ret_t pok_inb (uint16_t port)
24 {
25  int32_t ret = (int32_t) pok_syscall2 (POK_SYSCALL_INB,
26  (uint32_t)port,
27  0);
28 
29  if (ret < 0)
30  printf("pok_inb: error %d, port %x\n", ret, port);
31 
32  return (ret);
33 }
34 
35 pok_ret_t pok_outb (uint16_t port, uint8_t value)
36 {
37  int32_t ret = (int32_t) pok_syscall2 (POK_SYSCALL_OUTB,
38  (uint32_t)port,
39  (uint32_t)value);
40 
41  if (ret < 0)
42  printf("pok_outb: error %d, port %x\n", ret, port);
43 
44  return (ret);
45 }
46 
47 #endif