Line 1... |
Line 1... |
/* $Id: hook.hh,v 1.7 2008-04-26 19:31:35 sybreon Exp $
|
/* $Id: hook.hh,v 1.8 2008-04-27 16:04:42 sybreon Exp $
|
**
|
**
|
** AEMB2 HI-PERFORMANCE CPU
|
** AEMB2 HI-PERFORMANCE CPU
|
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
|
** Copyright (C) 2004-2007 Shawn Tan Ser Ngiap
|
**
|
**
|
** This file is part of AEMB.
|
** This file is part of AEMB.
|
Line 88... |
Line 88... |
|
|
// split and shift the stack for thread 1
|
// split and shift the stack for thread 1
|
if (isThread0()) // main thread
|
if (isThread0()) // main thread
|
{
|
{
|
// NOTE: Dupe the stack otherwise it will FAIL!
|
// NOTE: Dupe the stack otherwise it will FAIL!
|
dupStack((int *)setStack(getStack() - (getStackSize() >> 1)),
|
int oldstk = getStack();
|
(int *)getStack(),
|
int newstk = setStack(getStack() - (getStackSize() >> 1));
|
(int *)getStackTop);
|
dupStack((unsigned int *)newstk,
|
|
(unsigned int *)oldstk,
|
|
(unsigned int *)getStackTop());
|
signalMutex(); // exit critical section
|
signalMutex(); // exit critical section
|
while (1) asm volatile ("nop"); // lock thread
|
while (1) asm volatile ("nop"); // lock thread
|
}
|
}
|
|
|
signalMutex(); // exit critical section
|
signalMutex(); // exit critical section
|
Line 134... |
Line 136... |
|
|
#ifndef __OPTIMIZE__
|
#ifndef __OPTIMIZE__
|
// The main programme needs to be compiled with optimisations turned
|
// The main programme needs to be compiled with optimisations turned
|
// on (at least -O1). If not, the MUTEX value will be written to the
|
// on (at least -O1). If not, the MUTEX value will be written to the
|
// same RAM location, giving both threads the same value.
|
// same RAM location, giving both threads the same value.
|
OPTIMISATION_REQUIRED XXX
|
OPTIMISATION_REQUIRED OPTIMISATION_REQUIRED
|
#endif
|
#endif
|
|
|
/*
|
/*
|
$Log: not supported by cvs2svn $
|
$Log: not supported by cvs2svn $
|
|
Revision 1.7 2008/04/26 19:31:35 sybreon
|
|
Made headers C compatible.
|
|
|
Revision 1.6 2008/04/26 18:04:31 sybreon
|
Revision 1.6 2008/04/26 18:04:31 sybreon
|
Updated software to freeze T0 and run T1.
|
Updated software to freeze T0 and run T1.
|
|
|
Revision 1.5 2008/04/23 14:19:39 sybreon
|
Revision 1.5 2008/04/23 14:19:39 sybreon
|
Fixed minor bugs.
|
Fixed minor bugs.
|