POK(kernelpart)
ioports.h
Go to the documentation of this file.
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 julien on Thu Jan 15 23:34:13 2009
15  */
16 
25 #ifndef __POK_SPARC_LEON3_IOPORTS_H__
26 # define __POK_SPARC_LEON3_IOPORTS_H__
27 
28 # include <types.h>
29 # include "sparc_conf.h"
30 
31 static inline void outb(uint32_t addr, uint8_t data)
32 {
33  asm volatile ("sta %0, [%1] %2;\n"
34  : /* no output */
35  : "r" (data), "r" (addr), "i" (ASI_MMU_BYPASS)
36  : "memory");
37 }
38 
39 static inline void outw(uint32_t addr, uint32_t data)
40 {
41  asm volatile ("sta %0, [%1] %2;\n"
42  : /* no output */
43  : "r" (data), "r" (addr), "i" (ASI_MMU_BYPASS)
44  : "memory");
45 }
46 
47 static inline uint8_t inb(uint32_t addr)
48 {
49  uint8_t value = 0;
50  asm volatile ("lduba [%1] %2, %0;\n"
51  : "=r" (value)
52  : "r" (addr), "i" (ASI_MMU_BYPASS)
53  : "memory");
54  return value;
55 }
56 
57 static inline uint32_t inw(uint32_t addr)
58 {
59  uint32_t value = 0;
60  asm volatile ("lda [%1] %2, %0;\n"
61  : "=r" (value)
62  : "r" (addr), "i" (ASI_MMU_BYPASS)
63  : "memory");
64  return value;
65 }
66 
67 #endif /* __POK_SPARC_LEON3_IOPORTS_H__ */