POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/arch/sparc/leon3/ioports.h
Go to the documentation of this file.
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00025 #ifndef __POK_SPARC_LEON3_IOPORTS_H__
00026 # define __POK_SPARC_LEON3_IOPORTS_H__
00027 
00028 # include <types.h>
00029 # include "sparc_conf.h"
00030 
00031 static inline void outb(uint32_t addr, uint8_t data)
00032 {
00033   asm volatile ("sta %0, [%1] %2;\n"
00034                 : /* no output */
00035                 : "r" (data), "r" (addr), "i" (ASI_MMU_BYPASS)
00036                 : "memory");
00037 }
00038 
00039 static inline void outw(uint32_t addr, uint32_t data)
00040 {
00041   asm volatile ("sta %0, [%1] %2;\n"
00042                 : /* no output */
00043                 : "r" (data), "r" (addr), "i" (ASI_MMU_BYPASS)
00044                 : "memory");
00045 }
00046 
00047 static inline uint8_t inb(uint32_t addr)
00048 {
00049   uint8_t value = 0;
00050   asm volatile ("lduba [%1] %2, %0;\n"
00051                 : "=r" (value)
00052                 : "r" (addr), "i" (ASI_MMU_BYPASS)
00053                 : "memory");
00054   return value;
00055 }
00056 
00057 static inline uint32_t inw(uint32_t addr)
00058 {
00059   uint32_t value = 0;
00060   asm volatile ("lda [%1] %2, %0;\n"
00061                 : "=r" (value)
00062                 : "r" (addr), "i" (ASI_MMU_BYPASS)
00063                 : "memory");
00064   return value;
00065 }
00066 
00067 #endif /* __POK_SPARC_LEON3_IOPORTS_H__ */