Hi Please, How i implement this code in CARM? ///////////////////////////////////////////// typedef struct _AT91S_RTC { AT91_REG RTC_CR; // Control Register AT91_REG RTC_MR; // Mode Register AT91_REG RTC_TIMR; // Time Register AT91_REG RTC_CALR; // Calendar Register AT91_REG RTC_TIMALR; // Time Alarm Register AT91_REG RTC_CALALR; // Calendar Alarm Register AT91_REG RTC_SR; // Status Register AT91_REG RTC_SCCR; // Status Clear Command Register AT91_REG RTC_IER; // Interrupt Enable Register AT91_REG RTC_IDR; // Interrupt Disable Register AT91_REG RTC_IMR; // Interrupt Mask Register AT91_REG RTC_VER; // Valid Entry Register } AT91S_RTC, *AT91PS_RTC; #define AT91C_BASE_MC ((AT91PS_MC) 0xFFFFFF00) // (MC) Base Address #define AT91C_BASE_RTC ((AT91PS_RTC) 0xFFFFFE00) // (RTC) Base Address ///////////////////////////////////////////// I need access SFR whit structures For example I tried this: ////////////////////////////////// typedef struct { at91_reg PS_CR; /* Control Register */ at91_reg PS_PCER ; /* Peripheral Clock Enable Register */ at91_reg PS_PCDR ; /* Peripheral Clock Disable Register */ at91_reg PS_PCSR ; /* Peripheral Clock Status Register */ }StructPS; StructPS *PS_BASE __at 0xFFFF4000; //////////////////////////// When i try change the PS_PCER value: PS_BASE->PS_PCER = 0x04; The 0xFFFF4004 (PS_PCER) value not is affected (I saw this in Simulator). What's wrong? can you help me? Thank's Eduardo
Oh... Sure, sorry Maybe the problem is simulator config, because remains Now i create a new project only for test, there are:
#define PS_BASES 0xFFFF4000 /* Power Saving */ #define PS_TESTE (*((volatile unsigned int *)(PS_BASES + 0x04))) /* Peripheral Clock Enable Register */
PS_TESTE=0x04;
"Maybe the problem is simulator config..." If the simulator enforces the write-only semantics (assuming PCER is write-only for your derivative too), perhaps it always returns 0. That aside, you could inspect the compiler-generated code (compile to assembly source code) or disassemble and convince yourself that you are accessing the correct address.
Thanks Dan!! Now I understood! Thanks
I am happy to hear that, Eduardo. Cheers