帮忙看看这两段代码有什么不同,搞了我两晚上的时间了,郁闷.
/* Set system clock.*/
/*set PLLA for 180MHz */
LDR r1, =AT91_CKGR_PLLAR
LDR r2, =PLLAR_VAL
STR r2, [r1]
LDR r1, =AT91RM9200_DELAY_VALUE
LockPLLA:
SUBS r1, r1, #1
BNE LockPLLA
/* set PLLB for USB 48MHz */
LDR r1, =AT91_CKGR_PLLBR
LDR r2, =PLLBR_VAL
STR r2, [r1]
LDR r1, =AT91RM9200_DELAY_VALUE
LockPLLB:
SUBS r1, r1, #1
BNE LockPLLB
/* Write in the MCKR dirty value concerning the clock selection CSS then overwrite it in a second sequence */
LDR r1, =AT91_PMC_MCKR
LDR r2, =AT91_PMC_CSS_SLOW_CLK
STR r2, [r1]
LDR r1, =AT91RM9200_DELAY_VALUE
MCKRDY1:
SUBS r1, r1, #1
BNE MCKRDY1
/* set new MCKR value for you chooose */
LDR r1, =AT91_PMC_MCKR
LDR r2, =AT91_PMC_NEW_CLK
STR r2, [r1]
LDR r1, =AT91RM9200_DELAY_VALUE
MCKRDY2:
SUBS r1, r1, #1
BNE MCKRDY2
下面是C语言的
int i=0;
volatile int *pReigster = '\0';
pReigster = AT91_CKGR_PLLAR;
*pReigster = PLLAR_VAL;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);
pReigster = AT91_CKGR_PLLBR;
*pReigster = PLLBR_VAL;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);
pReigster = AT91_PMC_MCKR;
*pReigster = AT91_PMC_CSS_SLOW_CLK;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);
pReigster = AT91_PMC_MCKR;
*pReigster = AT91_PMC_NEW_CLK;
for (i=0; i<AT91RM9200_DELAY_VALUE; i++);