Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

mmio.h

Go to the documentation of this file.
00001 
00002 /*
00003         $Id: mmio.h,v 1.1 2001/03/06 15:09:17 mbn Exp $
00004 
00005         ------------------------------------------------------------------------
00006         ClanLib, the platform independent game SDK.
00007 
00008         This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE
00009         version 2. See COPYING for details.
00010 
00011         For a total list of contributers see CREDITS.
00012 
00013         ------------------------------------------------------------------------
00014 
00015 This file is from ggi's mga code:
00016    Copyright (C) 1999 Marcus Sundberg   [marcus@ggi-project.org]
00017         www.ggi-project.org
00018 
00019 */
00020 
00021 #include <asm/types.h>
00022 
00023 typedef __u8 uint8;
00024 typedef __u32 uint32;
00025 
00026 
00027 static inline void
00028 mga_out8(volatile uint8 *mmioaddr, uint8 value, uint32 reg)
00029 {
00030         *((uint8*)(mmioaddr+reg)) = value;
00031 }
00032 
00033 static inline void
00034 mga_out32(volatile uint8 *mmioaddr, uint32 value, uint32 reg)
00035 {
00036         *((uint32*)(mmioaddr+reg)) = value;
00037 }
00038 
00039 static inline volatile uint8
00040 mga_in8(volatile uint8 *mmioaddr, uint32 reg)
00041 {
00042         return *((uint8*)(mmioaddr+reg));
00043 }
00044 
00045 static inline volatile uint32
00046 mga_in32(volatile uint8 *mmioaddr, uint32 reg)
00047 {
00048         return *((uint32*)(mmioaddr+reg));
00049 }
00050 
00051 /* We seem to need this for gcc to work... */
00052 static int grodis;
00053 
00054 extern int fifos;
00055 
00056 /* Wait for fifo space */
00057 static inline void
00058 mga_waitfifo(volatile uint8 *mmioaddr, int space)
00059 {
00060 //      fifos+=space;
00061         while (mga_in8(mmioaddr, FIFOSTATUS) < space) {
00062                 grodis = 0;
00063         }
00064 }
00065 
00066 
00067 /* Wait for idle accelerator */
00068 static inline void
00069 mga_waitidle(volatile uint8 *mmioaddr)
00070 {
00071         while (mga_in32(mmioaddr, STATUS) & 0x10000) {
00072                 grodis = 0;
00073         }
00074 }
00075 

Generated at Wed Apr 4 19:54:01 2001 for ClanLib by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001