psxdev-core[top|sitemap|download|docs]

psxdev core - device driver and filesystem

Currently nothing important to type...

PSXDEV core components

The psxdev-core package installs the basic PSXDEV filesystem hierarchy (typically in /opt/psxdev), the PSXDEV kernel device driver sources and a compiled version of the driver (only during RPM install!) and as a bonus a small file magic configuration.

The driver sources are located in /opt/psxdev/pccl. Each time you have compiled a new kernel it is necessary to enter into this directory and do a make install, which simply builds and installs a recent version of the pccl.o module against the new kernel. You could also reinstall the psxdev-core RPM package with the --force option, but that is not the recommended way. I don't think that the pccl module will ever make it into the kernel...

The file /opt/psxdev/share/magic can be used to check typical PSX data files like PS-X EXE, TIM, BS, STR, and many more. You need the file package installed for this and you surely want to merge the PSXDEV magic entries with the global magic entries located in /usr/share/magic! This is not yet done during the installation process.


The /proc/pccl process information pseudo-filesystem

PSXDEV comes with an extension to the linux /proc pseudo-filesystem. If you do not know what the /proc pseudo-filesystem is, you should read the manual page of proc (man proc). To be short, /proc/pccl is an application which looks like a filesystem and is available as soon as the kernel driver is installed!

The PSXDEV pccl driver is able to support up to four (4) PCCL boards simultaneously, and so the /proc/pccl hierarchy has four subdirectories for each possible card. This is the hierarchy tree of /proc/pccl:
      /proc/pccl
      |-- 0
      |   |-- config		driver configuration
      |   |-- fullmem		pseudo-mirrored ram (full 32-bit)
      |   |-- mem			pseudo-mirrored main ram
      |   |-- status		CAETLA status
      |   |-- version		CAETLA versions
      |   `-- vram		pseudo-mirrored video ram
      |-- 1
      |   |-- config
      |   |-- fullmem
      |   |-- mem			-"-
      |   |-- status
      |   |-- version
      |   `-- vram
      |-- 2
      |   |-- config
      |   |-- fullmem
      |   |-- mem			-"-
      |   |-- status
      |   |-- version
      |   `-- vram
      |-- 3
      |   |-- config
      |   |-- fullmem
      |   |-- mem			-"-
      |   |-- status
      |   |-- version
      |   `-- vram
      `-- readme		a small static copyright notice
      
  • config
    You can read and write configurations from/to this file. So if you cat /proc/pccl/0/config you'll get the current configuration. The most important reason for this is currently the need to specify the VRAM dimensions for a snapshot during a game. Just echo "width=320" > /proc/pccl/0/config to set single options.
  • mem
    This special file represents the main memory of the PSX, located from 0x80000000-0x801FFFFF. You can search for strings in it, i.e. psx-strings /proc/pccl/0/mem but the coolest application is to use a memory editor with it. A very good program for this purpose is hexedit. Or just copy this file to /tmp to take a snapshot and so on.
  • fullmem
    This is the same as above, but this time the full 32-bit address range. This is a very very useful file for applications, since they are allowed to lseek() anywhere into existing address ranges and read/write from them, like the cache, the ROM and the HW registers. I mainly implemented this new file interface for debuggers and real time utilities.
  • status
    This file is only readable and returns the current state of the communication link. Example output:
    Status (PS/PAR) = (0x00) : CAETLA
    Status (CAETLA) = (0x40) : NOTIFY_HBP
    Execution Flags = (0x00) :
    
  • version
    This file is like the status file, but it will retrieve the version numbers of the caetla subsystems. example output:
    caetla firmware     :  0.33
    CD-ROM manager      :  0.1
    memory card manager :  0.5
    frame buffer viewer :  0.2
    cheat code selector :  0.2
    debug utility       :  0.5
    configuration menu  :  0.2
    main menu           :  0.33
    
  • vram
    This file is very useful. It represents the contents of the VRAM. Unlike the /proc/pccl/?/mem file, it has a file format - TIM. This means you can drop TIM images on this file and they will be uploaded! Example:
    #
    # upload all TIM images of your
    # project directly into the VRAM
    #
    bash> find *.tim -printf "cp %f /proc/pccl/0/vram\n" | sh
    
    You can of course copy all types of TIM images to this file; files with a palette and direct color images. If you read from this file, you'll get a screen snapshot, even during a game! If you are in the caetla frame buffer viewer, /proc/pccl/0/vram uses the selected dimensions (unfortunately no palette pictures for now!). During a game you have to specify the image dimensions with the config file. Example:
    # we want to download 320x240 images from 0,0 in 16-Bit
    bash> echo "width=320"  > /proc/pccl/0/config
    bash> echo "height=240" > /proc/pccl/0/config
    bash> echo "x=0"        > /proc/pccl/0/config
    bash> echo "y=0"        > /proc/pccl/0/config
    
    # now we can take pictures just by copying from the vram file !
    bash> cp /proc/pccl/0/vram /tmp/image.tim
    
    # directly view an image
    bash> timtoppm /proc/pccl/0/vram | xv -
    


The /dev/pccl kernel device driver interface

The PSXDEV pccl device driver is accessible through the device nodes

  • /dev/pccl0 - first PC commslink board
  • /dev/pccl1 - second PC commslink board
  • /dev/pccl2 - third PC commslink board
  • /dev/pccl3 - fourth PC commslink board
  • /dev/pccl - a symbolic link to the first board (/dev/pccl0)
All PSXDEV tools and applications are using the /dev/pccl link by default, but you can always use a configuration option like --device=/dev/pccl2 to use another device node. Your application should also provide this feature!

The PCCL API is a linux wrapper for the CAETLA API. All CAETLA protocol commands are available as ioctl() commands. So a minimal and also typical program which uses /dev/pccl would be:

    /** software reset the PlayStation **/
    
    #include <pccl.h>        /* load device driver api */
    #include <sys/ioctl.h>   /* needed for the ioctl() */
    
    main()
    {
    	int pccl;
                 
    	// open the device driver always in read/write mode,
    	// since we want to communicate with it!
                 
    	pccl = open("/dev/pccl",O_RDWR);
    	if (pccl != -1)
    	{
    		// reset the PlayStation
    		ioctl (pccl, CAEIOC_RESET);
                 
    		close (pccl);
    	}
    	else perror("/dev/pccl");
    }
    
Very important: you must not be root in the default installation! The device nodes are all protected by evil (666). This could be considered a security hole, but I don't think that someone will ever try to break into your linux system operating from your PlayStation...

If you want to code an application which uses the /dev/pccl API, you should check the <pccl.h> header file and read the PCCL API reference.



Created with psxdev.pl
Copyright ©2000 by Daniel Balster