ps2sdk  1.1
A collection of Open Source libraries used for developing applications on Sony's PlayStation 2® (PS2).
imgdrv.c File Reference
#include <ioman.h>
#include <irx.h>
#include <loadcore.h>
+ Include dependency graph for imgdrv.c:

Go to the source code of this file.

Data Structures

struct  iop_device_ops_short_t
 

Macros

#define MAX_IMAGES   2
 

Functions

static int imgdrv_dummy (void)
 
static int imgdrv_read (iop_file_t *f, void *buf, int size)
 
static int imgdrv_lseek (iop_file_t *f, int offset, int whence)
 
int _start (int argc, char *argv[])
 

Variables

static iop_device_ops_short_t imgdrv_ops
 
const void * img [MAX_IMAGES] = {0}
 
int img_size [MAX_IMAGES] = {0}
 
static iop_device_t img_device
 

Detailed Description

Image device driver (IMGDRV) Used by the special IOP reboot sequence, to reboot the IOP with a buffered IOPRP image.

Definition in file imgdrv.c.

Macro Definition Documentation

◆ MAX_IMAGES

#define MAX_IMAGES   2

Definition at line 49 of file imgdrv.c.

Function Documentation

◆ _start()

int _start ( int  argc,
char *  argv[] 
)

Definition at line 62 of file imgdrv.c.

63 {
64  return AddDrv(&img_device) < 0;
65 }
static iop_device_t img_device
Definition: imgdrv.c:54

References img_device.

◆ imgdrv_dummy()

static int imgdrv_dummy ( void  )
static

Definition at line 67 of file imgdrv.c.

68 {
69  return 0;
70 }

◆ imgdrv_lseek()

static int imgdrv_lseek ( iop_file_t *  f,
int  offset,
int  whence 
)
static

Definition at line 86 of file imgdrv.c.

87 {
88  return(whence == SEEK_SET ? 0 : img_size[f->unit]);
89 }
int img_size[MAX_IMAGES]
Definition: imgdrv.c:52

References img_size.

◆ imgdrv_read()

static int imgdrv_read ( iop_file_t *  f,
void *  buf,
int  size 
)
static

Definition at line 72 of file imgdrv.c.

73 {
74  int i;
75  const u32 *img_ptr;
76  u32 *img_out;
77 
78  img_out = (u32*)buf;
79  img_ptr = (const u32*)img[f->unit];
80  for(i = size; i > 0; i-=4,img_ptr++,img_out++)
81  *img_out = *img_ptr;
82 
83  return size;
84 }
const void * img[MAX_IMAGES]
Definition: imgdrv.c:51
unsigned int u32
Definition: tamtypes.h:30

References img.

Variable Documentation

◆ img

const void* img[MAX_IMAGES] = {0}

Definition at line 51 of file imgdrv.c.

Referenced by imgdrv_read().

◆ img_device

iop_device_t img_device
static
Initial value:
= {
"img",
IOP_DT_FS,
1,
"img",
(iop_device_ops_t*)&imgdrv_ops
}
static iop_device_ops_short_t imgdrv_ops
Definition: imgdrv.c:38

Definition at line 54 of file imgdrv.c.

Referenced by _start().

◆ img_size

int img_size[MAX_IMAGES] = {0}

Definition at line 52 of file imgdrv.c.

Referenced by imgdrv_lseek().

◆ imgdrv_ops

iop_device_ops_short_t imgdrv_ops
static
Initial value:
= {
(void*)imgdrv_dummy,
(void*)imgdrv_dummy,
NULL,
(void*)imgdrv_dummy,
(void*)imgdrv_dummy,
NULL,
}
static int imgdrv_read(iop_file_t *f, void *buf, int size)
Definition: imgdrv.c:72
static int imgdrv_lseek(iop_file_t *f, int offset, int whence)
Definition: imgdrv.c:86
static int imgdrv_dummy(void)
Definition: imgdrv.c:67
#define NULL
Definition: tamtypes.h:91

Definition at line 38 of file imgdrv.c.