LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cvs-checkins > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: cvs at opencores.org<cvs@o...>
    Date: Tue Jan 29 03:13:31 CET 2008
    Subject: [cvs-checkins] MODIFIED: mlite ...
    Top
    Date: 00/08/01 29:03:13

    Added: mlite/kernel flash.c
    Log:
    Flash controller


    Revision Changes Path
    1.1 mlite/kernel/flash.c

    http://www.opencores.org/cvsweb.shtml/mlite/kernel/flash.c?rev=1.1&content-type=text/x-cvsweb-markup

    Index: flash.c
    ===================================================================
    /*--------------------------------------------------------------------
    * TITLE: Plasma Flash
    * AUTHOR: Steve Rhoads (rhoadss@y...)
    * DATE CREATED: 12/17/05
    * FILENAME: plasma.h
    * PROJECT: Plasma CPU core
    * COPYRIGHT: Software placed into the public domain by the author.
    * Software 'as is' without warranty. Author liable for nothing.
    * DESCRIPTION:
    * Plasma flash controller
    * Only the lower 16-bits of each 32-bit word are connected --
    * this changes the address mapping to the flash.
    * ByteOffset and bytes must be a multiple of two.
    *--------------------------------------------------------------------*/
    #include "plasma.h"
    #include "rtos.h"


    void FlashRead(uint16 *dst, uint32 byteOffset, int bytes)
    {
    volatile uint32 *ptr=(uint32*)(FLASH_BASE + (byteOffset << 1));
    *ptr = 0xff; //read mode
    while(bytes > 0)
    {
    *dst++ = (uint16)*ptr++;
    bytes -= 2;
    }
    }


    void FlashWrite(uint16 *src, uint32 byteOffset, int bytes)
    {
    volatile uint32 *ptr=(uint32*)(FLASH_BASE + (byteOffset << 1));
    while(bytes > 0)
    {
    *ptr = 0x40; //write mode
    *ptr++ = *src++; //write data
    while((*ptr & 0x80) == 0) //check status
    ;
    bytes -= 2;
    }
    }


    void FlashErase(uint32 byteOffset)
    {
    volatile uint32 *ptr=(uint32*)(FLASH_BASE + (byteOffset << 1));
    *ptr = 0x20; //erase block
    *ptr = 0xd0; //confirm
    while((*ptr & 0x80) == 0) //check status
    ;
    }



     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.