OpenCores
URL https://opencores.org/ocsvn/aemb/aemb/trunk

Subversion Repositories aemb

[/] [aemb/] [trunk/] [sw/] [c/] [aeMB_testbench.c] - Diff between revs 97 and 106

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 97 Rev 106
Line 1... Line 1...
/* $Id: aeMB_testbench.c,v 1.14 2007-12-28 21:44:04 sybreon Exp $
/* $Id: aeMB_testbench.c,v 1.15 2008-01-31 19:07:14 sybreon Exp $
**
**
** AEMB Function Verification C Testbench
** AEMB Function Verification C Testbench
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net>
**
**
** This file is part of AEMB.
** This file is part of AEMB.
Line 20... Line 20...
*/
*/
 
 
#include <malloc.h>
#include <malloc.h>
#include <errno.h>
#include <errno.h>
#include <reent.h>
#include <reent.h>
 
#include <stdlib.h>
 
 
#include "libaemb.h"
#include "libaemb.h"
 
 
/**
/**
   INTERRUPT TEST
   INTERRUPT TEST
Line 262... Line 263...
  if (FSL != 0x1F) return -1;
  if (FSL != 0x1F) return -1;
 
 
  return 0;
  return 0;
}
}
 
 
// static int errnum;
/**
/*
   MALLOC TEST
int *__errno ()
   Works well with newlib malloc routine.
{
 
  return &_REENT->_errno;
 
  // return &errnum;
 
}
 
*/
*/
 
 
int malloc_test()
int malloc_test()
{
{
  void *alloc;
  int *alloc;
 
  int *mpi = (int*)0xFFFFFFFF;
  alloc = (void *)malloc(256); // allocate 32 bytes
  alloc = malloc(8 * sizeof(int)); // allocate 32 byte
 
  *mpi = _REENT->_errno; // for debugging purpose
  if (alloc == NULL)
  return (alloc == NULL) ? -1 : 0;
    return -1;
 
  else
 
    return (int) alloc;
 
}
}
 
 
/**
/**
   MAIN TEST PROGRAMME
   MAIN TEST PROGRAMME
 
 
Line 311... Line 305...
 
 
  // Enable Global Interrupts
  // Enable Global Interrupts
  aemb_enable_interrupt();
  aemb_enable_interrupt();
 
 
  // INT TEST
  // INT TEST
  //if (int_test() == -1) { *mpi = 0x4641494C; }
  if (int_test() == -1) { *mpi = 0x4641494C; }
 
 
  // TEST MALLOC
  // TEST MALLOC
  if (malloc_test() == -1) { *mpi = 0x4641494C; }
  if (malloc_test() == -1) { *mpi = 0x4641494C; }
 
 
  // FSL TEST
  // FSL TEST
Line 338... Line 332...
}
}
 
 
/*
/*
  HISTORY
  HISTORY
  $Log: not supported by cvs2svn $
  $Log: not supported by cvs2svn $
 
  Revision 1.14  2007/12/28 21:44:04  sybreon
 
  Added malloc() test
 
 
  Revision 1.13  2007/12/11 00:44:31  sybreon
  Revision 1.13  2007/12/11 00:44:31  sybreon
  Modified for AEMB2
  Modified for AEMB2
 
 
  Revision 1.12  2007/11/18 19:41:45  sybreon
  Revision 1.12  2007/11/18 19:41:45  sybreon
  Minor simulation fixes.
  Minor simulation fixes.

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.