|
HP85 GPIB Disk Emulator
1.0
HP85GPIBDiskEmulator
|
Go to the source code of this file.
Macros | |
| #define | CS_LOW() mmc_spi_begin() /* Set MMC_CS = low */ |
| #define | CS_HIGH() mmc_spi_end() /* Set MMC_CS = high */ |
| #define | MMC_CD mmc_ins_status() /* Test if card detected. yes:true, no:false, default:true */ |
| #define | MMC_WP mmc_wp_status() /* Test if write protected. yes:true, no:false, default:false */ |
| #define | FCLK_SLOW() mmc_slow() /* Set SPI slow clock (100-400kHz) */ |
| #define | FCLK_FAST() mmc_fast() /* Set SPI fast clock (20MHz max) */ |
| #define | CMD0 (0) /* GO_IDLE_STATE */ |
| #define | CMD1 (1) /* SEND_OP_COND (MMC) */ |
| #define | ACMD41 (0x80+41) /* SEND_OP_COND (SDC) */ |
| #define | CMD8 (8) /* SEND_IF_COND */ |
| #define | CMD9 (9) /* SEND_CSD */ |
| #define | CMD10 (10) /* SEND_CID */ |
| #define | CMD12 (12) /* STOP_TRANSMISSION */ |
| #define | ACMD13 (0x80+13) /* SD_STATUS (SDC) */ |
| #define | CMD16 (16) /* SET_BLOCKLEN */ |
| #define | CMD17 (17) /* READ_SINGLE_BLOCK */ |
| #define | CMD18 (18) /* READ_MULTIPLE_BLOCK */ |
| #define | CMD23 (23) /* SET_BLOCK_COUNT (MMC) */ |
| #define | ACMD23 (0x80+23) /* SET_WR_BLK_ERASE_COUNT (SDC) */ |
| #define | CMD24 (24) /* WRITE_BLOCK */ |
| #define | CMD25 (25) /* WRITE_MULTIPLE_BLOCK */ |
| #define | CMD32 (32) /* ERASE_ER_BLK_START */ |
| #define | CMD33 (33) /* ERASE_ER_BLK_END */ |
| #define | CMD38 (38) /* ERASE */ |
| #define | CMD48 (48) /* READ_EXTR_SINGLE */ |
| #define | CMD49 (49) /* WRITE_EXTR_SINGLE */ |
| #define | CMD55 (55) /* APP_CMD */ |
| #define | CMD58 (58) /* READ_OCR */ |
Functions | |
| static MEMSPACE void | power_on (void) |
| static MEMSPACE void | power_off (void) |
| power off More... | |
| static BYTE | xchg_spi (BYTE dat) |
| send/receive a SPI byte More... | |
| static void | rcvr_spi_multi (BYTE *p, UINT cnt) |
| Receive a data block fast. More... | |
| static void | xmit_spi_multi (const BYTE *p, UINT cnt) |
| Send a data block fast. More... | |
| MEMSPACE int | wait_ready (UINT wt) |
| wait for card ready More... | |
| static MEMSPACE void | deselect (void) |
| Deselect the card and release SPI bus. More... | |
| static MEMSPACE int | select (void) |
| Select the card and wait for ready. More... | |
| static MEMSPACE int | rcvr_datablock (BYTE *buff, UINT btr) |
| Receive a data packet from MMC. More... | |
| static MEMSPACE BYTE | send_cmd (BYTE cmd, DWORD arg) |
| Send a data packet to MMC. More... | |
| MEMSPACE DSTATUS | mmc_disk_initialize (void) |
| Public Functions. More... | |
| MEMSPACE DSTATUS | mmc_disk_status (void) |
| Get Disk Status. More... | |
| MEMSPACE DRESULT | mmc_disk_read (BYTE *buff, DWORD sector, UINT count) |
| Read Sector(s) More... | |
| void | mmc_disk_timerproc (void) |
| Write Sector(s) More... | |
Variables | |
| volatile DSTATUS | Stat = STA_NOINIT |
| static volatile BYTE | Timer1 |
| static volatile BYTE | Timer2 |
| static BYTE | CardType |
| #define CS_HIGH | ( | ) | mmc_spi_end() /* Set MMC_CS = high */ |
| #define CS_LOW | ( | ) | mmc_spi_begin() /* Set MMC_CS = low */ |
| #define FCLK_FAST | ( | ) | mmc_fast() /* Set SPI fast clock (20MHz max) */ |
| #define FCLK_SLOW | ( | ) | mmc_slow() /* Set SPI slow clock (100-400kHz) */ |
| #define MMC_CD mmc_ins_status() /* Test if card detected. yes:true, no:false, default:true */ |
| #define MMC_WP mmc_wp_status() /* Test if write protected. yes:true, no:false, default:false */ |
|
static |
Deselect the card and release SPI bus.
Definition at line 186 of file mmc.c.
Referenced by mmc_disk_initialize(), mmc_disk_read(), select(), and send_cmd().
Public Functions.
Initialize Disk Drive
Definition at line 334 of file mmc.c.
Referenced by disk_initialize().
Read Sector(s)
| [in] | buff | read buffer |
| [in] | sector | start sector number |
| [in] | count | sector count |
Definition at line 424 of file mmc.c.
Referenced by disk_read().
Get Disk Status.
Definition at line 411 of file mmc.c.
Referenced by disk_status().
| void mmc_disk_timerproc | ( | void | ) |
Write Sector(s)
| [out] | buff | write buffer |
| [in] | sector | start sector number |
| [in] | count | sector count |
Miscellaneous Functions
| [in] | cmd | Control code |
| [in|out] | buff: Send/Receive buffer |
mmc timer processes
Definition at line 761 of file mmc.c.
Referenced by disk_timerproc(), and mmc_task().
|
static |
|
static |
Receive a data packet from MMC.
| [in] | buff | Data buffer to read data into |
| [in] | btr | Bytes to read |
Definition at line 221 of file mmc.c.
Referenced by mmc_disk_read().
Receive a data block fast.
| [in] | p | Data block to be read |
| [in] | cnt | Bytes to read |
Definition at line 139 of file mmc.c.
Referenced by rcvr_datablock().
|
static |
Select the card and wait for ready.
Definition at line 199 of file mmc.c.
Referenced by send_cmd().
Send a data packet to MMC.
| [in] | buff | Data buffer to write |
| [in] | btr | Bytes to write |
Send a command packet to MMC
| [in] | send_cmd | Commend Index |
| [in] | cmd | Argument |
Definition at line 283 of file mmc.c.
Referenced by mmc_disk_initialize(), and mmc_disk_read().
send/receive a SPI byte
| [in] | dat | data to send |
Definition at line 125 of file mmc.c.
Referenced by deselect(), mmc_disk_initialize(), rcvr_datablock(), select(), send_cmd(), and wait_ready().
|
static |
Definition at line 84 of file mmc.c.
Referenced by mmc_disk_initialize(), and mmc_disk_read().
| volatile DSTATUS Stat = STA_NOINIT |
Definition at line 78 of file mmc.c.
Referenced by mmc_disk_initialize(), mmc_disk_read(), mmc_disk_status(), mmc_disk_timerproc(), mmc_init(), and mmc_test_timeout().
|
static |
Definition at line 81 of file mmc.c.
Referenced by mmc_disk_timerproc().
|
static |
Definition at line 81 of file mmc.c.
Referenced by mmc_disk_timerproc().
1.8.17