PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
common.c
Go to the documentation of this file.
1/*
2# _____ ___ ____ ___ ____
3# ____| | ____| | | |____|
4# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5#-----------------------------------------------------------------------
6# Copyright 2005, ps2dev - http://www.ps2dev.org
7# Licenced under GNU Library General Public License version 2
8*/
9
15#include <stdio.h>
16#include <thbase.h>
17#include <thsemap.h>
18#include <loadcore.h>
19#include <sysmem.h>
20#include <intrman.h>
21#include <sysclib.h>
22
23#include "common.h"
24
34int create_thread(void *func, int priority, void *param)
35{
36 int tid;
37 iop_thread_t thr;
38
39 thr.attr = TH_C;
40 thr.thread = func;
41 thr.option = 0;
42 thr.priority = priority;
43 thr.stacksize = 4096;
44 tid = CreateThread(&thr);
45 if (tid < 0)
46 {
47 return 0;
48 }
49
50 StartThread(tid, param);
51 return tid;
52}
53
58void print_hex_buffer(unsigned char *ptr, int len)
59{
60 int p;
61
62 for (p=0; p<len; p++)
63 {
64 if (p > 0 && (p & 0x0f) == 0)
65 {
66 printf("\n");
67 }
68
69 printf("%02x ", ptr[p]);
70 }
71}
void print_hex_buffer(unsigned char *ptr, int len)
Definition common.c:58
int create_thread(void *func, int priority, void *param)
Definition common.c:34