12APPENDIX A
13APPLICATION INFORMATION
14PACKAGE OUTLINE
15SOLDERING
15.1Introduction
15.2Reflow soldering
15.3Wave soldering
15.4Repairing soldered joints
16DEFINITIONS
17LIFE SUPPORT APPLICATIONS
1997 Aug 122
Page 3
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
1FEATURES
• Supports real time error detection and correction in
hardware. Error correction to n = 27, error detect to
n = 30 and raw data transfer to n = 32.
• DVD-ROM supported in combination with the SAA7335
• Direct generic interface to external Small Computer
Systems Interface (SCSI) controller devices
• Operates with up to 16 Mbytes DRAM
– Hyper-page DRAM up to 33 Mbytes words/s burst
– Fast-page DRAM at up to 17.5 Mbytes words/s burst
2
• Has fixed n = 1 or n = 2 rate (44.1 or 88.2 kHz) I
multimedia output for simple audio/video output;
features for CAV/quasi-CLV support
– Supports Philips multimedia audio CODEC
– Provides ‘SHOARMA’ Red Book audio buffer
• IEC 958 (SPDIF, AES/EBU and DOBM) output with
Q-W subcode and programmable category code, output
at n = 1 rate
• Device registers are memory mapped for faster direct
access to the chip
• Provides direct access from sub-CPU to buffer RAM to
support scratchpad accesses. This eliminates the need
for extra RAM chips in the system
• Automatic sequencing of ATAPI packet command
protocol, including command termination
• Automated data transfers to and from the host using
PIO, DMA and ultra DMA.
2GENERAL DESCRIPTION
The SAA7381 is a block decoder/encoder and buffer
manager for high-speed CD-ROM/CD-R functions, that
integrates real time error correction and detection and
bidirectional ATAPI transfer functions into a single chip.
2.1Memory mapped control registers
The SAA7381 device has a large number of memory
mapped registers. These are arranged so that high-level
languages see the registers as external byte or 16-bit
integer quantities. The block addressing of the SAA7381
facilitates the use of pairs of 16-bit quantities to represent
addresses.
S-bus
The reading and writing of 16-bit registers within the device
can be performed by two separate 8-bit reads, where the
second byte data is latched at the same time as the first
byte is read.
2.2Error correction features
The SAA7381 has an on-chip 36 kbits memory that is used
as a buffer memory for error and erasure correction
processing. This buffer memory reduces the number of
external RAM accesses that are needed for error
correction and thus allows for an increased rate of data
throughput.
The error corrector is switchable between two-pass,
single-pass [both with Error Detection/Correction
(EDC/ECC)] and EDC only modes to further improve
throughput. The presence of the full error corrector
removes the need for firmware based control of the error
corrector’s operation.
2.3Host interface features
The SAA7381 has an ATAPI host interface that may be
directly connected to the ATAPI bus thereby reducing the
need for external support devices. It supports PIO Mode 4
transfer and Mode 0 ultra DMA. This interface can also be
configured as a generic DMA interface for use with
external host interface devices (e.g. SCSI controller).
The DMA interface has the following features:
• ATAPI command packets are automatically loaded into
the command FIFO
• Data transfer to the host is automatically sequenced to
reduce inter-block latencies and improve host CPU
utilisation
• Host data transfer rate is independent of error corrector
operation and the data input path
• The host interface features automatic determination of
block length for Mode 2, Form 1 and Form 2 sectors.
The block length transferred is programmable.
• The host interface can transfer up to 3 sub-blocks per
sector, with each sub-block being transferred dependent
on the Form bit. Automatic reload of sub-block pointers
and unconditional transfer are supported.
1997 Aug 123
Page 4
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
2.4Buffer memory organisation
Memory is mapped as a 16-bit block number and 12-bit
offset into that block. The block oriented memory structure
permits the use of 16-bit pointers in software thereby
minimising the overhead of accessing memory.
The address can be found from the following equation:
address = block number × 2560 + offset.
The microcontroller sees the SAA7381 as a memory
mapped peripheral, with control and status registers
appearing in the upper address space.
The lowest 52 kbytes (48 kbytes + 4 kbytes) of the
8051 microcontroller external address space is mapped as
a window into the memory on a user-specified 1 kbyte
boundary within the buffer RAM. This can be used as a
scratchpad memory.
The next 4 kbytes is separately mapped as a window into
the memory on a user-specified 1 kbyte boundary within
the RAM.
The next 7.5 kbytes of the external data space consists of
three independently addressed memory segments for
accessing block data, subcode information and block
headers.
The registers of the SAA7381 are mapped into the top
256 bytes of external data space.
• Subcodes are written into memory together with their
associated sector data.This eases the provision of
specialist features, for example CD + G or Karaoke CD
applications.
• All channels of subcode are de-interleaved
• The Q channel is also Cyclic Redundancy Checked
(CRC) for increased reliability
• When operating in 3-wire subcode mode, it is possible
to control or read the P bit in the P-W subcode stream.
2.6Multimedia output audio control features
2
The I
S-bus input may be processed before feeding to the
multimedia audio output in several simple ways:
• As audio is transferred via the buffer memory, it is not
necessary to have the CD-DSP I2S-bus input at exactly
the audio n = 1 or video n = 2 rate. Any faster speed will
work because the buffer RAM is used as a FIFO.
• Both channels may be independently controlled. The left
channel output may be sourced from zero (digital
silence), left or right input; this also applies for the right
channel output. This permits basic audio switching and
channel swapping.
• IEC 958 (SPDIF, AES/EBU and DOBM) output with
Q-W subcode and programmable category code, can be
output from the same CD-DSP I2S-bus data source.
2.5Subcode handling features
The writing of data into the buffer RAM is aligned to the
absolute time sync marker with the following features:
3QUICK REFERENCE DATA
SYMBOLPARAMETERMIN.TYP.MAX.UNIT
V
DDD(core)
V
DDD(pad)
I
DDD
f
xtal
digital core supply voltage3.03.33.6V
digital peripheral supply voltageV
DDD(core)
5.0 or 3.35.0V
supply currenttbf60tbfmA
crystal frequency88.4672, 11.289,
clock/IEC 958 clock or divided system clock for
CD-DSP
SCK250I/OL/CmultimediaI
WS251I/OL/CI
SDO252OMI
2
S-bus bit clock input/output
2
S-bus word select strobe input/output
2
S-bus data output to DAC/video decoder
GND53−−−ground
CROUT54Ocrystal padcrystal oscillator crystal oscillator output
CRIN55Icrystal padcrystal oscillator/clock input
V
I
DDA
ref
56−−−analog supply voltage
57analogcurrent inputclock generator VCO reference current
POR58ISchmitt triggersystempower-on reset (active LOW)
TEST159ICtestmode control input test pins
TEST260IC
RESET61ISchmitt triggerhostATAPI bus reset input from host (active LOW)
DD762I/OAL/Thostdata bus input/output
DD863I/OAL/T
DD664I/OAL/T
V
DDD(pad1)
65−−−digital peripheral supply voltage 1
DGND666−−−digital ground 6
DD967I/OAL/Thostdata bus pin order of ATAPI interface matches
DD568I/OAL/T
DD1069I/OAL/T
the pinning of the 40-way IDE connector (slew
rate limiting by control of drive capability into
capacitive load of ATA bus)
DD470I/OAL/T
1997 Aug 127
Page 8
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
SYMBOLPINTYPE
DRIVE/
THRESHOLD
GROUPINGDESCRIPTION
n.c.71 to 74−−−not connected
DD1 175I/OAL/Thostdata bus; pin order of ATAPI interface matches
DD376I/OAL/T
DD1277I/OAL/T
the pinning of the 40-way IDE connector (slew
rate limiting by control of drive capability into
capacitive load of ATA bus)
subcode frame sync for transmitting 3-wire subcode
RCK3-wire subcode clockoutput bit clock for receiving 3-wire subcode; input bit clock for
transmitting 3-wire subcode
SUBIQ and R-W subcode inputconfigurable for 3-wire or Philips V4 subcode mode; can use either
RCK or WSI1 as clock references with appropriate dividers
2
Table 2 I
SYMBOLDESCRIPTIONCOMMENT
MCK256f
SCK2I
WS2I
SDO2I
IECOIEC 958 outputthe IEC 958 output combines multimedia data and Q-W subcode
S-bus multimedia audio output (5 pins)
or 384fs clock for
s
multimedia master
clock/IEC 958 clock or
divided system clock for
Clock reference input pin when interface is in a master mode; a
programmable divider is provided. This pin is also configurable as a
programmable clock output intended as a clock reference for a
CD-DSP. Should be pulled up if not in use.
CD-DSP
2
S-bus bit clockThis is used for master and slave I2S-bus application as both modes
are needed. For instance, the Philips multimedia CODEC is an I2S-bus
slave, hence this must be a master interface. When driving some
DACs, this interface can be a slave.
2
S-bus left/right strobeword select strobe either master or slave
2
S-bus data to DAC/video
I2S-bus multimedia data
decoder
2
Table 3 I
S-bus connections to CD engine (6 pins)
SYMBOLDESCRIPTIONCOMMENT
SCKI1I
2
S-bus bit clockthis is a separate clock to the multimedia bit clock as this rate is
derived from the disc linear velocity
2
WSI1I
SDI1I
C2P0CD C2 error corrector flag
CFLGCD error corrector flags and
S-bus left/right strobe
2
S-bus data from CD-DSP
from ERCO
absolute time sync
these flags are used to indicate errors from second layer correction to
the ERCO
The absolute time sync is used in the CD input process for playing
‘Red Book’ discs; the error corrector status is also read in from this
signal, to provide an indication of C1 and C2 performance for CD-RW
applications.
1997 Aug 1212
Page 13
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 4 ATAPI target mode interface
ATAPI
NAME
RESETATAPI reset signal: the SAA7381 will not recognize a signal assertion shorter than 20 ns as a valid
reset signal.
DD0 to DD7ATAPI D0 to D7.
DD8 to DD15 ATAPI D8 to D15: these data bits are only used in accesses to the 16-bit data port.
DMARQDMA request: this signal, used for DMA data transfers between host and device, is asserted by the
SAA7381 when it is ready to transfer data to or from the host. The direction of data transfer is
controlled by
DMACKDMA acknowledge: this signal is used by the host in response to DMARQ to initiate DMA transfers.
This signal may be temporarily negated by the host to suspend the DMA transfer in process.
IOCS16ATAPI I/O port is a 16-bit open-drain output: during PIO transfer Modes 0, 1 or 2, IOCS16 indicates to
the host system that the 16-bit data port has been addressed and that the device is prepared to send
or receive a 16-bit data word.
IORDYATAPI I/O ready open-drain output: this signal is negated to extend the host transfer cycle of any host
register access (read or write) when the SAA7381 is not ready to respond to a data transfer request.
This signal is only enabled during DIOR/DIOW cycles to the SAA7381. When IORDY is not active, it is
in the high-impedance (undriven) state.
DA0 to DA2Address bus (device address).
DIOWATAPI write strobe: the rising edge of DIOW latches data from the signals, DD0 to DD7 or
DD0 to DD15 into a register or the data port of the SAA7381. The SAA7381 will not act on the data
until it is latched.
DIORATAPI read strobe: the falling edge ofDIOR enables data from a register or data port ofthe SAA7381
onto the signals, DD0 to DD7 or DD0 to DD15. The rising edge of DIOR latches data at the host and
the host will not act on the data until it is latched.
CS0ATAPI chip select 0 input: this is the chip select signal from the host used to select the ATA command
block registers. This signal is also known as CS1FX.
CS1ATAPI chip select 1 input: this is the chip select signal from the host used to select the ATA control
block registers. This signal is also known as CS3FX.
INTRQATAPI interrupt output: this signal is used to interrupt the host system. INTRQ is asserted only when
the device has a pending interrupt, the device is selected, and the host has cleared the ‘nien’ bit in the
device control register. If the ‘nien’ bit is equal to 1, or the device is not selected, this output is in a
high-impedance state, regardless of the presence or absence of a pending interrupt.
PDIAGATAPI passed diagnostics: this signal shall be asserted by device 1 to indicate to device 0 that it has
completed diagnostics.
DASPATAPI DASP (device active, device 1 present): this is a time-multiplexed signal which indicates that a
device is active, or that device 1 is present. This signal is an open-drain output.
DIOR and DIOW.
ATAPI MEANING
1997 Aug 1213
Page 14
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 5 Generic host controller interface
ATAPI
NAME
RESETRESETcontroller reset output
DD0 to DD7D0 to D7controller DMA path/controller data and control bus (optional)
DD8 to DD15 D8 to D15controller upper DMA path (optional)
DMARQ
DMACKDMARQDMA request from controller
DA1
DA2
CS0SCSICScontroller chip select output for sub-CPU read/write cycles
Table 6 Miscellaneous pins
SYMBOLDESCRIPTIONCOMMENT
CRINcrystal oscillator/clock input−
CROUTcrystal oscillator output−
I
ref
PORpower-on reset pin−
TEST1 and TEST2mode control test pins−
Table 7 Sub-CPU interface pins
GENERIC
INTERFACE
NAME
DMACKDMA acknowledge to controller
DBWRDMA bus write to controller
DBRDDMA bus read from controller
VCO reference currentclock PLL multiplier
GENERIC HOST CONTROLLER INTERFACE MEANING
SYMBOLDESCRIPTIONCOMMENT
SRSTsub-CPU resetactive HIGH reset if XDD7 is pulled LOW during power-on reset;
active LOW reset if XDD7 is pulled HIGH during power-on reset
INTsub-CPU interrupt request
output from host interface
INT2sub-CPU interrupt output
from the SAA7381 drive
block and UART
SCCLKsub-CPU clock out−
RDsub-CPU read enablesub-CPU read enable strobe; if grounded permanently, the WR
WR/R/Wsub-CPU write enable/
read/write control
ALEdemultiplex enable input for
lower address lines
PSENprogram store enablethis pin should be tied high using a 10 kΩ resistor
SCD0 to SCD7/
SCA0 to SCA7
SCA8 to SCA15sub-CPU address high bits−
sub-CPU data bus
multiplexed/low address bus
open-drain sub-processor interrupt from host interface
open-drain sub-processor interrupt from drive and UART
signal will act as read/write control input
write enable; alternative usage is read/write if RD is held LOW at all
times; WR has priority over RD at all times
while HIGH, the lower address bits are latched from
SCD0 to SCD7; should be used with a Schmitt trigger input to
avoid false latching due to ground bounce on the
8051 microcontroller
−
1997 Aug 1214
Page 15
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 8 RAM interface pins
SYMBOLDESCRIPTIONCOMMENT
XDA0 to XDA11RAM address bits, multiplexed for DRAMup to 16 Mbytes DRAM only supported
XRASDRAM row address strobe
XCASDRAM column address strobe
XWRRAM write enable
XDD0 to XDD7RAM data bus
Table 9 Basic engine interface
SYMBOLDESCRIPTIONCOMMENT
SYSSYNCbasic engine synchronization inputgenerate interrupts on rising and/or falling edges
COMSYNCbasic engine synchronization inputgenerate interrupts on rising and/or falling edges
COMINreceive data−
COMOUTtransmit data−
COMCLKserial data clock for synchronous mode−
COMACKcommand acknowledge/transmit flow
control
must be HIGH for synchronous mode to transmit next
data byte
7FUNCTIONAL DESCRIPTION
The SAA7381 device consists of a number of main
functional units; a CD engine interface, a multimedia block,
a microcontroller interface, an error detection and
correction block, a host interface and a memory manager.
There are also several smaller blocks including a clock
control block and a UART for communication with the CD
engine. Each block is independently controlled by a
dedicated register set. These registers are memory
mapped to the sub-CPU to allow for faster access.
The external RAM can also be accessed directly from the
microcontroller to support scratchpad accesses and thus
eliminate the need for further memory devices in the
system.
7.1Memory field description
The CD input function of the SAA7381 buffer manager
receives the main data stream in I
CD-DSP, performs sync detection and partitions the data
into blocks.
2
S-bus format from the
It then writes the blocks to the buffer memory and onboard
ERCO RAM. Any detected errors are then corrected and
over written into the buffer memory.
Memory is segmented and addressable by segment
pointers. The segment pointers consist of a block number,
offset pointer and byte number within the block. The data
within each segment is organised in the same manner
(see Table 10).
The arrangement of data within each segment in memory
differs from other Philips devices, because of the different
error correction processing possibilities within the
SAA7381.
Addresses 0 to 2355 are written to memory by the drive
processor when enabled.
1997 Aug 1215
Page 16
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 10 The memory map of a block in the buffer RAM for standard density mode (see Table 11)
ADDRESS (OFFSET)TYPE OF DATA
0 to 3header field
4 to 2339block data field
2340 to 2351sync field
2352copy of STAT0
2353copy of STAT1
2354copy of STAT2
2355number of C2 flags in sector (compressed format)
2356 to 245196-byte de-interleaved R-W data field
2452 to 246312-byte Q-subcode field
2464 to 2465copy of STAT4 field; only valid if ERCO did run on this block
2466 to 2559user work space
Table 11 Description of Table 10
DATADESCRIPTION
Header fieldThe 4-byte header data consists of a 3-byte block address of absolute time (minutes,
seconds and frame, bytes 0 to 3). The fourth byte is for the mode of data:
Mode 0 = zero mode
Mode 1 = data storage with EDC and ECC
Mode 2 = data storage
Block data fieldin the CD-ROM mode the block data consists of 2048 bytes of user data and 288 bytes of
auxiliary data
User data:
Mode 0= all 2048 bytes in user data are zero
Mode 1= all 2048 bytes are available to the user
Mode 2= all 2048 bytes are available to the user
Auxiliary data:
Mode 0= all 288 bytes in Aux data are zero
Mode 1= the Aux field is in accordance with the EDC and ECC specification
Mode 2= all 288 bytes are available to the user
Sync fieldThe 12-byte sync field is the next segment in memory. All bytes in the sync field are FFH,
except the first and last bytes which are $00.
1997 Aug 1216
Page 17
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
DATADESCRIPTION
Number of C2 flags in
sector (compressed
format)
96-byte de-interleaved
R-W data field
12-byte Q-subcode fieldAs above: these will not be separated out if the copy2 interleaving option is set to raw.
2 copies of STAT4 fieldAddress 2465 and 2466 are copies of the STAT4 register written by the ERCO when
While storage of C2 flag positions is not possible as a consequence of the architecture of
the SAA7381, a count of the number of flags seen per block is made in a single-byte
counter. This counter packs the possibly 12-bit count into a single byte in the following
way, at the expense of resolution in the count values for large counts.
C2count_val = count (5 down to 0) × [4 ^ count (7 down to 6)], the resolution of the count
is therefore:
C2count_val 0 to 63: counter resolution = 1
C2count_val 64 to 255: counter resolution = 4
C2count_val 256 to 1023: counter resolution = 16
C2count_val 1024 to 4095: counter resolution = 64
Written to memory by the automatic Q-channel copy process (copy2 channel). If the copy
process is not enabled, these fields are not written (see Section 7.3.5). These bytes may
either be R-W de-interleaved or presented as raw Q-W subcode bytes. If the copy2
interleaving mode is set to raw, interleaved copying is still required as the subcode
temporary holding buffer has Q bytes interspersed with the raw R-W.
enabled. This allows the user to determine if the ST AT4 register has been written to by the
ERCO. If seg2465 = seg2466 then STAT4 definitely has not been written by the ERCO.
If seg2465 ≠ seg2466 then STAT4 probably has not been written by the ERCO.
Via direct access to buffer memory, the sub-CPU will be able to look at all of the blocks so
far corrected, to check their status, in a background task.
ERCO failures do not have to be dealt with immediately, as the status of every block
loaded in to RAM is stored with that block, and it is not overwritten until the RAM block is
filled with new data from CD input.
The error corrector will be controlled additionally to permit the use of single pass P-Q or
only EDC operation to allow for greater than n = 14 operation of the ERCO.
The ERCO status will be copied into the RAM along with the data. This is possible
because the RAM now has spare capacity to store the information, as part of the change
from linear to segment/offset addressing.
It is possible to program transfers into RAM of more than one block without processor
intervention. It is also possible to continually loop on the same buffer area of RAM, by not
altering the reload register values when the reload interrupt occurs.
7.1.1DVD-ROM MEMORY FIELD INFORMATION
The buffer arrangement for DVD usage is basically the same (data followed by flags) but the size of the block data differs,
and the ERCO flags are at a different offset, and as the ERCO is not in use, the flags relating to ERCO performance will
not be valid.
1997 Aug 1217
Page 18
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.2CD input control registers
The CD input process is intended to be as automated as possible. Data is read in from the front end, descrambled if in
CD-ROM mode and then written to RAM. The registers that control the address of where the data is written to are in the
memory processor block.
The input data is synchronized, decoded and written to the buffer RAM. The input data format is software programmable.
The synchronization is performed by using a sync detector and a sync interpolator. The sync detector can detect
CD-ROM syncs and syncs from the CFLG pin, for use with Red Book, audio and for DVD. When no sync is found, it is
optionally interpolated.
After decoding, each full sector of data (2352 bytes) comprising sync, header and sub-header is written to the buffer
RAM. The R-W and Q subcode is added by a software-initiated automatic block copy process.
7.2.1R
Table 12 IFCONFIG (write only; address FF10H) (see Table 13)
Table 13 Description of the IFCONFIG register bits
4subsel0both copies of sub-header contribute to STAT1/sh0err to sh3err
3 and 2modulo 1 and
modulo 0
1config swap0the received data from the CD-DSP or drive FIFO is not swapped
0config wclk0the internal ‘irclk’ is not inverted
00oversample, bit clock division ratio = 2
01oversample, bit clock division ratio = 4
10oversample, bit clock division ratio = 8
11bit clock division ratio = 1 (no division)
1first copy only of sub-header contributes to STAT1/sh0err to sh3err
00modulo count 2352
01
10modulo count 2064
11modulo count 2064, but do not count bytes with flag = 1
1the received data from the CD-DSP or drive FIFO is swapped
1the internal ‘irclk’ is inverted
2
S-bus mode
1997 Aug 1218
Page 19
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 14 CD input control registers (see Table 15)
There are two sets of address registers, one giving the current (DRIVECURSEG) number of the segment being filled and
a segment/block counter. The other set contains the values (DRIVENEXTSEG) to use on completion of the current group
of blocks being filled or emptied (in CD-R). The DRIVEPREVSEG register is loaded with the value of the DRIVECURSEG
register at the end of each CD-ROM block.
The reloading of the registers will trigger an interrupt, if enabled, of the sub-CPU, which will then have to reload the ‘next’
registers. before the transfer requested in the ‘current’ registers are exhausted.
Memory is split into segments, each segment is 2560 bytes. The drive data is written one block at a time at the segment
number pointed to by the DRIVECURSEG register. For the next block the ‘DRIVECURSEG’ is updated as follows.
Table 15 Description of the ‘incen’ and ‘wren’ bits (see Table 14)
BITNAMEVALUEMEANING
(2)
(1)
0hold value of DRIVECURSEG
1increment DRIVECURSEG at the end of each CD-ROM block received
0enable writes of data transferred
1disable write of data transferred
7incen
6wren
Notes
1. If ‘incen’ is logic 1, the ‘DRIVECURSEG’ pointer will increment every sector sync. The ‘DRIVECURCOUNT’ will
decrement every sector sync independent of ‘incen’. If ‘incen’ is logic 0 then the pointer will remain fixed pointing at
the same segment of RAM. If the reading of data from CD is enabled by the ‘wrreq’ bit in the CTRL0 register, and
the ‘wren’ bit is logic 0 the segment will be repeatedly filled by the data coming in from the CD-ROM.
2. If ‘wren’ is logic 1 and ‘incen’ is logic 1 then the DRIVECURSEG register will increment with each sync time and the
DRIVECURCOUNT register will decrement but data will not be written to external RAM. This allows the triggering of
the reading of data or the writing of data some time in the future.
Table 16 Control and status registers (see Tables 17, 18 and 19)
FF00HHEAD0minutes
FF01HHEAD1seconds
FF02HHEAD2frames
FF03HHEAD3mode
FF04HSUBHEAD0file number
FF05HSUBHEAD1channel number
FF06HSUBHEAD2submode
FF07HSUBHEAD3coding Information
FF08HSTAT0−ilsyncnosynlblk−sblkerablk−
1XXXpacket written CD-R, run in/run out, link, XXX is mode
1111mode = 7 or error in mode byte
Note
1. rmod3 = bit 7 #, bit 6 #, bit 5 #, bit 4 #, bit 3 # C2P0 (where # is logic OR). This is non-zero for packet written CD-R.
rmod2 = bit 2 # C2P0 (where C2P0 is C2 flag for mode byte).
rmod1 = bit 1 # C2P0 (where C2P0 is C2 flag for mode byte).
rmod0 = bit 0 # C2P0 (where C2P0 is C2 flag for mode byte).
(1)
MEANING
Table 27 Description of the STAT3 register bit
BITNAMEVALUEDESCRIPTION
7valst0registers associated with decoder interrupt valid
1registers invalid
Table 28 Description of the STAT4 register bits (this register contains the interrupt status on reading)
The auxiliary segment pointer points at a group of
segments which hold the data FIFOs used in the
SAA7381. These are the ‘large’ FIFOs rather than the
small resynchronizing FIFOs inside the SAA7381.
The subcode input/output and n = 1 I2S-bus interfaces use
these FIFOs (in addition, the shadow debug registers can
use some of this space).
The FIFOs are arranged to optimally occupy a contiguous
group of segments in the external RAM.
7.3Multimedia output interface
This block deals with subcode input and output in addition
to an audio output which is independent of the I
2
S-bus
input output path connected to the CD-R engine.
Q and R-W subcode features:
• Subcode sync is aligned with the start of the current
block in RAM
• Supports subcode resynchronization when subcode
sync is lost
• Supports Philips ‘V4’ and 3-wire formats
• Has selectable polarity on RCK
• Uses WSI1 pin as timing reference
• Supports regeneration of subcode from IEC 958 output
using WS2 as timing reference
• Can accept subcode input while I2S-bus from CD-DSP
is oversampled audio at n = 2 or n = 4 oversample
Audio output (multimedia) features:
• Has data output for simple audio or digital video for
n = 1 or n = 2 rate regardless of input CD-DSP data rate
• 4096-byte FIFO for audio samples, requires firmware
polling for refills using the block copy engine
• Permits CAV and quasi-CLV systems to maintain n = 1
audio output
• Basic channel swap, mono-L or mono-R modes,
includes muting and L + R summed mono
• IEC 958 output with subcode Q-W for use in CAV and
other modes where there is no n = 1 clock in the
CD-DSP subsystem
– IEC 958 interface has fully programmable category
code and copyright bits for flexibility
– Subcode on IEC 958 is only available in CD-ROM
mode, because the subcode output FIFO is shared.
2
• Master and slave I
S-bus modes are available
– IEC 958 is only available when the I2S-bus is in the
master mode.
• Can be configured to provide a clock for an external
CD-DSP function via the MCK pin
• Can operate in 64fs or 48fs I2S-bus modes
• IEC 958 can operate at n = 2 although not permitted by
standard.
7.3.1S
UBCODE INPUT BLOCK
7.3.1.1Q-W subcode handling
The subcode data is initially converted from
serial-to-parallel format and is then handled as Q-W bytes.
The de-interleaving is performed by a de-interleaving
block copy mode in the memory processor’s block copy
engine. Subcode blocks will always be aligned with a block
of CD-ROM data, although the subcode Minutes,
Seconds, Frames (MSF) absolute time may have an
uncertainty of ±5 frames in terms of the actual CD-ROM
block it is referring to. This offset is unknown but consistent
in any given application. The block copy engine will be
automatically triggered when the subcode synchronization
is found.
The error corrector will then compute the CRC syndrome
of the subcode and deposit it in the CRC bytes.
The sub-CPU will have to perform the actual correction if a
non-zero syndrome appears.
This syndrome, if calculated during encoding by the
ERCO, can be used as the CRC written to disc for the
subcode.
1997 Aug 1224
Page 25
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.3.1.2Description of subcode interface
The subcode interface allows the reception and transmission of subcodes. The subcodes will be received/transmitted to
two on-chip 512-byte FIFOs, one for transmit and one for receive. No interrupts are associated with these FIFOs as the
block copy engine removes data or fills these as necessary.
There is, however, an interrupt which is asserted when a sync is found in an unexpected location.
7.3.2S
Table 30 Subcode mode transmit control register (SUBMODETX; address FF13H); see Table 31
Table 31 Description of the SUBMODETX register bits
Note
1. Philips V4 subcode transmit mode must be selected for correct insertion of subcode into the IEC 958 data stream.
Table 32 Subcode mode receive control register (SUBMODERX, address FF17H); see Table 33
UBCODE MODE TRANSMIT CONTROL REGISTER
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
−−−pbit−txena−V4
BITNAMEVALUEDESCRIPTION
4pbit0P bit logic 1 in 3-wire mode (default)
1P bit logic 0 in 3-wire mode
2txena0subcode transmit interface is disabled
1subcode transmit interface is enabled
0V40Philips SRI 3-wire subcode
1Philips V4 mode; note 1
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
−−−wsdiv1wsdiv0rxenarckinvrxrxsubqw
Table 33 Description of the SUBMODERX register bits
The subcode is buffered in the AUXSEGMENT register. Two offset pointers, SUBPOINTR-L and SUBPOINTR-H, and
SUBPOINTW-L and SUBPOINTW-H are associated with it. The R pointer is for the subcode output and the W pointer
for the subcode input.
Pointers are also provided to point at the offset into the AUXSEGMENT register where the start of a subcode frame will
be found, SUBBASEPOINTR-L and SUBBASEPOINTR-H and SUBBASEPOINTW-L and SUBBASEPOINTW-H. The
block copy engine is expected to use these to automatically move the subcode into the segment pointed at by
DRIVECURSEG register.
7.3.3G
ENERAL DESCRIPTION OF THE MULTIMEDIA OUTPUT INTERFACE
7.3.3.1Basic description of the multimedia output interface
The multimedia data output may be used either with an internal clock or an externally provided clock. The clock used
should be a correct multiple of 44100 Hz in order for the block to correctly output IEC 958.
The multimedia interface data FIFO is located in the block of segments associated with AUXSEGMENT master/slave
mode operation (see Fig.3).
handbook, full pagewidth
e.g. DAC
SAA7381
SCK
WS
SDO2
slave: master = 0
e.g. DAC
SCK
WS
SDO2
master: master = 1
Fig.3 Master/slave mode operation.
Table 36 Description of the MMCTRL register bits
BITNAMEVALUEDESCRIPTION
7mmdiv−see Table 37
6−
5−
4−
3spdx20I
1I
2wslen0I
1I
2
S-bus output is single speed
2
S-bus (and IEC 958) output is double speed; video applications
2
S-bus bit clock is 64 times the sample rate
2
S-bus bit clock is 48 times the sample rate
1 and 0mcksel00multimedia internal clock is CRIN pin
01multimedia internal clock is MCK pin
10multimedia internal clock is system clock
SAA7381
MGL179
1997 Aug 1227
Page 28
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 37 mmdiv/mcksel relationship to clocks needed for I2S-bus and IEC 958
1. For these combinations the duty factor of the output SCK2 clock is not necessarily 50%. These combinations are
therefore not recommended.
2. This is illegal but possible.
Table 38 Description of the MMAUD register control bits
BITNAMEVALUEDESCRIPTION
7daen
(1)
0CD-DA interface is off
1CD-DA Interface is on
2
6eiaj0I
S-bus serial mode
1EIAJ16 serial mode
5master0I
1I
3leftmode00I
01I
210I
2
S-bus is slave
2
S-bus is master
2
S-bus left channel output is left (default)
2
S-bus left channel output is right
2
S-bus left channel output is muted
11reserved
2
1rightmode00I
S-bus right channel output is right (default). This is the opposite default to
left channel.
01I
010I
2
S-bus right channel output is left
2
S-bus right channel output is muted
11reserved
Note
1. If enabled, data is written to the CDDA interface from a FIFO located in the CDDA register space. If either ‘daen’ = 1
or ‘iecen’ = 1 (ieccrtl), the interface will become active.
1997 Aug 1228
Page 29
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.3.4IEC 958/EBU OUTPUT
Table 39 Description of the IECCTRL register control bits (notes 1 and 2)
BITNAMEVALUEDESCRIPTION
7iecen0IEC 958 interface is off
1IEC 958 Interface is on
6data0IEC 958 contains audio information
1IEC 958 contains data
5copyright0IEC 958 C bit in system channel is logic 0
1IEC 958 C bit in system channel is logic 1
4preem0audio pre-emphasis off/IEC 958 contains data
1audio pre-emphasis on (only appears in IEC 958 C channel;
de-emphasis bit is not implemented in the SAA7381)
3vbit0audio samples suitable for conversion
1mute audio, or signal is data and should not be digital-to-analog
converted at any time
2−−reserved
−reserved
1 to 0accu00level II clock accuracy
01level III clock accuracy (depends on mck/system clock)
10reserved
11reserved
Notes
1. In order for the IEC interface to operate correctly, it will require a clock at 128fs to be present.
2. The ‘vbit’ is copied into the V bit of the IEC 958 frame.
Table 40 IEC 958 system channel bit mapping (note 1)
1. The C bit is updated on an IEC frame-by-frame basis, the bit offset corresponds to the IEC frame offset. They are
repeated for both left and right channels. Bit 0 is present in the C bit of the first sample pair of the IEC superframe of
192 sample pairs.
BIT OFFSET
1997 Aug 1229
Page 30
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 41 Description of the MCK_CON register bits (note 1)
BITNAMEVALUEDESCRIPTION
3mckxtal0MCK reference is system clock (default)
1MCK reference is the CRIN pin
2mckoe0MCK pin is 3-state, an input to the MM block (default)
1MCK pin is output
1 and 0div00MCK reference is divided by 2 (default)
01MCK reference is divided by 1.5
10MCK reference is divided by 1
11MCK reference is divided by 4
Note
1. The bits in this register control the use of the MCK pin as an output to clock a CD-DSP. The division ratios chosen
are suitable for the SAA7335 or CDR60 devices. If the MCK pin is not being used then it should be pulled HIGH for
correct selection of the internal multimedia clocks.
7.3.5MEMORY-TO-MEMORY BLOCK COPY FUNCTION
This function is provided for the user to move and copy
blocks of RAM. Two pointer sets are provided. The second
of these is for the semi-automatic subcode copying
function of the subcode in the block. It is independent of
the first copy register set, which is available for e.g. audio
copying needed in the PLAY AUDIO function with the
SAA7381, and for subcode copying when recording.
When started, the copy process will copy the
COPYCOUNT register bytes from the ‘FROM’ pointers to
the ‘TO’ pointers. A copying process may be stopped
during its operation by writing to the ‘copyend’ bit.
7.3.5.1Automatic copying of received
subcode-to-data block
When enabled, the newly received subcode will be
automatically transferred to the current host segment in
RAM.
The only register that is user programmable in the subcode
copying engine is the COPYFROM2OFFSET pointer.
The ‘COPYFROM2OFFSET’ pointer is set up by the
sub-CPU to point into the subcode input FIFO. It points at
the first byte of subcode to be copied into the current host
data block. Once triggered, this copy is automatically
set-up to correctly transfer the next block of subcode
correctly without host intervention.
Copying of the subcode in the opposite direction is
performed by the sub-CPU commanding an interleaved
copy of data using the user block copy registers. This does
not have to be as fast for subcode output to the user
channel of the IEC 958 output as this is only specified to
n = 1 rate.
1997 Aug 1230
Page 31
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 42 Block copy registers
ADDRESSNAMEBIT 7BIT 6BIT 5BIT 4 BIT 3BIT 2BIT 1BIT 0
Table 43 Description of the COPYCONTROL register bits
BITNAMEVALUEDESCRIPTION
7dfrom0linear addressing with COPYOFFSET
1interleaved addressing with COPYOFFSET
6dto0linear addressing with COPYTOOFFSET
1interleaved addressing with COPYTOOFFSET
5dfrom20linear addressing in copy from block, subcode copy engine
1interleaved addressing in copy to block, subcode copy
engine
4dto20linear addressing in copy to block, subcode copy engine
1interleaved addressing in copy to block, user block copy
engine
3en10user block copy disabled
1user block copy enabled
2en20subcode block copy disabled
1subcode block copy enabled
1raw0enable complete subcode de-interleaving process
1de-interleave R-W bytes, but skip Q byte de-interleaving
0sub_deint_order0de-interleave received subcode (CD-ROM)
1Interleave transmitted subcode (CD-R)
1997 Aug 1231
Page 32
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.4Interrupt registers
The interrupt system in the SAA7381 is intended to make it possible to acknowledge interrupts both independently
without interference or together. There are two interrupt pins to the sub-CPU from the SAA7381. The INT pin is
associated only with the host interface register IFSTAT (address FF92H). The INT2 pin is associated with 6 interrupt
registers which cover the SAA7381 drive block and UART. Two status/reset registers and two interrupt enable register
for the drive block and one status/reset register plus an interrupt enable register for the UART.
Table 44 IFSTAT interrupt register for the host interface; address FF92H (note 1)
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
Rcmdidteidrqiultra_stopdtbsysrstireset08a0comp/
crc_error
Note
1. Interrupt status bits are described in the host interface; see Section 7.5.3.18.
7.4.1I
By writing a logic 1 to the INT1RESET register the bits will negate the INT1STATUS register bits. Writing a logic 1 to an
INT1ENABLE bit will enable the corresponding status bit. Writing a logic 0 will disable the status to zero.
7.4.3UART
By writing a logic 1 to the INT2RESET register bits will negate the INT2STATUS bit. Writing a logic 1 to an INT2ENABLE
bit will enable the corresponding status bit. Writing a logic 0 will disable the status to zero.
The INT2 interrupt corresponds to not (INT1 or INT2 or UARTINT).
Table 54 Description of the interrupt register bits
REGISTERINTERRUPTDESCRIPTION
INTERRUPT 1 decblock by block decoder interrupt
nocorERCO cannot be started on current block
erablkone or more bytes coming from CD-DSP have been flagged with error
cblkcorrected current block.
uceblkone or more bytes remain in error
crc-ngbad CRC on current block
q-ngbad Q CRC on current block
int2indicates that interrupt is caused by an enabled interrupt from INT2
INTERRUPT 2 hostbytecountzero the host counter decremented to zero and may have been reloaded; requires
sub-CPU intervention when reload is disabled
drivereloaddrive processing pointers have reloaded
hostcursegcntzero the host reload count decremented to zero; no more host reloads are available
copyendcopy process has finished
subcode syncintsubcode receive block detection of early subcode 98 frame sync period
dmatxintasserts when ‘dmacount’ reaches zero with ‘dmaon’ bit set
int1indicates that interrupt is caused by an enabled interrupt from INT1
uartintindicates that the interrupt is from the UART interrupt register
UART
INTcomsyncUART COMSYNC pin rising edge interrupt
syssyncSYSSYNC pin rising edge interrupt
notcomsyncCOMSYNC falling edge interrupt
notsyssyncSYSSYNC pin falling edge interrupt
nottxbfulltransmit buffer has become empty
rxbfullreceive buffer has become full
overrunreceive buffer has overrun
rxparitya character has been received with illegal parity
7.5Host interface
7.5.1I
The SAA7381 host interface block is responsible for the
transfer of data and control information between the
memory processor, external host and microcontroller.
The host interface operates in conjunction with the
SAA7381 Auxiliary block (Aux block). The Aux block
contains several registers that automate the SAA7381
memory processor in its task of supplying the host
interface with data from the buffer memory and receiving
data from the host interface to be placed in the buffer
memory. The host interface automates data transfer to
and from the host, whereas the Aux block automates data
transfer, via the memory processor and buffer memory,
depending on the CD format.
The host interface features are as follows:
1997 Aug 1234
NTRODUCTION
• Supports ATA Packet Interface (ATAPI revision 2.6) for
CD-ROMs
• Supports ATA/ATAPI 16-bit PIO data transfers for
Modes 0, 1, 2, 3 and 4
• Supports ATA/ATAPI single/multi word DMA transfers
for Modes 0, 1 and 2
• Supports ultra DMA for Mode 0
• Supports generic interface connection to external SCSI
controller device (NCR 53CF92)
• Command and status registers of external generic
interface controller are optionally mapped via the host
interface pins of the SAA7381. The SAA7381 becomes
the bus master.
• Operates automatically with multi-block host data
transfers
Page 35
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
• Reduces microcontroller load in simple streaming
transfers to or from host using a circular buffer
• Recognizes ATA SRST, the ATAPI reset command
(0X08) and the ATAPI packet command (0XA0) and
handles these automatically in ATAPI mode
• Handles unexpected ATA commands during PIO data
transfers
• Provides automatic DRQ for all PIO data transfers
• Provides automatic detection of ATAPI packet (A0)
command and reception of the packet bytes
• Provides automatic completion sequence for PIO DMA
and ultra DMA transfers
• Supports shadowing of registers for single drive
configurations with non-existent slave.
7.5.2D
The host interface block consists of three FIFOs which can
be configured by the DTCTR register to generate the
required data path through the host interface block.
The design supports ATAPI (revision 2.6) for CD-ROM
interfaces.
ESCRIPTION OF THE HOST INTERFACE BLOCK
The host interface has a shadow status register to permit
proper ATA operation. The
controlled by the register bits in the host interface block.
The microcontroller has access to all registers in the host
interface block. The microcontroller can control all
operations required for data transfer to and from the host,
but may configure the host interface sequencer to
automate the following three operations:
1. Automation of detection of the A0 packet command
and reception of the 12-byte packet.
2. Automation of the data transfer sequences for PIO,
DMA and ultra DMA modes of data transfer.
3. Automation of completion sequences for PIO, DMA
and ultra DMA modes of data transfer.
The host interface provides a generic interface mode for a
glueless connection to an external SCSI controller device.
In this mode the microcontroller can configure the registers
of the SCSI controller device and initiate DMA transfers.
PDIAG and DASP signals are
7.5.2.1
Table 55 Host interface registers as seen from the host (note 1)
CS0CS1DA2DA1DA0HOST READ (DIOR)HOST WRITE (DIOW)
10110ALT STATUS: alternative statusADCTRL: ATAPI device control
10111ADRADR: ATAPI drive addressnot used
01000DATA: data registerDATA: data register
01001AERR: ATAPI error registerAFEAT: ATAPI features register
01001SHERR: ATAPI error register (shadow) unused
01010AINTR: ATAPI interrupt reason register unused
01011ASAMT: ATAPI SAM TAG registerASAMT: ATAPI SAM TAG register
01100DBCL: ATAPI byte count lowDBCL: ATAPI byte count low
01101DBCH: ATAPI byte count highDBCH: ATAPI byte count high
01110ADRSEL: ATAPI drive select registerADRSEL: ATAPI drive select register
01111ASTAT: ATAPI status registerACMD: ATAPI command register
01111SHSTAT: ATAPI status register
Note
1. The operation of these registers complies with the ATA-3 specification (revision 6) and the ATAPI specification
The SAA7381
(revision 2.6).
host interface ATAPI registers visible to the host
unused
(shadow)
1997 Aug 1235
Page 36
1997 Aug 1236
7.5.2.2 The SAA7381 host interface registers visible by the microcontroller
The registers listed in Table 56 are used by the microcontroller to control the operation of the host interface block. The ATAPI command block registers
(ADATA, ASTAT, ADRADR, ASAMT, ADRSEL, AINTR, AERR, ACMD, ADCTR, AFEAT and APCMD) are dual port registers which can be accessed
either by the microcontroller or the host PC depending the state of the BSY flag, bit 7 of the ASTAT register.
Table 56 Host registers as seen by the microcontroller
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
ADDRACCESSNAME
FF80HWADATAATAPI Data register
FF81HRWIFCTRLcmdiendteiendrqienultra_
FF82HRWDBCLData Byte Count register (bits 7 to 0)
FF83HRWDBCHData Byte Count register (bits 15 to 8)
FF84HWDTRGData transfer Trigger register
FF85HWDTACKData Transfer Acknowledge register
FF86HWRESETreservedhsel
FF87HRWASTATATAPI Status register (see Table 61)
FF88HWITRGhost Interrupt Trigger register
FF89HWADRADRATAPI Drive Address register
FF8AHRWASAMTATAPI SAM tag register
FF8BHRWDTCTRreserveddmamodedmaultra_dmardrvtrant
7.5.3DESCRIPTION OF THE HOST INTERFACE REGISTERS
This section describes the operation of the register bits in the SAA7381 host interface block.
7.5.3.1ADATA
This is a 12-byte FIFO used to transfer data from the microcontroller to the host. To transfer data the ‘trant’ bits (0 to 2)
of the DTCTR register must be set to 101.
7.5.3.2IFCTRL
Table 57 IFCTRL: address FF81H (note 1)
ACCESS
RWcmdiendteiendrqienultra_stopien
Note
1. Bits ‘cmdien’, ‘dteien’, ‘drqien’ and ‘ultra_stopien’, are the enable bits for interrupt bits ‘cmdi’, ‘dtei’, ‘drqi’ and
‘ultra_stop’ in the IFSTAT register. These are interrupt masks, enabling/disabling the microcontroller interrupt pin.
They do not affect the bits in the IFSTAT register. If set to logic 1, the corresponding interrupt is enabled. It should
be noted that these masks do not clear the interrupts. Bit 2 (
interrupt. If set to logic 1 the ‘srsti’ interrupt is disabled.
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
−srstien−−
srstien) is asserted at power-on reset, enabling the ‘srsti’
7.5.3.3DBCL and DBCH
These are the ATAPI byte count registers. DBCL is the lower byte (bits 7 to 0) register and DBCH is the higher byte
(bits 15 to 8) register. These registers are read/writable for both the PC host and microcontroller.
RWData Byte Count register bits (bits 7 to 0)
RWData Byte Count register bits (bits 15 to 8)
The data byte counter is used by the microcontroller to control the number of bytes that are transferred during a data
transfer. During memory-to-host data transfers the data byte counter is decremented after every host read. During
host-to-memory data transfers the data byte counter is decremented as data is written into the external buffer memory.
The host may write to DBCL/DBCH to indicate to the microcontroller the maximum transfer/reception length, which may
be updated by the auto sequencer PACKETSIZE STORE registers or from the TRANSFER COUNTER (for the
remainder packet size) or directly by the microcontroller. The host can then read back the updated byte count to be
transferred.
7.5.3.4DTRG
Writing to this register starts a data transfer. The data written is discarded.
7.5.3.5DTACK
Writing to this register clears the DTEI interrupt and the ‘A0comp/crc_error’ flag. The data written is discarded.
1997 Aug 1238
Page 39
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.3.6RESET
Writing to this register resets the SAA7381 and initializes all the registers on the device.
Table 59
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
Note
1. The ‘hsel’ bits (see Table 60) control the mode of operation of the host interface block. After a power-on reset the
Table 60 Description of the ‘hsel’ bits
RESET; address FF86H (note 1)
Wreservedhsel
‘hsel’ bits default to 000, i.e. the host 3-state pins are 3-stated. The firmware must configure the ‘hsel’ bits for the
desired mode of operation after every hardware reset. It should be noted that any write operation by the
microcontroller to this register will result in the resetting of all other SAA7381 registers to their default condition.
hsel2 to hsel0HOST INTERFACE MODEDESCRIPTION
000unknown hostall host pins 3-state, default after hardware reset
001ATAPIATAPI Interface mode
011generic 8-bitgeneric interface mode, with 8-bit transfers
100generic 16-bitgeneric interface mode, with 16-bit transfers
othersreservedfor future enhancements
7.5.3.7ASTAT
This is the ATAPI status register.
Table 61 ASTAT: address FF87H (notes 1 and 2)
ACCESS
RWbsydrdydmardscdrqcorrresetcheck
Notes
1. The ‘bsy’ flag bit 7 will be set to logic 1 when:
a) The host writes to the ACMD register and the SAA7381 is the selected drive.
b) The host writes the execute drive diagnostic command (90H) to the ACMD register.
c) The host writes to the ADCTR register and sets the ‘srst’ bit.
d) There is a hardware reset.
2. If a host interrupt is asserted then it will be cleared by writing to this register.
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
7.5.3.8ITRG
In the ATAPI mode writing to this register generates a PC host interrupt on the INT pin. This interrupt is cleared when
the PC host reads the ATAPI status register (ASTAT) or writes to the ATAPI command register.
7.5.3.9ADRADR
This is the ATAPI drive address register for the SAA7381. This uses an obsolete register address (CS1 → DA0 = 10111)
from the ATAPI register map in the ATAPI specification. Bit 7 of this register is high-impedance when read by the host.
After a reset the ATAPI registers are all cleared except for the ASTAT register which has its ‘bsy’ bit set.
1997 Aug 1239
Page 40
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.3.10ASAMT
This is the ATAPI SAM TAG byte register.
7.5.3.11DTCTR
The DTCTR register controls data transfer flows in the host interface block. When reset this register is cleared to all zeros
except for the ‘rdrv’ bit which is set to logic 1. This means the SAA7381 will be then set to device 1 (slave) after a reset.
There are several possible data transfers through the SAA7381 host interface block and these are selected using the
‘trant’ bits. The transfers are described in Table 64.
Table 62 DTCTR: address FF8BH (see Tables 63 and 64)
ACCESS
RWreserveddmamodedmaultra_dmardrvtrant
Table 63 Description of the DTCTR register bits
BITNAMEDESCRIPTION
6dmamode DMA mode select; controls whether the DMA transfer is single word or multi-word
5dmathis bit is used to configure the SAA7381 hardware for either a DMA type transfer or a PIO
4ultra_dma this bit configures the SAA7381 for ultra DMA transfers. The SAA7381 must also be
3rdrvthis bit selects the device number: the polarity of this bit must be the same as the ‘drv’ bit in
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
dmamode = 1; host Interface DMA data transfers are multi-word
dmamode = 0; host Interface DMA data transfers single word
type transfer
dma = 1; configures the SAA7381 for a DMA transfer
dma = 0; configures the SAA7381 for a PIO type transfer
configured for multi-word DMA transfers for correct operation of ultra DMA i.e. bits 5 and 6
of the DTCTR register must also be set to logic 1 to select ultra DMA
ultra_dma = 1; configure the SAA7381 for ultra DMA (must be select dma = 1 and
dmamode = 1)
ultra_dma = 0; default for non-ultra DMA transfers
the ATAPI drive select register (ADRSEL) in order for the SAA7381 to communicate with
the PC host interface. After reset the microcontroller should configure the ‘rdrv’ bit as no
default may be assumed.
rdrv = 1; the SAA7381 is device 1 i.e slave
rdrv = 0; the SAA7381 is device 0 i.e master
1997 Aug 1240
Page 41
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 64 Description of the ‘trant’ bits
trant
(bits 2 to 0)
000−host65535
001hostmemory65535
010microcontrollermemory−redundant
011memorymicrocontroller−redundant
100hostmicrocontroller12PIO; DBC not used, always 12 bytes
101microcontrollerhost12DMA and PIO
11Xreservedreservedreserved−
FROMTO
MAXIMUM
BYTES
(ATAPI, PIO)
(ATAPI, PIO)
NOTES
maximum bytes for auto sequence DMA is
4.3 Gbytes
maximum bytes for auto sequence DMA is
4.3 Gbytes
7.5.3.12ADRSEL
This is the ATAPI drive select register.
Table 65 ADRSEL: address FF8CH
ACCESS
RW111drv
Note
1. Bit 4 of this register is the ‘drv’ bit. When this bit is the same as the ‘rdrv’ bit in the DTCTR register then the SAA7381
will be the selected ATAPI drive and will respond to commands and produce interrupts. The host interrupt pin will
also be enabled when the SAA7381 is the selected drive.
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
(1)
−−−−
7.5.3.13AINTR
This is the ATAPI interrupt reason register. See the ATAPI specification for a detailed description of these register bits.
Table 66 AINTR: address FF8DH
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
RW−−−−−release iocod
7.5.3.14AERR
This is the ATAPI error register. See the ATAPI specification for a detailed description of these register bits.
Table 67 AERR: address FF8EH
ACCESS
RWsense keymcrabrteom−
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
1997 Aug 1241
Page 42
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.3.15ACMD
This is the ATAPI command register. This register is read-only to the microcontroller and write-only to the host. The host
should only write to this register when the ‘bsy’ and ‘drq’ flags are both zero (see ASTAT register; Section 7.5.3.7).
A ‘cmdi’ interrupt is generated when:
• The host writes to this register while the SAA7381 is the selected drive (the ‘drv’ bit in register ADRSEL is equal to the
‘rdrv’ bit in register DTCTR)
• The host writes the execute drive diagnostic command (90H) to this register.
The microcontroller interrupt (cmdi) is cleared by the SAA7381 when the ACMD register is read by the microcontroller.
7.5.3.16ADCTR
This is the ATAPI device control register.
Table 68 ADCTR: address FF90H
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
Rreserved1srst
(1)
nien
(2)
0
Notes
1. Setting the ‘srst’ bit causes a ‘srsti’ interrupt and the ‘bsy’ bit to be set.
2. Bit ‘nien’ is used to enable or disable the host interrupt. When ‘nien’ is logic 0 and the drive is selected then the host
interrupt pin will be enabled. If ‘nien’ is logic 1 or the drive is not selected then the host interrupt pin will be in a
high-impedance state.
7.5.3.17AFEAT
This is the ATAPI features register. See the ATAPI specification for a detailed description of these register bits.
Table 69 AFEAT: address FF91H
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
R−−−−−−overlapdma
7.5.3.18IFSTAT
Table 70 IFSTAT: address FF92H (note 1); see Table 71
ACCESS
BIT 7BIT 6BIT 5BIT 4BIT 3
(2)
BIT 2BIT 1
(2)
BIT 0
(2)
RWcmdidteidrqiultra_stopdtbsysrstireset08a0comp/
crc_error
Notes
1. All interrupts may be negated by writing a logic 1 to their associated IFSTAT locations.
2. These bits are flags which do not generate interrupts.
1997 Aug 1242
Page 43
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 71 Description of the IFSTAT register bits
BITNAMEDESCRIPTION
7
6
5
4
3
2
1
0
cmdiCommand interrupt: in the ATAPI mode this bit is asserted when the PC host has written to
the ATAPI command register (see ACMD register; Section 7.5.3.15) and the drive is
selected. It is also asserted when the host writes the execute drive diagnostic command
(90H) to the ATAPI command register, regardless of whether the drive is selected. It is
negated when the microcontroller reads the ACMD register or writes logic 1 to ‘cmdi’.
dteiData transfer end interrupt: this bit is asserted at the end of data transfer. It is negated
when the microcontroller writes to the DTACK register or writes logic 1 to ‘dtei’. If the ATAPI
mode is selected this bit is also asserted when a packet command has been received and
after a microcontroller memory transfer. The interrupt generated by this bit can be masked
by the auto sequencer.
drqiAuto sequencer data request interrupt: if enabled by ‘drqien’ (IFCTRL; see Table 57), this
bit is asserted after every load of the packet size store into DBCH/DBCL during an ‘autodrq’
DMA sequence. ‘drqi’ is cleared along with its associated interrupt by the microcontroller
writing logic 1 to ‘drqi’.
ultra_stopUltra ATA stop before end of transfer interrupt: if enabled by ‘ultra_stopien’ (IFCTRL; see
Table 57), this bit is asserted if the host stops an ultra ATA data transfer before the
TRANSFER COUNTER has reached zero, when ‘autodrq’ is selected, or before the
DBCH/DBCL task file registers reach zero when ‘autodrq’ is not selected. ‘ultra_stop’ is
cleared along with its associated interrupt by the microcontroller writing logic 1 to
‘ultra_stop’ (IFSTAT; see Table 70).
dtbsyData transfer busy: this bit indicates if a data transfer is taking place. It is asserted by
writing to the DTRG register and is negated at the end of the transfer.
srstiInterrupt/status transfer busy: in ATAPI mode this bit is asserted when the host writes to the
ATAPI device control register and sets the ‘srsti’ bit. It is negated when the microcontroller
reads the ADCTR register or by writing a logic 1 to the ‘srst’ (ADCTR; see Table 68).
It should be noted that if this bit is asserted in the ATAPI mode then the microcontroller
interrupt will also be asserted. The ‘srsti’ interrupt cannot be disabled.
reset08The reset command 08 has been received: this bit indicates that the last command
received was the 08 reset command. Reading the command register ACMD will negate this
bit and its associated interrupt.
a0comp/
crc_error
The A0 command auto sequence is completed or ultra ATA CRC error flag: this bit
indicates that A0 command auto sequence is completed i.e. the correct A0 command has
been read and the host interface has been configured to receive the 12 byte packet. This
bit does generate an interrupt but should be used in conjunction with the ‘dtei’ interrupt.
A microcontroller write to DTACK will negate the ‘a0comp’ bit.
After an ultra DMA data transfer (read from the SAA7381 or write to the SAA7381) this bit
may be used in conjunction with the DTEI interrupt to indicate data integrity. If the
‘crc_error’ bit = 0 then the last data transfer was corrupt. Again writing to DTACK will
negate this bit.
7.5.3.19APCMD
During the ATAPI mode this register is used to read the packet command sent by the host. The packet command can
only be received if the appropriate mode has been selected (see DTCTR register; Table 62) and a data transfer has been
started (see DTRG register; see Table 56).
1997 Aug 1243
Page 44
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.3.20HICONF0
This is the host interface configuration register 0
Table 72 HICONF0: address FF94H
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
RWultractrl2 to ultractrl0dynhosthipriorhrequestshadow
Table 73 Description of the HICONF0 register bits
BITNAMEDESCRIPTION
7 to 5ultractrl2 to ultractrl0ultra control bits (3 to 1), see Section 7.5.3.22
4dynhosthipriordynhosthiprior (1)
0 = N = Dynamic Host High Priority asserted when FIFO is1⁄3full
2
⁄3full
1
⁄2full
1 = N = Dynamic Host High Priority asserted when FIFO is
3dynhosthipriordynhosthiprior (0)
0 = (default) dynamic host high priority off
1 = dynamic host high priority on when FIFO bytes, N, off when > N
2 and 1hrequesthrequest = 00; (default) assert host request when FIFO
hrequest = 01; assert host request when FIFO
hrequest = 10; assert host request when FIFO
7dmaenDMA suspend: this bit controls whether DMA transfers in generic mode are suspended
dmaen = 1; host Interface DMA data transfers in generic can be temporarily interrupted
dmaen = 0; host Interface DMA data transfers in generic mode cannot be suspended
6shhpbitthis bit allows statistical host high priority to be turned off
shhpbit = 0; (default) statistical host high priority turned on
shhpbit = 1; statistical host high priority turned off
5udmaoffthis bit allows ‘udma’ to be turned off at the end of a transfer
udmaoff = 0; (default) switch off the ‘ultra_ata’ bit in the DTCTR register
udmaoff = 1; do nothing
4flushfifoFlush 12-byte command FIFO: writing a logic 1 to this bit will ‘flush’ clear the command
FIFO pointer to zero. Clearing the pointer is required if a spurious command is received
while the FIFO is being loaded and is also used to ensure a 12-byte command read by the
auto sequencer.
flushfifo = 1; writing a logic 1 clears the FIFO pointer to zero
flushfifo = 0; do nothing
2unmaskdtei Unmask data transfer end interrupt during ‘autodrq’ sequence: this bit will disable the auto
sequencer masking of the ‘dtei’ interrupts during the ‘autodrq’ sequence. The ‘dtei’, bit 6 of
the IFSTAT register is not effected by ‘unmaskdtei’. If ‘unmaskdtei’ is asserted the
sequencer on detecting the next ‘dtei’ interrupt, will set the ‘bsy’ flag, negate the ‘drq’ flag
and suspend operation. The microcontroller may then reconfigure the host interface
before negating unmaskdtei bit. When ‘unmaskdtei’ is negated the sequencer will negate
the ‘dtei’ interrupt and operate as normal.
unmaskdtei = 1; disable ‘autodrq’ sequencer masking of ‘dtei’ interrupts and suspend the
sequence operation on next ‘dtei’ interrupt
unmaskdtei = 0; no effect, or restart ‘autodrq’ sequencer operation
1clear_regClear auto sequencer transfer counter and packet size store to zero: this bit will clear the
transfer counter and packet size store to zero if a logic 1 is written to it. After the write
operation the registers operate as normal and the ‘clear_reg’ bit will have no effect unless
written to again.
clear_reg = 1; clears to zero transfer counter and packet size store
clear_reg = 0; no effect
0ultractrl3ultra control bit 3; see Section 7.5.3.22
1997 Aug 1245
Page 46
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.3.22Description of the ultra control bits
The ‘ultractrl’ register bits can be used to add system clock
cycles to various timing limits used in the host interface
ultra DMA transfer engine.
This enables the SAA7381 to meet ultra DMA Mode 0
timings when the SAA7381 system clock is higher than
33.8688 MHz.
When the SAA7381 system clock is 33.8688 MHz,
maximum data transfer rates in ultra DMA Mode 0 are
achieved by setting ‘ultractrl’ to (0001).
For information on meeting Mode 0 timings for system
clocks other than 33.8688 MHz, please consult the user
manual or product support.
7autoa0automatic A0 packet transfer enable: this bit enables the sequencer to automatically
handle transfer of A0 packet bytes
autoa0 = 1; enables automatic transfer of A0 packet bytes
autoa0 = 0; disables automatic transfer of A0 packet bytes
6autodrqenables the auto data request sequence: this bit enables automatic handling of data
requests in PIO and DMA mode transfers
autodrq = 1; auto sequencer is enabled to perform auto data requests
autodrq = 0; auto sequencer is not enabled to perform auto data request
5compCompletion sequence for ‘autodrq’: this bit indicates that the auto completion sequence
should be performed after the last data transfer. This bit is only valid when the auto
sequencer is enabled.
comp = 1; enable the auto sequencer to automate the completion sequence
comp = 0; disable the auto completion sequence
4errorcompletion sequence with error status: this bit is copied to the check bit of the ASTAT
register just before an auto completion sequence is performed
error = 1; completion sequence with error status in check bit of ASTAT
error = 0; completion without error status
3sus_seqSuspend auto sequence: this bit suspends the auto sequencer for debug. If the
suspend state is a write to register state then the write operation will only take place
when after the ‘sus_seq’ bit is negated.
sus_seq = 1; suspend sequencer in present state
sus_seq = 0; normal sequence operation
2repeat autoa0Repeat the A0 packet reception auto sequence after an ‘autodrq’ or auto completion
sequence. This bit, if set before an ‘autodrq’ or auto completion sequence, will be
copied to ‘autoa0’ bit when the sequencer is reset at the end of an ‘autodrq’ or auto
completion sequence. This bit is negated at the end of the ‘autoA0’ sequence. Its effect
is to repeat the ‘autoA0’ sequence one more time only. It should be noted that this bit is
only available on RODAP and not the M1 data base.
repeat autoa0 = 1; repeat ‘autoA0’ sequencer after ‘autodrq’ or auto completion
repeat autoa0 = 0; no effect
1997 Aug 1246
Page 47
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.3.24SHSTAT
Table 78 SHSTAT: shadow status register; address FF97H
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
W0000000shcheck
Note
1. Shadow check bit: ‘shcheck’ is the ATAPI CHECK bit in the slave shadow status register for the non-existent drive.
a) 1 = Indicates an error has occurred.
b) 0 = Indicates no error has occurred.
1. Shadow abort bit: ‘shabrt’ is the ATAPI ‘abrt’ bit in the slave shadow error register for the non-existent drive. This bit
will be read by the host in shadow mode only.
a) 1 = indicates requested command has been aborted.
b) 0 = indicates requested command successful.
7pdiag outthis bit is the passed diagnostics signal output from the SAA7381
pdiag out = 1; writing logic 1 to this bit drives the PDIAG pin HIGH if the pad enable
(‘pdiag enable’ bit 6) is set to logic 1. It is recommended that this bit is written LOW and
that the enable bit is driven to emulate an open-collector output.
pdiag out = 0; writing logic 0 to this bit sets the
(‘pdiag enable’ bit 6) is set to logic 1
6pdiag pad
enable
5dasp outThis bit is the device active slave present signal output. This pin is open-collector with an
4dasp pad
enable
3pdiag inthis bit is the passed diagnostics signal input to the SAA7381, only valid if ‘pdiag enable’
2dasp inthis bit is the device active slave present signal input to the SAA7381, only valid if
0hosthipiThis bit allows the host interface to increase its priority rating when requesting a data
this bit default is an input to the SAA7381
pdiag pad enable = 1; writing logic 1 to this bit enables the
SAA7381
pdiag pad enable = 0; default on power-up allowing external control of the ‘pdiag in’ bit 3
external pull-up resistor. The
other device is driving this signal.
dasp out = 1; writing logic 1 to this bit drives
bit 4) is set to logic 1. It is recommended that this bit is written LOW and that the enable
bit is driven to emulate an open-collector output.
dasp out = 0; writing logic 0 to this bit sets the
enable bit 4) is set to logic 1
this bit default is an input to the SAA7381
dasp pad enable = 1; writing logic 1 to this bit enables the
SAA7381
dasp pad enable = 0; default on power-up allowing external control of the dasp in bit 2
bit 6 is set to logic 0 (default = 0)
‘dasp enable’ bit 4 is set to logic 0 (default = 0)
transfer between itself and the SAA7381 memory processor. With host high priority set the
host data transfer requests are given the second highest priority, the highest given to the
microcontroller.
hosthipi = 1; writing logic 1 increase host interface priority above all other data transfer
requests, bar the microcontroller.
hosthipi = 0; writing logic 0 to this bit (default setting) gives low priority to the host
interface data transfer request.
DASP bit must be set to logic 1 in order to determine if any
PDIAG pin LOW if the pad enable
PDIAG driver output of the
DASP HIGH if the pad enable (‘dasp enable’
DASP pin LOW if the pad enable (dasp
DASP driver output of the
1997 Aug 1248
Page 49
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.4TRANSFER COUNTER
The transfer counter register defines the total transfer length to be transferred to or from the host. This register is loaded
by the microcontroller and decrements synchronously with the DBCH/DBCL registers. The remainder packet size can be
loaded from the transfer counter into DBCH or DBCL when the transfer counter value becomes less than the packet size
store.
FFA0HRWbyte count (bits 7 to 0)
FFA1HRWbyte count (bits 15 to 8)
FFA2HRWbyte count (bits 23 to 16)
FFA3HRWbyte count (bits 31 to 24)
7.5.5P
The packet size store will be loaded from the DBCH or DBCL registers when the host writes to ACMD, provided the drive
is selected. It may also be updated by the microcontroller. The DBCH/DBCL registers will be auto loaded from the packet
size store on condition that the transfer counter contains an equal or greater value than that held in the packet size store.
FFA4HRWbyte count (bits 7 to 0)
FFA5HRWbyte count (bits 15 to 8)
7.5.6S
ACKET SIZE STORE
EQUENCER STATUS
7.5.6.1Sequencer status
For debugging the auto sequencer a sequencer status register has been provided (address FF6AH). A suspend
sequence bit has been provided (‘hiseq’ bit 4; see Table 76), which if asserted (logic 1) will suspend the auto sequencer
operation at its present state. The suspended state may then be read from the sequencer state register. If the sequencer
state is a write to a host interface registers state, then the sequencer will perform the write operation after the suspend
sequencer bit is negated by the microcontroller.
Table 84 Sequencer status: address FFA6H (note 1)
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
R−−sequencer state (bits 5 to 0)
Note
1. For an explanation of the sequence state number see the user guide. The user guide is available from product
support.
1997 Aug 1249
Page 50
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.6.2Auxiliary block memory processor registers
The registers given in Table 85 are located in the Aux
block of the and control the SAA7381 memory processor
buffer management. Transfer to/from the host is possible
as soon as the HOSTBYTECOUNT is non-zero, and the
HOSTCURSEGCNT is non-zero.
The ‘chan0’ and ‘chan1’ bits control the sequencing of
sub-block transfers. They indicate the number of
offset/length pairs to use for each block being transferred.
Normally only channels 0 and 1 are needed for Mode 2
host transfers. Channels 2 and 3 are available for special
READ-CD command options.
Table 85 Host interface DMA pointers
ADDRACCESSNAMEBIT 7BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0
An interrupt is associated with HOSTBYTECOUNT
becoming zero. This is an indication to the microcontroller
to reload the HOSTCURSEG and HOSTBYTECOUNT
registers for the next transfer.
The HOSTCURSEG, HOSTBYTEOFFSET and
HOSTBYTECOUNT registers indicate the address of the
next byte to be transferred to or from the host, in order that
the status of the interface may be read. The operation of
the HOSTBYTECOUNT and HOSTBYTEOFFSET
registers is given in Table 85.
1997 Aug 1250
Page 51
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 86 Decoding ‘chan’ bits
VALUEDESCRIPTION
00use extent 0
01use extent 0 to 1
10use extent 0 to 2
11use extent 0 to 3 (see also Section 7.5.8)
7.5.7H
OST INTERFACE DMA SPECIAL BITS
Table 87 Decoding bits 7 and 6 of HOSTSUBBLKOFFSETX-H (note 1)
BITNAMEVALUEDESCRIPTION
7autoform0unconditional transfer
1only transfer if previous Form bit matches bit 6
6form0match last Form bit = 0, perform this transfer if success else reload host registers
1match last Form bit = 1, perform this transfer if success else reload host registers
Note
1. The last Form bit is the LSB of the byte that is situated at offset 12 in the current segment pointed at by
HOSTCURSEG. This is the stored Form byte in the header.
7.5.8AUTOMATIC BLOCK POINTER RELOAD
PROGRAMMING
If either bit 6 or bit 7 are set in the HOSTRELOADFLAGS
register, then when the HOSTRELOADCOUNT register
becomes zero, the value of HOSTCURSEGCNT will be
copied from HOSTNEXTSEGCOUNT and
HOSTRELSEGMENT will be copied from
HOSTNEXTSEG.
This causes the host transfer process to continue looping
over the same region of memory in emulation of the
Chaucer and Sequioia devices.
At the same time one of the bits HOSTRELOADFLAGS
(bits 7 and 6) is reset on reload of the registers. The other
7.5.9DMA
The host interface is optimized for the normal read
commands, handling all data transfers or contiguous data
plus header requests automatically, with auto Form
detection in Mode 2.
If discontinuous data which requires more than
3 sub-block extents e.g. for READ-CD is required then it is
necessary to program the HOSTCURSEG,
HOSTBYTECOUNT and HOSTBYTEOFFSET for each
discontinuous part of each block that is to be transferred.
Writing the value 1 into the ‘hostblock’ will cause the
transfer to take place.
TRANSFER PROGRAMMING OF THE HOST
INTERFACE
bit retains its value. Therefore:
• Single auto-reload is allowed: HOSTRELOADFLAGS
(bits 7 and 6) = 1 0
• No auto-reload: HOSTRELOADFLAGS
(bits 7 and 6) = 0 0; pointer can be used as sub-block
extent 3
• Multiple auto-reload: HOSTRELOADFLAGS
(bits 7 and 6) = 0 1.
1997 Aug 1251
Page 52
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.10GENERIC INTERFACE OPERATION
Implementation of the generic interface with the
NCR 53CF92 in a multiplexed bus configuration is shown
in Fig.4. The host interface, after power-up, needs to be
configured for the SCSI controller by writing the value 3 to
the RESET register (address FF86H) for an 8-bit data
transfer configuration and the value 4 for a 16-bit data
transfer configuration. The NCR 53CF92 device is
configured by tying it’s mode pin to ground. In this mode
the NCR 53CF92 device expects from the microcontroller
a multiplexed address/data bus. Multiplexed address/data
bus is the only mode supported by the SAA7381.
handbook, full pagewidth
DMACK/DMARQ
DMARQ/DMACK
DA1/DBWR
DD0 to DD7
SAA7381
DA2/DBRD
CS0/SCSICS
8-bit DMA bus
The active LOW Chip Select (CS) signal from the
SAA7381 is generated by the host interface. There are
32 specific SCSI addresses in the SAA7381 memory map,
between location FFC0H and FFDFH. The CS pin will be
active LOW for addresses in this range. The standard
register set on the NCR 53CF92 contains 16 registers
which are accessed when the CS is true. The specific
register being accessed is determined by the states of the
RD and WR signals together with the address pins
A3 to A0.
DREQ
DACK
DBWR
DB7 to DB0
A0
NCR 53CF92
A1
A2/DBRD
A3/ALE
CS
8051
MICROCONTROLLER
8-bit address/data bus
Fig.4 Generic interface connection to NCR 53CF92 in multiplexed mode.
1997 Aug 1252
RD
WR
MODE
MGL175
Page 53
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.5.11DMA TRANSFERS IN GENERIC MODE
The host interface in generic mode will support two types
of DMA transfer to the NCR device, namely:
• Normal DMA mode
• Burst DMA mode.
Both of these modes are 8 bit DMA transfers. During data
transfers the microcontroller can suspend the DMA
transfer (via HICONF1 register ‘dmaen’ bit 7) under the
following conditions:
• An Interrupt received
• An abort received
• A register read required.
handbook, full pagewidth
DMARQ
DMACK
7.5.12NORMAL DMA MODE
In this mode the host Interface transfers data in single
bytes. This DMA mode is configured by setting ‘dmamode’
(DTCTR register bit 6) to zero, and DMA (DTCTR register
bit 5) to one. Data flow direction and byte counts are
configured the same as ATAPI DMA modes of data
transfer, but with command information being received via
the NCR SCSI controller registers external to the
SAA7381 operation. The data transfer takes place as long
as the DMA request signal DMARQ is true. The DMACK
signal is toggled by the host Interface for each byte
transferred as shown in Fig.5.
DBRD/
DBWR
MGK514
Fig.5 Generic interface normal DMA mode.
7.5.13BURST DMA MODE USING MULTIPLEXED BUS CONFIGURATION
In this mode the DMA data is available on the DMA bus when both, DBRD or DBWR and DMACK are true. DMACK
remains asserted throughout the transfer while DBRD toggles for each transfer as shown in Fig.6. To configure the host
interface the DMA mode and DMA bits (DTCTR bits 6 and 5) should be set to logic 1.
1997 Aug 1253
Page 54
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
DMARQ
DMACK
DBRD/
DBWR
Fig.6 Burst DMA mode using multiplexed bus configuration.
7.6Microcontroller interface
This section provides a brief introduction to the software
and hardware environment expected in a system using the
SAA7381 device. Because all of the SAA7381 registers
are randomly accessible, the processor controlling the
SAA7381 is able to use interrupts.
7.6.1K
ERNEL BASED FIRMWARE
It is recommended that the sub-CPU runs a multi-tasking
kernel to properly support the multiple ‘threads’ of
operation that are required of it in use. Therefore the
memory mapper specified in this document has the
concept of having 2 pages of memory for data. Then one
page of data space can be switched in to the memory map
for each thread as needed, while still keeping a fixed part
of the memory map for the interrupt service routines and
other fixed housekeeping code and data.
7.6.216-
BIT REGISTERS AUTOMATIC READ AND WRITE
All of the 16-bit registers provided in the SAA7381, are
used by writing the Most Significant Bit (MSB) first. These
registers are located in the address range FF20H to
FF6FH together with some 8-bit registers. To facilitate
‘snapshot’ reading or writing of the 16-bit register an 8-bit
holding register is provided to store the ‘spare’ byte of
data.
MGK515
The low byte is kept in a holding register and presented to
the sub-CPU when the low byte is requested. Even if the
sub-CPU is interrupted (and the holding register is then
stacked and replaced during the service routine) the 16-bit
read will be the value of the register at a single instance in
time.
Similarly for writing, the high byte is held in the holding
register to be written later to the 16-bit register at the same
time as the low byte is written to the SAA7381. Again the
holding register must be saved during an Interrupt Service
Routine (ISR) if the ISR itself is likely to cause any 16-bit
reads or writes to take place. It should be noted that any
ISR, which requires access to a 16-bit or 8-bit register in
the address range FF20H to FF6FH, will overwrite the
holding register and therefore its contents must be stacked
before the interrupt is serviced. Furthermore, there is only
one holding register that may be accessed both for reading
and writing. In this way the interrupt routine can easily save
data that was stored in the holding register before it was
written.
A single location (TEMP_DATA, register FF6FH) is used
as the location to read the value of the holding register,
regardless of which address was used in the original read
or write process. The IRS stacking process of the holding
register is illustrated in Fig.8.
This is implemented in such a way that a 16-bit read
consists of a sample of the value of the register at the
instant that the high byte was read from that register.
1997 Aug 1254
Page 55
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
address bus
data bus
0
MUX
1
read
This is intended for big-endian high byte then low byte accesses to 16-bit register space.
16-BIT
REGISTER FILE
A1 to An
D8 to D15
D0 to D7
Q8 to Q15
Q0 to Q7
8
8
8-BIT
HOLDING
REGISTER
(FF6F)
loaded when:
(A0 = 0 and write) or (A0 = 0 and read)
Fig.7 Holding register used in 16-bit access via 8-bit bus.
A0
8
0
MUX
1
MGK509
handbook, halfpage
program flow
read/write high1
read/write low1
Fig.8 Stacking 8-bit holding register during interrupt service.
1997 Aug 1255
interrupt
save register
read/write high2
read/write low2
restore register
MGK510
Page 56
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.78051 CPU and memory management functions
The 8051 CPU and memory management functions are as
follows:
• Device registers are memory mapped for faster direct
access to the chip
• Provides direct access from sub-CPU to buffer RAM to
support scratchpad accesses; this eliminates the need
for extra RAM chips in the system
• Address space reserved for generic host interface
control and status pass-through (it is shared with ATAPI
register space; see Section 7.5)
• Interfaces to 8051 multiplexed address and data bus
• Two dynamically controllable RAM access modes allow
trade-off between accessible scratchpad RAM size and
RAM access time.
7.7.1S
UB-CPU BUS ACCESS TIMING
The fast and slow RAM access timing diagrams are
illustrated in Figs 10 and 9. It should be noted that fast
RAM access is not recommended due to its negative effect
on the RAM bandwidth and the overall system
performance.
In the fast RAM access mode all external accesses below
C000 are expected to be program fetches. A DRAM
access cycle is not begun. Above C000, the RAM cycle
begins on the falling edge of ALE hence the number of
8051 wait states can be reduced. This is not however
recommended.
The disadvantage is, that the RAM access cycle is started
regardless of whether it will be needed. This has the effect
of aborting any other on-going use of the buffer memory
and reducing the available bandwidth.
Consequently, the number of wait states on accessing
RAM must be greater. In return, more RAM is accessible.
In the slow RAM access mode the RAM access cycle
starts on the falling edge of
RD or WR, if PSEN is HIGH,
this being the first time in the 8051 external memory
access cycle that it is possible to determine that an XDATA
access is in fact being made.
This access mode has a lower impact on the buffer RAM
memory bandwidth as only accesses that are needed are
made. The two modes are under control of a register bit,
and it is possible to switch between them at any time.
handbook, full pagewidth
sub-CPU clock
sub-CPU ALE
XDA8
XDA15
RD/WR
(1) SAA7381 accesses RAM and stops clock until complete.
(2) RD LOW or WR LOW indicates access actually taking place.
(3) 8051 microcontroller continues.
(4) Address decoded for possible access RAM.
XDA0 to XDA7, XDA8 to XDA15 latchedXDD0 to XDD7
to
Fig.9 Slow RAM access mode timing.
(1)
(2)
(3)
MGK516
(4)
1997 Aug 1256
Page 57
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
sub-CPU clock
sub-CPU ALE
XDA8
XDA15
RD/WR
(1) Address decoded in upper 16 kbytes indicates access to RAM or SAA7381 registers, RAM access begins, SAA7381 accesses RAM, stops clock
only if SAA7381 asserts
(2) 8051 microcontroller continues.
XDA0 to XDA7, XDA8 to XDA15 latchedXDD0 to XDD7
to
RD or WR before access complete.
(1)
(2)
MGK517
Fig.10 Fast RAM access mode timing.
7.7.2BUFFER MEMORY ORGANISATION
Memory is mapped as a 12-bit block number and a 12-bit
offset into that block. The block oriented memory structure
permits the use of 16-bit pointers in software, minimising
the overhead of accessing memory. The address can be
found from the following equation:
addressblock_number2560 offset+×=
The sub-CPU sees the SAA7381 as a memory mapped
peripheral, with control and status registers appearing in
the highest 256 bytes of the external address space
(PDATA space).
The phrase (PDATA space) is meant to imply that the code
will access registers most efficiently if the PDATA
The lowest 56 kbytes of the 8051 external address data
space is mappable as two windows into the memory of
52 kbytes and 4 kbytes, on any user-specified 256 byte
boundary within the RAM. This is usable as scratchpad
RAM.
The two pages permits the paging of process context
information for use with a multi-tasking kernel, while still
keeping some global variables.
The next 7.5 kbytes is mapped as a window into memory
starting at a user-specified block number. This is usable for
accessing block data, subcode information, error corrector
status and block headers.
The 64 kbytes memory mapping is shown in Fig.11.
(8051 port P2) pointer is set to point at the register space
of the SAA7381. If the PDATA space is better used as
context switching space then it can be used for that
purpose.
All registers and RAM are accessible in the XDATA space
at all times, the PDATA is just a movable 256 byte window
with faster access into XDATA.
1997 Aug 1257
Page 58
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
In fast RAM mode (see ‘CONF_8051’ bit 7) the lower 48 kbytes of RAM space is not accessible as it is reserved for external ROM.
0XFF00
0XE000
0XD000
0XC000
0X0000
subseg 2
subseg 1
subseg 0
subpage 2
subpage 1
MGK511
7.5 kbits window into 3 CD-ROM blocks
base address is moved in terms of block number
4 kbits always accessible, base address movable in 256 byte pages
top 4 kbits always visible
bottom 48 kbits not usable in fast RAM mode
Fig.11 Memory mapping of the SAA7381 registers into 64 kbytes sub-CPU address space.
Table 88 The SAA7381 memory map
ADDRESS
SEGMENT SIZE
(BYTES)
USED FORADDRESS FUNCTION
FFCOH to FFFFH64the SAA7381s dead spacenone; note 1
FF00H to FFBFH192the SAA7381 register access, debug write
none; notes 2 and 3
to DRAM
E000H to FEFFH7936segments in DRAMnote 4
D000H to DFFFH4096subpage 2 in DRAMnote 5
C000H to CFFFH4096subpage 1 in DRAMnote 6
0000H to BFFFH49152subpage 1 in DRAMnotes 1 and 6
Notes
1. If the SAA7381 is addressed in this area it will not access the DRAM and the data output of the sub-CPU interface
to the microcontroller is disabled. If the SAA7381 host interface has been configured for generic mode and the
address access from FFC0H to FFDFH, a chip select signal is asserted ‘zero’ on the output pin XDA1.
2. CPU address (bits 23 to 8) = 0. CPU address (bits 7 to 0) = address (bits 7 to 0).
3. Read in this segment is always from internal the SAA7381 registers. Write is to internal the SAA7381 registers and,
optionally, also to DRAM if debug is set (conf_8051, bit 1 = 1).
4. CPU address (bits 8 to 0) = address (bits 8 to 0). CPU address (bits 23 to 9) = subseg 1 (bits 12 to 0) + subseg 1
(12 to 0) × 4 + address (bits 12 to 9).
5. CPU address (bits 9 to 0) = address (bits 9 to 0). CPU address (bits 23 to 10) = subseg 2
(bits 15 to 2) + address (bits 11 and 10).
6. CPU address (bits 9 to 0) = address (bits 9 to 0). CPU address (bits 23 to 10) = subseg 1
(bits 15 to 2) + address (bits 15 to 10).
1997 Aug 1258
Page 59
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.7.3SUBPAGE
The lowest 52 kbytes (0X000H to 0XCFFFH) of the external data memory is mapped to SUBPAGE1. If the user requires
less RAM than is provided here (up to 52 kbytes), the 1024 byte granularity of positioning the offsets permits the pages
to be overlapped. In the fast RAM access mode, the lowest 48 kbytes are not accessible as they are assumed to be ROM
space.
The next 4 kbytes (0XD000H to 0XDFFFH) of the external data memory is always mapped to SUBPAGE2, and is always
available.
The sub-CPU may access three adjacent segments of data offset from the base segment pointed to by ‘subseg’. These
are mapped as a contiguous 7.5 kbytes block at the top of memory from 0XE000 to 0XF800.
The buffer address is formed using the following equation:
Buffer addresssubseg down to 0()2560 sub-CPU (a12 down to 0)+×=
This permits the writing of headers and looking at subcode information which may span more than one segment. Linked
lists in the ‘spare’ space at the end of a segment may be more easily manipulated if the segment and its neighbours are
visible to the sub-CPU in a consistent manner.
It is also possible to indirectly access any part of RAM by using the block copy registers to move the data to and from
the sub-CPU subpages.
7.7.3.2Sub-CPU segment page restriction
It should be noted that the SAA7381 device does not have the concept of a defined upper limit on the segment addressed
block. Hence the segment page is always 3 contiguous segments of RAM, even when near or at the top of accessible
RAM or at the top of the firmware defined data input buffer. In this case 1 or 2 of the blocks accessed will be beyond the
buffer.
The external memory interface is designed to operate with up to 128 Mbits hyper-page 33 MHz DRAM (EDO RAM) It is
also designed to operate with fast-page DRAM giving a 17.5 Mbyte/s burst transfer rate. Figures 13 and 14 illustrate the
timing diagram for fast-page mode.
It should be noted that during the power-on reset cycle it is necessary to pull the XDATA bus to all zeros to configure the
SAA7381 for use with the 8051 microcontroller.
1997 Aug 1259
Page 60
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.8.1DRAM INTERFACE CONFIGURATION REGISTER
Table 91 DRAM_CONFIG: address FF6AH (see Table 92)
ACCESSBIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
W−−−feature 4feature 3feature 2feature 1feature 0
Table 92 Description of the DRAM interface features
1XXXXrefresh every 511 system clock cycles
X1XXXminimum
X0XXXminimum
XX10X1 Mbit × 4 DRAM used
XX11X4 Mbit × 4 DRAM used
XX0XX512 kbits × 8, 1 Mbit × 8, 2 Mbits × 8, 4 Mbits × 8,
8 Mbits × 8 or 16 Mbits × 8 DRAM used
XXXX0use fast-page mode device
XXXX1use hyper-page mode device
RAS LOW is 2 clock cycles
RAS LOW is 3 clock cycles
7.9UART for communication with CD engine
The following are required for communication with the CD
engine:
• Clock prescaler for selectable baud rate
• Synchronous slave peripheral interface
• Asynchronous UART
• DMA to reduce sub-CPU loading in SPI mode
• Interrupt options available.
7.9.1UART
The basic engine interface implements both a
synchronous peripheral interface and an asynchronous
high-speed serial interface. The same registers are shared
between the functions involved. Transmitted and received
data in asynchronous mode is sent or received with parity
bits in 8-bit, one parity bit, one STOP bit format.
The registers that are implemented are described below.
Two 16-bit DMA pointers (SPI_RX_OFF and
SPI_TX_OFF) are provided so that the interface may be
used in a DMA mode. As a byte is transferred to or from
the UART registers, it is possible to copy it into a part of the
AUXSEG RAM (16-bit register AUXSEGMENT-H or
AUXSEGMENT-L) in the SAA7381s buffer memory.
The pointers auto-increment and wrap within the region
assigned, so if the user wishes the data to appear in the
BASIC ENGINE INTERFACE
same place in the buffer for each DMA transfer it will be
necessary to reload these pointers before re-enabling
DMA for the data transfer.
DMA operation can be independently on for the transmit
and receive channels.
To enable the DMA receive channel the
UART_DMA_CTRL bit 7 must be set to logic 1. When the
receive DMA channel is active the sub-CPU cannot read
the receive register (RXDATA address FF77H) any more
but the SAA7381 will automatically copy the contents of
the RXDATA register to the address pointed at by the
SPI_RX_OFFSET pointer if it is full, increment the
SPI_RX_OFFSET pointer and reset the ‘rvbfull’ bit.
The SPI offset registers are available in both synchronous
and asynchronous modes and not just for SPI.
The SPI_RX_OFFSET register may be read to determine
how many bytes have been received.
The polarity of the SPI clock is selectable from the
UARTCOM register (see Table 94).
To enable the DMA transmit channel the
UART_DMA_CTRL bit 6 must be set to logic 1 and, at the
same time, bits 5 to 0 (‘txdmacount’) must be greater than
zero. When the transmit channel is active the sub-CPU
can write to the transmit register (TXDATA
address FF77H), however, the SAA7381 will automatically
perform the following operation.
1997 Aug 1260
Page 61
1997 Aug 1261
If (transmit register empty)
SPI_TX_OFFSETSPI_TX_OFFSET1+=
TRANSMITREGRAM [AUXSEGMENT 2560 SPI_TX_OFFSET]+×=
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
uart_dma_ctrl (5 : 0)uart_dma_ctrl (5 : 0) 1–=
end if;
Transmission will automatically stop when the ‘uart_dma_ctrl’ (bits 5 to 0) (the ‘txdmacount’) has incremented to zero. This condition will produce the
interrupt.
Data transmission rates are selectable by writing a value n(0 to 255) to the UART_PRE_SCALER register. The baud rate for each mode can then be
calculated as follows:
The crystal oscillator is a conventional 2-pin inverting design operating from 8 to 35 MHz; this oscillator is also capable
of operating with a 33.8 MHz ceramic resonator. It is capable of oscillating with both fundamental and 3rd-overtone mode
crystals. External components should be used to suppress the fundamental output of the 3rd-overtone types as shown
in Fig.12. When operating with lower frequency crystals, Rs must be greater than 0 Ω to avoid overdriving the crystal.
handbook, halfpage
CROUTCRIN
3.3 µH
1 nF10 pF10 pF
SAA7381
oscillator
Rs (0 Ω)
34 MHz
100 kΩ
MGL178
Fig.12 Clock oscillator application circuit for 3rd-overtone crystal.
1997 Aug 1263
Page 64
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
7.10.2SUB-CPU CLOCK CONTROL REGISTER
This register controls the clocking of the sub-CPU and the generation of wait states, ensuring a low jitter in the clock while
allowing wait states.
Table 98 CONF_8051: address FF73H (see Table 99)
BIT 7BIT 6BIT 5BIT 4BIT 3BIT 2BIT 1BIT 0
modselwait2wait1wait0div2div1div0debug
Table 99 Description of the CONF_8051 register bits
BITNAMEVALUEDESCRIPTION
7modsel0wait state control
1
6 to 4wait2 to wait00000 wait states
0011 wait state
0102 wait states
0113 wait states
1004 wait states
1015 wait states
1106 wait states
1117 wait states
3 to 1div2 to div00008051 clock is sysclk; note 1
0018051 clock is sysclk/1.5; note 1
0108051 clock is sysclk/2
0118051 clock is sysclk/3
1008051 clock is sysclk/4
1XXundefined
0debug0−
1register writes are shadowed through into buffer RAM
Note
1. The clock pulse provided to the 8051 is equal to the HIGH period of sysclk for divide-by-1 and divide-by-1.5. For all
other division ratios the clock pulse HIGH time is equal to one cycle of sysclk.
1. Write operations to bit 6 of CLK_CON register may become unreliable once this bit has been written to with a logic 1.
1997 Aug 1264
SYSTEM CLOCK CONTROL REGISTERS
(1)
pllpwrpllena−−−−xtal1xtal0
Page 65
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 101 Description of the CLK_CON register bits
BITNAMEVALUEDESCRIPTIONf
7pllpwr0PLL is powered-down−default
1PLL is powered-up−−
6pllena0system clock source is CRIN−default
1system clock source is from clock multiplier−−
1 and 0xtal1 and
xtal0
Table 102 The relationship between the values of the
m bits and VCO frequency for a normalised
PLL frequency of 500 kHz; note 1
m6 to m0
(HEX)
023
044
085
116
227
448
099
1310
2611
4C12
1813
3114
6215
4516
0B17
1718
2E19
5D20
3A21
7522
6B23
5624
2D25
5B26
3627
6C28
00crystal is 8.4672 MHz; divide-by-16529.2−
01crystal is 11.289 MH; divide-by-22513.1−
10crystal is 16.9344 MHz; divide-by-32529.2default
11crystal is 33.8688 MHz; divide-by-64529.2−
FREQUENCY (MHz)
m6 to m0
(HEX)
5829
3030
6031
4132
0333
0634
0C35
1936
3337
6638
4D39
1A40
3541
6A42
5443
2944
5345
2746
4E47
1C48
3949
7350
6751
4F52
1E53
3D54
(kHz)NOTES
PLL
FREQUENCY (MHz)
1997 Aug 1265
Page 66
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
m6 to m0
(HEX)
7B55
7656
6D57
5A58
3459
6860
5061
2162
4263
0564
0A65
1566
2A67
5568
2B69
5770
2F71
5F72
3E73
7D74
7A75
7476
6977
5278
2579
4A80
1481
2882
5183
2384
4685
0D86
1B87
3788
6E89
5C90
3891
7192
6393
4794
FREQUENCY (MHz)
m6 to m0
(HEX)
0F95
1F96
3F97
7F98
7E99
7C100
78101
70102
61103
43104
07105
0E106
1D107
3B108
77109
6F110
5E111
3C112
79113
72114
65115
4B116
16117
2C118
59119
32120
64121
49122
12123
24124
48125
10126
20127
40128
Note
1. It should be noted that the mode bit (MSB high byte)
has not been included in the table. The oscillator
output frequency can be determined by dividing the
VCO frequency given in Table 102 according to the
mode bit described in Table 103.
FREQUENCY (MHz)
1997 Aug 1266
Page 67
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 103 Explanation of mode bit
MODE BITDIVISION RATIO
0divide the frequency from Table 102 by 4 to obtain ‘sysclk’ frequency
1divide the frequency from Table 102 by 2 to obtain ‘sysclk’ frequency
8LIMITING VALUES
In accordance with the Absolute Maximum Rating System (IEC 134)
SYMBOLPARAMETERMIN.MAX.UNIT
V
DDD(core)
V
DDD(pad)
V
DDA
V
i(max)
V
o
I
o
Ppower dissipation−400mW
T
stg
T
amb
core digital supply voltage−0.5+4.5V
periphery digital supply voltage−0.5+6.5V
analog supply voltage−0.5+4.6V
maximum voltage on any input−0.5V
DDD(pad)
+ 0.5V
output voltage on any output−0.5+6.5V
output current (continuous)−20mA
11.1External memory interface timing
Table 104 DRAM interface timing (fast-page mode); see Figs 13 and 14 and note 1
SYMBOLP ARAMETER
T
cy
t
ACC(CAS)
t
ACC(RAS)
t
RASH
t
RASL
t
h(RAS)
t
CASL
t
h(CAS)
t
d(CASH-RAS)
t
d(RAS-CAS)
t
d(RAS-CA)
t
su(RA)
t
h(RA)
t
su(CA)
t
h(CA)
t
h(CA-RASL)
t
l(CA-RAS)
t
h(R)
t
h(R-RAS)
t
su(W)
t
h(W)
t
WL
t
h(W-RAS)
t
l(W-CAS)
t
l(W-RAS)
t
su(DO)
t
h(DO)
t
h(DO-RAS)
read or write cycle period160−ns
access time from CAS−20ns
access time from RAS−−ns
RAS HIGH time70−ns
RAS LOW time8010000ns
RAS hold time20−ns
CAS LOW time2010000ns
CAS hold time80−ns
delay time CAS HIGH to RAS10−ns
RAS to CAS delay time25−ns
RAS to column address delay time20−ns
row address set-up time0−ns
row address hold time15−ns
column address set-up time0−ns
column address hold time20−ns
column address hold time from RAS LOW60−ns
column address to RAS lead time40−ns
read command hold time0−ns
read command hold time from RAS60−ns
write command set-up time0−ns
write command hold time15−ns
write command LOW time15−ns
write command hold time from RAS60−ns
write command to CAS lead time20−ns
write command to RAS lead time20−ns
data output set-up time0−ns
data output hold time15−ns
data output hold time from RAS60−ns
MIN.MAX.UNIT
Note
1. For further information regarding the DRAM timing please consult the device user manual or contact product support.
1997 Aug 1270
Page 71
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
XRAS
XCAS
XDA0
to
XDA13
XWR
t
su(RA)
t
RASL
t
h(CA-RASL)
t
t
d(RAS-CAS)
t
d(CASH-RAS)
t
d(RAS-CA)
t
h(RA)
ROWCOLUMN
t
su(W)
t
su(DO)
h(CAS)
t
h(CA)
t
su(CA)
t
WL
t
h(W-RAS)
t
h(DO-RAS)
T
cy
t
h(W)
t
l(W-RAS)
t
l(W-CAS)
t
h(DO)
t
h(RAS)
t
CASL
t
l(CA-RAS)
t
RASH
t
d(CASH-RAS)
XDD0 to XDD7
Fig.13 External DRAM write cycle timing for fast-page.
1997 Aug 1271
MGK518
Page 72
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
XRAS
XCAS
t
su(RA)
XDA0
to
XDA13
XWR
XDD0 to XDD7
t
RASL
t
h(CA-RASL)
t
t
d(RAS-CAS)
t
d(CASH-RAS)
t
d(RAS-CA)
t
h(RA)
ROWCOLUMN
t
ACC(RAS)
h(CAS)
t
h(CA)
t
su(CA)
T
cy
t
h(RAS)
t
l(CA-RAS)
t
ACC(CAS)
t
CASL
INPUT
t
RASH
t
d(CASH-RAS)
t
t
h(R-RAS)
h(R)
MGK519
Fig.14 External DRAM read cycle timing for fast-page.
1997 Aug 1272
Page 73
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
11.2Host interface timing
This section deals with the implemented timings of the SAA7381 host interface in both the ATAPI and generic interface
modes. The timings of the ATAPI PIO Mode 3 and Mode 4 are also taken into account.
Table 105 Basic AC characteristics, ATA bus
SYMBOLPARAMETERCONDITIONSMIN.MAX.UNIT
t
r
t
f
C
i
C
o
rise time for any signal on ATAPI interface10 to 90% of full signal amplitude
5−ns
with a total capacitive load of 100 pf
fall time for any signal on ATAPI interface10 to 90% of full signal amplitude
5−ns
with a total capacitive load of 100 pf
input capacitance for each host or device−25pf
output capacitance for each host or device−25pf
11.2.1H
OST INTERFACE ATAPI PIO AND DMA TIMING
This section deals with the implemented timings of the SAA7381 host interface in both the ATAPI and generic interface
modes. The timings of the ATAPI PIO Mode 3 and Mode 4 are also taken into account (see Table 105).
1997 Aug 1273
Page 74
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
11.2.2ATA BUS TIMING
The figures and timing characteristics detail the timing as specified in the ATA-3 documentation.
Table 106 Timing of PIO data transfer to and from device; see Fig.15
is the
minimum command recovery time or command inactive time. The actual cycle time equals the sum of the actual
command active time and the actual command inactive time. The three timing requirements of Tcy, t
t
rec(DIOR/DIOW)
t
rec(DIOR/DIOW)
shall be met. The minimum total cycle time requirements is greater than the sum of t
. This means a host implementation can lengthen either or both t
W(DIOR/DIOW)
or t
rec(DIOR/DIOW)
W(DIOR/DIOW)
W(DIOR/DIOW)
, and
and
to ensure
that Tcy is equal to or greater than the value reported in the devices identify drive data. A device implementation shall
support any legal host implementation.
2. This parameter specifies the time from the negation edge of DIOR to the time that the data bus is no longer driven
by the device (3-state).
3. The delay from the activation of DIOR or DIOW until the state of IORDY is first sampled. If IORDY is inactive then
the host shall wait until IORDY is active before the PIO cycle can be completed. If the device is not driving IORDY
negated at the t
su(IORDY)
applicable. If the device is driving IORDY negated at the time t
t
R(DAT-IORDY)
4. t
ass(A-IOCS16)
shall be met and t
and t
after the activation of DIOR or DIOW, then t
is not applicable.
su(DIOR)
rel(A-IOCS16)
apply only to Modes 0, 1 and 2. This signal is not valid for other modes.
su(DIOR)
su(IORDY)
shall be met and t
R(DAT-IORDY)
is not
after the activation of DIOR or DIOW, then
1997 Aug 1276
Page 77
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
address valid
DIOR/DIOW
write
DD0 to DD15
read
DD0 to DD15
IOCS16
IORDY
no wait
t
su(A-DIOR/DIOW)
t
ass(A-IOCS16)
T
cy
t
W(A-DIOR/DIOW)
t
su(DIOW)
t
su(DIOR)
t
su(IORDY)
t
rec(A-DIOR/DIOW)
t
h(DIOW)
t
h(DIOR)
t
z(DIOR)
t
h(DIOR/DIOW-A)
t
rel(A-IOCS16)
IORDY
ignoring glitch
IORDY
causing wait
Fig.15 ATA bus timing diagram.
1997 Aug 1277
t
R(DAT-IORDY)
t
W(IORDY)
MGK520
Page 78
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 107 Single word DMA timing; see Fig.16
SYMBOLPARAMETERCONDITIONSMIN.MAX.UNIT
T
cy
t
d(DMACK-DMARQ)
t
W(DIOR/DIOW)
t
ACC(DIOR)
t
h(DIOR)
t
su(DIOW)
t
h(DIOW)
t
su(DMACK-DIOR/DIOW)
t
h(DIOR/DIOW-DMACK)
t
su(DIOR)
cycle timeMode 0960−ns
Mode 1480−ns
Mode 2240−ns
DMACK to DMARQ delayMode 0−200ns
Mode 1−100ns
Mode 2−80ns
DIOR/DIOW pulse width
16-bit
Mode 0480−ns
Mode 1240−ns
Mode 2120−ns
DIOR data access timeMode 0−250ns
Mode 1−150ns
Mode 2−60ns
DIOR data hold timeMode 05−ns
Mode 15−ns
Mode 25−ns
DIOW data set-up timeMode 0250−ns
Mode 1100−ns
Mode 235−ns
DIOW data hold timeMode 050−ns
Mode 130−ns
Mode 220−ns
DMACK to DIOR/DIOW
set-up time
Mode 00−ns
Mode 10−ns
Mode 20−ns
DIOR/DIOW to DMACK
hold time
Mode 00−ns
Mode 10−ns
Mode 20−ns
DIOR set-up timeMode 0t
Mode 1t
Mode 2t
W(DIOR/DIOW)
W(DIOR/DIOW)
W(DIOR/DIOW)
− t
ACC(DIOR)
− t
ACC(DIOR)
− t
ACC(DIOR)
−ns
−ns
−ns
1997 Aug 1278
Page 79
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
DMARQ
DMACK
DIOR/DIOW
read DD0 to DD15
write DD0 to DD15
t
d(DMACK-DMARQ)
t
su(DMACK-DIOR/DIOW)
t
ACC(DIOR)
t
W(DIOR/DIOW)
t
su(DIOR)
t
su(DIOW)
T
cy
t
h(DIOR/DIOW-DMACK)
t
h(DIOR)
t
h(DIOW)
MGK521
Fig.16 ATA single word DMA timing.
1997 Aug 1279
Page 80
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
Table 108 Multi-word DMA timing; see Fig.17
SYMBOLPARAMETERCONDITIONSMIN.MAX.UNIT
T
cy
t
W(DIOR/DIOW)
t
ACC(DIOR)
t
h(DIOR)
t
su(DIOW)
t
h(DIOW)
t
su(DMACK-DIOR/DIOW)
t
h(DIOR/DIOW-DMACK)
t
Wneg(DIOR)
t
Wneg(DIOW)
t
d(DIOR-DMARQ)
cycle timenote 1
Mode 0480−ns
Mode 1150−ns
Mode 2120−ns
DIOR/DIOW pulse width 16-bitMode 0215−ns
Mode 180−ns
Mode 270−ns
DIOR data access timeMode 0−150ns
Mode 1−60ns
Mode 2−−ns
DIOR data hold timenote 2
Mode 05−ns
Mode 15−ns
Mode 25−ns
DIOW data set-up timeMode 0100−ns
Mode 130−ns
Mode 220−ns
DIOW data hold timeMode 020−ns
Mode 115−ns
Mode 210−ns
DMACK to DIOR/DIOW set-up timeMode 00−ns
Mode 10−ns
Mode 20−ns
DIOR/DIOW to DMACK hold timeMode 020−ns
Mode 15−ns
Mode 25−ns
DIOR negated pulse widthnote 1
Mode 050−ns
Mode 150−ns
Mode 225−ns
DIOW negated pulse widthnote 1
Mode 0215−ns
Mode 150−ns
Mode 225−ns
delay time from DIOR to DMARQMode 0−120ns
Mode 1−40ns
Mode 2−35ns
1997 Aug 1280
Page 81
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
SYMBOLPARAMETERCONDITIONSMIN.MAX.UNIT
t
d(DIOW-DMARQ)
t
d(DMACK-z)
Notes
1. Tcy is the minimum total cycle time, t
as appropriate) is the minimum command recovery time or command inactive time. The actual cycle time equals the
sum of the actual command active time and the actual command inactive time. The three timing requirements of Tcy,
t
W(DIOR/DIOW)
than the sum of t
or both t
W(DIOR/DIOW)
identify drive data. A device implementation shall support any legal host implementation.
2. The original ATA standard defined a maximum value for t
parameter has been renamed to t
device data signals are no longer driven by the device (3-state). The t
a multi-word DMA cycle, i.e., when DMACK is negated. The device may actively drive the Device Data signals, or
may 3-state the device data signals, while DMACK is active from the first time that DIOR is asserted until DMACK is
negated as long as t
delay time from DIOW to DMARQMode 0−40ns
Mode 1−40ns
Mode 2−35ns
delay time from DMACK to 3-statenote 2
Mode 0−20ns
Mode 1−25ns
Mode 2−25ns
is the minimum command active time, and t
Wneg(DIOR)
shall be met. The minimum total cycle time requirement, Tcy, is greater
or t
Wneg(DIOW)
. This means a host implementation can lengthen either
to ensure that Tcy is equal to the value reported in the devices
. The meaning of this value was not clear. This
h(DIOR)
and specifies the time from the negation edge of DMACK to the time the
d(DMACK-z)
parameter applies only at the end of
requirements are met.
and t
Wneg(DIOR)
W(DIOR/DIOW)
or t
Wneg(DIOR)
ACC(DIOR)
or t
Wneg(DIOW)
and t
and t
W(DIOR/DIOW)
Wneg(DIOR)
or t
Wneg(DIOW)
d(DMACK-z)
h(DIOR)
or t
Wneg(DIOW)
,
1997 Aug 1281
Page 82
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
handbook, full pagewidth
DMARQ
DMACK
DIOR/DIOW
read DD0 to DD15
write DD0 to DD15
(1)
t
ACC(DIOR)
t
su(DMACK-DIOR/DIOW)
t
W(DIOR/DIOW)
t
Wneg(DIOW)
t
Wneg(DIOR)
t
h(DIOR)
t
h(DIOW)
T
cy
t
d(DIOR-DMARQ)
t
h(DIOR/DIOW-DMACK)
t
su(DIOW)
t
d(DMACK-z)
MGK522
(1) This signal may be negated by the host to suspend the DMA transfer in progress. For multi-word DMA transfers, the device may negate DMARQ
within the t
Alternatively, if the device is able to continue the transfer of data, the device may leave DMARQ asserted and wait for the host to reassert
d(DIOR-DMARQ)
or t
d(DIOW-DMARQ)
specified time onceDMACK is asserted and reassert it again at a later time to resume the DMA operation.
Fig.17 Multi-word DMA timing.
1997 Aug 1282
DMACK.
Page 83
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
11.2.3ULTRA DMA OPERATION AND TIMING
Selection of ultra DMA is similar to multi-word DMA operation. Bits 5, 6 and 7 of the DTCTR register should all be set to
logic 1 and data byte counts and data flow selection does not change from ATAPI DMA operation.
The ‘ultra_stop’ interrupt (IFSTAT bit 4) when enabled by ‘ultra_stopien’ (IFCTRL bit 4) will interrupt the microcontroller
if the host stops a transfer before the required data has been transfer i.e. the data byte count has not reached zero.
A flag, ‘crc_error’ (IFSTAT bit 0) if asserted in conjunction with the ‘dtei’ interrupt (IFSTAT bit 6) will indicate to the
microcontroller that the last transfer of data was corrupt.
No changes of pin direction are required for ultra DMA, but the ATA description changes (see Table 109).
Table 109 Ultra DMA pin changes
ATA PIN NAME ULTRA DMA READ PIN NAME ULTRA DMA WRITE PIN NAMECOMMENT
IORDYsender strobeD_DMARDY
(device DMA ready)
DMARQDMARQDMARQsimilar to ATAPI DMA
DMACKDMACKDMACKsimilar to ATAPI DMA, but also
DIORSTOPsender strobestop can terminate the data
DIOWH_DMARDY (host DMA ready) STOPH_DMARDY can be used by to
D_DMARDY can be used to
pause transmission
used at the end of transmission
for the CRC strobe
transfer before all bytes have
been transferred; this action will
generate a microcontroller
interrupt
pause transmission
11.2.4U
LTRA DMA READ/WRITE TIMING
This section provides the timing diagrams for the ultra DMA protocol. The timing diagrams are shown in Figs 18 to 26.
The timing information is provided in Table 110.
Table 110 Timing parameter values; see Figs 18 to 26
SYMBOLPARAMETERCONDITIONSMIN.MAX.UNIT
T
cy
cycle time (from STROBE edge to STROBE
edge)
Mode 0117−ns
Mode 177−ns
Mode 257−ns
t
su(D)(RX)
data set-up time (at receiver)Mode 015−ns
Mode 110−ns
Mode 27−ns
t
h(D)(RX)
data hold time (at receiver)Mode 03−ns
Mode 13−ns
Mode 23−ns
t
su(DV)
data valid set-up time (at sender); time from data
bus being valid until STROBE edge
Mode 075−ns
Mode 148−ns
Mode 238−ns
1997 Aug 1283
Page 84
Philips SemiconductorsObjective specification
ATAPI CD-R block decoderSAA7381
SYMBOLPARAMETERCONDITIONSMIN.MAX.UNIT
t
h(DV)
t
li
t
li(min)
t
ui
t
(O-z)(max)
t
d(min)
t
env
t
res(STROBE-DMARDY)
t
(READY-STROBE)
t
(READY-PAUSE)
t
pu
t
(IORDY)(max)
t
su(ass/deass)
data valid hold time (at sender); time from
STROBE edge until data goes invalid
Mode 08−ns
Mode 18−ns
Mode 28−ns
limited interlock time; time allowed between an
action by one agent and the following action by
the other agent
Mode 00150ns
Mode 10150ns
Mode 20150ns
limited interlock time with minimumMode 020150ns
Mode 120150ns
Mode 220150ns
unlimited interlock timeMode 00−ns
Mode 10−ns
Mode 20−ns
maximum time allowed for outputs to 3-stateMode 0−10ns
Mode 1−10ns
Mode 2−10ns
minimum delay time for output drivers turning on
(from high-impedance)
Mode 020−ns
Mode 120−ns
Mode 220−ns
envelope time (all control signal transitions are
within the DACKb envelope by this time)
Mode 02070ns
Mode 12070ns
Mode 22070ns
STROBE-to-DMARDY response time to ensure
synchronous pause case (when receiver is
pausing)
READY-to-final-STROBE time (this long after
DMARDYb de-assertion, no more STROBE
edges may be sent)
READY-to-pause time: time until a receiver may
assume that the sender has paused after
de-asserting DMARDYb
pull-up time before allowing IORDY to go
high-impedance