UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer umerdarazawan
Observer
3,127 Views
Registered: ‎11-01-2010

Possible to bit level access in XGpio

Jump to solution

Plz help me whether it is possibe......

 

Q1.

Weather it is possible to set or clear single bit in XGpio register ?

just like

 

#define led0        0

#define led1        1

#define led2         2

 

main()

{

 

// to ON led0 and led1

XGpio_DiscreteSet(&leds, led0 | led1);

 

// to ON led1 and led2

XGpio_DiscreteSet(&leds, led1 | led2);

 

// to OFF led0, led1 and led2

XGpio_DiscreteClear(&leds, led0 | led1 |led2);

 

}

 

 

thanks in advance

umer

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
4,071 Views
Registered: ‎08-02-2007

Re: Possible to bit level access in XGpio

Jump to solution

yes, you can set or clear single bits in the xgpio register, but it doesn't look like you can just call those functions as you have specified. Review the xgpio_extra.c source code found in the C:\Xilinx\12.3\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\gpio_v3_00_a\src to get an idea of how the functions actually work.

 

For example, the function is as follows:

 

void XGpio_DiscreteSet(XGpio * InstancePtr, unsigned Channel, u32 Mask)

 

So first, you will need three values passed into the function.  Second, the u32 Mask, should be something like 0x01, or 0x0001, or whatever the length of GPIO you have specified, so I'm not sure that the way you have the code written will correctly function.  You can review some examples in the C:\Xilinx\12.3\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\gpio_v3_00_a\examples folder. looks like xgpio_example.c might be the best example for discreteset to get started with.

0 Kudos
1 Reply
Highlighted
Explorer
Explorer
4,072 Views
Registered: ‎08-02-2007

Re: Possible to bit level access in XGpio

Jump to solution

yes, you can set or clear single bits in the xgpio register, but it doesn't look like you can just call those functions as you have specified. Review the xgpio_extra.c source code found in the C:\Xilinx\12.3\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\gpio_v3_00_a\src to get an idea of how the functions actually work.

 

For example, the function is as follows:

 

void XGpio_DiscreteSet(XGpio * InstancePtr, unsigned Channel, u32 Mask)

 

So first, you will need three values passed into the function.  Second, the u32 Mask, should be something like 0x01, or 0x0001, or whatever the length of GPIO you have specified, so I'm not sure that the way you have the code written will correctly function.  You can review some examples in the C:\Xilinx\12.3\ISE_DS\EDK\sw\XilinxProcessorIPLib\drivers\gpio_v3_00_a\examples folder. looks like xgpio_example.c might be the best example for discreteset to get started with.

0 Kudos