/*
 * $Id: main.c,v 1.1 2006/03/21 01:33:16 bsd Exp $
 *
 */

/*
 * This is a simple sample program demonstrating the use of external
 * memory, 64K, on the MAVRIC-IB boards and the MAVRIC-IIB with the
 * MAVRIC-II-RE memory expansion adapter.  See:
 *
 *     http://www.bdmicro.com/
 *
 */

#include <avr/io.h>


/*
 * place a function in the '.init1' section to enable external RAM so
 * that the C runtime startup can initialize it during C startup.  
 */
void enable_external_ram (void) __attribute__ ((naked)) __attribute__ ((section (".init1")));


void enable_external_ram(void)
{
  /* 
   * enable external memory, no wait states 
   */
  MCUCR |= _BV(SRE);
}


int main(void)
{
  char * xram_ptr, x;

  /*
   * external memory is enabled by this point, try it out ...
   */

  xram_ptr = (char *)0xf000;

  *xram_ptr = 0xba;

  x = *xram_ptr;

  while (1)
    ;
}

