@Lowlevel.c@
void lowlevel_init(void) //16line 선택적 컴파일
{
unsigned char i = 0;
///////////////////////////////////////////////////////////////////////////
// EFC Init
///////////////////////////////////////////////////////////////////////////
#ifdef AT91SAM7S512 //선택적 컴파일--AT91SAM7S512가 define(정의)되면 밑에 두줄을 포함한다..
AT91C_BASE_MC->MC0_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State to work at 48MHz
AT91C_BASE_MC->MC1_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State to work at 48MHz
#else //선택적 컴파일--AT91SAM7S512가 define(정의)되지않으면 밑에 한줄을 포함한다..
AT91C_BASE_MC->MC_FMR = AT91C_MC_FWS_1FWS; // 1 Wait State to work at 48MHz
//AT91C_MC_FWS_1FWS => #define AT91C_MC_FWS_1FWS (0x1 << 8) // (MC) 2 cycles for Read, 3 for Write operations
//★MC_FMR : MC Flash Mode Register
AT91C_BASE_MC = 0xFFFFFF00이며
MC_FMR은 MC에서 0ㅌ60만큼 떨어져 있다. 그래서 결국 0XFFFFFF60과 같다.
AT91_BASE_MC -> MC_FMR =value;
(volatile unsigned int*) 0xFFFFFF=value;
AT91C_MC_FMR(AT91_CAST(AT91_REG *)주소값 = value;
*AT91C_MC_FMR = value;
#endif
///////////////////////////////////////////////////////////////////////////
// Init PMC Step 1. Enable Main Oscillator
// Main Oscillator startup time is board specific:
// Main Oscillator Startup Time worst case (3MHz) corresponds to 15ms
// (0x40 for AT91C_CKGR_OSCOUNT field)
///////////////////////////////////////////////////////////////////////////
AT91C_BASE_PMC->PMC_MOR = (((AT91C_CKGR_OSCOUNT & (0x40 << 8)) | AT91C_CKGR_MOSCEN));
// ★PMC_MOR
// Wait Main Oscillator stabilization
//main Oscillator가 안정될때까지 대기
while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS));
(#은 전처리 지시어)
-------------------------------------------------------------------------
@makefile@
CCFLAGS=-g -mcpu=arm7tdmi $(OPTIM) -Wall -I$(WCINCL) -D$(WCTARGET)
'School Study' 카테고리의 다른 글
[업무일지]20100930-임종현 (0) | 2010.09.30 |
---|---|
[업무일지]20100928 (0) | 2010.09.29 |
[업무일지]20100920 (0) | 2010.09.20 |
[업무일지]20100909 (0) | 2010.09.09 |
[업무일지]-20100906-임종현 (0) | 2010.09.07 |