cr_unpack.h revision f3f69e0e8d6a713566e129aa3ab321b1e6b07fbc
/* Copyright (c) 2001, Stanford University
* All rights reserved.
*
* See the file LICENSE.txt for information on redistributing this software.
*/
#ifndef CR_UNPACK_H
#define CR_UNPACK_H
#include "cr_compiler.h"
#include "cr_spu.h"
#include "cr_protocol.h"
#include "cr_mem.h"
#include "cr_opcodes.h"
#ifdef __cplusplus
extern "C" {
#endif
extern SPUDispatchTable cr_unpackDispatch;
/*extern DLLDATA(const unsigned char *) cr_unpackData;*/
extern DECLEXPORT(const unsigned char *) cr_unpackData;
DECLEXPORT(void) crUnpack( const void *data, const void *opcodes, unsigned int num_opcodes, SPUDispatchTable *table );
DECLEXPORT(void) crUnpackPush(void);
DECLEXPORT(void) crUnpackPop(void);
typedef enum
{
DECLINLINE(CR_UNPACK_BUFFER_TYPE) crUnpackGetBufferType(const void *opcodes, unsigned int num_opcodes)
{
if (!num_opcodes)
return CR_UNPACK_BUFFER_TYPE_GENERIC;
enmType = (first != CR_CMDBLOCKBEGIN_OPCODE) ? CR_UNPACK_BUFFER_TYPE_GENERIC : CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN;
if (last != CR_CMDBLOCKEND_OPCODE)
return enmType;
/* last is CMDBLOCKEND*/
return (enmType == CR_UNPACK_BUFFER_TYPE_CMDBLOCK_BEGIN) ? CR_UNPACK_BUFFER_TYPE_GENERIC : CR_UNPACK_BUFFER_TYPE_CMDBLOCK_END;
}
extern CRNetworkPointer * return_ptr;
extern CRNetworkPointer * writeback_ptr;
#define CR_UNALIGNED_ACCESS_OKAY
#else
#endif
#ifdef CR_UNALIGNED_ACCESS_OKAY
#define READ_DOUBLE( offset ) \
#else
#define READ_DOUBLE( offset ) \
#endif
#define READ_NETWORK_POINTER( offset ) \
( cr_unpackData + (offset) )
/* XXX make this const */
#define INCR_DATA_PTR( delta ) \
cr_unpackData += (delta)
#define INCR_DATA_PTR_NO_ARGS() \
INCR_DATA_PTR( 4 )
#define INCR_VAR_PTR() \
INCR_DATA_PTR( *((int *) cr_unpackData ) )
#define SET_RETURN_PTR( offset ) do { \
} while (0);
#define SET_WRITEBACK_PTR( offset ) do { \
} while (0);
#ifdef __cplusplus
}
#endif
#endif /* CR_UNPACK_H */