diff --git a/bacnet-stack/ports/at91sam7s/main.c b/bacnet-stack/ports/at91sam7s/main.c index 69750424..95cf3943 100644 --- a/bacnet-stack/ports/at91sam7s/main.c +++ b/bacnet-stack/ports/at91sam7s/main.c @@ -91,9 +91,13 @@ static inline void millisecond_timer( static inline void init( void) { + unsigned int pcsr; + /* Initialize the Parallel I/O Controller A Peripheral Clock */ volatile AT91PS_PMC pPMC = AT91C_BASE_PMC; - pPMC->PMC_PCER = pPMC->PMC_PCSR | (1 << AT91C_ID_PIOA); + + pcsr = pPMC->PMC_PCSR; + pPMC->PMC_PCER = pcsr | (1 << AT91C_ID_PIOA); /* Set up the LEDs (PA0 - PA3) */ volatile AT91PS_PIO pPIO = AT91C_BASE_PIOA; diff --git a/bacnet-stack/ports/at91sam7s/rs485.c b/bacnet-stack/ports/at91sam7s/rs485.c index db1b5806..a67e2278 100644 --- a/bacnet-stack/ports/at91sam7s/rs485.c +++ b/bacnet-stack/ports/at91sam7s/rs485.c @@ -65,9 +65,12 @@ static int RS485_Baud = 38400; void RS485_Initialize( void) { + unsigned int pcsr; /* Enable the USART0 clock in the Power Management Controller */ volatile AT91PS_PMC pPMC = AT91C_BASE_PMC; - pPMC->PMC_PCER = pPMC->PMC_PCSR | (1 << AT91C_ID_US0); + + pcsr = pPMC->PMC_PCSR; + pPMC->PMC_PCER = pcsr | (1 << AT91C_ID_US0); /* Disable and clear USART0 interrupt in AIC Interrupt Disable Command Register */ diff --git a/bacnet-stack/ports/at91sam7s/timer.c b/bacnet-stack/ports/at91sam7s/timer.c index 8ef64672..bd91ef90 100644 --- a/bacnet-stack/ports/at91sam7s/timer.c +++ b/bacnet-stack/ports/at91sam7s/timer.c @@ -337,9 +337,12 @@ void Timer_Silence_Reset( void TimerInit( void) { + unsigned int pcsr; /* enable the Timer0 peripheral clock */ volatile AT91PS_PMC pPMC = AT91C_BASE_PMC; - pPMC->PMC_PCER = pPMC->PMC_PCSR | (1 << AT91C_ID_TC0); + + pcsr = pPMC->PMC_PCSR; + pPMC->PMC_PCER = pcsr | (1 << AT91C_ID_TC0); /* Set up the AIC registers for Timer 0 */ volatile AT91PS_AIC pAIC = AT91C_BASE_AIC; /* Disable timer 0 interrupt */