ok, you can try with this macro
# define SET(x,val)
{
unsigned char in_led=IORD_ALTERA_AVALON_PIO_DATA(X_BASE);
unsigned char out_tmp=1<<x;
unsigned char out;
if(val==1){
out=in_led | out_tmp;
}
else{
out=in_led &(~out_tmp);
}
IOWR_ALTERA_AVALON_PIO_DATA(X_BASE , out );\
}
if you want set in 1, only put the macro in your code like the following
SET(0,1)// put in 1 the led 0
SET(1,1)// put in 1 the led 1
SET(0,0)// put in 0 the led 0
SET(1,0)// put in 0 the led 1
or if you want toggle macro, try this
# define TOGGLE_LED(x)
{
unsigned char in_led=IORD_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE);
unsigned char out_tmp=1<<x;
unsigned char out=in_led ^ out_tmp;
IOWR_ALTERA_AVALON_PIO_DATA(LED_PIO_BASE , out);\
}