This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Accessing SFR

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

0