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

Subversion Repositories s6soc

[/] [s6soc/] [trunk/] [sw/] [dev/] [board.h] - Blame information for rev 45

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

Line No. Rev Author Line
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 15 dgisselq
// 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 12 dgisselq
#define INT_BUTTON      0x001
60
#define INT_BUSERR      0x002 // Kind of useless, a buserr will kill us anyway
61
#define INT_SCOPE       0x004
62 45 dgisselq
#define INT_TIMER       0x010
63
//#define INT_WATCHDOG  0x020   // Catching a watchdog/reset interrupt makes no sense
64 12 dgisselq
#define INT_UARTRX      0x040
65
#define INT_UARTTX      0x080
66
#define INT_KEYPAD      0x100
67
#define INT_AUDIO       0x200
68
#define INT_GPIO        0x400
69 15 dgisselq
// #define      INT_FLASH       0x800   // Not available due to lack of space
70
#define INT_ENABLEV(IN)         (INT_ENABLE|((IN)<<16))
71 45 dgisselq
#define INT_DISABLEV(IN)        ((IN)<<16)
72 15 dgisselq
#define INT_CLEAR(IN)           (IN)
73 45 dgisselq
#define INT_CLEARPIC    0x7fff7fff
74
#define INT_DALLPIC     0x7fff0000
75 12 dgisselq
 
76
// Clocks per second, for use with the timer
77
#define TM_ONE_SECOND   80000000
78
#define TM_REPEAT       0x80000000
79
 
80
typedef struct  {
81 45 dgisselq
        int             io_pic;
82
        unsigned        *io_buserr;
83
        int             io_timer, io_watchdog;
84
        unsigned        io_pwm_audio;
85
        unsigned        io_spio; // aka keypad, buttons, and keyboard
86
        unsigned        io_gpio;
87
        unsigned        io_uart;
88
        unsigned        io_version;
89 12 dgisselq
} IOSPACE;
90
 
91
 
92 45 dgisselq
#define WBSCOPE_NO_RESET        0x80000000
93
#define WBSCOPE_MANUAL  WBSCOPE_TRIGGER
94
//
95
#define WBSCOPE_STOPPED         0x40000000
96
#define WBSCOPE_TRIGGERED       0x20000000
97
#define WBSCOPE_PRIMED          0x10000000
98
#define WBSCOPE_TRIGGER        (0x08000000|WBSCOPE_NO_RESET)
99
#define WBSCOPE_DISABLED        0x04000000
100
#define WBSCOPE_DISABLE         0x04000000      // Disable the scope trigger
101
#define WBSCOPE_RZERO           0x02000000      // Unused,true if ptd at begning
102
#define WBSCOPE_LGLEN(A)        ((A>>20)&0x01f)
103
#define WBSCOPE_LENGTH(A)       (1<<(WBSCOPE_LGLEN(A)))
104 12 dgisselq
 
105 45 dgisselq
typedef struct WBSCOPE_S {
106
        unsigned        s_ctrl, s_data;
107
} WBSCOPE;
108 12 dgisselq
 
109 45 dgisselq
#define IOADDR          0x000400
110
#define SCOPEADDR       0x000800
111
// #define FCTLADDR     0x000c00 // Flash control, depends upon write capability
112
#define RAMADDR         0x004000
113
#define RAMSZ           (RAMADDR)
114
#define FLASHADDR       0x1000000
115
#define RESET_ADDR      0x1200000
116
#define FLASHSZ         (FLASHADDR)
117 12 dgisselq
 
118 45 dgisselq
static  volatile IOSPACE *const _sys   = (IOSPACE *)IOADDR;
119
static  volatile WBSCOPE *const _scope = (WBSCOPE *)SCOPEADDR;
120
 
121 12 dgisselq
#endif

powered by: WebSVN 2.1.0

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