PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
ps2dev9.c File Reference
#include <types.h>
#include <defs.h>
#include <loadcore.h>
#include <intrman.h>
#include <iomanX.h>
#include <dmacman.h>
#include <thbase.h>
#include <thsemap.h>
#include <stdio.h>
#include <sysclib.h>
#include <dev9.h>
#include <aifregs.h>
#include <dev9regs.h>
#include <speedregs.h>
#include <smapregs.h>
+ Include dependency graph for ps2dev9.c:

Go to the source code of this file.

Macros

#define MODNAME   "dev9"
 
#define DRIVERNAME   "dev9"
 
#define M_PRINTF(format, args...)    printf(MODNAME ": " format, ##args)
 
#define VERSION   "1.0"
 
#define BANNER   "\nDEV9 device driver v%s - Copyright (c) 2003 Marcus R. Brown\n\n"
 
#define SSBUS_R_1418   0xbf801418
 
#define SSBUS_R_141c   0xbf80141c
 
#define SSBUS_R_1420   0xbf801420
 

Typedefs

typedef int(* dev9IntrDispatchCb_t) (int flag)
 

Enumerations

enum  PC_CARD_TYPE { PC_CARD_TYPE_NONE = 0 , PC_CARD_TYPE_PCMCIA , PC_CARD_TYPE_CARDBUS }
 
enum  PC_CARD_VOLTAGE { PC_CARD_VOLTAGE_INVALID = 0 , PC_CARD_VOLTAGE_3V , PC_CARD_VOLTAGE_5V , PC_CARD_VOLTAGE_04h }
 

Functions

 IRX_ID (MODNAME, 2, 8)
 
static void dev9RegisterIntrDispatchCb (dev9IntrDispatchCb_t callback)
 
static int dev9_intr_dispatch (int flag)
 
static void dev9_set_stat (int stat)
 
static int dev9_ssbus_mode (int mode)
 
static int dev9_device_probe (void)
 
static int dev9_device_reset (void)
 
static int dev9_card_find_manfid (u32 manfid)
 
static int read_eeprom_data (void)
 
static int dev9_init (int sema_attr)
 
static int speed_device_init (void)
 
static void pcmcia_set_stat (int stat)
 
static int pcic_ssbus_mode (int mode)
 
static int pcmcia_device_probe (void)
 
static int pcmcia_device_reset (void)
 
static int card_find_manfid (u32 manfid)
 
static int pcmcia_init (int sema_attr)
 
static void expbay_set_stat (int stat)
 
static int expbay_device_probe (void)
 
static int expbay_device_reset (void)
 
static int expbay_init (int sema_attr)
 
static int dev9x_dummy (void)
 
static int dev9x_devctl (iop_file_t *f, const char *name, int cmd, void *args, unsigned int arglen, void *buf, unsigned int buflen)
 
static int print_help (void)
 
int _start (int argc, char *argv[])
 
int _exit (void)
 
void SpdRegisterIntrHandler (int intr, dev9_intr_cb_t cb)
 
void dev9RegisterPreDmaCb (int ctrl, dev9_dma_cb_t cb)
 
void dev9RegisterPostDmaCb (int ctrl, dev9_dma_cb_t cb)
 
void Dev9CardStop (void)
 
void SpdIntrEnable (int mask)
 
void SpdIntrDisable (int mask)
 
int SpdDmaTransfer (int device, void *buf, int bcr, int dir)
 
int SpdGetEthernetID (u16 *buf)
 
void SpdSetLED (int ctl)
 
void dev9LED2Ctl (int ctl)
 
void dev9ControlPIO3 (int ctl)
 
int Dev9RegisterPowerOffHandler (int idx, dev9_shutdown_cb_t cb)
 
static int dev9_smap_read_phy (volatile u8 *emac3_regbase, unsigned int address, unsigned int *data)
 
static int dev9_smap_write_phy (volatile u8 *emac3_regbase, unsigned char address, unsigned short int value)
 
static int dev9_smap_init (void)
 
static int pcic_get_cardtype (void)
 
static int pcic_get_voltage (void)
 
static int pcic_power (int voltage, int flag)
 
static int pcmcia_intr (void *unused)
 
static int expbay_intr (void *unused)
 

Variables

static int semaAttrGlobal
 
static const char * mod_name
 
static int dev9type = -1
 
static int using_aif = 0
 
static int dma_lock_sem
 
static int pcic_cardtype
 
static int pcic_voltage
 
static s16 eeprom_data [5]
 
static dev9IntrDispatchCb_t p_dev9_intr_cb = NULL
 
static dev9_intr_cb_t dev9_intr_cbs [16]
 
static dev9_shutdown_cb_t dev9_shutdown_cbs [16]
 
static dev9_dma_cb_t dev9_predma_cbs [4]
 
static dev9_dma_cb_t dev9_postdma_cbs [4]
 
static u8 dev9_has_dvr_capability = 0
 
struct irx_export_table _exp_dev9
 
static iop_device_ops_t dev9x_ops
 
static iop_device_t dev9x_device
 

Detailed Description

DEV9 Device Driver.

Definition in file ps2dev9.c.

Macro Definition Documentation

◆ MODNAME

#define MODNAME   "dev9"

Definition at line 36 of file ps2dev9.c.

◆ DRIVERNAME

#define DRIVERNAME   "dev9"

Definition at line 37 of file ps2dev9.c.

◆ M_PRINTF

#define M_PRINTF (   format,
  args... 
)     printf(MODNAME ": " format, ##args)

Definition at line 41 of file ps2dev9.c.

◆ VERSION

#define VERSION   "1.0"

Definition at line 44 of file ps2dev9.c.

◆ BANNER

#define BANNER   "\nDEV9 device driver v%s - Copyright (c) 2003 Marcus R. Brown\n\n"

Definition at line 45 of file ps2dev9.c.

◆ SSBUS_R_1418

#define SSBUS_R_1418   0xbf801418

Definition at line 48 of file ps2dev9.c.

◆ SSBUS_R_141c

#define SSBUS_R_141c   0xbf80141c

Definition at line 49 of file ps2dev9.c.

◆ SSBUS_R_1420

#define SSBUS_R_1420   0xbf801420

Definition at line 50 of file ps2dev9.c.

Typedef Documentation

◆ dev9IntrDispatchCb_t

typedef int(* dev9IntrDispatchCb_t) (int flag)

Definition at line 79 of file ps2dev9.c.

Enumeration Type Documentation

◆ PC_CARD_TYPE

enum PC_CARD_TYPE

Definition at line 59 of file ps2dev9.c.

◆ PC_CARD_VOLTAGE

enum PC_CARD_VOLTAGE

Definition at line 65 of file ps2dev9.c.

Function Documentation

◆ dev9RegisterIntrDispatchCb()

static void dev9RegisterIntrDispatchCb ( dev9IntrDispatchCb_t  callback)
static

Definition at line 630 of file ps2dev9.c.

◆ dev9_intr_dispatch()

static int dev9_intr_dispatch ( int  flag)
static

Definition at line 296 of file ps2dev9.c.

◆ dev9_set_stat()

static void dev9_set_stat ( int  stat)
static

Definition at line 322 of file ps2dev9.c.

◆ dev9_ssbus_mode()

static int dev9_ssbus_mode ( int  mode)
static

Definition at line 334 of file ps2dev9.c.

◆ dev9_device_probe()

static int dev9_device_probe ( void  )
static

Definition at line 346 of file ps2dev9.c.

◆ dev9_device_reset()

static int dev9_device_reset ( void  )
static

Definition at line 358 of file ps2dev9.c.

◆ dev9_card_find_manfid()

static int dev9_card_find_manfid ( u32  manfid)
static

Definition at line 399 of file ps2dev9.c.

◆ read_eeprom_data()

static int read_eeprom_data ( void  )
static

Definition at line 495 of file ps2dev9.c.

◆ dev9_init()

static int dev9_init ( int  sema_attr)
static

Definition at line 645 of file ps2dev9.c.

◆ speed_device_init()

static int speed_device_init ( void  )
static

Definition at line 868 of file ps2dev9.c.

◆ pcmcia_set_stat()

static void pcmcia_set_stat ( int  stat)
static

Definition at line 985 of file ps2dev9.c.

◆ pcic_ssbus_mode()

static int pcic_ssbus_mode ( int  mode)
static

Definition at line 1011 of file ps2dev9.c.

◆ pcmcia_device_probe()

static int pcmcia_device_probe ( void  )
static

Definition at line 1042 of file ps2dev9.c.

◆ pcmcia_device_reset()

static int pcmcia_device_reset ( void  )
static

Definition at line 1060 of file ps2dev9.c.

◆ card_find_manfid()

static int card_find_manfid ( u32  manfid)
static

Definition at line 1082 of file ps2dev9.c.

◆ pcmcia_init()

static int pcmcia_init ( int  sema_attr)
static

Definition at line 1209 of file ps2dev9.c.

◆ expbay_set_stat()

static void expbay_set_stat ( int  stat)
static

Definition at line 1288 of file ps2dev9.c.

◆ expbay_device_probe()

static int expbay_device_probe ( void  )
static

Definition at line 1294 of file ps2dev9.c.

◆ expbay_device_reset()

static int expbay_device_reset ( void  )
static

Definition at line 1300 of file ps2dev9.c.

◆ expbay_init()

static int expbay_init ( int  sema_attr)
static

Definition at line 1332 of file ps2dev9.c.

◆ dev9x_dummy()

static int dev9x_dummy ( void  )
static

Definition at line 125 of file ps2dev9.c.

◆ dev9x_devctl()

static int dev9x_devctl ( iop_file_t f,
const char *  name,
int  cmd,
void *  args,
unsigned int  arglen,
void *  buf,
unsigned int  buflen 
)
static

Definition at line 130 of file ps2dev9.c.

◆ print_help()

static int print_help ( void  )
static

Definition at line 194 of file ps2dev9.c.

◆ _start()

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

Definition at line 206 of file ps2dev9.c.

◆ _exit()

int _exit ( void  )

Definition at line 275 of file ps2dev9.c.

◆ SpdRegisterIntrHandler()

void SpdRegisterIntrHandler ( int  intr,
dev9_intr_cb_t  cb 
)

Definition at line 278 of file ps2dev9.c.

◆ dev9RegisterPreDmaCb()

void dev9RegisterPreDmaCb ( int  ctrl,
dev9_dma_cb_t  cb 
)

Definition at line 284 of file ps2dev9.c.

◆ dev9RegisterPostDmaCb()

void dev9RegisterPostDmaCb ( int  ctrl,
dev9_dma_cb_t  cb 
)

Definition at line 290 of file ps2dev9.c.

◆ Dev9CardStop()

void Dev9CardStop ( void  )

Definition at line 371 of file ps2dev9.c.

◆ SpdIntrEnable()

void SpdIntrEnable ( int  mask)

Definition at line 412 of file ps2dev9.c.

◆ SpdIntrDisable()

void SpdIntrDisable ( int  mask)

Definition at line 423 of file ps2dev9.c.

◆ SpdDmaTransfer()

int SpdDmaTransfer ( int  device,
void *  buf,
int  bcr,
int  dir 
)

Definition at line 434 of file ps2dev9.c.

◆ SpdGetEthernetID()

int SpdGetEthernetID ( u16 *  buf)

Definition at line 563 of file ps2dev9.c.

◆ SpdSetLED()

void SpdSetLED ( int  ctl)

Definition at line 591 of file ps2dev9.c.

◆ dev9LED2Ctl()

void dev9LED2Ctl ( int  ctl)

Definition at line 603 of file ps2dev9.c.

◆ dev9ControlPIO3()

void dev9ControlPIO3 ( int  ctl)

Definition at line 619 of file ps2dev9.c.

◆ Dev9RegisterPowerOffHandler()

int Dev9RegisterPowerOffHandler ( int  idx,
dev9_shutdown_cb_t  cb 
)

Definition at line 636 of file ps2dev9.c.

◆ dev9_smap_read_phy()

static int dev9_smap_read_phy ( volatile u8 *  emac3_regbase,
unsigned int  address,
unsigned int *  data 
)
static

Definition at line 700 of file ps2dev9.c.

◆ dev9_smap_write_phy()

static int dev9_smap_write_phy ( volatile u8 *  emac3_regbase,
unsigned char  address,
unsigned short int  value 
)
static

Definition at line 733 of file ps2dev9.c.

◆ dev9_smap_init()

static int dev9_smap_init ( void  )
static

Definition at line 752 of file ps2dev9.c.

◆ pcic_get_cardtype()

static int pcic_get_cardtype ( void  )
static

Definition at line 934 of file ps2dev9.c.

◆ pcic_get_voltage()

static int pcic_get_voltage ( void  )
static

Definition at line 946 of file ps2dev9.c.

◆ pcic_power()

static int pcic_power ( int  voltage,
int  flag 
)
static

Definition at line 960 of file ps2dev9.c.

◆ pcmcia_intr()

static int pcmcia_intr ( void *  unused)
static

Definition at line 1139 of file ps2dev9.c.

◆ expbay_intr()

static int expbay_intr ( void *  unused)
static

Definition at line 1316 of file ps2dev9.c.

Variable Documentation

◆ semaAttrGlobal

int semaAttrGlobal
static

Definition at line 52 of file ps2dev9.c.

◆ mod_name

const char* mod_name
static

Definition at line 53 of file ps2dev9.c.

◆ dev9type

int dev9type = -1
static

Definition at line 54 of file ps2dev9.c.

◆ using_aif

int using_aif = 0
static

Definition at line 55 of file ps2dev9.c.

◆ dma_lock_sem

int dma_lock_sem
static

Definition at line 57 of file ps2dev9.c.

◆ pcic_cardtype

int pcic_cardtype
static

Definition at line 72 of file ps2dev9.c.

◆ pcic_voltage

int pcic_voltage
static

Definition at line 73 of file ps2dev9.c.

◆ eeprom_data

s16 eeprom_data[5]
static

Definition at line 75 of file ps2dev9.c.

◆ p_dev9_intr_cb

dev9IntrDispatchCb_t p_dev9_intr_cb = NULL
static

Definition at line 80 of file ps2dev9.c.

◆ dev9_intr_cbs

dev9_intr_cb_t dev9_intr_cbs[16]
static

Definition at line 85 of file ps2dev9.c.

◆ dev9_shutdown_cbs

dev9_shutdown_cb_t dev9_shutdown_cbs[16]
static

Definition at line 90 of file ps2dev9.c.

◆ dev9_predma_cbs

dev9_dma_cb_t dev9_predma_cbs[4]
static

Definition at line 95 of file ps2dev9.c.

◆ dev9_postdma_cbs

dev9_dma_cb_t dev9_postdma_cbs[4]
static

Definition at line 95 of file ps2dev9.c.

◆ dev9_has_dvr_capability

u8 dev9_has_dvr_capability = 0
static

Definition at line 97 of file ps2dev9.c.

◆ dev9x_ops

iop_device_ops_t dev9x_ops
static
Initial value:
=
{
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
&dev9x_devctl,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
(void *)&dev9x_dummy,
}

Definition at line 154 of file ps2dev9.c.

◆ dev9x_device

iop_device_t dev9x_device
static
Initial value:
=
{
"dev9x",
IOP_DT_FS | IOP_DT_FSEXT,
1,
"DEV9",
&dev9x_ops,
}
#define IOP_DT_FSEXT
Definition iomanX.h:66

Definition at line 185 of file ps2dev9.c.