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

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [firmware/] [include/] [isr.h] - Blame information for rev 9

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 9 nussgipfel
/* -*- c++ -*- */
2
/*
3
 * Copyright 2003 Free Software Foundation, Inc.
4
 *
5
 * This file is part of GNU Radio
6
 *
7
 * GNU Radio 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, or (at your option)
10
 * any later version.
11
 *
12
 * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
19
 * the Free Software Foundation, Inc., 51 Franklin Street,
20
 * Boston, MA 02110-1301, USA.
21
 */
22
 
23
#ifndef _ISR_H_
24
#define _ISR_H_
25
 
26
/************************************************************************/
27
/** \file isr.h
28
 *************************************************************************
29
 * \brief       routines for managing interrupt services routines
30
 *
31
 * The FX2 has three discrete sets of interrupt vectors.
32
 * The first set is the standard 8051 vector (13 8-byte entries).
33
 * The second set is USB interrupt autovector (32 4-byte entries).
34
 * The third set is the FIFO/GPIF autovector (14 4-byte entries).
35
 *
36
 * Since all the code we're running in the FX2 is ram based, we
37
 * forego the typical "initialize the interrupt vectors at link time"
38
 * strategy, in favor of calls at run time that install the correct
39
 * pointers to functions.
40
 *
41
 * \author       GNU Radio
42
 */
43
 
44
/*
45
 * Standard Vector numbers
46
 */
47
 
48
#define SV_INT_0                0x03  /**< INT0 Pin */
49
#define SV_TIMER_0              0x0b  /**< Timer 0 Overflow */
50
#define SV_INT_1                0x13  /**< INT1 Pin */
51
#define SV_TIMER_1              0x1b  /**< Timer 1 Overflow */
52
#define SV_SERIAL_0             0x23  /**< USART 0 Rx & Tx */
53
#define SV_TIMER_2              0x2b  /**< Timer 2 Overflow */
54
#define SV_RESUME               0x33  /**< WAKEUP / WU2 Pin or USB Resume */
55
#define SV_SERIAL_1             0x3b  /**< USART 1 Rx & Tx */
56
#define SV_INT_2                0x43  /**< (INT_2) points at USB autovector */
57
#define SV_I2C                  0x4b  /**< I2C Bus */
58
#define SV_INT_4                0x53  /**< (INT_4) points at FIFO/GPIF autovector */
59
#define SV_INT_5                0x5b  /**< INT5 Pin */
60
#define SV_INT_6                0x63  /**< INT6 Pin */
61
 
62
#define SV_MIN                  SV_INT_0
63
#define SV_MAX                  SV_INT_6
64
 
65
/*
66
 * USB Auto Vector numbers
67
 */
68
 
69
#define UV_SUDAV                0x00  /**< SETUP Data Available */
70
#define UV_SOF                  0x04  /**< Start of Frame (or Microframe) */
71
#define UV_SUTOK                0x08  /**< Setup Token Received */
72
#define UV_SUSPEND              0x0c  /**< USB Suspend request */
73
#define UV_USBRESET             0x10  /**< Bus Reset */
74
#define UV_HIGHSPEED            0x14  /**< Entered high speed operation */
75
#define UV_EP0ACK               0x18  /**< EZ-USB ACK'd the CONTROL Handshake */
76
#define UV_SPARE_1C             0x1c  
77
#define UV_EP0IN                0x20  /**< EP0-IN ready to be loaded with data */
78
#define UV_EP0OUT               0x24  /**< EP0-OUT has USB data */
79
#define UV_EP1IN                0x28  /**< EP1-IN ready to be loaded with data */
80
#define UV_EP1OUT               0x2c  /**< EP1-OUT has USB data */
81
#define UV_EP2                  0x30  /**< IN: buffer available. OUT: buffer has data */
82
#define UV_EP4                  0x34  /**< IN: buffer available. OUT: buffer has data */
83
#define UV_EP6                  0x38  /**< IN: buffer available. OUT: buffer has data */
84
#define UV_EP8                  0x3c  /**< IN: buffer available. OUT: buffer has data */
85
#define UV_IBN                  0x40  /**< IN-Bulk-NAK (any IN endpoint) */
86
#define UV_SPARE_44             0x44
87
#define UV_EP0PINGNAK           0x48  /**< EP0 OUT was Pinged and it NAK'd */
88
#define UV_EP1PINGNAK           0x4c  /**< EP1 OUT was Pinged and it NAK'd */
89
#define UV_EP2PINGNAK           0x50  /**< EP2 OUT was Pinged and it NAK'd */
90
#define UV_EP4PINGNAK           0x54  /**< EP4 OUT was Pinged and it NAK'd */
91
#define UV_EP6PINGNAK           0x58  /**< EP6 OUT was Pinged and it NAK'd */
92
#define UV_EP8PINGNAK           0x5c  /**< EP8 OUT was Pinged and it NAK'd */
93
#define UV_ERRLIMIT             0x60  /**< Bus errors exceeded the programmed limit */
94
#define UV_SPARE_64             0x64  
95
#define UV_SPARE_68             0x68
96
#define UV_SPARE_6C             0x6c
97
#define UV_EP2ISOERR            0x70  /**< ISO EP2 OUT PID sequence error */
98
#define UV_EP4ISOERR            0x74  /**< ISO EP4 OUT PID sequence error */
99
#define UV_EP6ISOERR            0x78  /**< ISO EP6 OUT PID sequence error */
100
#define UV_EP8ISOERR            0x7c  /**< ISO EP8 OUT PID sequence error */
101
 
102
#define UV_MIN                  UV_SUDAV
103
#define UV_MAX                  UV_EP8ISOERR
104
 
105
/*
106
 * FIFO/GPIF Auto Vector numbers
107
 */
108
 
109
#define FGV_EP2PF               0x00  /**< Endpoint 2 Programmable Flag */
110
#define FGV_EP4PF               0x04  /**< Endpoint 4 Programmable Flag */
111
#define FGV_EP6PF               0x08  /**< Endpoint 6 Programmable Flag */
112
#define FGV_EP8PF               0x0c  /**< Endpoint 8 Programmable Flag */
113
#define FGV_EP2EF               0x10  /**< Endpoint 2 Empty Flag */
114
#define FGV_EP4EF               0x14  /**< Endpoint 4 Empty Flag */
115
#define FGV_EP6EF               0x18  /**< Endpoint 6 Empty Flag */
116
#define FGV_EP8EF               0x1c  /**< Endpoint 8 Empty Flag */
117
#define FGV_EP2FF               0x20  /**< Endpoint 2 Full Flag */
118
#define FGV_EP4FF               0x24  /**< Endpoint 4 Full Flag */
119
#define FGV_EP6FF               0x28  /**< Endpoint 6 Full Flag */
120
#define FGV_EP8FF               0x2c  /**< Endpoint 8 Full Flag */
121
#define FGV_GPIFDONE            0x30  /**< GPIF Operation Complete */
122
#define FGV_GPIFWF              0x34  /**< GPIF Waveform */
123
 
124
#define FGV_MIN                 FGV_EP2PF
125
#define FGV_MAX                 FGV_GPIFWF
126
 
127
 
128
/**
129
 * \brief Hook standard interrupt vector.
130
 *
131
 * \param[in] vector_number is from the SV_<foo> list above.
132
 * \param[in] addr is the address of the interrupt service routine.
133
 */
134
void hook_sv (unsigned char vector_number, unsigned short addr);
135
 
136
/**
137
 * \brief Hook usb interrupt vector.
138
 *
139
 * \param[in] vector_number is from the UV_<foo> list above.
140
 * \param[in] addr is the address of the interrupt service routine.
141
 */
142
void hook_uv (unsigned char vector_number, unsigned short addr);
143
 
144
/**
145
 * \brief Hook fifo/gpif interrupt vector.
146
 *
147
 * \param[in] vector_number is from the FGV_<foo> list above.
148
 * \param[in] addr is the address of the interrupt service routine.
149
 */
150
void hook_fgv (unsigned char vector_number, unsigned short addr);
151
 
152
/**
153
 * One time call to enable autovectoring for both USB and FIFO/GPIF
154
 */
155
void setup_autovectors (void);
156
 
157
 
158
/**
159
 * Makro to clear the pending USB interrrupt
160
 *
161
 * \warning Must be called in each usb interrupt handler
162
 */
163
#define clear_usb_irq()                 \
164
        EXIF &= ~bmEXIF_USBINT;         \
165
        INT2CLR = 0
166
 
167
/**
168
 * Makro to clear the pending FIFO/GPIF interrupt
169
 *
170
 * \warning Must be called in each fifo/gpif interrupt handler
171
 */
172
#define clear_fifo_gpif_irq()           \
173
        EXIF &= ~bmEXIF_IE4;            \
174
        INT4CLR = 0
175
 
176
#endif /* _ISR_H_ */

powered by: WebSVN 2.1.0

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