VLSI Solution Oy / MegaLib Documentation

dev1000.h File Reference

#include <vstypes.h>

Include dependency graph for dev1000.h:

Go to the source code of this file.

Defines

#define PATCH_TEST_UNIT_READY
#define MMC_MISO_BIT   8
#define MMC_MOSI_BIT   12
#define MMC_CLK   (1<<9)
#define MMC_MOSI   (1<<MMC_MOSI_BIT)
#define MMC_MISO   (1<<MMC_MISO_BIT)
#define MMC_XCS   (1<<11)
#define MMC_GO_IDLE_STATE   0
#define MMC_SEND_OP_COND   1
#define MMC_SEND_IF_COND   8
#define MMC_SEND_CSD   9
#define MMC_SEND_CID   10
#define MMC_SEND_STATUS   13
#define MMC_SET_BLOCKLEN   16
#define MMC_READ_SINGLE_BLOCK   17
#define MMC_WRITE_BLOCK   24
#define MMC_PROGRAM_CSD   27
#define MMC_SET_WRITE_PROT   28
#define MMC_CLR_WRITE_PROT   29
#define MMC_SEND_WRITE_PROT   30
#define MMC_TAG_SECTOR_START   32
#define MMC_TAG_SECTOR_END   33
#define MMC_UNTAG_SECTOR   34
#define MMC_TAG_ERASE_GROUP_START   35
#define MMC_TAG_ERARE_GROUP_END   36
#define MMC_UNTAG_ERASE_GROUP   37
#define MMC_ERASE   38
#define MMC_READ_OCR   58
#define MMC_CRC_ON_OFF   59
#define MMC_R1_BUSY   0x80
#define MMC_R1_PARAMETER   0x40
#define MMC_R1_ADDRESS   0x20
#define MMC_R1_ERASE_SEQ   0x10
#define MMC_R1_COM_CRC   0x08
#define MMC_R1_ILLEGAL_COM   0x04
#define MMC_R1_ERASE_RESET   0x02
#define MMC_R1_IDLE_STATE   0x01
#define MMC_STARTBLOCK_READ   0xFE
#define MMC_STARTBLOCK_WRITE   0xFE
#define MMC_STARTBLOCK_MWRITE   0xFC
#define MMC_STOPTRAN_WRITE   0xFD
#define MMC_DE_MASK   0x1F
#define MMC_DE_ERROR   0x01
#define MMC_DE_CC_ERROR   0x02
#define MMC_DE_ECC_FAIL   0x04
#define MMC_DE_OUT_OF_RANGE   0x04
#define MMC_DE_CARD_LOCKED   0x04
#define MMC_DR_MASK   0x1F
#define MMC_DR_ACCEPT   0x05
#define MMC_DR_REJECT_CRC   0x0B
#define MMC_DR_REJECT_WRITE_ERROR   0x0D
#define KEY_6   (1<<5)
#define RC5_SYS_TVSET   0
#define RC5_SYS_TELETEXT   2
#define RC5_SYS_VCR   5
#define RC5_SYS_EXPERIMENTAL7   7
#define RC5_SYS_PREAMP   16
#define RC5_SYS_RECEIVERTUNER   17
#define RC5_SYS_TAPERECORDER   18
#define RC5_SYS_EXPERIMENTAL19   19
#define RC5_SYS_CDPLAYER   20
#define RC5_CMD_0   0
#define RC5_CMD_1   1
#define RC5_CMD_2   2
#define RC5_CMD_3   3
#define RC5_CMD_4   4
#define RC5_CMD_5   5
#define RC5_CMD_6   6
#define RC5_CMD_7   7
#define RC5_CMD_8   8
#define RC5_CMD_9   9
#define RC5_CMD_ONETWODIGITS   10
#define RC5_CMD_STANDBY   12
#define RC5_CMD_MUTE   13
#define RC5_CMD_PRESET   14
#define RC5_CMD_DISPLAY   15
#define RC5_CMD_VOLUME_UP   16
#define RC5_CMD_VOLUME_DOWN   17
#define RC5_CMD_BRIGHT_UP   18
#define RC5_CMD_BRIGHT_DOWN   19
#define RC5_CMD_COLOR_UP   20
#define RC5_CMD_COLOR_DOWN   21
#define RC5_CMD_BASS_UP   22
#define RC5_CMD_BASS_DOWN   23
#define RC5_CMD_TREBLE_UP   24
#define RC5_CMD_TREBLE_DOWN   25
#define RC5_CMD_BALANCE_LEFT   26
#define RC5_CMD_BALANCE_RIGHT   27
#define RC5_CMD_CONTRAST_UP   28
#define RC5_CMD_CONTRAST_DOWN   29
#define RC5_CMD_PROGRAM_UP   32
#define RC5_CMD_PROGRAM_DOWN   33
#define RC5_CMD_ALTERNATE   34
#define RC5_CMD_LANGUAGE   35
#define RC5_CMD_EXPAND   36
#define RC5_CMD_TIMER   38
#define RC5_CMD_STORE   41
#define RC5_CMD_CLOCK   42
#define RC5_CMD_FINETUNE_PLUS   43
#define RC5_CMD_FINETUNE_MINUS   44
#define RC5_CMD_CROSS   45
#define RC5_CMD_MIX   46
#define RC5_CMD_PAUSE   48
#define RC5_CMD_FAST_REVERSE   50
#define RC5_CMD_FAST_FORWARD   52
#define RC5_CMD_PLAY   53
#define RC5_CMD_STOP   54
#define RC5_CMD_RECORD   55
#define RC5_CMD_SWITCH   56
#define RC5_CMD_MENU   59
#define RC5_CMD_TEXT   60
#define RC5_CMD_SYSTEM_SELECT   63

Functions

auto u_int16 SpiSendReceiveMmc (register __a0 u_int16 dataTopAligned, register __a1 bits)
auto void SpiSendClocks (void)
auto u_int16 MmcCommand (register __b0 s_int16 cmd, register __d u_int32 arg)
void PatchMSCPacketFromPC (void *)
void ScsiTestUnitReady (void)
auto u_int16 Fat12OpenFile (register __c0 u_int16 fileNum)
auto u_int16 OpenFileBaseName (register __i2 const u_int16 *packedName)
void PlayRangeSet (u_int32 start, u_int32 end)
void PlayRange (void)
void puthex (u_int16 d)
void KeyScan7 (void)
void Suspend7 (void)
auto u_int16 MapperlessReadDiskSector (register __i0 u_int16 *buffer, register __reg_a u_int32 sector)
void NandPutCommand (register __a0 u_int16 command)
void NandPutAddressOctet (register __a0 u_int16 address)
void NandGetOctets (register __c0 s_int16 length, register __i2 u_int16 *buf)
void NandPutOctets (register __c0 s_int16 length, register __i2 u_int16 *buf)
void NandSetWaits (register __a0 u_int16 waitns)
u_int32 ReadIRam (register __i0 u_int16 addr)
void WriteIRam (register __i0 u_int16 addr, register __a u_int32 ins)
void InterruptStub0 (void)
void InterruptStub1 (void)
void InterruptStub2 (void)
void InterruptStub3 (void)
auto void Interrupt0 (void)
auto void Interrupt1 (void)
auto void Interrupt2 (void)
auto void Interrupt3 (void)
void Rc5Init (u_int16 vector)
u_int16 Rc5GetFIFO (void)


Detailed Description

Development library header file.

Definition in file dev1000.h.


Define Documentation

#define KEY_6   (1<<5)
 

Definition at line 122 of file dev1000.h.

#define MMC_CLK   (1<<9)
 

Definition at line 12 of file dev1000.h.

#define MMC_CLR_WRITE_PROT   29
 

Definition at line 28 of file dev1000.h.

#define MMC_CRC_ON_OFF   59
 

Definition at line 38 of file dev1000.h.

#define MMC_DE_CARD_LOCKED   0x04
 

Definition at line 56 of file dev1000.h.

#define MMC_DE_CC_ERROR   0x02
 

Definition at line 53 of file dev1000.h.

#define MMC_DE_ECC_FAIL   0x04
 

Definition at line 54 of file dev1000.h.

#define MMC_DE_ERROR   0x01
 

Definition at line 52 of file dev1000.h.

#define MMC_DE_MASK   0x1F
 

Definition at line 51 of file dev1000.h.

#define MMC_DE_OUT_OF_RANGE   0x04
 

Definition at line 55 of file dev1000.h.

#define MMC_DR_ACCEPT   0x05
 

Definition at line 58 of file dev1000.h.

#define MMC_DR_MASK   0x1F
 

Definition at line 57 of file dev1000.h.

#define MMC_DR_REJECT_CRC   0x0B
 

Definition at line 59 of file dev1000.h.

#define MMC_DR_REJECT_WRITE_ERROR   0x0D
 

Definition at line 60 of file dev1000.h.

#define MMC_ERASE   38
 

Definition at line 36 of file dev1000.h.

#define MMC_GO_IDLE_STATE   0
 

Definition at line 17 of file dev1000.h.

#define MMC_MISO   (1<<MMC_MISO_BIT)
 

Definition at line 14 of file dev1000.h.

#define MMC_MISO_BIT   8
 

Definition at line 10 of file dev1000.h.

#define MMC_MOSI   (1<<MMC_MOSI_BIT)
 

Definition at line 13 of file dev1000.h.

#define MMC_MOSI_BIT   12
 

Definition at line 11 of file dev1000.h.

#define MMC_PROGRAM_CSD   27
 

Definition at line 26 of file dev1000.h.

#define MMC_R1_ADDRESS   0x20
 

Definition at line 41 of file dev1000.h.

#define MMC_R1_BUSY   0x80
 

Definition at line 39 of file dev1000.h.

#define MMC_R1_COM_CRC   0x08
 

Definition at line 43 of file dev1000.h.

#define MMC_R1_ERASE_RESET   0x02
 

Definition at line 45 of file dev1000.h.

#define MMC_R1_ERASE_SEQ   0x10
 

Definition at line 42 of file dev1000.h.

#define MMC_R1_IDLE_STATE   0x01
 

Definition at line 46 of file dev1000.h.

#define MMC_R1_ILLEGAL_COM   0x04
 

Definition at line 44 of file dev1000.h.

#define MMC_R1_PARAMETER   0x40
 

Definition at line 40 of file dev1000.h.

#define MMC_READ_OCR   58
 

Definition at line 37 of file dev1000.h.

#define MMC_READ_SINGLE_BLOCK   17
 

Definition at line 24 of file dev1000.h.

#define MMC_SEND_CID   10
 

Definition at line 21 of file dev1000.h.

#define MMC_SEND_CSD   9
 

Definition at line 20 of file dev1000.h.

#define MMC_SEND_IF_COND   8
 

Definition at line 19 of file dev1000.h.

#define MMC_SEND_OP_COND   1
 

Definition at line 18 of file dev1000.h.

#define MMC_SEND_STATUS   13
 

Definition at line 22 of file dev1000.h.

#define MMC_SEND_WRITE_PROT   30
 

Definition at line 29 of file dev1000.h.

#define MMC_SET_BLOCKLEN   16
 

Definition at line 23 of file dev1000.h.

#define MMC_SET_WRITE_PROT   28
 

Definition at line 27 of file dev1000.h.

#define MMC_STARTBLOCK_MWRITE   0xFC
 

Definition at line 49 of file dev1000.h.

#define MMC_STARTBLOCK_READ   0xFE
 

Definition at line 47 of file dev1000.h.

#define MMC_STARTBLOCK_WRITE   0xFE
 

Definition at line 48 of file dev1000.h.

#define MMC_STOPTRAN_WRITE   0xFD
 

Definition at line 50 of file dev1000.h.

#define MMC_TAG_ERARE_GROUP_END   36
 

Definition at line 34 of file dev1000.h.

#define MMC_TAG_ERASE_GROUP_START   35
 

Definition at line 33 of file dev1000.h.

#define MMC_TAG_SECTOR_END   33
 

Definition at line 31 of file dev1000.h.

#define MMC_TAG_SECTOR_START   32
 

Definition at line 30 of file dev1000.h.

#define MMC_UNTAG_ERASE_GROUP   37
 

Definition at line 35 of file dev1000.h.

#define MMC_UNTAG_SECTOR   34
 

Definition at line 32 of file dev1000.h.

#define MMC_WRITE_BLOCK   24
 

Definition at line 25 of file dev1000.h.

#define MMC_XCS   (1<<11)
 

Definition at line 15 of file dev1000.h.

#define PATCH_TEST_UNIT_READY
 

Definition at line 9 of file dev1000.h.

#define RC5_CMD_0   0
 

Definition at line 205 of file dev1000.h.

#define RC5_CMD_1   1
 

Definition at line 206 of file dev1000.h.

#define RC5_CMD_2   2
 

Definition at line 207 of file dev1000.h.

#define RC5_CMD_3   3
 

Definition at line 208 of file dev1000.h.

#define RC5_CMD_4   4
 

Definition at line 209 of file dev1000.h.

#define RC5_CMD_5   5
 

Definition at line 210 of file dev1000.h.

#define RC5_CMD_6   6
 

Definition at line 211 of file dev1000.h.

#define RC5_CMD_7   7
 

Definition at line 212 of file dev1000.h.

#define RC5_CMD_8   8
 

Definition at line 213 of file dev1000.h.

#define RC5_CMD_9   9
 

Definition at line 214 of file dev1000.h.

#define RC5_CMD_ALTERNATE   34
 

Definition at line 236 of file dev1000.h.

#define RC5_CMD_BALANCE_LEFT   26
 

Definition at line 230 of file dev1000.h.

#define RC5_CMD_BALANCE_RIGHT   27
 

Definition at line 231 of file dev1000.h.

#define RC5_CMD_BASS_DOWN   23
 

Definition at line 227 of file dev1000.h.

#define RC5_CMD_BASS_UP   22
 

Definition at line 226 of file dev1000.h.

#define RC5_CMD_BRIGHT_DOWN   19
 

Definition at line 223 of file dev1000.h.

#define RC5_CMD_BRIGHT_UP   18
 

Definition at line 222 of file dev1000.h.

#define RC5_CMD_CLOCK   42
 

Definition at line 241 of file dev1000.h.

#define RC5_CMD_COLOR_DOWN   21
 

Definition at line 225 of file dev1000.h.

#define RC5_CMD_COLOR_UP   20
 

Definition at line 224 of file dev1000.h.

#define RC5_CMD_CONTRAST_DOWN   29
 

Definition at line 233 of file dev1000.h.

#define RC5_CMD_CONTRAST_UP   28
 

Definition at line 232 of file dev1000.h.

#define RC5_CMD_CROSS   45
 

Definition at line 244 of file dev1000.h.

#define RC5_CMD_DISPLAY   15
 

Definition at line 219 of file dev1000.h.

#define RC5_CMD_EXPAND   36
 

Definition at line 238 of file dev1000.h.

#define RC5_CMD_FAST_FORWARD   52
 

Definition at line 248 of file dev1000.h.

#define RC5_CMD_FAST_REVERSE   50
 

Definition at line 247 of file dev1000.h.

#define RC5_CMD_FINETUNE_MINUS   44
 

Definition at line 243 of file dev1000.h.

#define RC5_CMD_FINETUNE_PLUS   43
 

Definition at line 242 of file dev1000.h.

#define RC5_CMD_LANGUAGE   35
 

Definition at line 237 of file dev1000.h.

#define RC5_CMD_MENU   59
 

Definition at line 253 of file dev1000.h.

#define RC5_CMD_MIX   46
 

Definition at line 245 of file dev1000.h.

#define RC5_CMD_MUTE   13
 

Definition at line 217 of file dev1000.h.

#define RC5_CMD_ONETWODIGITS   10
 

Definition at line 215 of file dev1000.h.

#define RC5_CMD_PAUSE   48
 

Definition at line 246 of file dev1000.h.

#define RC5_CMD_PLAY   53
 

Definition at line 249 of file dev1000.h.

#define RC5_CMD_PRESET   14
 

Definition at line 218 of file dev1000.h.

#define RC5_CMD_PROGRAM_DOWN   33
 

Definition at line 235 of file dev1000.h.

#define RC5_CMD_PROGRAM_UP   32
 

Definition at line 234 of file dev1000.h.

#define RC5_CMD_RECORD   55
 

Definition at line 251 of file dev1000.h.

#define RC5_CMD_STANDBY   12
 

Definition at line 216 of file dev1000.h.

#define RC5_CMD_STOP   54
 

Definition at line 250 of file dev1000.h.

#define RC5_CMD_STORE   41
 

Definition at line 240 of file dev1000.h.

#define RC5_CMD_SWITCH   56
 

Definition at line 252 of file dev1000.h.

#define RC5_CMD_SYSTEM_SELECT   63
 

Definition at line 255 of file dev1000.h.

#define RC5_CMD_TEXT   60
 

Definition at line 254 of file dev1000.h.

#define RC5_CMD_TIMER   38
 

Definition at line 239 of file dev1000.h.

#define RC5_CMD_TREBLE_DOWN   25
 

Definition at line 229 of file dev1000.h.

#define RC5_CMD_TREBLE_UP   24
 

Definition at line 228 of file dev1000.h.

#define RC5_CMD_VOLUME_DOWN   17
 

Definition at line 221 of file dev1000.h.

#define RC5_CMD_VOLUME_UP   16
 

Definition at line 220 of file dev1000.h.

#define RC5_SYS_CDPLAYER   20
 

Definition at line 203 of file dev1000.h.

#define RC5_SYS_EXPERIMENTAL19   19
 

Definition at line 202 of file dev1000.h.

#define RC5_SYS_EXPERIMENTAL7   7
 

Definition at line 198 of file dev1000.h.

#define RC5_SYS_PREAMP   16
 

Definition at line 199 of file dev1000.h.

#define RC5_SYS_RECEIVERTUNER   17
 

Definition at line 200 of file dev1000.h.

#define RC5_SYS_TAPERECORDER   18
 

Definition at line 201 of file dev1000.h.

#define RC5_SYS_TELETEXT   2
 

Definition at line 196 of file dev1000.h.

#define RC5_SYS_TVSET   0
 

Definition at line 195 of file dev1000.h.

#define RC5_SYS_VCR   5
 

Definition at line 197 of file dev1000.h.


Function Documentation

auto u_int16 Fat12OpenFile register __c0 u_int16  fileNum  ) 
 

Replacement for FatOpenFile that is normally in OpenFile hook. This version disables subdirectories for FAT12 partitions so OpenFile will not go into infinite recursion trying to handle it. Is not needed for VS1000d, but is compatible with it.

SetHookFunction((u_int16)OpenFile, Fat12OpenFile);

Parameters:
fileNum the same as for OpenFile
Returns:
the same as OpenFile

auto void Interrupt0 void   ) 
 

Called by InterruptStub0.

auto void Interrupt1 void   ) 
 

Called by InterruptStub1.

auto void Interrupt2 void   ) 
 

Called by InterruptStub2.

auto void Interrupt3 void   ) 
 

Called by InterruptStub3.

void InterruptStub0 void   ) 
 

Four interrupt stubs that the programmer can use without using ASM. For example to set up the first interrupt stub to GPIO0 interrupt, use the following:

Then you can enable GPIO0 interrupt and it will call your routine Interrupt0() whenever GPIO0 interrupt request is generated.

void InterruptStub1 void   ) 
 

Stub function that can be plugged to any interrupt vector. Calls Interrupt1(), which must be provided by the user.

void InterruptStub2 void   ) 
 

Stub function that can be plugged to any interrupt vector. Calls Interrupt2(), which must be provided by the user.

void InterruptStub3 void   ) 
 

Stub function that can be plugged to any interrupt vector. Calls Interrupt3(), which must be provided by the user.

void KeyScan7 void   ) 
 

Replacement routine for KeyScan() to read GPIO[5:0] and power button instead of just GPIO[4:0] and power button. See also Suspend7().

auto u_int16 MapperlessReadDiskSector register __i0 u_int16 buffer,
register __reg_a u_int32  sector
 

auto u_int16 MmcCommand register __b0 s_int16  cmd,
register __d u_int32  arg
 

Send MMC/SD command. The CRC that is sent will always be 0x95.

Parameters:
cmd The MMC command, must include the start bit (0x40).
arg The command argument.
Returns:
the result code or 0xff (8th bit set) for timeout.

void NandGetOctets register __c0 s_int16  length,
register __i2 u_int16 buf
 

Writes packed data to NFIO. You must handle NFCS yourself.

void NandPutAddressOctet register __a0 u_int16  address  ) 
 

writes 8 bits with ALE=1. You must handle NFCS yourself.

void NandPutCommand register __a0 u_int16  command  ) 
 

Writes 8 bits with CLE=1. You must handle NFCS yourself.

void NandPutOctets register __c0 s_int16  length,
register __i2 u_int16 buf
 

Reads packed data from NFIO. You must handle NFCS yourself.

void NandSetWaits register __a0 u_int16  waitns  ) 
 

Sets NAND-interface waitstates in nanoseconds. Uses current clockX value for calculation.

auto u_int16 OpenFileBaseName register __i2 const u_int16 packedName  ) 
 

Open a file based on the name. The suffix is not changed, the caller must select the right suffix and restore the original after the call.

Parameters:
packedName The 8-character name must be in upper case and in packed format.
Returns:
The file index or 0xffffU if file is not found.

void PatchMSCPacketFromPC void *   ) 
 

LBAB patch -- removes 4G restriction from USB (SCSI). Is not needed for VS1000d, but is compatible with it.

void PlayRange void   ) 
 

Plays from a previously set start position to end position. Handles player and cs structure initialization. You must call PlayRangeSet() before calling PlayRange().

void PlayRangeSet u_int32  start,
u_int32  end
 

Sets the start and end positions for the PlayRange() function.

Parameters:
start Play start time in 1/65536th of a second resolution.
end Play end time in 1/65536th of a second resolution. Set to 0x7fffffffUL to disable end time.

void puthex u_int16  d  ) 
 

For debugging with vs3emu: print 4-digit hex number.

u_int16 Rc5GetFIFO void   ) 
 

Returns 0 if no values are available, received 14-bit value otherwise.

void Rc5Init u_int16  vector  ) 
 

Initializes RC5 structure and installs interrupt handler. RC5 receiver uses one of the interruptable GPIO pins as input. Interrupt must be generated on both edges. The polarity of the receiver does not matter. Currently receives only codes that have two start bits.

    Rc5Init(INTV_GPIO0);
    PERIP(GPIO0_INT_FALL) |= (1<<14);
    PERIP(GPIO0_INT_RISE) |= (1<<14);
    PERIP(INT_ENABLEL) |= INTF_GPIO0;
    while (1) {
        register u_int16 t = Rc5GetFIFO();
        if (t) {
            puthex(t);
            puts("=got");
        }
    }
See also example code rc5.c .

u_int32 ReadIRam register __i0 u_int16  addr  ) 
 

Reads instruction RAM.

void ScsiTestUnitReady void   ) 
 

Hook called by PatchMSCPacketFromPC().

auto void SpiSendClocks void   ) 
 

Send MMC clocks with XCS high.

auto u_int16 SpiSendReceiveMmc register __a0 u_int16  dataTopAligned,
register __a1  bits
 

Send and receive bits from MMC/SD.

Parameters:
dataTopAligned The first bit to send must be in the most-significant bit.
bits The number of bits to send/receive.
Returns:
If less than 16 bits are sent, the high bits of the result will be the low bits of the dataTopAligned parameter.

void Suspend7 void   ) 
 

Replacement routine for USBSuspend() to wake up from GPIO[5:0] and power button (and USB pins) instead of just GPIO[4:0] and power button (and USB pins). Also puts the analog to powerdown for the duration of USB suspend/low-power pause. See also KeyScan7().

void WriteIRam register __i0 u_int16  addr,
register __a u_int32  ins
 

Writes instruction RAM.


All software copyright 2005-2006 VLSI Solution OY. Redistribution of this software is strictly forbidden.