root / firmware / fx2 / common / init_gpif.c @ c473cc56
History | View | Annotate | Download (1.79 KB)
| 1 |
/*
|
|---|---|
| 2 |
* USRP - Universal Software Radio Peripheral
|
| 3 |
*
|
| 4 |
* Copyright (C) 2003 Free Software Foundation, Inc.
|
| 5 |
*
|
| 6 |
* This program is free software; you can redistribute it and/or modify
|
| 7 |
* it under the terms of the GNU General Public License as published by
|
| 8 |
* the Free Software Foundation; either version 3 of the License, or
|
| 9 |
* (at your option) any later version.
|
| 10 |
*
|
| 11 |
* This program is distributed in the hope that it will be useful,
|
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 14 |
* GNU General Public License for more details.
|
| 15 |
*
|
| 16 |
* You should have received a copy of the GNU General Public License
|
| 17 |
* along with this program; if not, write to the Free Software
|
| 18 |
* Foundation, Inc., 51 Franklin Street, Boston, MA 02110-1301 USA
|
| 19 |
*/
|
| 20 |
|
| 21 |
#include "usrp_common.h" |
| 22 |
|
| 23 |
// These are the tables generated by the Cypress GPIF Designer
|
| 24 |
|
| 25 |
extern const char WaveData[128]; |
| 26 |
extern const char FlowStates[36]; |
| 27 |
extern const char InitData[7]; |
| 28 |
|
| 29 |
// The tool is kind of screwed up, in that it doesn't configure some
|
| 30 |
// of the ports correctly. We just use their tables and handle the
|
| 31 |
// initialization ourselves. They also declare that their static
|
| 32 |
// initialized data is in xdata, which screws us too.
|
| 33 |
|
| 34 |
void
|
| 35 |
init_gpif (void)
|
| 36 |
{
|
| 37 |
// we've already setup IFCONFIG before calling this...
|
| 38 |
|
| 39 |
GPIFABORT = 0xFF; // abort any waveforms pending |
| 40 |
SYNCDELAY; |
| 41 |
|
| 42 |
GPIFREADYCFG = InitData[ 0 ];
|
| 43 |
GPIFCTLCFG = InitData[ 1 ];
|
| 44 |
GPIFIDLECS = InitData[ 2 ];
|
| 45 |
GPIFIDLECTL = InitData[ 3 ];
|
| 46 |
// Hmmm, what's InitData[ 4 ] ...
|
| 47 |
GPIFWFSELECT = InitData[ 5 ];
|
| 48 |
// GPIFREADYSTAT = InitData[ 6 ]; // I think this register is read only...
|
| 49 |
|
| 50 |
{
|
| 51 |
BYTE i; |
| 52 |
|
| 53 |
for (i = 0; i < 128; i++){ |
| 54 |
GPIF_WAVE_DATA[i] = WaveData[i]; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
FLOWSTATE = 0; /* ensure it's off */ |
| 59 |
} |