| 1 |
12 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
//
|
| 3 |
|
|
// Filename: board.h
|
| 4 |
|
|
//
|
| 5 |
|
|
// Project: CMod S6 System on a Chip, ZipCPU demonstration project
|
| 6 |
|
|
//
|
| 7 |
|
|
// Purpose: To define the interfaces to the peripherals on the board, as
|
| 8 |
|
|
// given by the ZipCPU's view of the board.
|
| 9 |
|
|
//
|
| 10 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
| 11 |
|
|
// Gisselquist Technology, LLC
|
| 12 |
|
|
//
|
| 13 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
| 14 |
|
|
//
|
| 15 |
|
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
| 16 |
|
|
//
|
| 17 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
| 18 |
|
|
// modify it under the terms of the GNU General Public License as published
|
| 19 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
| 20 |
|
|
// your option) any later version.
|
| 21 |
|
|
//
|
| 22 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
| 23 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
| 24 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 25 |
|
|
// for more details.
|
| 26 |
|
|
//
|
| 27 |
|
|
// You should have received a copy of the GNU General Public License along
|
| 28 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
| 29 |
|
|
// target there if the PDF file isn't present.) If not, see
|
| 30 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
| 31 |
|
|
//
|
| 32 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
| 33 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
| 34 |
|
|
//
|
| 35 |
|
|
//
|
| 36 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
| 37 |
|
|
//
|
| 38 |
|
|
//
|
| 39 |
|
|
#ifndef BOARD_H
|
| 40 |
|
|
#define BOARD_H
|
| 41 |
|
|
|
| 42 |
|
|
#define INT_BUTTON 0x001
|
| 43 |
|
|
#define INT_BUSERR 0x002 // Kind of useless, a buserr will kill us anyway
|
| 44 |
|
|
#define INT_SCOPE 0x004
|
| 45 |
|
|
#define INT_RTC 0x008
|
| 46 |
|
|
#define INT_TIMA 0x010
|
| 47 |
|
|
#define INT_TIMB 0x020
|
| 48 |
|
|
#define INT_UARTRX 0x040
|
| 49 |
|
|
#define INT_UARTTX 0x080
|
| 50 |
|
|
#define INT_KEYPAD 0x100
|
| 51 |
|
|
#define INT_AUDIO 0x200
|
| 52 |
|
|
#define INT_GPIO 0x400
|
| 53 |
|
|
// #define INT_FLASH 0x800
|
| 54 |
|
|
|
| 55 |
|
|
// Clocks per second, for use with the timer
|
| 56 |
|
|
#define TM_ONE_SECOND 80000000
|
| 57 |
|
|
#define TM_REPEAT 0x80000000
|
| 58 |
|
|
|
| 59 |
|
|
typedef struct {
|
| 60 |
|
|
volatile int io_pic;
|
| 61 |
|
|
volatile unsigned *io_buserr;
|
| 62 |
|
|
volatile int io_tima, io_timb;
|
| 63 |
|
|
volatile unsigned io_pwm_audio;
|
| 64 |
|
|
volatile unsigned io_spio; // aka keypad, buttons, and keyboard
|
| 65 |
|
|
volatile unsigned io_gpio;
|
| 66 |
|
|
volatile unsigned io_uart;
|
| 67 |
|
|
volatile unsigned io_version;
|
| 68 |
|
|
} IOSPACE;
|
| 69 |
|
|
|
| 70 |
|
|
typedef struct {
|
| 71 |
|
|
volatile unsigned s_control, s_data;
|
| 72 |
|
|
} SCOPE;
|
| 73 |
|
|
|
| 74 |
|
|
typedef struct {
|
| 75 |
|
|
volatile unsigned f_crc, f_far_maj, f_far_min, f_fdri,
|
| 76 |
|
|
f_fdro, f_cmd, f_ctl, f_mask,
|
| 77 |
|
|
f_stat, f_lout, f_cor1, f_cor2,
|
| 78 |
|
|
f_pwrdn, f_flr, f_idcode, f_cwdt,
|
| 79 |
|
|
f_hcopt, f_csbo, f_gen1, f_gen2,
|
| 80 |
|
|
f_gen3, f_gen4, f_gen5, f_mode,
|
| 81 |
|
|
f_gwe, f_mfwr, f_cclk, f_seu, f_exp, f_rdbk,
|
| 82 |
|
|
f_bootsts, f_eye, f_cbc;
|
| 83 |
|
|
} FPGACONFIG;
|
| 84 |
|
|
|
| 85 |
|
|
typedef struct {
|
| 86 |
|
|
volatile unsigned c_clock, c_timer, c_stopwatch, c_alarm;
|
| 87 |
|
|
} RTCCLOCK;
|
| 88 |
|
|
|
| 89 |
|
|
#define IOADDR 0x000100
|
| 90 |
|
|
#define SCOPEADDR 0x000200
|
| 91 |
|
|
// #define FCTLADDR 0x000300 // Flash control, depends upon write capability
|
| 92 |
|
|
#define CONFIGADDR 0x000400
|
| 93 |
|
|
// #define RTCADDR 0x000800 // Disabled for lack of space on device
|
| 94 |
|
|
#define RAMADDR 0x002000
|
| 95 |
|
|
#define FLASHADDR 0x400000
|
| 96 |
|
|
#define RESET_ADDR 0x480000
|
| 97 |
|
|
|
| 98 |
|
|
#endif
|