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

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [zlib/] [zipsys.h] - Blame information for rev 59

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

Line No. Rev Author Line
1 54 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    zipsys.h
4
//
5
// Project:     OpenArty, an entirely open SoC based upon the Arty platform
6
//
7
// Purpose:     Declare the capabilities and memory structure of the ZipSystem
8
//              for programs that must interact with it.
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 ZIPSYS_H
40
#define ZIPSYS_H
41
 
42
typedef struct  {
43
        unsigned        ac_ck, ac_mem, ac_pf, ac_icnt;
44
} ZIPTASKCTRS;
45
 
46
typedef struct  {
47
        int     d_ctrl, d_len;
48
        int     *d_rd, *d_wr;
49
} ZIPDMA;
50
 
51
#define DMA_TRIGGER     0x00008000
52
#define DMACABORT       0xffed0000
53
#define DMACLEAR        0xafed0000
54
#define DMACCOPY        0x0fed0000
55
#define DMACERR         0x40000000
56
#define DMA_CONSTSRC    0x20000000
57
#define DMA_CONSTDST    0x10000000
58
#define DMAONEATATIME   0x0fed0001
59
#define DMA_BUSY        0x80000000
60
#define DMA_ERR         0x40000000
61
#define DMA_ONINT(INT)  (DMA_TRIGGER|(((INT)&15)<<10))
62
#define DMA_ONJIFFIES   DMA_ONINT(1)
63
#define DMA_ONTMC       DMA_ONINT(2)
64
#define DMA_ONTMB       DMA_ONINT(3)
65
#define DMA_ONTMA       DMA_ONINT(4)
66
#define DMA_ONAUX       DMA_ONINT(5)
67
 
68
#define TMR_INTERVAL    0x80000000
69
typedef struct  {
70
        int     z_pic, z_wdt, z_wbus, z_apic, z_tma, z_tmb, z_tmc,
71
                z_jiffies;
72
#ifdef  _HAVE_ZIPSYS_PERFORMANCE_COUNTERS
73
        ZIPTASKCTRS     z_m, z_u;
74
#else
75
        unsigned        z_nocounters[8];
76
#endif
77
#ifdef  _HAVE_ZIPSYS_DMA
78
        ZIPDMA          z_dma;
79
#else
80
        unsigned        z_nodma[4];
81
#endif
82
} ZIPSYS;
83
 
84
#define ZIPSYS_ADDR     0xff000000
85
 
86
#define SYSINT_DMAC     0x0001
87
#define SYSINT_JIFFIES  0x0002
88
#define SYSINT_TMC      0x0004
89
#define SYSINT_TMB      0x0008
90
#define SYSINT_TMA      0x0010
91
#define SYSINT_AUX      0x0020
92
//
93
#define SYSINT(INTID)   (1<<(INTID))
94
#define ALTINT(INTID)   (1<<(INTID))
95
 
96
#ifdef  _HAVE_ZIPSYS_PERFORMANCE_COUNTERS
97
#define ALTINT_UIC      ALTINT(0)
98
#define ALTINT_UTC      ALTINT(3)
99
#define ALTINT_MIC      ALTINT(4)
100
#define ALTINT_MTC      ALTINT(7)
101
#endif
102
 
103
#define INT_ENABLE      0x80000000
104
#define EINT(A) (INT_ENABLE|((A)<<16))
105
#define DINT(A) ((A)<<16)
106
#define CLEARPIC        0x7fff7fff
107
#define DALLPIC         0x7fff0000      // Disable all PIC interrupt sources
108
#define INTNOW          0x08000
109
 
110
static  volatile ZIPSYS *const zip = (ZIPSYS *)(ZIPSYS_ADDR);
111
 
112
static inline void      DISABLE_INTS(void) {
113
        zip->z_pic = 0;
114
}
115
 
116
static inline void      ENABLE_INTS(void) {
117
        zip->z_pic = 0x80000000;
118
}
119
 
120
typedef struct  {
121
        int     c_r[16];
122
#ifdef  _HAVE_ZIPSYS_PERFORMANCE_COUNTERS
123
        unsigned long   c_ck, c_mem, c_pf, c_icnt;
124
#endif
125
} ZSYSCONTEXT;
126
 
127
#ifdef  _HAVE_ZIPSYS_PERFORMANCE_COUNTERS
128
void    save_contextncntrs(ZSYSCONTEXT *c);
129
void    restore_contextncntrs(ZSYSCONTEXT *c);
130
#else
131
#define save_contextncntrs(CONTEXT)     save_context((int *)CONTEXT)
132
#define restore_contextncntrs(CONTEXT)  restore_context((int *)CONTEXT)
133
#endif
134
 
135
#endif

powered by: WebSVN 2.1.0

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