00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef DYNPROGR_SPE_H_
00031 #define DYNPROGR_SPE_H_
00032
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036
00037 #include <sys/types.h>
00038
00039 #define TOTAL_MEMORY 200000
00040 #define MAX_TRANSFER 16384
00041
00042 #define __ALIGNED__ __attribute__((__aligned__(16)))
00043 #define ALIGN16(x) (((x)+15)&(-16))
00044 #define ALIGN32(x) (((x)+31)&(-32))
00045
00046
00047
00048
00049 #define SPE_ALIGNMENT_TYPE_MASK 0xf
00050 #define SPE_ALIGNMENT_TYPE_DOUBLE 5
00051 #define SPE_ALIGNMENT_TYPE_FLOAT 4
00052 #define SPE_ALIGNMENT_TYPE_INT 3
00053 #define SPE_ALIGNMENT_TYPE_SHORT 2
00054 #define SPE_ALIGNMENT_TYPE_BYTE 1
00055
00056
00057 #define SPE_ALIGNMENT_PROFILE 16
00058
00059 typedef unsigned long long ppu_addr_t;
00060
00061 typedef struct{
00062 int32_t len;
00063 int32_t blockSize;
00064 double min;
00065 double max;
00066 ppu_addr_t addr;
00067 } SPEProfile;
00068
00069 typedef struct{
00070 int32_t len;
00071 ppu_addr_t addr;
00072 } SPESequence;
00073
00074 typedef struct{
00075 double min;
00076 double max;
00077 ppu_addr_t addr;
00078 } SPEMatrix;
00079
00080 enum SPECommands{
00081 SPE_CMD_INIT,
00082 SPE_CMD_CREATE_PROFILE,
00083 SPE_CMD_PUT_PROFILE,
00084 SPE_CMD_GET_PROFILE,
00085 SPE_CMD_ALIGN
00086 };
00087
00088 enum SPEDatatypes{
00089 SPE_DATA_INT8 = 0,
00090 SPE_DATA_INT16 = 1,
00091 SPE_DATA_INT32 = 2,
00092 SPE_DATA_FLOAT = 3,
00093 SPE_DATA_DOUBLE = 4
00094 };
00095
00096 static const int dataSize[5] = {1,2,4,sizeof(float),sizeof(double)};
00097
00098 typedef struct{
00099 int32_t command;
00100 union {
00101 struct {
00102 int32_t datatype;
00103 int32_t dbMaxLen;
00104 double fixedDel;
00105 double incDel;
00106 } INIT;
00107 struct {
00108 SPESequence query;
00109 SPEMatrix matrix;
00110 } CREATE_PROFILE;
00111 struct {
00112 ppu_addr_t addr;
00113 int32_t blockSize;
00114 } PUT_PROFILE;
00115 struct {
00116 SPEProfile profile;
00117 } GET_PROFILE;
00118 struct {
00119 SPESequence db;
00120 double result;
00121 } ALIGN;
00122 } data;
00123 } SPECommand;
00124
00125
00126 void * alloc( int n );
00127 void reset();
00128 int memRemaining();
00129
00130 #ifdef __cplusplus
00131 }
00132 #endif
00133
00134 #endif