flashsectorerasethrough.c 1.29 KB
/*---------------------------------------------------------------------
        Copyright (C) 1998 Nintendo.
        
        File            flash.c
        Coded    by     Atushi Watanabe. Dec  1, 1998.
        Modified by     Atushi Watanabe. Apr 4, 2000.
        Comments        1M Flash ROM access functions(Ver.7.6)
   
 	$Id: flashsectorerasethrough.c,v 1.2 2003/03/26 02:00:13 blythe Exp $
   ---------------------------------------------------------------------*/
/**************************************************************************
 *
 *  $Revision: 1.2 $
 *  $Date: 2003/03/26 02:00:13 $
 *  $Source: 
 *
 **************************************************************************/

#include	<ultra64.h>
#include        "osint_flash.h"
#ifdef BBPLAYER
#include        "osint_flash.h"
#endif

/* SECTOR ERASE Through*/
void	osFlashSectorEraseThrough(u32 page_num)
{
#ifndef BBPLAYER
  if (__osBbFlashSize && page_num*128 < __osBbFlashSize) {
      int i;
      u32* p = __osBbFlashAddress+page_num*128;
      for(i = 0; i < 128/4; i++)
	p[i] = 0xffffffff;
  }
#else
  /* Page Erase Reserve*/
  osEPiWriteIo(&__osFlashHandler,(__osFlashHandler.baseAddress|0x10000),0x4b000000|page_num);

  /* Erase Start */
  osEPiWriteIo(&__osFlashHandler,(__osFlashHandler.baseAddress|0x10000),0x78000000);
#endif
}