URL
https://opencores.org/ocsvn/aemb/aemb/trunk
Subversion Repositories aemb
Compare Revisions
- This comparison shows the changes necessary to convert path
/aemb/trunk/sw/cc/aemb
- from Rev 165 to Rev 191
- ↔ Reverse comparison
Rev 165 → Rev 191
/core.hh
0,0 → 1,53
/* $Id: core.hh,v 1.5 2008-05-31 17:02:04 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
General AEMB2 core library |
@file core.hh |
*/ |
|
#ifdef __MICROBLAZE__ |
|
#include "aemb/msr.hh" |
#include "aemb/stack.hh" |
#include "aemb/heap.hh" |
#include "aemb/thread.hh" |
#include "aemb/hook.hh" |
#include "aemb/stdio.hh" |
#include "aemb/semaphore.hh" |
|
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.4 2008/04/28 20:29:15 sybreon |
Made files C compatible under C++. |
|
Revision 1.3 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.2 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
/hook.hh
0,0 → 1,169
/* $Id: hook.hh,v 1.11 2008-04-28 20:31:40 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic begin/end hooks |
@file hook.hh |
|
These routines hook themselves onto parts of the main programme to |
enable the hardware threads to work properly. |
*/ |
|
#include "aemb/stack.hh" |
#include "aemb/heap.hh" |
#include "aemb/thread.hh" |
|
#ifndef _AEMB_HOOK_HH |
#define _AEMB_HOOK_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
void _program_init(); |
void _program_clean(); |
|
// newlib locks |
void __malloc_lock(struct _reent *reent); |
void __malloc_unlock(struct _reent *reent); |
//void __env_lock(struct _reent *reent); |
//void __env_unlock(struct _reent *reent); |
|
/** |
Finalisation hook |
|
This function executes during the shutdown phase after the |
finalisation routine is called. It will merge the changes made |
during initialisation. |
*/ |
|
void _program_clean() |
{ |
_aembLockMTX(); // enter critical section |
|
// unify the stack backwards |
if (aembIsThread0()) |
{ |
aembSetStack(aembGetStack() + (aembGetStackSize() >> 1)); |
} |
|
_aembFreeMTX(); // exit critical section |
} |
|
/** |
Initialisation hook |
|
This function executes during the startup phase before the |
initialisation routine is called. It splits the stack between the |
threads. For now, it will lock up T0 for compatibility purposes. |
*/ |
|
void _program_init() |
{ |
_aembLockMTX(); // enter critical section |
|
// split and shift the stack for thread 1 |
if (aembIsThread0()) // main thread |
{ |
// NOTE: Dupe the stack otherwise it will FAIL! |
int oldstk = aembGetStack(); |
int newstk = aembSetStack(aembGetStack() - (aembGetStackSize() >> 1)); |
aembDupStack((unsigned int *)newstk, |
(unsigned int *)oldstk, |
(unsigned int *)aembGetStackTop()); |
_aembFreeMTX(); // exit critical section |
while (1) asm volatile ("nop"); // lock thread |
} |
|
_aembFreeMTX(); // exit critical section |
} |
|
/** |
Heap Lock |
|
This function is called during malloc() to lock out the shared |
heap to avoid data corruption. |
*/ |
|
void __malloc_lock(struct _reent *reent) |
{ |
_aembLockMTX(); |
} |
|
/** |
Heap Unlock |
|
This function is called during malloc() to indicate that the |
shared heap is now available for another thread. |
*/ |
|
void __malloc_unlock(struct _reent *reent) |
{ |
_aembFreeMTX(); |
} |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
#ifndef __OPTIMIZE__ |
// The main programme needs to be compiled with optimisations turned |
// on (at least -O1). If not, the MUTEX value will be written to the |
// same RAM location, giving both threads the same value. |
OPTIMISATION_REQUIRED OPTIMISATION_REQUIRED |
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.10 2008/04/28 20:29:15 sybreon |
Made files C compatible under C++. |
|
Revision 1.9 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.8 2008/04/27 16:04:42 sybreon |
Minor cosmetic changes. |
|
Revision 1.7 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.6 2008/04/26 18:04:31 sybreon |
Updated software to freeze T0 and run T1. |
|
Revision 1.5 2008/04/23 14:19:39 sybreon |
Fixed minor bugs. |
Initial use of hardware mutex. |
|
Revision 1.4 2008/04/20 16:35:53 sybreon |
Added C/C++ compatible #ifdef statements |
|
Revision 1.3 2008/04/12 13:46:02 sybreon |
Added malloc() lock and unlock routines |
|
Revision 1.2 2008/04/11 15:20:31 sybreon |
added static assert hack |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
/msr.hh
0,0 → 1,181
/* $Id: msr.hh,v 1.9 2008-04-28 20:29:15 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic MSR functions |
@file msr.hh |
|
These functions provide read/write access to the Machine Status |
Register. It also contains the bit definitions of the register. |
*/ |
|
#ifndef _AEMB_MSR_HH |
#define _AEMB_MSR_HH |
|
// STANDARD BITS |
#define AEMB_MSR_BE (1 << 0) ///< Buslock Enable |
#define AEMB_MSR_IE (1 << 1) ///< Interrupt Enable |
#define AEMB_MSR_C (1 << 2) ///< Arithmetic Carry |
#define AEMB_MSR_BIP (1 << 3) ///< Break in Progress |
|
#define AEMB_MSR_ITE (1 << 5) ///< Instruction Cache Enable |
#define AEMB_MSR_DZ (1 << 6) ///< Division by Zero |
#define AEMB_MSR_DTE (1 << 7) ///< Data Cache Enable |
|
// CUSTOM BITS |
#define AEMB_MSR_MTX (1 << 4) ///< Hardware Mutex |
#define AEMB_MSR_PHA (1 << 29) ///< Hardware Thread Phase |
#define AEMB_MSR_HTX (1 << 30) ///< Hardware Threads Extension |
#define AEMB_MSR_CC (1 << 31) ///< Carry Copy |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/** |
Read the value of the MSR register |
@return register contents |
*/ |
|
inline int aembGetMSR() |
{ |
int rmsr; |
asm volatile ("mfs %0, rmsr":"=r"(rmsr)); |
return rmsr; |
} |
|
/** |
Write a value to the MSR register |
@param rmsr value to write |
*/ |
|
inline void aembPutMSR(int rmsr) |
{ |
asm volatile ("mts rmsr, %0"::"r"(rmsr)); |
} |
|
/** |
Read and clear the MSR |
@param rmsk clear mask |
@return msr value |
*/ |
|
inline int aembClrMSR(const short rmsk) |
{ |
int tmp; |
//asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(rmsk):"memory"); |
return tmp; |
} |
|
/** |
Read and set the MSR |
@param rmsk set mask |
@return msr value |
*/ |
|
inline int aembSetMSR(const short rmsk) |
{ |
int tmp; |
//asm volatile ("msrset %0, %1":"=r"(tmp):"K"(rmsk):"memory"); |
return tmp; |
} |
|
/** Enable global interrupts */ |
inline int aembEnableInterrupts() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_IE)); |
return msr; |
} |
|
/** Disable global interrupts */ |
inline int aembDisableInterrupts() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_IE)); |
return msr; |
} |
|
/** Enable data caches */ |
inline int aembEnableDataTag() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_DTE)); |
return msr; |
} |
|
/** Disable data caches */ |
inline int aembDisableDataTag() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_DTE)); |
return msr; |
} |
|
/** Enable inst caches */ |
inline int aembEnableInstTag() |
{ |
int msr; |
asm volatile ("msrset %0, %1":"=r"(msr):"K"(AEMB_MSR_ITE)); |
return msr; |
} |
|
/** Disable inst caches */ |
inline int aembDisableInstTag() |
{ |
int msr; |
asm volatile ("msrclr %0, %1":"=r"(msr):"K"(AEMB_MSR_ITE)); |
return msr; |
} |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.8 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.7 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.6 2008/04/26 18:05:22 sybreon |
Minor cosmetic changes. |
|
Revision 1.5 2008/04/20 16:35:53 sybreon |
Added C/C++ compatible #ifdef statements |
|
Revision 1.4 2008/04/11 15:53:03 sybreon |
changed MSR bits |
|
Revision 1.3 2008/04/11 12:24:12 sybreon |
added cache controls |
|
Revision 1.2 2008/04/11 11:48:37 sybreon |
added interrupt controls (may need to be factorised out) |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
/stdio.hh
0,0 → 1,77
/* $Id: stdio.hh,v 1.5 2008-04-28 20:29:15 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic standard I/O functions |
@file stdio.hh |
|
These functions provide function prototypes for outbyte/inbyte |
which are required by the linker during compile time. These |
functions can be defined anywhere else in code but should not be |
inlined. |
*/ |
|
#ifndef _AEMB_STDIO_HH |
#define _AEMB_STDIO_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/** |
Default stdout prototype. |
@param c char |
|
This is used to output characters to LCD or UART. |
*/ |
|
void outbyte(char c); |
|
/** |
Default stdin prototype. |
@return char |
|
This is used to read characters in from UART or keyboard. |
*/ |
|
char inbyte(); |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.4 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.3 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.2 2008/04/26 18:05:22 sybreon |
Minor cosmetic changes. |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
/semaphore.hh
0,0 → 1,103
/* $Id: semaphore.hh,v 1.1 2008-04-28 20:29:15 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
General semaphore library |
@file semaphore.hh |
*/ |
|
#include "aemb/thread.hh" |
|
#ifndef _AEMB_SEMAPHORE_HH |
#define _AEMB_SEMAPHORE_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
// TODO: Extend this library to include threading mechanisms such as |
// semaphores, mutexes and such. |
|
/** |
Semaphore struct. |
Presently implemented as software solution but a hardware one may be |
required as the threads are hardware. |
*/ |
|
typedef int semaphore; |
|
/** |
Software Semaphore Signal. |
|
Increment the semaphore and run. This is a software mechanism. |
*/ |
inline void aembSignal(volatile semaphore _sem) |
{ |
_aembLockMTX(); |
_sem++; |
_aembFreeMTX(); |
} |
|
/** |
Software Semaphore Wait. |
|
Decrement the semaphore and block if < 0. This is a software |
mechanism. |
*/ |
inline void aembWait(volatile semaphore _sem) |
{ |
_aembLockMTX(); |
_sem--; |
_aembFreeMTX(); |
while (_sem < 0); |
} |
|
semaphore __mutex_rendezvous0 = 0; ///< internal rendezvous mutex |
semaphore __mutex_rendezvous1 = 1; ///< internal rendezvous mutex |
|
/** |
Implements a simple rendezvous mechanism |
*/ |
/* |
inline void aembRendezvous() |
{ |
if (isThread1()) |
{ |
wait(__mutex_rendezvous0); |
signal(__mutex_rendezvous1); |
} |
else |
{ |
signal(__mutex_rendezvous0); |
wait(__mutex_rendezvous1); |
} |
} |
*/ |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
/* |
$log$ |
*/ |
/stack.hh
0,0 → 1,145
/* $Id: stack.hh,v 1.8 2008-04-28 20:29:15 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic stack related functions |
@file stack.hh |
*/ |
|
#ifndef _AEMB_STACK_HH |
#define _AEMB_STACK_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/** |
Reads the size of the memory space allocated for the stack in bytes. |
@return size of stack |
*/ |
|
inline int aembGetStackSize() |
{ |
int tmp; |
asm ("la %0, r0, _STACK_SIZE":"=r"(tmp)); |
return tmp; |
} |
|
/** |
Reads the end of the memory space allocated for the stack. This is |
where the stack ends. |
@return end of stack |
*/ |
|
inline int aembGetStackEnd() |
{ |
int tmp; |
asm ("la %0, r0, _stack_end":"=r"(tmp)); |
return tmp; |
} |
|
/** |
Reads the top of the memory space allocated for the stack. This is |
where the stack starts. |
@return top of stack |
*/ |
|
inline int aembGetStackTop() |
{ |
int tmp; |
asm ("la %0, r0, _stack":"=r"(tmp)); |
return tmp; |
} |
|
/** |
Reads register R1 which is the designated stack pointer. |
@return stack pointer |
*/ |
|
inline int aembGetStack() |
{ |
int tmp; |
asm ("addk %0, r0, r1":"=r"(tmp)); |
return tmp; |
} |
|
/** |
Sets register R1 to the new stack pointer. |
@param stk new stack pointer |
@return new stack pointer |
*/ |
|
inline int aembSetStack(int stk) |
{ |
asm ("addk r1, r0, %0"::"r"(stk)); |
return stk; |
} |
|
/** |
Duplicates the stack |
@param newp new stack pointer |
@param oldp old stack pointer |
@param endp end of the stack |
*/ |
|
inline void aembDupStack(unsigned int *newp, unsigned int *oldp, unsigned int *endp) |
{ |
while (oldp < endp) |
{ |
// copy the stack content |
*newp = *oldp; |
// this increments 1 word (not 1 byte) |
newp++; |
oldp++; |
} |
} |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.7 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.6 2008/04/27 16:04:42 sybreon |
Minor cosmetic changes. |
|
Revision 1.5 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.4 2008/04/26 18:04:31 sybreon |
Updated software to freeze T0 and run T1. |
|
Revision 1.3 2008/04/23 14:19:39 sybreon |
Fixed minor bugs. |
Initial use of hardware mutex. |
|
Revision 1.2 2008/04/20 16:35:53 sybreon |
Added C/C++ compatible #ifdef statements |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
/thread.hh
0,0 → 1,133
/* $Id: thread.hh,v 1.10 2008-04-28 20:29:15 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic thread functions |
@file thread.hh |
|
These functions deal with the various hardware threads. It also |
provides simple mechanisms for toggling semaphores. |
*/ |
|
#include "aemb/msr.hh" |
|
#ifndef _AEMB_THREAD_HH |
#define _AEMB_THREAD_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/** |
Checks to see if currently executing Thread 1 |
@return true if is Thread 1 |
*/ |
|
inline int aembIsThread1() |
{ |
int rmsr = aembGetMSR(); |
return ((rmsr & AEMB_MSR_HTX) && (rmsr & AEMB_MSR_PHA)); |
} |
|
/** |
Checks to see if currently executing Thread 0 |
@return true if is Thread 0 |
*/ |
|
inline int aembIsThread0() |
{ |
int rmsr = aembGetMSR(); |
return ((rmsr & AEMB_MSR_HTX) && (!(rmsr & AEMB_MSR_PHA))); |
} |
|
/** |
Checks to see if it is multi-threaded or not. |
@return true if thread capable |
*/ |
inline int aembIsThreaded() |
{ |
int rmsr = aembGetMSR(); |
return (rmsr & AEMB_MSR_HTX); |
} |
|
/** |
Hardware Mutex Signal. |
Unlock the hardware mutex, which is unlocked on reset. |
*/ |
inline void _aembFreeMTX() |
{ |
int tmp; |
asm volatile ("msrclr %0, %1":"=r"(tmp):"K"(AEMB_MSR_MTX)); |
} |
|
/** |
Hardware Mutex Wait. |
|
Waits until the hardware mutex is unlocked. This should be used |
as part of a larger software mutex mechanism. |
*/ |
inline void _aembLockMTX() |
{ |
int rmsr; |
do |
{ |
asm volatile ("msrset %0, %1":"=r"(rmsr):"K"(AEMB_MSR_MTX)); |
} |
while (rmsr & AEMB_MSR_MTX); |
} |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.9 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.8 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.7 2008/04/26 18:05:22 sybreon |
Minor cosmetic changes. |
|
Revision 1.6 2008/04/23 14:19:39 sybreon |
Fixed minor bugs. |
Initial use of hardware mutex. |
|
Revision 1.5 2008/04/20 16:35:53 sybreon |
Added C/C++ compatible #ifdef statements |
|
Revision 1.4 2008/04/12 14:07:26 sybreon |
added a rendezvous function |
|
Revision 1.3 2008/04/11 15:53:24 sybreon |
changed MSR bits |
|
Revision 1.2 2008/04/11 11:34:30 sybreon |
changed semaphore case |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |
/heap.hh
0,0 → 1,93
/* $Id: heap.hh,v 1.6 2008-04-28 20:29:15 sybreon Exp $ |
** |
** AEMB2 HI-PERFORMANCE CPU |
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap <shawn.tan@aeste.net> |
** |
** This file is part of AEMB. |
** |
** AEMB is free software: you can redistribute it and/or modify it |
** under the terms of the GNU General Public License as published by |
** the Free Software Foundation, either version 3 of the License, or |
** (at your option) any later version. |
** |
** AEMB is distributed in the hope that it will be useful, but WITHOUT |
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public |
** License for more details. |
** |
** You should have received a copy of the GNU General Public License |
** along with AEMB. If not, see <http://www.gnu.org/licenses/>. |
*/ |
|
/** |
Basic heap related functions |
@file heap.hh |
*/ |
|
#ifndef _AEMB_HEAP_HH |
#define _AEMB_HEAP_HH |
|
#ifdef __cplusplus |
extern "C" { |
#endif |
|
/** |
Extracts the heap size from the linker |
@return heap size |
*/ |
|
inline int aembGetHeapSize() |
{ |
int tmp; |
asm ("la %0, r0, _HEAP_SIZE":"=r"(tmp)); |
return tmp; |
} |
|
/** |
Extracts the heap end from the linker |
@return heap end |
*/ |
|
inline int aembGetHeapEnd() |
{ |
int tmp; |
asm ("la %0, r0, _heap_end":"=r"(tmp)); |
return tmp; |
} |
|
/** |
Extracts the heap top from the linker |
@return heap top |
*/ |
|
inline int aembGetHeapTop() |
{ |
int tmp; |
asm ("la %0, r0, _heap":"=r"(tmp)); |
return tmp; |
} |
|
#ifdef __cplusplus |
} |
#endif |
|
#endif |
|
/* |
$Log: not supported by cvs2svn $ |
Revision 1.5 2008/04/27 16:33:42 sybreon |
License change to GPL3. |
|
Revision 1.4 2008/04/26 19:31:35 sybreon |
Made headers C compatible. |
|
Revision 1.3 2008/04/26 18:05:22 sybreon |
Minor cosmetic changes. |
|
Revision 1.2 2008/04/20 16:35:53 sybreon |
Added C/C++ compatible #ifdef statements |
|
Revision 1.1 2008/04/09 19:48:37 sybreon |
Added new C++ files |
|
*/ |