Hi Marius,
According to your given code for GPIOs, I wrote a similar code that it is :
#include <stdint.h>
#include <stdio.h>
static void dbg_io_initial()
{
// e500 Core View To Power Architecture CCSR: 0x0_FF70_0000
volatile uint32_t * Guts_Pmuxcr = (volatile uint32_t *)(0xFF7E0060); // GUTS_PMUXCR: Alternate Function Signal Multiplex Control Register
volatile uint32_t * Gpio3_Gpdir = (volatile uint32_t *)(0xFF70F200); // GPIO3_GPDIR: GPIO3 direction register
volatile uint32_t * Gpio3_Gpdat = (volatile uint32_t *)(0xFF70F208); // GPIO3_GPDAT: GPIO3 data register
// Enable GPIO3[10]: IRQ_DEBUG1_GPIO FIELD [BIT 26] set to "1"
*(Guts_Pmuxcr) = 0x00000010;
// Set Direction for GPIO3[10] to Output: FIELD DR10 [BIT 10] set to '1'
*(Gpio3_Gpdir) = 0x00200000;
// Set GPIO3[10] to '0': FIELD D10 [BIT 10] set to '0'
*(Gpio3_Gpdat) = 0x00000000;
}
int main(){
dbg_io_initial();
return 0;
}
I run this code on P1022, but Guts_Pmuxcr couldn't been initialized. I got segmentation fault.
Do I have to write codes in kernel level? or write a driver?