Hi,
I would like to access each of the LEDs on the Zedboard individually. First I declare a bitfield:
struct io_leds {
tunsigned long led0:1;
tunsigned long led1:1;
unsigned long led2:1;
tunsigned long led3:1;
unsigned long led4:1;
tunsigned long led5:1;
unsigned long led6:1;
tunsigned long led7:1;
};
static volatile struct io_leds *io_data;
Afterwards, I setup the interface as follows:
static void io_setup(void)
{
t/* open /dev/mem device file */
t int fd = open("/dev/mem", O_RDWR|O_SYNC);t
t/* map it into logical memory */
tvoid *gpio = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x41220000);
tio_data = gpio;
/* test the device */
io_data->led0 = 1;
io_data->led1 = 1;
}
When the test part is executed, the result of the different lines is:
io_data->led0 = 1;
--> Result = LED0 is ON, the rest is OFF
io_data->led1 = 1;
--> Result = LED1 is ON, the rest is OFF
But I would like:
io_data->led0 = 1;
--> Result = LED0 is ON, the rest is OFF
io_data->led1 = 1;
--> Result = Both LED0 and LED1 are ON, the rest is OFF
Any ideas how could I solve this?
Thanks,
CHR