OpenCores
URL https://opencores.org/ocsvn/s6soc/s6soc/trunk

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [zipos/] [board.h] - Blame information for rev 44

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 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
// GPIO PINS
43
//   first the outputs ...
44
#define GPO_SDA         0x000001
45
#define GPO_SCL         0x000002
46
#define GPO_MOSI        0x000004
47
#define GPO_SCK         0x000008
48
#define GPO_SS          0x000010
49
//   then the inputs.
50
#define GPI_SDA         0x010000
51
#define GPI_SCL         0x020000
52
#define GPI_MISO        0x040000
53
 
54
#define GPOSETV(PINS)   ((PINS)|((PINS)<<16))
55
#define GPOCLRV(PINS)   ((PINS)<<16)
56
 
57
// Interrupts
58
#define INT_ENABLE      0x80000000
59
#define INT_BUTTON      0x001
60
#define INT_BUSERR      0x002 // Kind of useless, a buserr will kill us anyway
61
#define INT_SCOPE       0x004
62
#define INT_RTC         0x008 // May not be available, due to lack of space
63
#define INT_TIMA        0x010
64
#define INT_TIMB        0x020
65
#define INT_UARTRX      0x040
66
#define INT_UARTTX      0x080
67
#define INT_KEYPAD      0x100
68
#define INT_AUDIO       0x200
69
#define INT_GPIO        0x400
70
// #define      INT_FLASH       0x800   // Not available due to lack of space
71
#define INT_ENABLEV(IN)         (INT_ENABLE|((IN)<<16))
72
#define INT_DISABLEV(IN)        ((IN)<<16)
73
#define INT_CLEAR(IN)           (IN)
74
 
75
// Clocks per second, for use with the timer
76
#define TM_ONE_SECOND   80000000
77
#define TM_REPEAT       0x80000000
78
 
79
typedef struct  {
80
        volatile int            io_pic;
81
        volatile unsigned       *io_buserr;
82
        volatile int            io_tima, io_timb;
83
        volatile unsigned       io_pwm_audio;
84
        volatile unsigned       io_spio; // aka keypad, buttons, and keyboard
85
        volatile unsigned       io_gpio;
86
        volatile unsigned       io_uart;
87
        volatile unsigned       io_version;
88
} IOSPACE;
89
 
90
// Wishbone scope control
91
#define TRIGGER_SCOPE_NOW       0x88000000
92
#define SCOPE_IS_STOPPED        0x40000000
93
#define DISABLE_TRIGGER         0x84000000
94
typedef struct {
95
        volatile unsigned       s_control, s_data;
96
} SCOPE;
97
 
98
typedef struct  {
99
        volatile unsigned       f_crc, f_far_maj, f_far_min, f_fdri,
100
                        f_fdro, f_cmd, f_ctl, f_mask,
101
                        f_stat, f_lout, f_cor1, f_cor2,
102
                        f_pwrdn, f_flr, f_idcode, f_cwdt,
103
                        f_hcopt, f_csbo, f_gen1, f_gen2,
104
                        f_gen3, f_gen4, f_gen5, f_mode,
105
                        f_gwe, f_mfwr, f_cclk, f_seu, f_exp, f_rdbk,
106
                        f_bootsts, f_eye, f_cbc;
107
} FPGACONFIG;
108
 
109
typedef struct  {
110
        volatile unsigned       c_clock, c_timer, c_stopwatch, c_alarm;
111
} RTCCLOCK;
112
 
113
#define IOADDR          0x000100
114
#define SCOPEADDR       0x000200
115
// #define FCTLADDR     0x000300 // Flash control, depends upon write capability
116
#define CONFIGADDR      0x000400
117
// #define RTCADDR      0x000800 // Disabled for lack of space on device
118
#define RAMADDR         0x002000
119
#define RAMSZ           0x001000
120
#define FLASHADDR       0x400000
121
#define RESET_ADDR      0x480000
122
#define FLASHSZ         0x400000
123
 
124
#define valid_ram_region(PTR,LN) (((int)(PTR)>=RAMADDR)&&((int)(PTR+LN)<RAMADDR+RAMSZ))
125
#define valid_flash_region(PTR,LN) (((int)(PTR)>=FLASHADDR)&&((int)(PTR+LN)<FLASHADDR+FLASHSZ))
126
#define valid_mem_region(PTR,LN)        ((valid_ram_region(PTR,LN))||(valid_flash_region(PTR,LN)))
127
 
128
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.