1 |
9 |
nussgipfel |
/* GECKO3COM
|
2 |
|
|
*
|
3 |
|
|
* Copyright (C) 2008 by
|
4 |
|
|
* ___ ____ _ _
|
5 |
|
|
* ( _`\ ( __)( ) ( )
|
6 |
|
|
* | (_) )| (_ | |_| | Berne University of Applied Sciences
|
7 |
|
|
* | _ <'| _) | _ | School of Engineering and
|
8 |
|
|
* | (_) )| | | | | | Information Technology
|
9 |
|
|
* (____/'(_) (_) (_)
|
10 |
|
|
*
|
11 |
|
|
*
|
12 |
|
|
* This program is free software: you can redistribute it and/or modify
|
13 |
|
|
* it under the terms of the GNU General Public License as published by
|
14 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
15 |
|
|
* (at your option) any later version.
|
16 |
|
|
*
|
17 |
|
|
* This program is distributed in the hope that it will be useful,
|
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
|
|
* GNU General Public License for more details.
|
21 |
|
|
* You should have received a copy of the GNU General Public License
|
22 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
/*********************************************************************/
|
26 |
|
|
/** \file gecko3com_common.h
|
27 |
|
|
*********************************************************************
|
28 |
|
|
* \brief common defines and prototypes for GECKO3COM
|
29 |
|
|
*
|
30 |
|
|
* \author GNUradio, Christoph Zimmermann bfh.ch
|
31 |
|
|
* \date
|
32 |
|
|
*
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
|
|
#ifndef _GECKO3COMCOMMON_H_
|
36 |
|
|
#define _GECKO3COMCOMMON_H_
|
37 |
|
|
|
38 |
|
|
#include <stdint.h>
|
39 |
|
|
#include "syncdelay.h"
|
40 |
|
|
#include "gecko3com_regs.h"
|
41 |
|
|
#include "i2c.h"
|
42 |
|
|
#include "gecko3com_i2c.h"
|
43 |
|
|
|
44 |
|
|
#define TRUE 1
|
45 |
|
|
#define FALSE 0
|
46 |
|
|
|
47 |
|
|
/* Defines for LED output colors */
|
48 |
|
|
#define RED 0x02 /**< Switch bi-color LED to RED */
|
49 |
|
|
#define GREEN 0x04 /**< Switch bi-color LED to GREEN */
|
50 |
|
|
#define ORANGE 0x06 /**< Switch bi-color LED to ORANGE */
|
51 |
|
|
#define LEDS_OFF 0x00 /**< Switch bi-color LED off */
|
52 |
|
|
|
53 |
|
|
extern volatile uint8_t flLED;
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
/* defines and global variable for context switching between EZ-USB and GPIF/FPGA */
|
57 |
|
|
#define GECKO3COM_LOCAL 0 /** firmware parses commands */
|
58 |
|
|
#define GECKO3COM_REMOTE 1 /** no commands parsed, data passed to fpga */
|
59 |
|
|
|
60 |
|
|
extern volatile uint8_t flLOCAL; /**< flag to signal who interpretes TMC messages */
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
|
|
/** initialize all board specific stuff */
|
65 |
|
|
void init_gecko3com (void);
|
66 |
|
|
|
67 |
|
|
/** initialize the GPIF system of the EZ-USB FX2 */
|
68 |
|
|
void init_gpif (void);
|
69 |
|
|
|
70 |
|
|
/** resets the connected FPGA and the connected modules */
|
71 |
|
|
void gecko3com_system_reset(void);
|
72 |
|
|
|
73 |
|
|
/** switch LED0 on or off
|
74 |
|
|
* \param[in] on this value is active low, write 0 to activate LED0 */
|
75 |
|
|
void set_led_0 (const uint8_t on);
|
76 |
|
|
|
77 |
|
|
/** switch LED1 on or off
|
78 |
|
|
* \param[in] on this value is active low, write 0 to activate LED1 */
|
79 |
|
|
void set_led_1 (const uint8_t on);
|
80 |
|
|
|
81 |
|
|
/** toogles LED0. Connected to Port C. Debug purpose only! */
|
82 |
|
|
void toggle_led_0 (void);
|
83 |
|
|
|
84 |
|
|
/** toogles LED1 Connected to Port C. Debug purpose only! */
|
85 |
|
|
void toggle_led_1 (void);
|
86 |
|
|
|
87 |
|
|
/** initialize the external I2C I/O Expander */
|
88 |
|
|
void init_io_ext (void);
|
89 |
|
|
|
90 |
|
|
/** function that write to external LEDs (connected through I2C I/O Expander) */
|
91 |
|
|
void set_led_ext (const uint8_t color);
|
92 |
|
|
|
93 |
|
|
/** function that read the external switch (connected through I2C I/O Expander) */
|
94 |
|
|
uint8_t get_switch (void);
|
95 |
|
|
|
96 |
|
|
#endif /* _GECKO3COMCOMMON_H_ */
|