main.c
来自「mpc55**系列芯片的例程 包括SCI,SPI,TIMER,FIT,EDMA」· C语言 代码 · 共 43 行
C
43 行
/* main.c - MMU - create TLB entry example */
/* Description: Creates a new entry to the TLB table in the MMU */
/* Rev 1.0 Sept 28, 2003 S.Mihalik, Copyright Freescale, 2004. All Rights Reserved */
/* Rev 1.1 July 06, 2007 SM - included header files for MPC551x family */
/* Notes: */
/* Notes: */
/* 1. MMU not initialized; must be done by debug scripts or BAM */
/* 2. SRAM not initialized; must be done by debug scripts or in a crt0 type file */
#include "mpc563m.h" /* Use proper include file such as mpc5510.h or mpc5554.h */
asm void MMU_init_TLB6(void) {
lis r3, 0x1006 /* Select TLB entry #, define R/W replacment control */
mtMAS0 r3 /* Load MAS0 with 0x1006 0000 for TLB entry #6 */
/* Define description context and configuration control: */
/* VALID=1, IPROT=0, TID=0, TS=0, TSIZE=1 (4KB size) */
lis r3, 0x8000 /* Load MAS 1 with 0x8000 0100 */
ori r3, r3, 0x0100
mtMAS1 r3
/* Define EPN and page attributes: */
/* EPN = 0x4004 0000, WIMAGE = all 0's */
lis r3, 0x4004 /* Load MAS2 with 0x4004 0000 */
mtMAS2 r3
/* Define RPN and access control for data R/W */
/* RPN = 0x4004 0000, U0:3=0, UX/SX=0, UR/SR/UW/SW=1 */
lis r3, 0x4004 /* Load MAS3 with 0x4004 000F */
ori r3, r3, 0x000F
mtMAS3 r3
tlbwe /* Write entry defined in MAS0 (entry 6 here) to MMU TLB */
}
void main (void) {
int i = 0; /* Dummy idle counter */
MMU_init_TLB6(); /* Define 4KB R/W space starting at 0x4004 0000, no translation */
while (1) { i++; } /* Loop forever */
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?