• Main Page
  • Classes
  • Files
  • File List
  • File Members

9302hw.h

Go to the documentation of this file.
00001 //
00002 // begin license header
00003 //  
00004 // This file is part of Terk and TerkOS.
00005 //
00006 // All Terk and TerkOS source code is provided under the terms of the 
00007 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).  
00008 // Those wishing to use Terk and TerkOS source code, software and/or
00009 // technologies under different licensing terms should contact us at 
00010 // [email protected]. Such licensing terms are available for
00011 // all portions of the Terk and TerkOS codebase presented here.
00012 //
00013 // end license header
00014 //
00015 
00016 #ifndef _9302HW_H
00017 #define _9302HW_H
00018 
00019 #include "singleton.h"
00020 #include "memmap.h"
00021 
00025 #define HW_AD_CHANNELS             5
00026 
00045 class C9302Hardware
00046 {
00047 public:
00051   SINGLETON(C9302Hardware);
00052 
00058   unsigned short GetAD(unsigned int channel);
00059 
00064   inline void SetGreenLED(bool state)
00065   {
00066     *PortEData() = state ? *PortEData() |= 0x01 : *PortEData() &= ~0x01;
00067   }
00068 
00073   inline void SetRedLED(bool state)
00074   {
00075     *PortEData() = state ? *PortEData() |= 0x02 : *PortEData() &= ~0x02;
00076   }
00077 
00082   inline volatile unsigned int *PortAData()
00083   {
00084     return m_gpio.Uint(0x00);
00085   }
00086 
00091   inline volatile unsigned int *PortADataDR()
00092   {
00093     return m_gpio.Uint(0x10);
00094   }
00095 
00100   inline volatile unsigned int *PortBData()
00101   {
00102     return m_gpio.Uint(0x04);
00103   }
00104 
00109   inline volatile unsigned int *PortBDataDR()
00110   {
00111     return m_gpio.Uint(0x14);
00112   }
00113 
00118   inline volatile unsigned int *PortCData()
00119   {
00120     return m_gpio.Uint(0x08);
00121   }
00122 
00127   inline volatile unsigned int *PortCDataDR()
00128   {
00129     return m_gpio.Uint(0x18);
00130   }
00131 
00136   inline volatile unsigned int *PortEData()
00137   {
00138     return m_gpio.Uint(0x20);
00139   }
00140 
00145   inline volatile unsigned int *PortEDataDR()
00146   {
00147     return m_gpio.Uint(0x24);
00148   }
00149 
00154   inline volatile unsigned int *PortFData()
00155   {
00156     return m_gpio.Uint(0x30);
00157   }
00158 
00163   inline volatile unsigned int *PortFDataDR()
00164   {
00165     return m_gpio.Uint(0x34);
00166   }
00167 
00172   inline volatile unsigned int *PortGData()
00173   {
00174     return m_gpio.Uint(0x38);
00175   }
00176 
00181   inline volatile unsigned int *PortGDataDR()
00182   {
00183     return m_gpio.Uint(0x3c);
00184   }
00185 
00190   inline volatile unsigned int *PortHData()
00191   {
00192     return m_gpio.Uint(0x40);
00193   }
00194 
00199   inline volatile unsigned int *PortHDataDR()
00200   {
00201     return m_gpio.Uint(0x44);
00202   }
00203 
00208   unsigned short GetBitstreamVersion();
00209 
00214   unsigned char GetBitstreamMinorVersion();
00215 
00220   unsigned char GetBitstreamMajorVersion();
00221 
00225   CMemMap m_scr;
00226 
00227 
00231   CMemMap m_gpio;
00232 
00236   CMemMap m_syscon;
00237 
00241   CMemMap m_fpga;
00242 
00246   CMemMap m_adc;
00247 
00251   CMemMap m_uart1;
00252 
00256   CMemMap m_uart2;
00257 
00258 private:
00259   C9302Hardware();
00260   ~C9302Hardware();
00261 };
00262 
00263 #endif

Generated on Mon Oct 3 2011 15:36:31 for libqwerk by  doxygen 1.7.1