Hello all, I'm using the powerpc-eabispe gcc version 3.4.4 and I want to initialize the decrenenter with the following code:
#include "mpc5500_spr.h"
union SPR_TCRVAL my_SPR_TCRVAL; union SPR_HID0VAL my_SPR_HID0VAL; /* Load initial DEC value */ asm volatile ("mtdec %[DEC]"::[DEC]"r"(configCPU_CLOCK_HZ / configTICK_RATE_HZ)); /* Load the same value into the reload register */ asm volatile ("mtdecar %[DECAR]"::[DECAR]"r"(configCPU_CLOCK_HZ / configTICK_RATE_HZ)); /* Enable decrementer interrupt */ my_SPR_TCRVAL.B.DIE = 1; /* Auto-reload enable */ my_SPR_TCRVAL.B.ARE = 1; asm volatile ("mttcr %[TCR]"::[TCR]"r"(my_SPR_TCRVAL)); /* Time base: 0 = processor clock, 1 = p_tbclk */ my_SPR_HID0VAL.B.SEL_TBCLK = 0; /* Enable the time base and decrementer */ my_SPR_HID0VAL.B.TBEN = 1; asm volatile ("mthid0 %[HID0]"::[HID0]"r"(my_SPR_HID0VAL));
The resulting error message is: Error: Unrecognized opcode: `mthid0'
than I tried the following:
asm volatile ("mtspr %[SPRHID0], %[HID0]"::[SPRHID0]"i"(SPR_HID0),[HID0]"r"(my_SPR_HID0VAL));
This compiles but the wornf code is generated, the dump of the elf-file:
asm volatile ("mtspr %[SPRHID0], %[HID0]"::[SPRHID0]"r"(SPR_HID0),[HID0]"r"(my_SPR_HID0VAL)); a920: 39 20 03 f0 li r9,1008 a924: 80 1f 00 0c lwz r0,12(r31) a928: 7c 09 03 a6 mtctr r0
Finally I tried it with the following line od code:
asm volatile ("mtspr 1008, r0"); a920: 7c 10 fb a6 mtdbsr r0
Why is mthid0 unkown and why is the compiler/assember generating the wrong code? How can I write into the HID0 Register with the gnu compiler?
Regards, Gilles