source: ResearchApps/PHY/WARPLAB/WARPLab_v05_2/C_Code_Reference/warp_userio.h

Last change on this file was 1385, checked in by sgupta, 14 years ago

warplab v5.1 update

File size: 1.9 KB
Line 
1/************************************************************
2* This file provides macros and constants for interfacing with
3* the LEDs, buttons and switches on the WARP FPGA Board v1.2
4*
5* The constants here assume a hardware platform (MHS) built using
6*  Xilinx EDK 10.1.02 (or later)
7*  Base System Builder
8*  WARP FPGA Board v1.2 XBD svn rev 925 (or later)
9*************************************************************/
10
11#ifndef USERIO_H
12#define USERIO_H
13
14#ifndef WARP_FPGA_BOARD_V2_2
15//Bit masks for user inputs (buttons & switches)
16#define USERIO_CHAN_INPUTS  1
17#define USERIO_MASK_DIPSW   0x3C000
18#define USERIO_MASK_PB      0x03C00
19#define USERIO_MASK_PBC     0x00400
20#define USERIO_MASK_PBR     0x00800
21#define USERIO_MASK_PBL     0x01000
22#define USERIO_MASK_PBU     0x02000
23#define USERIO_MASK_INPUTS  (USERIO_MASK_DIPSW | USERIO_MASK_PB)
24
25//Offsets for user inputs
26#define USERIO_OFFSET_DIPSW 14
27#define USERIO_OFFSET_PB    10
28
29#define USERIO_MAP_DIPSW(x) ( (unsigned int)( (x & USERIO_MASK_DIPSW) >> USERIO_OFFSET_DIPSW) )
30#define USERIO_MAP_PB(x) ( (unsigned int)( (x & USERIO_MASK_PB) >> USERIO_OFFSET_PB) )
31
32//Bit masks for user outputs (LEDs and 7-segment displays)
33#define USERIO_CHAN_OUTPUTS 2
34#define USERIO_MASK_DISPR   0x0003F800
35#define USERIO_MASK_DISPL   0x000007F0
36#define USERIO_MASK_LEDS    0x0000000F
37#define USERIO_MASK_OUTPUTS (USERIO_MASK_DISPL | USERIO_MASK_DISPR | USERIO_MASK_LEDS)
38
39//Offsets for user outputs
40#define USERIO_OFFSET_DISPR 11
41#define USERIO_OFFSET_DISPL 4
42#define USERIO_OFFSET_LEDS  0
43
44#define USERIO_MAP_DISPR(x) ( (unsigned int)(USERIO_MASK_DISPR & ( (unsigned int)x << USERIO_OFFSET_DISPR)) )
45#define USERIO_MAP_DISPL(x) ( (unsigned int)(USERIO_MASK_DISPL & ( (unsigned int)x << USERIO_OFFSET_DISPL)) )
46#define USERIO_MAP_LEDS(x) ( (unsigned int)(USERIO_MASK_LEDS & ((unsigned int)x << USERIO_OFFSET_LEDS)) )
47
48#endif //ifndef WARP_FPGA_BOARD_V2_2
49
50#endif //ifndef USERIO_H
Note: See TracBrowser for help on using the repository browser.