00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef __UTILS_H__
00015 #define __UTILS_H__
00016
00017 #include <psptypes.h>
00018
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022
00023
00024
00025
00031
00032 #include <sys/time.h>
00033
00038 time_t sceKernelLibcTime(time_t *t);
00039
00043 clock_t sceKernelLibcClock(void);
00044
00048 int sceKernelLibcGettimeofday(struct timeval *tp, struct timezone *tzp);
00049
00053 void sceKernelDcacheWritebackAll(void);
00054
00058 void sceKernelDcacheWritebackInvalidateAll(void);
00059
00063 void sceKernelDcacheWritebackRange(const void *p, unsigned int size);
00064
00068 void sceKernelDcacheWritebackInvalidateRange(const void *p, unsigned int size);
00069
00073 void sceKernelDcacheInvalidateRange(const void *p, unsigned int size);
00074
00076 typedef struct _SceKernelUtilsMt19937Context {
00077 unsigned int count;
00078 unsigned int state[624];
00079 } SceKernelUtilsMt19937Context;
00080
00096 int sceKernelUtilsMt19937Init(SceKernelUtilsMt19937Context *ctx, u32 seed);
00097
00104 u32 sceKernelUtilsMt19937UInt(SceKernelUtilsMt19937Context *ctx);
00105
00107 typedef struct _SceKernelUtilsMd5Context {
00108 unsigned int h[4];
00109 unsigned int pad;
00110 SceUShort16 usRemains;
00111 SceUShort16 usComputed;
00112 SceULong64 ullTotalLen;
00113 unsigned char buf[64];
00114 } SceKernelUtilsMd5Context;
00115
00125 int sceKernelUtilsMd5Digest(u8 *data, u32 size, u8 *digest);
00126
00142 int sceKernelUtilsMd5BlockInit(SceKernelUtilsMd5Context *ctx);
00143
00153 int sceKernelUtilsMd5BlockUpdate(SceKernelUtilsMd5Context *ctx, u8 *data, u32 size);
00154
00163 int sceKernelUtilsMd5BlockResult(SceKernelUtilsMd5Context *ctx, u8 *digest);
00164
00166 typedef struct _SceKernelUtilsSha1Context {
00167 unsigned int h[5];
00168 SceUShort16 usRemains;
00169 SceUShort16 usComputed;
00170 SceULong64 ullTotalLen;
00171 unsigned char buf[64];
00172 } SceKernelUtilsSha1Context;
00173
00183 int sceKernelUtilsSha1Digest(u8 *data, u32 size, u8 *digest);
00184
00201 int sceKernelUtilsSha1BlockInit(SceKernelUtilsSha1Context *ctx);
00202
00212 int sceKernelUtilsSha1BlockUpdate(SceKernelUtilsSha1Context *ctx, u8 *data, u32 size);
00213
00222 int sceKernelUtilsSha1BlockResult(SceKernelUtilsSha1Context *ctx, u8 *digest);
00223
00226 #ifdef __cplusplus
00227 }
00228 #endif
00229
00230 #endif