WB_IDE - Operational Overview
Frozen Content
The following sections take a look at initialization of the WB_IDE and example usage.
Initialization
After an external reset on the RST_I
line, you will need to initialize the WB_IDE. This should be carried out in accordance with design requirements and can include:
- Loading the Setup register with the required PIO timing values for setup, pulse and recovery times.
- Setting the
csel
bit in the Setup register (SETUP.13) dependent on how you have attached the IDE storage device. By default,csel
will be '0', causing theCSEL
line to be Low and giving the attached IDE device the address 0 (Master). Setcsel
to '1' to takeCSEL
line High, giving the IDE device the address 1 (Slave).
- Clearing the
pwrdn
bit in the Setup register (SETUP.15) that is set by default after a reset.
Example Usage
The following sections provide examples of how the WB_IDE peripheral can be used.
Writing an IDE Register with Automatic Busy Check
- Write the data to be written to the internal register of the attached IDE storage device into the WB_IDE's Data register.
- Write the WB_IDE's Command register with the following:
- The address for the IDE register into bits
iders4
..iders0
(COMMAND(4..0)) - The
idewr
bit (COMMAND.7) set to '1' - The
bsychk
bit (COMMAND.6) set to '1' - The
txsec
bit (COMMAND.5) cleared to '0'.
- The address for the IDE register into bits
- Repeatedly read the WB_IDE's Data register until the
busy
flag (DATA.16) is '0'.
Reading an IDE Register with Automatic Busy Check
- Write the WB_IDE's Command register with the following:
- The address for the IDE register into bits
iders4
..iders0
(COMMAND(4..0)) - The
idewr
bit (COMMAND.7) cleared to '0' - The
bsychk
bit (COMMAND.6) set to '1' - The
txsec
bit (COMMAND.5) cleared to '0'.
- The address for the IDE register into bits
- Repeatedly read the WB_IDE's Data register until the
busy
flag (DATA.16) is '0'.
- The last data read is the data from the IDE device's internal register.
Writing a Data Sector to the IDE Drive using Memory DMA
- Write the relevant values to all required internal registers of the attached IDE device, needed to inform the device of what sector to write to and to give the drive the command to start writing.
- Write the memory buffer start address to the WB_IDE's Memory DMA Start Address register.
- Write the WB_IDE's Command register with the following:
- The address of the IDE device's data port that is to be accessed for writing into bits
iders4
..iders0
(COMMAND(4..0)) - The
idewr
bit (COMMAND.7) set to '1' - The
bsychk
bit (COMMAND.6) cleared to '0' - The
txsec
bit (COMMAND.5) set to '1'.
- The address of the IDE device's data port that is to be accessed for writing into bits
- Repeatedly read the WB_IDE's Data register until the
busy
flag (DATA.16) is '0'.
Reading a Data Sector from the IDE Drive using Memory DMA
- Write the relevant values to all required internal registers of the attached IDE device, needed to inform the device of what sector to fetch and to give the drive the command to start reading.
- Write the memory buffer start address to the WB_IDE's Memory DMA Start Address register.
- Write the WB_IDE's Command register with the following:
- The address of the IDE device's data port that is to be accessed for reading into bits
iders4
..iders0
(COMMAND(4..0)) - The
idewr
bit (COMMAND.7) cleared to '0' - The
bsychk
bit (COMMAND.6) cleared to '0' - The
txsec
bit (COMMAND.5) set to '1'.
- The address of the IDE device's data port that is to be accessed for reading into bits
- Repeatedly read the WB_IDE's Data register until the
busy
flag (DATA.16) is '0'.