Search
lxdream.org :: lxdream/src/drivers/cdrom/README.LIBEDC :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/drivers/cdrom/README.LIBEDC
changeset 1097:d4807997e450
prev644:ccae4bfa5f82
author nkeynes
date Sun Jan 31 18:35:06 2010 +1000 (10 years ago)
permissions -rw-r--r--
last change Refactor CDROM host support
- Completely separate GDROM hardware (in gdrom/gdrom.c) from generic CDROM
support (now in drivers/cdrom)
- Add concept of 'sector sources' that can be mixed and matched to create
cdrom discs (makes support of arbitrary disc types much simpler)
file annotate diff log raw
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/drivers/cdrom/README.LIBEDC Sun Jan 31 18:35:06 2010 +1000
1.3 @@ -0,0 +1,123 @@
1.4 +This describes the program as shipped with cdrkit, a spinoff from the
1.5 +cdrtools project. However, the cdrtools developers are no longer
1.6 +involved in the development of this spinoff and therefore shall not
1.7 +be made responsible for any problem caused by it. Do not try to get
1.8 +support for this program by contacting the original authors.
1.9 +
1.10 +This is a small description for the Reed-Solomon library intended for
1.11 +CD sector formatting.
1.12 +
1.13 +Basics:
1.14 +It is assumed that you have a basic knowledge of cd sector formats.
1.15 +
1.16 +The library can handle three types of sector data:
1.17 + data sectors,
1.18 + audio sectors, and
1.19 + sub channel r-w sectors
1.20 +
1.21 +Currently only encoding is implemented. Decoding and optionally
1.22 +error correction is planned for later.
1.23 +
1.24 +Stages:
1.25 +
1.26 +The process of sector formatting has several stages. Beginning with
1.27 +a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is
1.28 +built. This format can be read raw by SCSI MMC-2 and ATAPI drives and
1.29 +is accepted by cd burners. The additions are an optionally 32 bit CRC
1.30 +checksum and two layers of Reed-Solomon codes (called Reed-Solomon
1.31 +Product Code RSPC).
1.32 +This sector is then scrambled (exor'ed with a bitstream).
1.33 +The result is called F1 frames. Afterwards even and odd bytes are
1.34 +swapped, this is called F2 frames. The result is equivalent to an
1.35 +audio sector and is treated as such by the cd burner.
1.36 +So, if we wrote a series of sectors (F2 frames) into a CDR file and
1.37 +later burned them as 'audio', they would turn up as perfect data sectors.
1.38 +
1.39 +So, now we are at the level of audio sectors. Audio sectors get their
1.40 +own error correction data (called CIRC). Sector size goes up to
1.41 +3136 bytes (that is 4/3 times 2352 bytes). Furthermore different
1.42 +words get delayed differently and swap positions. The result is ready
1.43 +to be fed into the so-called EightFourteenModulator (when subchannels
1.44 +have been added).
1.45 +
1.46 +Now, only sub channels are missing. While the p and q sub
1.47 +channels have to be generated elsewhere, any supplied r-w subchannel
1.48 +user data is protected by two levels of error correction
1.49 +codes. This format is read by cd burners when burning cd+graphics.
1.50 +The cdimage is a sequence of sectors, each containing audio data and
1.51 +after that subchannel data.
1.52 +Similar to audio sectors delaying and permutation of words
1.53 +takes place. After that the cd burner would mix sub channel data with
1.54 +the formatted audio sectors to feed the EFModulator.
1.55 +
1.56 +NOTE: Most of the described stages need not to be done in order to
1.57 +prepare sectors for burning, since all cd burners do at least CIRC,
1.58 +delaying and swaps. For data sectors they also do scrambling and f2
1.59 +frame generation.
1.60 +
1.61 +Encoding routines:
1.62 +
1.63 +For data sectors
1.64 + int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);
1.65 +
1.66 + encodes data sectors. The returned data is __unscrambled__ and not in
1.67 + F2-frame format.
1.68 +
1.69 +Parameters are:
1.70 + inout pointer to an array of at least 2352 bytes.
1.71 + sectortype One of the MODE_* constants from ecc.h. This defines
1.72 + how to format the sector.
1.73 + address The logical address to be used in the header
1.74 + (150 = 0:2.0 MSF).
1.75 +
1.76 +NOTE: the data portion has be to aligned properly for performance
1.77 +reasons (see ecc.h for details). So, no moves are necessary here.
1.78 +
1.79 +Generating f2 frames to be used like audio sectors
1.80 + int scramble_L2(unsigned char *inout)
1.81 +
1.82 + generates f2 frames in place from sectors generated by do_encode_L2().
1.83 +
1.84 +Parameters are:
1.85 + inout pointer to an array of at least 2352 bytes.
1.86 +
1.87 +
1.88 +
1.89 +For sub channels
1.90 + int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],
1.91 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*
1.92 + PACKETS_PER_SUBCHANNELFRAME],
1.93 + int delay1, int permute);
1.94 +
1.95 + repack user data and add error correction data. P and q subchannels
1.96 +should be added later, since all bytes are in place then.
1.97 +
1.98 +Parameters are:
1.99 + in pointer to an array of at least 72 bytes. It contains
1.100 + the user data for one frame.
1.101 + out pointer to an array of at least 96 bytes. Here is
1.102 + output frame is placed.
1.103 + delay1 do low level delaying, when set to 1.
1.104 + permute do low level permutations, when set to 1.
1.105 +
1.106 +NOTE: Probably both options need either to be set on (1) or off (0) together.
1.107 +
1.108 +There is more, but that is seldomly used.
1.109 +
1.110 +Tests:
1.111 +The library is accompanied by small verify programs, that compare real
1.112 +raw sectors with the formatted results. They are also intended as demo
1.113 +applications (how to use the library). In order to be able to feed
1.114 +real raw sectors into them, the package read2448 is recommended/needed.
1.115 +You can only verify sector streams of one sector type, currently no mix.
1.116 +
1.117 +For more information have a look into ecc.h
1.118 +
1.119 +recommended Documents:
1.120 +Yellow Book or ISO 10149
1.121 +Appendix Red Book
1.122 +Red Book or IEC 908
1.123 +
1.124 +Source: libedc/README from cdrtools package
1.125 +Edited for cdrkit by Christian Fromme <kaner@strace.org>
1.126 +
.