w3_userio driver
Driver for WARP v3 user IO control core (w3_userio_axi_v1_02_a)
Reading user IO

Macros

#define userio_read_inputs(baseaddr)   Xil_In32(baseaddr+W3_USERIO_SLV_REG6_OFFSET)
 
#define userio_read_hexdisp_left(baseaddr)   Xil_In32(baseaddr+W3_USERIO_SLV_REG1_OFFSET)
 
#define userio_read_hexdisp_right(baseaddr)   Xil_In32(baseaddr+W3_USERIO_SLV_REG2_OFFSET)
 
#define userio_read_leds_red(baseaddr)   Xil_In32(baseaddr+W3_USERIO_SLV_REG3_OFFSET)
 
#define userio_read_leds_green(baseaddr)   Xil_In32(baseaddr+W3_USERIO_SLV_REG4_OFFSET)
 
#define userio_read_leds_rf(baseaddr)   Xil_In32(baseaddr+W3_USERIO_SLV_REG5_OFFSET)
 

Detailed Description

Note on output state: The macros for reading the current state of user outputs (LEDs, hex displays) can only access outputs configured for software control. Attempts to read the state of outputs configured for hardware control (i.e. outputs with corresponding CTRLSRC_* asserted in control reg) will not reflect actual output state.

Examples:

//Assumes user code sets USERIO_BASEADDR to base address of w3_userio core, as set in xparameters.h
//Check if middle push button is being pressed
if(userio_read_inputs(USERIO_BASEADDR) & W3_USERIO_PB_M) {...}
//Read 4-bit DIP switch value
u8 x = userio_read_inputs(USERIO_BASEADDR) & W3_USERIO_DIPSW;

Macro Definition Documentation

#define userio_read_inputs (   baseaddr)    Xil_In32(baseaddr+W3_USERIO_SLV_REG6_OFFSET)

Returns the current state of the user inputs (buttons and DIP switch)

#define userio_read_hexdisp_left (   baseaddr)    Xil_In32(baseaddr+W3_USERIO_SLV_REG1_OFFSET)

Returns the current state of the left hex display outputs.

#define userio_read_hexdisp_right (   baseaddr)    Xil_In32(baseaddr+W3_USERIO_SLV_REG2_OFFSET)

Returns the current state of the right hex display outputs.

#define userio_read_leds_red (   baseaddr)    Xil_In32(baseaddr+W3_USERIO_SLV_REG3_OFFSET)

Returns the current state of the red user LEDs.

#define userio_read_leds_green (   baseaddr)    Xil_In32(baseaddr+W3_USERIO_SLV_REG4_OFFSET)

Returns the current state of the green user LEDs.

#define userio_read_leds_rf (   baseaddr)    Xil_In32(baseaddr+W3_USERIO_SLV_REG5_OFFSET)

Returns the current state of the RF LEDs.