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: Thu Jan 31 20:07:14 CET 2008
    Subject: [cvs-checkins] MODIFIED: aemb ...
    Top
    Date: 00/08/01 31:20:07

    Modified: aemb/sw/c aeMB_testbench.c
    Log:
    Made code work with newlib's malloc();


    Revision Changes Path
    1.15 aemb/sw/c/aeMB_testbench.c

    http://www.opencores.org/cvsweb.shtml/aemb/sw/c/aeMB_testbench.c.diff?r1=1.14&r2=1.15

    (In the diff below, changes in quantity of whitespace are not shown.)

    Index: aeMB_testbench.c
    ===================================================================
    RCS file: /cvsroot/sybreon/aemb/sw/c/aeMB_testbench.c,v
    retrieving revision 1.14
    retrieving revision 1.15
    diff -u -b -r1.14 -r1.15
    --- aeMB_testbench.c 28 Dec 2007 21:44:04 -0000 1.14
    +++ aeMB_testbench.c 31 Jan 2008 19:07:14 -0000 1.15
    @@ -1,4 +1,4 @@
    -/* $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
    ** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@a...>
    @@ -22,6 +22,7 @@
    #include <malloc.h>
    #include <errno.h>
    #include <reent.h>
    +#include <stdlib.h>

    #include "libaemb.h"

    @@ -264,25 +265,18 @@
    return 0;
    }

    -// static int errnum;
    -/*
    -int *__errno ()
    -{
    - return &_REENT->_errno;
    - // return &errnum;
    -}
    +/**
    + MALLOC TEST
    + Works well with newlib malloc routine.
    */

    int malloc_test()
    {
    - void *alloc;
    -
    - alloc = (void *)malloc(256); // allocate 32 bytes
    -
    - if (alloc == NULL)
    - return -1;
    - else
    - return (int) alloc;
    + int *alloc;
    + int *mpi = (int*)0xFFFFFFFF;
    + alloc = malloc(8 * sizeof(int)); // allocate 32 byte
    + *mpi = _REENT->_errno; // for debugging purpose
    + return (alloc == NULL) ? -1 : 0;
    }

    /**
    @@ -313,7 +307,7 @@
    aemb_enable_interrupt();

    // INT TEST
    - //if (int_test() == -1) { *mpi = 0x4641494C; }
    + if (int_test() == -1) { *mpi = 0x4641494C; }

    // TEST MALLOC
    if (malloc_test() == -1) { *mpi = 0x4641494C; }
    @@ -340,6 +334,9 @@
    /*
    HISTORY
    $Log: aeMB_testbench.c,v $
    + Revision 1.15 2008/01/31 19:07:14 sybreon
    + Made code work with newlib's malloc();
    +
    Revision 1.14 2007/12/28 21:44:04 sybreon
    Added malloc() test




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