Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# membus.c

    00001 /*! \file membus.c \brief Memory Bus Driver for ADuC7026. */
    00002 //*****************************************************************************
    00003 //
    00004 // File Name    : 'membus.c'
    00005 // Title        : Memory Bus Driver for ADuC7026
    00006 // Author       : Pascal Stang - Copyright (C) 2005
    00007 // Created      : 2005.02.14
    00008 // Revised      : 2005.02.14
    00009 // Version      : 0.1
    00010 // Target MCU   : Analog Devices ADuC7026 ARM Series
    00011 // Editor Tabs  : 4
    00012 //
    00013 // NOTE: This code is currently below version 1.0, and therefore is considered
    00014 // to be lacking in some functionality or documentation, or may not be fully
    00015 // tested.  Nonetheless, you can expect most functions to work.
    00016 //
    00017 // This code is distributed under the GNU Public License
    00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
    00019 //
    00020 //*****************************************************************************
    00021
    00022 #include "aduc7026.h"
    00023 #include "global.h"
    00024 #include "membus.h"
    00025
    00026 void membusInit(void)
    00027 {
    00028     // enable external memory bus
    00029     XMCFG = 0x01;
    00030     // setup I/O lines
    00031     // setup control lines
    00032     GP2CON |= 0x22222220;
    00033     // setup AD0-15
    00034     GP3CON |= 0x22222222;
    00035     GP4CON |= 0x22222222;
    00036
    00037     // setup all memory banks as 16-bit
    00038     XM0CON = XMCON_16BIT | XMCON_ENABLE;
    00039     XM1CON = XMCON_16BIT | XMCON_ENABLE;
    00040     XM2CON = XMCON_16BIT | XMCON_ENABLE;
    00041     XM3CON = XMCON_16BIT | XMCON_ENABLE;
    00042
    00043     XM0PAR = XMPAR_16BITADDR | XMPAR_EXTRAHOLD;
    00044     XM1PAR = XMPAR_16BITADDR | XMPAR_EXTRAHOLD;
    00045     XM2PAR = XMPAR_16BITADDR | XMPAR_EXTRAHOLD;
    00046     XM3PAR = XMPAR_16BITADDR | XMPAR_EXTRAHOLD;
    00047 }
    00048
    00049 uint16_t membusRead(uint32_t addr)
    00050 {
    00051     return *((unsigned short*)addr);
    00052 }
    00053
    00054 void membusWrite(uint32_t addr, uint16_t data)
    00055 {
    00056     *((unsigned short*)addr) = data;
    00057 }