| 1 | /** |
| 2 | * @section LICENSE |
| 3 | * |
| 4 | * PickleLauncher |
| 5 | * Copyright (C) 2010-2011 Scott Smith |
| 6 | * |
| 7 | * This program is free software: you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation, either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | * |
| 20 | * @section LOCATION |
| 21 | */ |
| 22 | |
| 23 | #ifndef CSYSTEM_H |
| 24 | #define CSYSTEM_H |
| 25 | |
| 26 | #include "cbase.h" |
| 27 | |
| 28 | using namespace std; |
| 29 | |
| 30 | #if defined(PANDORA) |
| 31 | #define CPU_CLOCK_DEF 600 |
| 32 | #define CPU_CLOCK_MAX 1200 |
| 33 | |
| 34 | #elif defined(WIZ) || defined(CAANOO) |
| 35 | #define CPU_CLOCK_DEF 300 |
| 36 | #define CPU_CLOCK_MAX 600 |
| 37 | #define MMAP_ADDRESS 0x10000 |
| 38 | #define SYS_CLK_FREQ 27 |
| 39 | #define PLLSETREG0 (memregl[0xF004>>2]) |
| 40 | #define PWRMODE (memregl[0xF07C>>2]) |
| 41 | |
| 42 | #elif defined(GP2X) |
| 43 | #define CPU_CLOCK_DEF 150 |
| 44 | #define CPU_CLOCK_MAX 300 |
| 45 | #define MMAP_ADDRESS 0x20000 |
| 46 | #define SYS_CLK_FREQ 7372800 |
| 47 | |
| 48 | #elif defined(GP2X) |
| 49 | #define CPU_CLOCK_DEF 1000 |
| 50 | #define CPU_CLOCK_MAX 2000 |
| 51 | |
| 52 | #else |
| 53 | #define CPU_CLOCK_DEF 1 |
| 54 | #define CPU_CLOCK_MAX 1 |
| 55 | #endif |
| 56 | |
| 57 | /** @brief This class controls resources, logic for gui, interaction with the user. |
| 58 | */ |
| 59 | class CSystem : public CBase |
| 60 | { |
| 61 | public: |
| 62 | /** Constructor. */ |
| 63 | CSystem(); |
| 64 | /** Destructor. */ |
| 65 | virtual ~CSystem(); |
| 66 | |
| 67 | /** @brief Set the CPU clock of the system. |
| 68 | * @param clock : number of arguments. |
| 69 | * @return 0 if passed 1 if failed. |
| 70 | */ |
| 71 | void SetCPUClock( uint16_t& mhz ); |
| 72 | |
| 73 | private: |
| 74 | |
| 75 | #if defined(GP2X) || defined(WIZ) || defined(CAANOO) |
| 76 | uint32_t memdev; |
| 77 | volatile uint32_t *memregs; |
| 78 | #endif |
| 79 | }; |
| 80 | |
| 81 | #endif // CSYSTEM_H |