mpc860init.rar

  • dangongli
    了解作者
  • C/C++
    开发工具
  • 138KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 7
    下载次数
  • 2010-05-01 17:49
    上传日期
mpc860初始化程序代码,可当做为mpc860的LOADER使用。可用它来加载操作系统。
mpc860init.rar
  • mpc860init
  • smc2.h
    1.5KB
  • masks860.h
    117.3KB
  • init860.lnx
    318B
  • ppc_asm.tmpl
    6.5KB
  • test.S
    241B
  • init860t.o
    12.2KB
  • smc2.c
    16.4KB
  • mpc860.h
    46.5KB
  • smc2.o
    26.5KB
  • init860.map
    62.5KB
  • init860.out
    98.4KB
  • init860t.S
    93.1KB
  • smc2.c~
    16.5KB
  • ttt.s
    220.1KB
  • makefile
    1KB
  • netcomm.h
    1.2KB
  • mpc860.out
    287.7KB
  • ppc_asm.h
    630B
内容介绍
/*------------------------------------------------------------------------- * FILENAME: smc2.c * * DESCRIPTION: * * The code in this module provides echo capability on SMC2. It's * intent is to provide the beginnings of a debug port that is * mostly compiler independent. If an ASCII terminal is connected * at 9600,N,8,1 on Port 2 (PB3) on the ADS board with no hardware * control, characters typed on the keyboard will be received by * SMC2 and echoed back out the RS232 port to the ASCII terminal. * There is also code that blinks the Ethernet LED so that the * observer can quickly tell if code is executing if debugging * while code is in flash. This is helpful if the user is trying * to get the ASCII terminal working and is curious if the code is * executing. This function was designed and tested on an ADS860 * development board. Note that if a different baud rate is * required, there is a header file on the netcomm website under * the General Software category that is labelled "Asynchronous * Baud Rate Tables". * * REFERENCES: * * 1) MPC860 Users Manual * 2) PowerPC Microprocessor Family: The Programming Environments for * 32-Bit Microprocessors * * HISTORY: * * 27 APR 98 jay initial release * *-------------------------------------------------------------------------*/ #include "netcomm.h" #include "mpc860.h" #include "masks860.h" #include "smc2.h" /***********************/ /* Global Declarations */ /***********************/ EPPC *IMMR; /* IMMR base pointer */ BDRINGS *RxTxBD; /* buffer descriptors base pointer */ LB *SMC2Buffers; /* SMC2 base pointers */ /*---------------------*/ /* Function Prototypes */ /*---------------------*/ void SMC2PutChar(UBYTE); UBYTE SMC2GetChar(void); UBYTE SMC2Poll(void); void EthLED(UBYTE); void EchoChar(void); void BlinkEthLED(void); void SMC2Init(void); void InitBDs(void); void main(void); GetIMMR(); int strlen(char * str); void send_string(const char *str); void ClearSRAM(unsigned long StartAddr, unsigned long EndAddr); void SetSRAM(unsigned long StartAddr, unsigned long EndAddr); unsigned char TestSRAM(unsigned long StartAddr, unsigned long EndAddr); /*---------------------------------------------------------------------------- * * FUNCTION NAME: main * * DESCRIPTION: * * This is the main function for the SMC2 code. * * EXTERNAL EFFECT: * * PARAMETERS: None * * RETURNS: None * *---------------------------------------------------------------------------*/ void main(void) { /*------------------------*/ /* Establish IMMR pointer */ /*------------------------*/ IMMR = (EPPC *)(GetIMMR() & 0xFFFF0000); /* MPC8xx internal register map */ /*--------------------------------------------------------------------*/ /* We add 64 bytes to the start of the buffer descriptors because */ /* this code was also tested on the monitor version of SDS debugger. */ /* The monitor program on our target uses most of the first 64 bytes */ /* for buffer descriptors. If you are not using the SDS monitor with */ /* Motorola's ADS development board, you can delete 64 below and */ /* start at the beginning of this particular block of Dual Port RAM. */ /*--------------------------------------------------------------------*/ /*----------------------------------*/ /* Get pointer to BD area on DP RAM */ /*----------------------------------*/ RxTxBD = (BDRINGS *)(IMMR->qcp_or_ud.ud.udata_bd + 64); /*-------------------------------------------------------------------*/ /* Establish the buffer pool in Dual Port RAM. We do this because the*/ /* pool size is only 2 bytes (1 for Rx and 1 for Tx) and to avoid */ /* disabling data cache for the memory region where BufferPool would */ /* reside. The CPM does not recognize data in buffer pools once it */ /* been cached. It's acesses are direct through DMA to external */ /* memory. */ /*-------------------------------------------------------------------*/ SMC2Buffers = (LB *)(IMMR->qcp_or_ud.ud.udata_bd + 80); /*-------------------------------------------------------------------*/ /* Establish the buffer pool in Dual Port RAM. We do this because the*/ /* pool size is only 2 bytes (1 for Rx and 1 for Tx) and to avoid */ /* disabling data cache for the memory region where BufferPool would */ /* reside. The CPM does not recognize data in buffer pools once it */ /* been cached. It's acesses are direct through DMA to external */ /* memory. */ /*-------------------------------------------------------------------*/ SMC2Buffers = (LB *)(IMMR->qcp_or_ud.ud.udata_bd + 80); /*----------------------------------------*/ /* Initialize SMC2 and buffer descriptors */ /*----------------------------------------*/ SMC2Init(); while (1) { /*--------------------------------------------------*/ /* if there is a receive character echo it back out */ /*--------------------------------------------------*/ if (SMC2Poll()) /* Check BD status for Rx characters */ EchoChar(); // BlinkEthLED(); /* Blink the ethernet LED */ } } /* END main */ /*---------------------------------------------------------------------------- * * FUNCTION NAME: SMC2Init * * DESCRIPTION: * * Initialize SMC2 as a UART at 9600 Baud * with 24MHZ CPU clock. * * EXTERNAL EFFECT: * * PARAMETERS: None * * RETURNS: None * *---------------------------------------------------------------------------*/ void SMC2Init(void) { unsigned long *bcsr1; /*-----------------------*/ /* Allow SMC2 TX, RX out */ /*-----------------------*/ IMMR->pip_pbpar |= (0x0C00); IMMR->pip_pbdir &= 0xF3FF; /*------------------------------------------------*/ /* Set Baud Rate to 9600 for 24MHz System Clock. */ /* Enable BRG Count. */ /*------------------------------------------------*/ IMMR->brgc2 = (0x0013E | 0x10000); IMMR->si_simode &= ~(0xF0000000); /* SCM2: NMSI mode */ IMMR->si_simode |= 0x10000000; /* SCM2: Tx/Rx Clocks are BRG2 */ /*----------------------------------------*/ /* Set RXBD table start at Dual Port +800 */ /*----------------------------------------*/ IMMR->PRAM[PAGE4].pg.other.smc_dsp2.psmc2.u2.rbase = (UHWORD)&RxTxBD->RxBD; /*----------------------------------------*/ /* Set TXBD table start at Dual Port +808 */ /*----------------------------------------*/ IMMR->PRAM[PAGE4].pg.other.smc_dsp2.psmc2.u2.tbase = (UHWORD)&RxTxBD->TxBD; /*---------------------------------------*/ /* Initialize Rx and Tx Params for SMC2: */ /* Spin until cpcr flag is cleared */ /*---------------------------------------*/ for(IMMR->cp_cr = 0x00d1; IMMR->cp_cr & 0x0001;) ; /*--------------------------------------*/ /* Set RFCR,TFCR -- Rx,Tx Function Code */ /* Normal Operation and Motorola byte */ /* ordering */ /*--------------------------------------*/ IMMR->PRAM[PAGE4].pg.other.smc_dsp2.psmc2.u2.rfcr = 0x18; IMMR->PRAM[PAGE4].pg.other.smc_dsp2.psmc2.u2.tfcr = 0x18; /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /* Protocol Specific Parameters */ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /*---------------------------*/ /* MRBLR = MAX buffer length */ /*---------------------------*/ IMMR->PRAM[PAGE4].pg.other.smc_dsp2.psmc2.u2.mrblr = 1; /*------------------------------------*/ /* MAX_IDL = Disable MAX Idle Feature */ /*------------------------------------*/ IMMR->PRAM[PAGE4].pg.other.sm
评论
    相关推荐