revision 1097:d4807997e450
summary |
tree |
shortlog |
changelog |
graph |
changeset |
raw | bz2 | zip | gz changeset | 1097:d4807997e450 |
parent | 1096:3f8f4c5b9ef4 |
child | 1098:4f2750753a6c |
author | nkeynes |
date | Sun Jan 31 18:35:06 2010 +1000 (14 years ago) |
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)
- 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)
1.1 --- a/config.h.in Sun Jan 31 18:30:13 2010 +10001.2 +++ b/config.h.in Sun Jan 31 18:35:06 2010 +10001.3 @@ -16,7 +16,7 @@1.4 /* Enable SH4 statistics */1.5 #undef ENABLE_SH4STATS1.7 -/* Enable shared library support */1.8 +/* Enable shared-library plugins */1.9 #undef ENABLE_SHARED1.11 /* Enable IO tracing */1.12 @@ -85,6 +85,9 @@1.13 /* Define to 1 if you have the `z' library (-lz). */1.14 #undef HAVE_LIBZ1.16 +/* Using the linux native CDROM driver */1.17 +#undef HAVE_LINUX_CDROM1.18 +1.19 /* Have linux joystick support */1.20 #undef HAVE_LINUX_JOYSTICK
2.1 --- a/configure Sun Jan 31 18:30:13 2010 +10002.2 +++ b/configure Sun Jan 31 18:35:06 2010 +10002.3 @@ -11237,6 +11237,13 @@2.4 CDROM_NONE_FALSE=2.5 fi2.7 +if test "x$CDROM_DRIVER" = "xlinux"; then2.8 +2.9 +cat >>confdefs.h <<\_ACEOF2.10 +#define HAVE_LINUX_CDROM 12.11 +_ACEOF2.12 +2.13 +fi2.15 if test "${ac_cv_header_linux_joystick_h+set}" = set; then2.16 { $as_echo "$as_me:$LINENO: checking for linux/joystick.h" >&5
3.1 --- a/configure.in Sun Jan 31 18:30:13 2010 +10003.2 +++ b/configure.in Sun Jan 31 18:35:06 2010 +10003.3 @@ -357,6 +357,9 @@3.4 AM_CONDITIONAL(CDROM_LINUX, [test "x$CDROM_DRIVER" = "xlinux"])3.5 AM_CONDITIONAL(CDROM_OSX, [test "x$CDROM_DRIVER" = "xosx"])3.6 AM_CONDITIONAL(CDROM_NONE, [test "x$CDROM_DRIVER" = "x"])3.7 +if test "x$CDROM_DRIVER" = "xlinux"; then3.8 + AC_DEFINE([HAVE_LINUX_CDROM],1,[Using the linux native CDROM driver])3.9 +fi3.11 AC_CHECK_HEADER([linux/joystick.h], [3.12 HAVE_LINUX_JOYSTICK_H=yes
4.1 --- a/src/Makefile.am Sun Jan 31 18:30:13 2010 +10004.2 +++ b/src/Makefile.am Sun Jan 31 18:35:06 2010 +10004.3 @@ -45,10 +45,7 @@4.4 asic.c asic.h clock.h serial.h \4.5 syscall.c syscall.h bios.c dcload.c gdbserver.c \4.6 ioutil.c ioutil.h lxpaths.c lxpaths.h \4.7 - gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdimage.c \4.8 - gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c \4.9 - gdrom/edc_ecc.c gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \4.10 - gdrom/edc_l2sq.h gdrom/edc_scramble.h gdrom/gddriver.h \4.11 + gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdrom.c gdrom/gdrom.h \4.12 dreamcast.c dreamcast.h eventq.c eventq.h \4.13 sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c \4.14 sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \4.15 @@ -67,9 +64,15 @@4.16 loader.c loader.h elf.h bootstrap.c bootstrap.h util.c gdlist.c gdlist.h \4.17 vmu/vmuvol.c vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h \4.18 display.c display.h dckeysyms.h \4.19 - drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \4.20 + drivers/audio_null.c drivers/video_null.c \4.21 drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \4.22 drivers/serial_unix.c \4.23 + drivers/cdrom/cdrom.h drivers/cdrom/cdrom.c drivers/cdrom/drive.h \4.24 + drivers/cdrom/sector.h drivers/cdrom/sector.c drivers/cdrom/defs.h \4.25 + drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c \4.26 + drivers/cdrom/edc_ecc.c drivers/cdrom/ecc.h drivers/cdrom/drive.c \4.27 + drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \4.28 + drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \4.29 sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in \4.30 hotkeys.c hotkeys.h4.31 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@4.32 @@ -213,15 +216,15 @@4.33 endif # end shared/static control4.35 if CDROM_LINUX4.36 -lxdream_SOURCES += drivers/cd_linux.c4.37 +lxdream_SOURCES += drivers/cdrom/cd_linux.c4.38 endif4.40 if CDROM_OSX4.41 -lxdream_SOURCES += drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h4.42 +lxdream_SOURCES += drivers/cdrom/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h4.43 endif4.45 if CDROM_NONE4.46 -lxdream_SOURCES += drivers/cd_none.c4.47 +lxdream_SOURCES += drivers/cdrom/cd_none.c4.48 endif4.50 if JOY_LINUX
5.1 --- a/src/Makefile.in Sun Jan 31 18:30:13 2010 +10005.2 +++ b/src/Makefile.in Sun Jan 31 18:35:06 2010 +10005.3 @@ -84,9 +84,9 @@5.4 @AUDIO_ALSA_TRUE@@BUILD_SHARED_FALSE@am__append_24 = @ALSA_LIBS@5.5 @BUILD_SHARED_FALSE@@INPUT_LIRC_TRUE@am__append_25 = drivers/input_lirc.c5.6 @BUILD_SHARED_FALSE@@INPUT_LIRC_TRUE@am__append_26 = -llirc_client5.7 -@CDROM_LINUX_TRUE@am__append_27 = drivers/cd_linux.c5.8 -@CDROM_OSX_TRUE@am__append_28 = drivers/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h5.9 -@CDROM_NONE_TRUE@am__append_29 = drivers/cd_none.c5.10 +@CDROM_LINUX_TRUE@am__append_27 = drivers/cdrom/cd_linux.c5.11 +@CDROM_OSX_TRUE@am__append_28 = drivers/cdrom/cd_osx.c drivers/osx_iokit.m drivers/osx_iokit.h5.12 +@CDROM_NONE_TRUE@am__append_29 = drivers/cdrom/cd_none.c5.13 @JOY_LINUX_TRUE@am__append_30 = drivers/joy_linux.c drivers/joy_linux.h5.14 subdir = src5.15 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in5.16 @@ -143,51 +143,58 @@5.17 mem.h sdram.c mmio.h watch.c asic.c asic.h clock.h serial.h \5.18 syscall.c syscall.h bios.c dcload.c gdbserver.c ioutil.c \5.19 ioutil.h lxpaths.c lxpaths.h gdrom/ide.c gdrom/ide.h \5.20 - gdrom/packet.h gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h \5.21 - gdrom/nrg.c gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c \5.22 - gdrom/ecc.h gdrom/edc_crctable.h gdrom/edc_encoder.h \5.23 - gdrom/edc_l2sq.h gdrom/edc_scramble.h gdrom/gddriver.h \5.24 - dreamcast.c dreamcast.h eventq.c eventq.h sh4/sh4.c sh4/intc.c \5.25 - sh4/intc.h sh4/sh4mem.c sh4/timer.c sh4/dmac.c sh4/mmu.c \5.26 - sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h \5.27 - sh4/sh4mmio.c sh4/sh4mmio.h sh4/scif.c sh4/sh4stat.c \5.28 - sh4/sh4stat.h xlat/xltcache.c xlat/xltcache.h sh4/sh4.h \5.29 - sh4/dmac.h sh4/pmm.c sh4/cache.c sh4/mmu.h aica/armcore.c \5.30 - aica/armcore.h aica/armdasm.c aica/armdasm.h aica/armmem.c \5.31 - aica/aica.c aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c \5.32 - pvr2/pvr2.h pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c \5.33 - pvr2/rendsort.c pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c \5.34 - pvr2/scene.c pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c \5.35 - pvr2/glutil.c pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \5.36 + gdrom/packet.h gdrom/gdrom.c gdrom/gdrom.h dreamcast.c \5.37 + dreamcast.h eventq.c eventq.h sh4/sh4.c sh4/intc.c sh4/intc.h \5.38 + sh4/sh4mem.c sh4/timer.c sh4/dmac.c sh4/mmu.c sh4/sh4core.c \5.39 + sh4/sh4core.h sh4/sh4dasm.c sh4/sh4dasm.h sh4/sh4mmio.c \5.40 + sh4/sh4mmio.h sh4/scif.c sh4/sh4stat.c sh4/sh4stat.h \5.41 + xlat/xltcache.c xlat/xltcache.h sh4/sh4.h sh4/dmac.h sh4/pmm.c \5.42 + sh4/cache.c sh4/mmu.h aica/armcore.c aica/armcore.h \5.43 + aica/armdasm.c aica/armdasm.h aica/armmem.c aica/aica.c \5.44 + aica/aica.h aica/audio.c aica/audio.h pvr2/pvr2.c pvr2/pvr2.h \5.45 + pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c \5.46 + pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \5.47 + pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c \5.48 + pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \5.49 pvr2/fragment.glsl maple/maple.c maple/maple.h \5.50 maple/controller.c maple/kbd.c maple/mouse.c maple/lightgun.c \5.51 maple/vmu.c loader.c loader.h elf.h bootstrap.c bootstrap.h \5.52 util.c gdlist.c gdlist.h vmu/vmuvol.c vmu/vmuvol.h \5.53 vmu/vmulist.c vmu/vmulist.h display.c display.h dckeysyms.h \5.54 - drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \5.55 - drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \5.56 - drivers/serial_unix.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \5.57 - sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c hotkeys.h plugin.c \5.58 - plugin.h sh4/sh4x86.c xlat/x86/x86op.h xlat/x86/ia32abi.h \5.59 - xlat/x86/amd64abi.h sh4/sh4trans.c sh4/sh4trans.h sh4/mmux86.c \5.60 - x86dasm/x86dasm.c x86dasm/x86dasm.h x86dasm/i386-dis.c \5.61 - x86dasm/dis-init.c x86dasm/dis-buf.c x86dasm/ansidecl.h \5.62 - x86dasm/bfd.h x86dasm/dis-asm.h x86dasm/symcat.h \5.63 - x86dasm/sysdep.h gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c \5.64 - gtkui/gtkcb.c gtkui/gtk_cfg.c gtkui/gtk_mmio.c \5.65 - gtkui/gtk_debug.c gtkui/gtk_dump.c gtkui/gtk_ctrl.c \5.66 - gtkui/gtk_gd.c drivers/io_glib.c drivers/video_gtk.c \5.67 - cocoaui/cocoaui.m cocoaui/cocoaui.h cocoaui/cocoa_cfg.m \5.68 - cocoaui/cocoa_win.m cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m \5.69 - cocoaui/cocoa_ctrl.m cocoaui/paths_osx.m drivers/io_osx.m \5.70 - drivers/video_osx.m drivers/mac_keymap.h \5.71 - drivers/mac_keymap.txt paths_unix.c drivers/video_gdk.c \5.72 - drivers/video_glx.c drivers/video_glx.h drivers/video_nsgl.m \5.73 - drivers/video_nsgl.h drivers/audio_osx.m drivers/audio_sdl.c \5.74 - drivers/audio_pulse.c drivers/audio_esd.c drivers/audio_alsa.c \5.75 - drivers/input_lirc.c drivers/cd_linux.c drivers/cd_osx.c \5.76 - drivers/osx_iokit.m drivers/osx_iokit.h drivers/cd_none.c \5.77 - drivers/joy_linux.c drivers/joy_linux.h5.78 + drivers/audio_null.c drivers/video_null.c drivers/video_gl.c \5.79 + drivers/video_gl.h drivers/gl_fbo.c drivers/serial_unix.c \5.80 + drivers/cdrom/cdrom.h drivers/cdrom/cdrom.c \5.81 + drivers/cdrom/drive.h drivers/cdrom/sector.h \5.82 + drivers/cdrom/sector.c drivers/cdrom/defs.h \5.83 + drivers/cdrom/cd_nrg.c drivers/cdrom/cd_cdi.c \5.84 + drivers/cdrom/cd_gdi.c drivers/cdrom/edc_ecc.c \5.85 + drivers/cdrom/ecc.h drivers/cdrom/drive.c \5.86 + drivers/cdrom/edc_crctable.h drivers/cdrom/edc_encoder.h \5.87 + drivers/cdrom/edc_l2sq.h drivers/cdrom/edc_scramble.h \5.88 + drivers/cdrom/cd_mmc.c sh4/sh4.def sh4/sh4core.in \5.89 + sh4/sh4x86.in sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c \5.90 + hotkeys.h plugin.c plugin.h sh4/sh4x86.c xlat/x86/x86op.h \5.91 + xlat/x86/ia32abi.h xlat/x86/amd64abi.h sh4/sh4trans.c \5.92 + sh4/sh4trans.h sh4/mmux86.c x86dasm/x86dasm.c \5.93 + x86dasm/x86dasm.h x86dasm/i386-dis.c x86dasm/dis-init.c \5.94 + x86dasm/dis-buf.c x86dasm/ansidecl.h x86dasm/bfd.h \5.95 + x86dasm/dis-asm.h x86dasm/symcat.h x86dasm/sysdep.h \5.96 + gtkui/gtkui.c gtkui/gtkui.h gtkui/gtk_win.c gtkui/gtkcb.c \5.97 + gtkui/gtk_cfg.c gtkui/gtk_mmio.c gtkui/gtk_debug.c \5.98 + gtkui/gtk_dump.c gtkui/gtk_ctrl.c gtkui/gtk_gd.c \5.99 + drivers/io_glib.c drivers/video_gtk.c cocoaui/cocoaui.m \5.100 + cocoaui/cocoaui.h cocoaui/cocoa_cfg.m cocoaui/cocoa_win.m \5.101 + cocoaui/cocoa_gd.m cocoaui/cocoa_prefs.m cocoaui/cocoa_ctrl.m \5.102 + cocoaui/paths_osx.m drivers/io_osx.m drivers/video_osx.m \5.103 + drivers/mac_keymap.h drivers/mac_keymap.txt paths_unix.c \5.104 + drivers/video_gdk.c drivers/video_glx.c drivers/video_glx.h \5.105 + drivers/video_nsgl.m drivers/video_nsgl.h drivers/audio_osx.m \5.106 + drivers/audio_sdl.c drivers/audio_pulse.c drivers/audio_esd.c \5.107 + drivers/audio_alsa.c drivers/input_lirc.c \5.108 + drivers/cdrom/cd_linux.c drivers/cdrom/cd_osx.c \5.109 + drivers/osx_iokit.m drivers/osx_iokit.h \5.110 + drivers/cdrom/cd_none.c drivers/joy_linux.c \5.111 + drivers/joy_linux.h5.112 @BUILD_SHARED_TRUE@am__objects_1 = lxdream-plugin.$(OBJEXT)5.113 @BUILD_SH4X86_TRUE@am__objects_2 = lxdream-sh4x86.$(OBJEXT) \5.114 @BUILD_SH4X86_TRUE@ lxdream-sh4trans.$(OBJEXT) \5.115 @@ -238,36 +245,37 @@5.116 lxdream-syscall.$(OBJEXT) lxdream-bios.$(OBJEXT) \5.117 lxdream-dcload.$(OBJEXT) lxdream-gdbserver.$(OBJEXT) \5.118 lxdream-ioutil.$(OBJEXT) lxdream-lxpaths.$(OBJEXT) \5.119 - lxdream-ide.$(OBJEXT) lxdream-gdimage.$(OBJEXT) \5.120 - lxdream-gdrom.$(OBJEXT) lxdream-nrg.$(OBJEXT) \5.121 - lxdream-cdi.$(OBJEXT) lxdream-gdi.$(OBJEXT) \5.122 - lxdream-edc_ecc.$(OBJEXT) lxdream-dreamcast.$(OBJEXT) \5.123 - lxdream-eventq.$(OBJEXT) lxdream-sh4.$(OBJEXT) \5.124 - lxdream-intc.$(OBJEXT) lxdream-sh4mem.$(OBJEXT) \5.125 - lxdream-timer.$(OBJEXT) lxdream-dmac.$(OBJEXT) \5.126 - lxdream-mmu.$(OBJEXT) lxdream-sh4core.$(OBJEXT) \5.127 - lxdream-sh4dasm.$(OBJEXT) lxdream-sh4mmio.$(OBJEXT) \5.128 - lxdream-scif.$(OBJEXT) lxdream-sh4stat.$(OBJEXT) \5.129 - lxdream-xltcache.$(OBJEXT) lxdream-pmm.$(OBJEXT) \5.130 - lxdream-cache.$(OBJEXT) lxdream-armcore.$(OBJEXT) \5.131 - lxdream-armdasm.$(OBJEXT) lxdream-armmem.$(OBJEXT) \5.132 - lxdream-aica.$(OBJEXT) lxdream-audio.$(OBJEXT) \5.133 - lxdream-pvr2.$(OBJEXT) lxdream-pvr2mem.$(OBJEXT) \5.134 - lxdream-tacore.$(OBJEXT) lxdream-rendsort.$(OBJEXT) \5.135 - lxdream-texcache.$(OBJEXT) lxdream-yuv.$(OBJEXT) \5.136 - lxdream-rendsave.$(OBJEXT) lxdream-scene.$(OBJEXT) \5.137 - lxdream-gl_sl.$(OBJEXT) lxdream-gl_slsrc.$(OBJEXT) \5.138 - lxdream-glutil.$(OBJEXT) lxdream-glrender.$(OBJEXT) \5.139 - lxdream-maple.$(OBJEXT) lxdream-controller.$(OBJEXT) \5.140 - lxdream-kbd.$(OBJEXT) lxdream-mouse.$(OBJEXT) \5.141 - lxdream-lightgun.$(OBJEXT) lxdream-vmu.$(OBJEXT) \5.142 - lxdream-loader.$(OBJEXT) lxdream-bootstrap.$(OBJEXT) \5.143 - lxdream-util.$(OBJEXT) lxdream-gdlist.$(OBJEXT) \5.144 - lxdream-vmuvol.$(OBJEXT) lxdream-vmulist.$(OBJEXT) \5.145 - lxdream-display.$(OBJEXT) lxdream-audio_null.$(OBJEXT) \5.146 - lxdream-video_null.$(OBJEXT) lxdream-cd_mmc.$(OBJEXT) \5.147 + lxdream-ide.$(OBJEXT) lxdream-gdrom.$(OBJEXT) \5.148 + lxdream-dreamcast.$(OBJEXT) lxdream-eventq.$(OBJEXT) \5.149 + lxdream-sh4.$(OBJEXT) lxdream-intc.$(OBJEXT) \5.150 + lxdream-sh4mem.$(OBJEXT) lxdream-timer.$(OBJEXT) \5.151 + lxdream-dmac.$(OBJEXT) lxdream-mmu.$(OBJEXT) \5.152 + lxdream-sh4core.$(OBJEXT) lxdream-sh4dasm.$(OBJEXT) \5.153 + lxdream-sh4mmio.$(OBJEXT) lxdream-scif.$(OBJEXT) \5.154 + lxdream-sh4stat.$(OBJEXT) lxdream-xltcache.$(OBJEXT) \5.155 + lxdream-pmm.$(OBJEXT) lxdream-cache.$(OBJEXT) \5.156 + lxdream-armcore.$(OBJEXT) lxdream-armdasm.$(OBJEXT) \5.157 + lxdream-armmem.$(OBJEXT) lxdream-aica.$(OBJEXT) \5.158 + lxdream-audio.$(OBJEXT) lxdream-pvr2.$(OBJEXT) \5.159 + lxdream-pvr2mem.$(OBJEXT) lxdream-tacore.$(OBJEXT) \5.160 + lxdream-rendsort.$(OBJEXT) lxdream-texcache.$(OBJEXT) \5.161 + lxdream-yuv.$(OBJEXT) lxdream-rendsave.$(OBJEXT) \5.162 + lxdream-scene.$(OBJEXT) lxdream-gl_sl.$(OBJEXT) \5.163 + lxdream-gl_slsrc.$(OBJEXT) lxdream-glutil.$(OBJEXT) \5.164 + lxdream-glrender.$(OBJEXT) lxdream-maple.$(OBJEXT) \5.165 + lxdream-controller.$(OBJEXT) lxdream-kbd.$(OBJEXT) \5.166 + lxdream-mouse.$(OBJEXT) lxdream-lightgun.$(OBJEXT) \5.167 + lxdream-vmu.$(OBJEXT) lxdream-loader.$(OBJEXT) \5.168 + lxdream-bootstrap.$(OBJEXT) lxdream-util.$(OBJEXT) \5.169 + lxdream-gdlist.$(OBJEXT) lxdream-vmuvol.$(OBJEXT) \5.170 + lxdream-vmulist.$(OBJEXT) lxdream-display.$(OBJEXT) \5.171 + lxdream-audio_null.$(OBJEXT) lxdream-video_null.$(OBJEXT) \5.172 lxdream-video_gl.$(OBJEXT) lxdream-gl_fbo.$(OBJEXT) \5.173 - lxdream-serial_unix.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \5.174 + lxdream-serial_unix.$(OBJEXT) lxdream-cdrom.$(OBJEXT) \5.175 + lxdream-sector.$(OBJEXT) lxdream-cd_nrg.$(OBJEXT) \5.176 + lxdream-cd_cdi.$(OBJEXT) lxdream-cd_gdi.$(OBJEXT) \5.177 + lxdream-edc_ecc.$(OBJEXT) lxdream-drive.$(OBJEXT) \5.178 + lxdream-cd_mmc.$(OBJEXT) lxdream-hotkeys.$(OBJEXT) \5.179 $(am__objects_1) $(am__objects_2) $(am__objects_3) \5.180 $(am__objects_4) $(am__objects_5) $(am__objects_6) \5.181 $(am__objects_7) $(am__objects_8) $(am__objects_9) \5.182 @@ -546,38 +554,43 @@5.183 gui.h cpu.c cpu.h hook.h gettext.h mem.c mem.h sdram.c mmio.h \5.184 watch.c asic.c asic.h clock.h serial.h syscall.c syscall.h \5.185 bios.c dcload.c gdbserver.c ioutil.c ioutil.h lxpaths.c \5.186 - lxpaths.h gdrom/ide.c gdrom/ide.h gdrom/packet.h \5.187 - gdrom/gdimage.c gdrom/gdrom.c gdrom/gdrom.h gdrom/nrg.c \5.188 - gdrom/cdi.c gdrom/gdi.c gdrom/edc_ecc.c gdrom/ecc.h \5.189 - gdrom/edc_crctable.h gdrom/edc_encoder.h gdrom/edc_l2sq.h \5.190 - gdrom/edc_scramble.h gdrom/gddriver.h dreamcast.c dreamcast.h \5.191 - eventq.c eventq.h sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c \5.192 - sh4/timer.c sh4/dmac.c sh4/mmu.c sh4/sh4core.c sh4/sh4core.h \5.193 - sh4/sh4dasm.c sh4/sh4dasm.h sh4/sh4mmio.c sh4/sh4mmio.h \5.194 - sh4/scif.c sh4/sh4stat.c sh4/sh4stat.h xlat/xltcache.c \5.195 - xlat/xltcache.h sh4/sh4.h sh4/dmac.h sh4/pmm.c sh4/cache.c \5.196 - sh4/mmu.h aica/armcore.c aica/armcore.h aica/armdasm.c \5.197 - aica/armdasm.h aica/armmem.c aica/aica.c aica/aica.h \5.198 - aica/audio.c aica/audio.h pvr2/pvr2.c pvr2/pvr2.h \5.199 - pvr2/pvr2mem.c pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c \5.200 - pvr2/texcache.c pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c \5.201 - pvr2/scene.h pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c \5.202 - pvr2/glutil.h pvr2/glrender.c pvr2/vertex.glsl \5.203 - pvr2/fragment.glsl maple/maple.c maple/maple.h \5.204 - maple/controller.c maple/kbd.c maple/mouse.c maple/lightgun.c \5.205 - maple/vmu.c loader.c loader.h elf.h bootstrap.c bootstrap.h \5.206 - util.c gdlist.c gdlist.h vmu/vmuvol.c vmu/vmuvol.h \5.207 - vmu/vmulist.c vmu/vmulist.h display.c display.h dckeysyms.h \5.208 - drivers/audio_null.c drivers/video_null.c drivers/cd_mmc.c \5.209 - drivers/video_gl.c drivers/video_gl.h drivers/gl_fbo.c \5.210 - drivers/serial_unix.c sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in \5.211 - sh4/sh4dasm.in sh4/sh4stat.in hotkeys.c hotkeys.h \5.212 - $(am__append_1) $(am__append_2) $(am__append_4) \5.213 - $(am__append_5) $(am__append_6) $(am__append_7) \5.214 - $(am__append_8) $(am__append_9) $(am__append_10) \5.215 - $(am__append_17) $(am__append_19) $(am__append_21) \5.216 - $(am__append_23) $(am__append_25) $(am__append_27) \5.217 - $(am__append_28) $(am__append_29) $(am__append_30)5.218 + lxpaths.h gdrom/ide.c gdrom/ide.h gdrom/packet.h gdrom/gdrom.c \5.219 + gdrom/gdrom.h dreamcast.c dreamcast.h eventq.c eventq.h \5.220 + sh4/sh4.c sh4/intc.c sh4/intc.h sh4/sh4mem.c sh4/timer.c \5.221 + sh4/dmac.c sh4/mmu.c sh4/sh4core.c sh4/sh4core.h sh4/sh4dasm.c \5.222 + sh4/sh4dasm.h sh4/sh4mmio.c sh4/sh4mmio.h sh4/scif.c \5.223 + sh4/sh4stat.c sh4/sh4stat.h xlat/xltcache.c xlat/xltcache.h \5.224 + sh4/sh4.h sh4/dmac.h sh4/pmm.c sh4/cache.c sh4/mmu.h \5.225 + aica/armcore.c aica/armcore.h aica/armdasm.c aica/armdasm.h \5.226 + aica/armmem.c aica/aica.c aica/aica.h aica/audio.c \5.227 + aica/audio.h pvr2/pvr2.c pvr2/pvr2.h pvr2/pvr2mem.c \5.228 + pvr2/pvr2mmio.h pvr2/tacore.c pvr2/rendsort.c pvr2/texcache.c \5.229 + pvr2/yuv.c pvr2/rendsave.c pvr2/scene.c pvr2/scene.h \5.230 + pvr2/gl_sl.c pvr2/gl_slsrc.c pvr2/glutil.c pvr2/glutil.h \5.231 + pvr2/glrender.c pvr2/vertex.glsl pvr2/fragment.glsl \5.232 + maple/maple.c maple/maple.h maple/controller.c maple/kbd.c \5.233 + maple/mouse.c maple/lightgun.c maple/vmu.c loader.c loader.h \5.234 + elf.h bootstrap.c bootstrap.h util.c gdlist.c gdlist.h \5.235 + vmu/vmuvol.c vmu/vmuvol.h vmu/vmulist.c vmu/vmulist.h \5.236 + display.c display.h dckeysyms.h drivers/audio_null.c \5.237 + drivers/video_null.c drivers/video_gl.c drivers/video_gl.h \5.238 + drivers/gl_fbo.c drivers/serial_unix.c drivers/cdrom/cdrom.h \5.239 + drivers/cdrom/cdrom.c drivers/cdrom/drive.h \5.240 + drivers/cdrom/sector.h drivers/cdrom/sector.c \5.241 + drivers/cdrom/defs.h drivers/cdrom/cd_nrg.c \5.242 + drivers/cdrom/cd_cdi.c drivers/cdrom/cd_gdi.c \5.243 + drivers/cdrom/edc_ecc.c drivers/cdrom/ecc.h \5.244 + drivers/cdrom/drive.c drivers/cdrom/edc_crctable.h \5.245 + drivers/cdrom/edc_encoder.h drivers/cdrom/edc_l2sq.h \5.246 + drivers/cdrom/edc_scramble.h drivers/cdrom/cd_mmc.c \5.247 + sh4/sh4.def sh4/sh4core.in sh4/sh4x86.in sh4/sh4dasm.in \5.248 + sh4/sh4stat.in hotkeys.c hotkeys.h $(am__append_1) \5.249 + $(am__append_2) $(am__append_4) $(am__append_5) \5.250 + $(am__append_6) $(am__append_7) $(am__append_8) \5.251 + $(am__append_9) $(am__append_10) $(am__append_17) \5.252 + $(am__append_19) $(am__append_21) $(am__append_23) \5.253 + $(am__append_25) $(am__append_27) $(am__append_28) \5.254 + $(am__append_29) $(am__append_30)5.255 lxdream_CPPFLAGS = @LXDREAMCPPFLAGS@5.256 @BUILD_SH4X86_TRUE@test_testsh4x86_LDADD = @LXDREAM_LIBS@ @GLIB_LIBS@ @GTK_LIBS@ @LIBPNG_LIBS@5.257 @BUILD_SH4X86_TRUE@test_testsh4x86_CPPFLAGS = @LXDREAMCPPFLAGS@5.258 @@ -756,11 +769,14 @@5.259 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-bios.Po@am__quote@5.260 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-bootstrap.Po@am__quote@5.261 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cache.Po@am__quote@5.262 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_cdi.Po@am__quote@5.263 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_gdi.Po@am__quote@5.264 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_linux.Po@am__quote@5.265 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_mmc.Po@am__quote@5.266 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_none.Po@am__quote@5.267 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_nrg.Po@am__quote@5.268 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cd_osx.Po@am__quote@5.269 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cdi.Po@am__quote@5.270 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cdrom.Po@am__quote@5.271 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoa_cfg.Po@am__quote@5.272 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoa_ctrl.Po@am__quote@5.273 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-cocoa_gd.Po@am__quote@5.274 @@ -776,11 +792,10 @@5.275 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-display.Po@am__quote@5.276 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dmac.Po@am__quote@5.277 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-dreamcast.Po@am__quote@5.278 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-drive.Po@am__quote@5.279 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-edc_ecc.Po@am__quote@5.280 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-eventq.Po@am__quote@5.281 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdbserver.Po@am__quote@5.282 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdi.Po@am__quote@5.283 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdimage.Po@am__quote@5.284 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdlist.Po@am__quote@5.285 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gdrom.Po@am__quote@5.286 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-gl_fbo.Po@am__quote@5.287 @@ -816,7 +831,6 @@5.288 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mmu.Po@am__quote@5.289 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mmux86.Po@am__quote@5.290 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-mouse.Po@am__quote@5.291 -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-nrg.Po@am__quote@5.292 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-osx_iokit.Po@am__quote@5.293 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-paths_osx.Po@am__quote@5.294 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-paths_unix.Po@am__quote@5.295 @@ -829,6 +843,7 @@5.296 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-scene.Po@am__quote@5.297 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-scif.Po@am__quote@5.298 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sdram.Po@am__quote@5.299 +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sector.Po@am__quote@5.300 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-serial_unix.Po@am__quote@5.301 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4.Po@am__quote@5.302 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lxdream-sh4core.Po@am__quote@5.303 @@ -1153,20 +1168,6 @@5.304 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.305 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-ide.obj `if test -f 'gdrom/ide.c'; then $(CYGPATH_W) 'gdrom/ide.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/ide.c'; fi`5.307 -lxdream-gdimage.o: gdrom/gdimage.c5.308 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdimage.o -MD -MP -MF "$(DEPDIR)/lxdream-gdimage.Tpo" -c -o lxdream-gdimage.o `test -f 'gdrom/gdimage.c' || echo '$(srcdir)/'`gdrom/gdimage.c; \5.309 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-gdimage.Tpo" "$(DEPDIR)/lxdream-gdimage.Po"; else rm -f "$(DEPDIR)/lxdream-gdimage.Tpo"; exit 1; fi5.310 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/gdimage.c' object='lxdream-gdimage.o' libtool=no @AMDEPBACKSLASH@5.311 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.312 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdimage.o `test -f 'gdrom/gdimage.c' || echo '$(srcdir)/'`gdrom/gdimage.c5.313 -5.314 -lxdream-gdimage.obj: gdrom/gdimage.c5.315 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdimage.obj -MD -MP -MF "$(DEPDIR)/lxdream-gdimage.Tpo" -c -o lxdream-gdimage.obj `if test -f 'gdrom/gdimage.c'; then $(CYGPATH_W) 'gdrom/gdimage.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdimage.c'; fi`; \5.316 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-gdimage.Tpo" "$(DEPDIR)/lxdream-gdimage.Po"; else rm -f "$(DEPDIR)/lxdream-gdimage.Tpo"; exit 1; fi5.317 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/gdimage.c' object='lxdream-gdimage.obj' libtool=no @AMDEPBACKSLASH@5.318 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.319 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdimage.obj `if test -f 'gdrom/gdimage.c'; then $(CYGPATH_W) 'gdrom/gdimage.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdimage.c'; fi`5.320 -5.321 lxdream-gdrom.o: gdrom/gdrom.c5.322 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdrom.o -MD -MP -MF "$(DEPDIR)/lxdream-gdrom.Tpo" -c -o lxdream-gdrom.o `test -f 'gdrom/gdrom.c' || echo '$(srcdir)/'`gdrom/gdrom.c; \5.323 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-gdrom.Tpo" "$(DEPDIR)/lxdream-gdrom.Po"; else rm -f "$(DEPDIR)/lxdream-gdrom.Tpo"; exit 1; fi5.324 @@ -1181,62 +1182,6 @@5.325 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.326 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdrom.obj `if test -f 'gdrom/gdrom.c'; then $(CYGPATH_W) 'gdrom/gdrom.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdrom.c'; fi`5.328 -lxdream-nrg.o: gdrom/nrg.c5.329 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-nrg.o -MD -MP -MF "$(DEPDIR)/lxdream-nrg.Tpo" -c -o lxdream-nrg.o `test -f 'gdrom/nrg.c' || echo '$(srcdir)/'`gdrom/nrg.c; \5.330 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-nrg.Tpo" "$(DEPDIR)/lxdream-nrg.Po"; else rm -f "$(DEPDIR)/lxdream-nrg.Tpo"; exit 1; fi5.331 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/nrg.c' object='lxdream-nrg.o' libtool=no @AMDEPBACKSLASH@5.332 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.333 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-nrg.o `test -f 'gdrom/nrg.c' || echo '$(srcdir)/'`gdrom/nrg.c5.334 -5.335 -lxdream-nrg.obj: gdrom/nrg.c5.336 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-nrg.obj -MD -MP -MF "$(DEPDIR)/lxdream-nrg.Tpo" -c -o lxdream-nrg.obj `if test -f 'gdrom/nrg.c'; then $(CYGPATH_W) 'gdrom/nrg.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/nrg.c'; fi`; \5.337 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-nrg.Tpo" "$(DEPDIR)/lxdream-nrg.Po"; else rm -f "$(DEPDIR)/lxdream-nrg.Tpo"; exit 1; fi5.338 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/nrg.c' object='lxdream-nrg.obj' libtool=no @AMDEPBACKSLASH@5.339 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.340 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-nrg.obj `if test -f 'gdrom/nrg.c'; then $(CYGPATH_W) 'gdrom/nrg.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/nrg.c'; fi`5.341 -5.342 -lxdream-cdi.o: gdrom/cdi.c5.343 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdi.o -MD -MP -MF "$(DEPDIR)/lxdream-cdi.Tpo" -c -o lxdream-cdi.o `test -f 'gdrom/cdi.c' || echo '$(srcdir)/'`gdrom/cdi.c; \5.344 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cdi.Tpo" "$(DEPDIR)/lxdream-cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cdi.Tpo"; exit 1; fi5.345 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/cdi.c' object='lxdream-cdi.o' libtool=no @AMDEPBACKSLASH@5.346 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.347 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdi.o `test -f 'gdrom/cdi.c' || echo '$(srcdir)/'`gdrom/cdi.c5.348 -5.349 -lxdream-cdi.obj: gdrom/cdi.c5.350 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-cdi.Tpo" -c -o lxdream-cdi.obj `if test -f 'gdrom/cdi.c'; then $(CYGPATH_W) 'gdrom/cdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/cdi.c'; fi`; \5.351 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cdi.Tpo" "$(DEPDIR)/lxdream-cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cdi.Tpo"; exit 1; fi5.352 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/cdi.c' object='lxdream-cdi.obj' libtool=no @AMDEPBACKSLASH@5.353 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.354 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdi.obj `if test -f 'gdrom/cdi.c'; then $(CYGPATH_W) 'gdrom/cdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/cdi.c'; fi`5.355 -5.356 -lxdream-gdi.o: gdrom/gdi.c5.357 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdi.o -MD -MP -MF "$(DEPDIR)/lxdream-gdi.Tpo" -c -o lxdream-gdi.o `test -f 'gdrom/gdi.c' || echo '$(srcdir)/'`gdrom/gdi.c; \5.358 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-gdi.Tpo" "$(DEPDIR)/lxdream-gdi.Po"; else rm -f "$(DEPDIR)/lxdream-gdi.Tpo"; exit 1; fi5.359 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/gdi.c' object='lxdream-gdi.o' libtool=no @AMDEPBACKSLASH@5.360 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.361 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdi.o `test -f 'gdrom/gdi.c' || echo '$(srcdir)/'`gdrom/gdi.c5.362 -5.363 -lxdream-gdi.obj: gdrom/gdi.c5.364 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-gdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-gdi.Tpo" -c -o lxdream-gdi.obj `if test -f 'gdrom/gdi.c'; then $(CYGPATH_W) 'gdrom/gdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdi.c'; fi`; \5.365 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-gdi.Tpo" "$(DEPDIR)/lxdream-gdi.Po"; else rm -f "$(DEPDIR)/lxdream-gdi.Tpo"; exit 1; fi5.366 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/gdi.c' object='lxdream-gdi.obj' libtool=no @AMDEPBACKSLASH@5.367 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.368 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-gdi.obj `if test -f 'gdrom/gdi.c'; then $(CYGPATH_W) 'gdrom/gdi.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/gdi.c'; fi`5.369 -5.370 -lxdream-edc_ecc.o: gdrom/edc_ecc.c5.371 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.o -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.o `test -f 'gdrom/edc_ecc.c' || echo '$(srcdir)/'`gdrom/edc_ecc.c; \5.372 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi5.373 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/edc_ecc.c' object='lxdream-edc_ecc.o' libtool=no @AMDEPBACKSLASH@5.374 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.375 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.o `test -f 'gdrom/edc_ecc.c' || echo '$(srcdir)/'`gdrom/edc_ecc.c5.376 -5.377 -lxdream-edc_ecc.obj: gdrom/edc_ecc.c5.378 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.obj -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.obj `if test -f 'gdrom/edc_ecc.c'; then $(CYGPATH_W) 'gdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/edc_ecc.c'; fi`; \5.379 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi5.380 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gdrom/edc_ecc.c' object='lxdream-edc_ecc.obj' libtool=no @AMDEPBACKSLASH@5.381 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.382 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.obj `if test -f 'gdrom/edc_ecc.c'; then $(CYGPATH_W) 'gdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/gdrom/edc_ecc.c'; fi`5.383 -5.384 lxdream-dreamcast.o: dreamcast.c5.385 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-dreamcast.o -MD -MP -MF "$(DEPDIR)/lxdream-dreamcast.Tpo" -c -o lxdream-dreamcast.o `test -f 'dreamcast.c' || echo '$(srcdir)/'`dreamcast.c; \5.386 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-dreamcast.Tpo" "$(DEPDIR)/lxdream-dreamcast.Po"; else rm -f "$(DEPDIR)/lxdream-dreamcast.Tpo"; exit 1; fi5.387 @@ -1909,20 +1854,6 @@5.388 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.389 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-video_null.obj `if test -f 'drivers/video_null.c'; then $(CYGPATH_W) 'drivers/video_null.c'; else $(CYGPATH_W) '$(srcdir)/drivers/video_null.c'; fi`5.391 -lxdream-cd_mmc.o: drivers/cd_mmc.c5.392 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.o `test -f 'drivers/cd_mmc.c' || echo '$(srcdir)/'`drivers/cd_mmc.c; \5.393 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi5.394 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_mmc.c' object='lxdream-cd_mmc.o' libtool=no @AMDEPBACKSLASH@5.395 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.396 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.o `test -f 'drivers/cd_mmc.c' || echo '$(srcdir)/'`drivers/cd_mmc.c5.397 -5.398 -lxdream-cd_mmc.obj: drivers/cd_mmc.c5.399 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_mmc.c'; fi`; \5.400 -@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi5.401 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_mmc.c' object='lxdream-cd_mmc.obj' libtool=no @AMDEPBACKSLASH@5.402 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.403 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_mmc.c'; fi`5.404 -5.405 lxdream-video_gl.o: drivers/video_gl.c5.406 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-video_gl.o -MD -MP -MF "$(DEPDIR)/lxdream-video_gl.Tpo" -c -o lxdream-video_gl.o `test -f 'drivers/video_gl.c' || echo '$(srcdir)/'`drivers/video_gl.c; \5.407 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-video_gl.Tpo" "$(DEPDIR)/lxdream-video_gl.Po"; else rm -f "$(DEPDIR)/lxdream-video_gl.Tpo"; exit 1; fi5.408 @@ -1965,6 +1896,118 @@5.409 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.410 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-serial_unix.obj `if test -f 'drivers/serial_unix.c'; then $(CYGPATH_W) 'drivers/serial_unix.c'; else $(CYGPATH_W) '$(srcdir)/drivers/serial_unix.c'; fi`5.412 +lxdream-cdrom.o: drivers/cdrom/cdrom.c5.413 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdrom.o -MD -MP -MF "$(DEPDIR)/lxdream-cdrom.Tpo" -c -o lxdream-cdrom.o `test -f 'drivers/cdrom/cdrom.c' || echo '$(srcdir)/'`drivers/cdrom/cdrom.c; \5.414 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cdrom.Tpo" "$(DEPDIR)/lxdream-cdrom.Po"; else rm -f "$(DEPDIR)/lxdream-cdrom.Tpo"; exit 1; fi5.415 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cdrom.c' object='lxdream-cdrom.o' libtool=no @AMDEPBACKSLASH@5.416 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.417 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdrom.o `test -f 'drivers/cdrom/cdrom.c' || echo '$(srcdir)/'`drivers/cdrom/cdrom.c5.418 +5.419 +lxdream-cdrom.obj: drivers/cdrom/cdrom.c5.420 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cdrom.obj -MD -MP -MF "$(DEPDIR)/lxdream-cdrom.Tpo" -c -o lxdream-cdrom.obj `if test -f 'drivers/cdrom/cdrom.c'; then $(CYGPATH_W) 'drivers/cdrom/cdrom.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cdrom.c'; fi`; \5.421 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cdrom.Tpo" "$(DEPDIR)/lxdream-cdrom.Po"; else rm -f "$(DEPDIR)/lxdream-cdrom.Tpo"; exit 1; fi5.422 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cdrom.c' object='lxdream-cdrom.obj' libtool=no @AMDEPBACKSLASH@5.423 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.424 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cdrom.obj `if test -f 'drivers/cdrom/cdrom.c'; then $(CYGPATH_W) 'drivers/cdrom/cdrom.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cdrom.c'; fi`5.425 +5.426 +lxdream-sector.o: drivers/cdrom/sector.c5.427 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-sector.o -MD -MP -MF "$(DEPDIR)/lxdream-sector.Tpo" -c -o lxdream-sector.o `test -f 'drivers/cdrom/sector.c' || echo '$(srcdir)/'`drivers/cdrom/sector.c; \5.428 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-sector.Tpo" "$(DEPDIR)/lxdream-sector.Po"; else rm -f "$(DEPDIR)/lxdream-sector.Tpo"; exit 1; fi5.429 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/sector.c' object='lxdream-sector.o' libtool=no @AMDEPBACKSLASH@5.430 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.431 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-sector.o `test -f 'drivers/cdrom/sector.c' || echo '$(srcdir)/'`drivers/cdrom/sector.c5.432 +5.433 +lxdream-sector.obj: drivers/cdrom/sector.c5.434 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-sector.obj -MD -MP -MF "$(DEPDIR)/lxdream-sector.Tpo" -c -o lxdream-sector.obj `if test -f 'drivers/cdrom/sector.c'; then $(CYGPATH_W) 'drivers/cdrom/sector.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/sector.c'; fi`; \5.435 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-sector.Tpo" "$(DEPDIR)/lxdream-sector.Po"; else rm -f "$(DEPDIR)/lxdream-sector.Tpo"; exit 1; fi5.436 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/sector.c' object='lxdream-sector.obj' libtool=no @AMDEPBACKSLASH@5.437 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.438 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-sector.obj `if test -f 'drivers/cdrom/sector.c'; then $(CYGPATH_W) 'drivers/cdrom/sector.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/sector.c'; fi`5.439 +5.440 +lxdream-cd_nrg.o: drivers/cdrom/cd_nrg.c5.441 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_nrg.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_nrg.Tpo" -c -o lxdream-cd_nrg.o `test -f 'drivers/cdrom/cd_nrg.c' || echo '$(srcdir)/'`drivers/cdrom/cd_nrg.c; \5.442 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_nrg.Tpo" "$(DEPDIR)/lxdream-cd_nrg.Po"; else rm -f "$(DEPDIR)/lxdream-cd_nrg.Tpo"; exit 1; fi5.443 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_nrg.c' object='lxdream-cd_nrg.o' libtool=no @AMDEPBACKSLASH@5.444 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.445 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_nrg.o `test -f 'drivers/cdrom/cd_nrg.c' || echo '$(srcdir)/'`drivers/cdrom/cd_nrg.c5.446 +5.447 +lxdream-cd_nrg.obj: drivers/cdrom/cd_nrg.c5.448 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_nrg.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_nrg.Tpo" -c -o lxdream-cd_nrg.obj `if test -f 'drivers/cdrom/cd_nrg.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_nrg.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_nrg.c'; fi`; \5.449 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_nrg.Tpo" "$(DEPDIR)/lxdream-cd_nrg.Po"; else rm -f "$(DEPDIR)/lxdream-cd_nrg.Tpo"; exit 1; fi5.450 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_nrg.c' object='lxdream-cd_nrg.obj' libtool=no @AMDEPBACKSLASH@5.451 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.452 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_nrg.obj `if test -f 'drivers/cdrom/cd_nrg.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_nrg.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_nrg.c'; fi`5.453 +5.454 +lxdream-cd_cdi.o: drivers/cdrom/cd_cdi.c5.455 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_cdi.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_cdi.Tpo" -c -o lxdream-cd_cdi.o `test -f 'drivers/cdrom/cd_cdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_cdi.c; \5.456 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_cdi.Tpo" "$(DEPDIR)/lxdream-cd_cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_cdi.Tpo"; exit 1; fi5.457 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_cdi.c' object='lxdream-cd_cdi.o' libtool=no @AMDEPBACKSLASH@5.458 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.459 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_cdi.o `test -f 'drivers/cdrom/cd_cdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_cdi.c5.460 +5.461 +lxdream-cd_cdi.obj: drivers/cdrom/cd_cdi.c5.462 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_cdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_cdi.Tpo" -c -o lxdream-cd_cdi.obj `if test -f 'drivers/cdrom/cd_cdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_cdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_cdi.c'; fi`; \5.463 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_cdi.Tpo" "$(DEPDIR)/lxdream-cd_cdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_cdi.Tpo"; exit 1; fi5.464 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_cdi.c' object='lxdream-cd_cdi.obj' libtool=no @AMDEPBACKSLASH@5.465 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.466 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_cdi.obj `if test -f 'drivers/cdrom/cd_cdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_cdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_cdi.c'; fi`5.467 +5.468 +lxdream-cd_gdi.o: drivers/cdrom/cd_gdi.c5.469 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_gdi.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_gdi.Tpo" -c -o lxdream-cd_gdi.o `test -f 'drivers/cdrom/cd_gdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_gdi.c; \5.470 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_gdi.Tpo" "$(DEPDIR)/lxdream-cd_gdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_gdi.Tpo"; exit 1; fi5.471 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_gdi.c' object='lxdream-cd_gdi.o' libtool=no @AMDEPBACKSLASH@5.472 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.473 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_gdi.o `test -f 'drivers/cdrom/cd_gdi.c' || echo '$(srcdir)/'`drivers/cdrom/cd_gdi.c5.474 +5.475 +lxdream-cd_gdi.obj: drivers/cdrom/cd_gdi.c5.476 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_gdi.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_gdi.Tpo" -c -o lxdream-cd_gdi.obj `if test -f 'drivers/cdrom/cd_gdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_gdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_gdi.c'; fi`; \5.477 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_gdi.Tpo" "$(DEPDIR)/lxdream-cd_gdi.Po"; else rm -f "$(DEPDIR)/lxdream-cd_gdi.Tpo"; exit 1; fi5.478 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_gdi.c' object='lxdream-cd_gdi.obj' libtool=no @AMDEPBACKSLASH@5.479 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.480 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_gdi.obj `if test -f 'drivers/cdrom/cd_gdi.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_gdi.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_gdi.c'; fi`5.481 +5.482 +lxdream-edc_ecc.o: drivers/cdrom/edc_ecc.c5.483 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.o -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.o `test -f 'drivers/cdrom/edc_ecc.c' || echo '$(srcdir)/'`drivers/cdrom/edc_ecc.c; \5.484 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi5.485 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/edc_ecc.c' object='lxdream-edc_ecc.o' libtool=no @AMDEPBACKSLASH@5.486 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.487 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.o `test -f 'drivers/cdrom/edc_ecc.c' || echo '$(srcdir)/'`drivers/cdrom/edc_ecc.c5.488 +5.489 +lxdream-edc_ecc.obj: drivers/cdrom/edc_ecc.c5.490 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-edc_ecc.obj -MD -MP -MF "$(DEPDIR)/lxdream-edc_ecc.Tpo" -c -o lxdream-edc_ecc.obj `if test -f 'drivers/cdrom/edc_ecc.c'; then $(CYGPATH_W) 'drivers/cdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/edc_ecc.c'; fi`; \5.491 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-edc_ecc.Tpo" "$(DEPDIR)/lxdream-edc_ecc.Po"; else rm -f "$(DEPDIR)/lxdream-edc_ecc.Tpo"; exit 1; fi5.492 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/edc_ecc.c' object='lxdream-edc_ecc.obj' libtool=no @AMDEPBACKSLASH@5.493 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.494 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-edc_ecc.obj `if test -f 'drivers/cdrom/edc_ecc.c'; then $(CYGPATH_W) 'drivers/cdrom/edc_ecc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/edc_ecc.c'; fi`5.495 +5.496 +lxdream-drive.o: drivers/cdrom/drive.c5.497 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-drive.o -MD -MP -MF "$(DEPDIR)/lxdream-drive.Tpo" -c -o lxdream-drive.o `test -f 'drivers/cdrom/drive.c' || echo '$(srcdir)/'`drivers/cdrom/drive.c; \5.498 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-drive.Tpo" "$(DEPDIR)/lxdream-drive.Po"; else rm -f "$(DEPDIR)/lxdream-drive.Tpo"; exit 1; fi5.499 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/drive.c' object='lxdream-drive.o' libtool=no @AMDEPBACKSLASH@5.500 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.501 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-drive.o `test -f 'drivers/cdrom/drive.c' || echo '$(srcdir)/'`drivers/cdrom/drive.c5.502 +5.503 +lxdream-drive.obj: drivers/cdrom/drive.c5.504 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-drive.obj -MD -MP -MF "$(DEPDIR)/lxdream-drive.Tpo" -c -o lxdream-drive.obj `if test -f 'drivers/cdrom/drive.c'; then $(CYGPATH_W) 'drivers/cdrom/drive.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/drive.c'; fi`; \5.505 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-drive.Tpo" "$(DEPDIR)/lxdream-drive.Po"; else rm -f "$(DEPDIR)/lxdream-drive.Tpo"; exit 1; fi5.506 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/drive.c' object='lxdream-drive.obj' libtool=no @AMDEPBACKSLASH@5.507 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.508 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-drive.obj `if test -f 'drivers/cdrom/drive.c'; then $(CYGPATH_W) 'drivers/cdrom/drive.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/drive.c'; fi`5.509 +5.510 +lxdream-cd_mmc.o: drivers/cdrom/cd_mmc.c5.511 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.o `test -f 'drivers/cdrom/cd_mmc.c' || echo '$(srcdir)/'`drivers/cdrom/cd_mmc.c; \5.512 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi5.513 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_mmc.c' object='lxdream-cd_mmc.o' libtool=no @AMDEPBACKSLASH@5.514 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.515 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.o `test -f 'drivers/cdrom/cd_mmc.c' || echo '$(srcdir)/'`drivers/cdrom/cd_mmc.c5.516 +5.517 +lxdream-cd_mmc.obj: drivers/cdrom/cd_mmc.c5.518 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_mmc.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_mmc.Tpo" -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cdrom/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_mmc.c'; fi`; \5.519 +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_mmc.Tpo" "$(DEPDIR)/lxdream-cd_mmc.Po"; else rm -f "$(DEPDIR)/lxdream-cd_mmc.Tpo"; exit 1; fi5.520 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_mmc.c' object='lxdream-cd_mmc.obj' libtool=no @AMDEPBACKSLASH@5.521 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.522 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_mmc.obj `if test -f 'drivers/cdrom/cd_mmc.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_mmc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_mmc.c'; fi`5.523 +5.524 lxdream-hotkeys.o: hotkeys.c5.525 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-hotkeys.o -MD -MP -MF "$(DEPDIR)/lxdream-hotkeys.Tpo" -c -o lxdream-hotkeys.o `test -f 'hotkeys.c' || echo '$(srcdir)/'`hotkeys.c; \5.526 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-hotkeys.Tpo" "$(DEPDIR)/lxdream-hotkeys.Po"; else rm -f "$(DEPDIR)/lxdream-hotkeys.Tpo"; exit 1; fi5.527 @@ -2357,47 +2400,47 @@5.528 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.529 @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-input_lirc.obj `if test -f 'drivers/input_lirc.c'; then $(CYGPATH_W) 'drivers/input_lirc.c'; else $(CYGPATH_W) '$(srcdir)/drivers/input_lirc.c'; fi`5.531 -lxdream-cd_linux.o: drivers/cd_linux.c5.532 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.o `test -f 'drivers/cd_linux.c' || echo '$(srcdir)/'`drivers/cd_linux.c; \5.533 +lxdream-cd_linux.o: drivers/cdrom/cd_linux.c5.534 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.o `test -f 'drivers/cdrom/cd_linux.c' || echo '$(srcdir)/'`drivers/cdrom/cd_linux.c; \5.535 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_linux.Tpo" "$(DEPDIR)/lxdream-cd_linux.Po"; else rm -f "$(DEPDIR)/lxdream-cd_linux.Tpo"; exit 1; fi5.536 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_linux.c' object='lxdream-cd_linux.o' libtool=no @AMDEPBACKSLASH@5.537 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_linux.c' object='lxdream-cd_linux.o' libtool=no @AMDEPBACKSLASH@5.538 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.539 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.o `test -f 'drivers/cd_linux.c' || echo '$(srcdir)/'`drivers/cd_linux.c5.540 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.o `test -f 'drivers/cdrom/cd_linux.c' || echo '$(srcdir)/'`drivers/cdrom/cd_linux.c5.542 -lxdream-cd_linux.obj: drivers/cd_linux.c5.543 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.obj `if test -f 'drivers/cd_linux.c'; then $(CYGPATH_W) 'drivers/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_linux.c'; fi`; \5.544 +lxdream-cd_linux.obj: drivers/cdrom/cd_linux.c5.545 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_linux.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_linux.Tpo" -c -o lxdream-cd_linux.obj `if test -f 'drivers/cdrom/cd_linux.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_linux.c'; fi`; \5.546 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_linux.Tpo" "$(DEPDIR)/lxdream-cd_linux.Po"; else rm -f "$(DEPDIR)/lxdream-cd_linux.Tpo"; exit 1; fi5.547 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_linux.c' object='lxdream-cd_linux.obj' libtool=no @AMDEPBACKSLASH@5.548 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_linux.c' object='lxdream-cd_linux.obj' libtool=no @AMDEPBACKSLASH@5.549 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.550 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.obj `if test -f 'drivers/cd_linux.c'; then $(CYGPATH_W) 'drivers/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_linux.c'; fi`5.551 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_linux.obj `if test -f 'drivers/cdrom/cd_linux.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_linux.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_linux.c'; fi`5.553 -lxdream-cd_osx.o: drivers/cd_osx.c5.554 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.o `test -f 'drivers/cd_osx.c' || echo '$(srcdir)/'`drivers/cd_osx.c; \5.555 +lxdream-cd_osx.o: drivers/cdrom/cd_osx.c5.556 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.o `test -f 'drivers/cdrom/cd_osx.c' || echo '$(srcdir)/'`drivers/cdrom/cd_osx.c; \5.557 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_osx.Tpo" "$(DEPDIR)/lxdream-cd_osx.Po"; else rm -f "$(DEPDIR)/lxdream-cd_osx.Tpo"; exit 1; fi5.558 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_osx.c' object='lxdream-cd_osx.o' libtool=no @AMDEPBACKSLASH@5.559 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_osx.c' object='lxdream-cd_osx.o' libtool=no @AMDEPBACKSLASH@5.560 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.561 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.o `test -f 'drivers/cd_osx.c' || echo '$(srcdir)/'`drivers/cd_osx.c5.562 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.o `test -f 'drivers/cdrom/cd_osx.c' || echo '$(srcdir)/'`drivers/cdrom/cd_osx.c5.564 -lxdream-cd_osx.obj: drivers/cd_osx.c5.565 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.obj `if test -f 'drivers/cd_osx.c'; then $(CYGPATH_W) 'drivers/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_osx.c'; fi`; \5.566 +lxdream-cd_osx.obj: drivers/cdrom/cd_osx.c5.567 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_osx.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_osx.Tpo" -c -o lxdream-cd_osx.obj `if test -f 'drivers/cdrom/cd_osx.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_osx.c'; fi`; \5.568 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_osx.Tpo" "$(DEPDIR)/lxdream-cd_osx.Po"; else rm -f "$(DEPDIR)/lxdream-cd_osx.Tpo"; exit 1; fi5.569 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_osx.c' object='lxdream-cd_osx.obj' libtool=no @AMDEPBACKSLASH@5.570 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_osx.c' object='lxdream-cd_osx.obj' libtool=no @AMDEPBACKSLASH@5.571 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.572 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.obj `if test -f 'drivers/cd_osx.c'; then $(CYGPATH_W) 'drivers/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_osx.c'; fi`5.573 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_osx.obj `if test -f 'drivers/cdrom/cd_osx.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_osx.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_osx.c'; fi`5.575 -lxdream-cd_none.o: drivers/cd_none.c5.576 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.o `test -f 'drivers/cd_none.c' || echo '$(srcdir)/'`drivers/cd_none.c; \5.577 +lxdream-cd_none.o: drivers/cdrom/cd_none.c5.578 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.o -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.o `test -f 'drivers/cdrom/cd_none.c' || echo '$(srcdir)/'`drivers/cdrom/cd_none.c; \5.579 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_none.Tpo" "$(DEPDIR)/lxdream-cd_none.Po"; else rm -f "$(DEPDIR)/lxdream-cd_none.Tpo"; exit 1; fi5.580 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_none.c' object='lxdream-cd_none.o' libtool=no @AMDEPBACKSLASH@5.581 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_none.c' object='lxdream-cd_none.o' libtool=no @AMDEPBACKSLASH@5.582 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.583 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.o `test -f 'drivers/cd_none.c' || echo '$(srcdir)/'`drivers/cd_none.c5.584 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.o `test -f 'drivers/cdrom/cd_none.c' || echo '$(srcdir)/'`drivers/cdrom/cd_none.c5.586 -lxdream-cd_none.obj: drivers/cd_none.c5.587 -@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.obj `if test -f 'drivers/cd_none.c'; then $(CYGPATH_W) 'drivers/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_none.c'; fi`; \5.588 +lxdream-cd_none.obj: drivers/cdrom/cd_none.c5.589 +@am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-cd_none.obj -MD -MP -MF "$(DEPDIR)/lxdream-cd_none.Tpo" -c -o lxdream-cd_none.obj `if test -f 'drivers/cdrom/cd_none.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_none.c'; fi`; \5.590 @am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/lxdream-cd_none.Tpo" "$(DEPDIR)/lxdream-cd_none.Po"; else rm -f "$(DEPDIR)/lxdream-cd_none.Tpo"; exit 1; fi5.591 -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cd_none.c' object='lxdream-cd_none.obj' libtool=no @AMDEPBACKSLASH@5.592 +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='drivers/cdrom/cd_none.c' object='lxdream-cd_none.obj' libtool=no @AMDEPBACKSLASH@5.593 @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@5.594 -@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.obj `if test -f 'drivers/cd_none.c'; then $(CYGPATH_W) 'drivers/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cd_none.c'; fi`5.595 +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o lxdream-cd_none.obj `if test -f 'drivers/cdrom/cd_none.c'; then $(CYGPATH_W) 'drivers/cdrom/cd_none.c'; else $(CYGPATH_W) '$(srcdir)/drivers/cdrom/cd_none.c'; fi`5.597 lxdream-joy_linux.o: drivers/joy_linux.c5.598 @am__fastdepCC_TRUE@ if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lxdream_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT lxdream-joy_linux.o -MD -MP -MF "$(DEPDIR)/lxdream-joy_linux.Tpo" -c -o lxdream-joy_linux.o `test -f 'drivers/joy_linux.c' || echo '$(srcdir)/'`drivers/joy_linux.c; \
6.1 --- a/src/drivers/cd_linux.c Sun Jan 31 18:30:13 2010 +10006.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00006.3 @@ -1,174 +0,0 @@6.4 -/**6.5 - * $Id$6.6 - *6.7 - * Linux cd-rom device driver. Implemented using the SCSI transport.6.8 - *6.9 - * Copyright (c) 2005 Nathan Keynes.6.10 - *6.11 - * This program is free software; you can redistribute it and/or modify6.12 - * it under the terms of the GNU General Public License as published by6.13 - * the Free Software Foundation; either version 2 of the License, or6.14 - * (at your option) any later version.6.15 - *6.16 - * This program is distributed in the hope that it will be useful,6.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of6.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6.19 - * GNU General Public License for more details.6.20 - */6.21 -#include <unistd.h>6.22 -#include <stdlib.h>6.23 -#include <stdio.h>6.24 -#include <string.h>6.25 -#include <errno.h>6.26 -#include <ctype.h>6.27 -#include <linux/cdrom.h>6.28 -#include <sys/stat.h>6.29 -#include <sys/ioctl.h>6.30 -#include <fstab.h>6.31 -#include <fcntl.h>6.32 -6.33 -#include "gdrom/gddriver.h"6.34 -#include "gdrom/packet.h"6.35 -#include "dream.h"6.36 -6.37 -static gboolean linux_is_cdrom_device( FILE *f );6.38 -static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f );6.39 -static gdrom_error_t linux_packet_read( gdrom_disc_t disc, char *cmd,6.40 - unsigned char *buf, uint32_t *buflen );6.41 -static gdrom_error_t linux_packet_cmd( gdrom_disc_t disc, char *cmd );6.42 -static gboolean linux_media_changed( gdrom_disc_t disc );6.43 -6.44 -6.45 -struct gdrom_image_class cdrom_device_class = { "Linux", NULL,6.46 - linux_is_cdrom_device, linux_open_device };6.47 -6.48 -static struct gdrom_scsi_transport linux_scsi_transport = {6.49 - linux_packet_read, linux_packet_cmd, linux_media_changed };6.50 -6.51 -static gboolean linux_is_cdrom_device( FILE *f )6.52 -{6.53 - int caps = ioctl(fileno(f), CDROM_GET_CAPABILITY);6.54 - if( caps == -1 ) {6.55 - /* Quick check that this is really a CD device */6.56 - return FALSE;6.57 - } else {6.58 - return TRUE;6.59 - }6.60 -}6.61 -6.62 -GList *cdrom_get_native_devices(void)6.63 -{6.64 - GList *list = NULL;6.65 - struct fstab *ent;6.66 - struct stat st;6.67 - setfsent();6.68 - while( (ent = getfsent()) != NULL ) {6.69 - if( (stat(ent->fs_spec, &st) != -1) &&6.70 - S_ISBLK(st.st_mode) ) {6.71 - /* Got a valid block device - is it a CDROM? */6.72 - int fd = open(ent->fs_spec, O_RDONLY|O_NONBLOCK);6.73 - if( fd == -1 )6.74 - continue;6.75 - int caps = ioctl(fd, CDROM_GET_CAPABILITY);6.76 - if( caps != -1 ) {6.77 - /* Appears to support CDROM functions */6.78 - FILE *f = fdopen(fd,"r");6.79 - gdrom_disc_t disc = gdrom_scsi_disc_new(ent->fs_spec, f, &linux_scsi_transport);6.80 - if( disc != NULL ) {6.81 - list = g_list_append( list, gdrom_device_new(disc->name, disc->display_name) );6.82 - disc->destroy(disc,TRUE);6.83 - } else {6.84 - close(fd);6.85 - }6.86 - } else {6.87 - close(fd);6.88 - }6.89 - }6.90 - }6.91 - return list;6.92 -}6.93 -6.94 -gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *path )6.95 -{6.96 - return NULL;6.97 -}6.98 -6.99 -static gdrom_disc_t linux_open_device( const gchar *filename, FILE *f )6.100 -{6.101 - if( !linux_is_cdrom_device(f) ) {6.102 - return NULL;6.103 - }6.104 -6.105 - return gdrom_scsi_disc_new(filename, f, &linux_scsi_transport);6.106 -}6.107 -6.108 -static gboolean linux_media_changed( gdrom_disc_t disc )6.109 -{6.110 - int fd = fileno(disc->file);6.111 - int status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);6.112 - if( status == CDS_DISC_OK ) {6.113 - status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);6.114 - return status == 0 ? FALSE : TRUE;6.115 - } else {6.116 - return disc->disc_type == IDE_DISC_NONE ? FALSE : TRUE;6.117 - }6.118 -}6.119 -6.120 -/**6.121 - * Send a packet command to the device and wait for a response.6.122 - * @return 0 on success, -1 on an operating system error, or a sense error6.123 - * code on a device error.6.124 - */6.125 -static gdrom_error_t linux_packet_read( gdrom_disc_t disc, char *cmd,6.126 - unsigned char *buffer, uint32_t *buflen )6.127 -{6.128 - int fd = fileno(disc->file);6.129 - struct request_sense sense;6.130 - struct cdrom_generic_command cgc;6.131 -6.132 - memset( &cgc, 0, sizeof(cgc) );6.133 - memset( &sense, 0, sizeof(sense) );6.134 - memcpy( cgc.cmd, cmd, 12 );6.135 - cgc.buffer = buffer;6.136 - cgc.buflen = *buflen;6.137 - cgc.sense = &sense;6.138 - cgc.data_direction = CGC_DATA_READ;6.139 -6.140 - if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {6.141 - if( sense.sense_key == 0 ) {6.142 - return -1;6.143 - } else {6.144 - /* TODO: Map newer codes back to the ones used by the gd-rom. */6.145 - return sense.sense_key | (sense.asc<<8);6.146 - }6.147 - } else {6.148 - *buflen = cgc.buflen;6.149 - return 0;6.150 - }6.151 -}6.152 -6.153 -static gdrom_error_t linux_packet_cmd( gdrom_disc_t disc, char *cmd )6.154 -{6.155 - int fd = fileno(disc->file);6.156 - struct request_sense sense;6.157 - struct cdrom_generic_command cgc;6.158 -6.159 - memset( &cgc, 0, sizeof(cgc) );6.160 - memset( &sense, 0, sizeof(sense) );6.161 - memcpy( cgc.cmd, cmd, 12 );6.162 - cgc.buffer = 0;6.163 - cgc.buflen = 0;6.164 - cgc.sense = &sense;6.165 - cgc.data_direction = CGC_DATA_NONE;6.166 -6.167 - if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {6.168 - if( sense.sense_key == 0 ) {6.169 - return -1;6.170 - } else {6.171 - /* TODO: Map newer codes back to the ones used by the gd-rom. */6.172 - return sense.sense_key | (sense.asc<<8);6.173 - }6.174 - } else {6.175 - return 0;6.176 - }6.177 -}
7.1 --- a/src/drivers/cd_mmc.c Sun Jan 31 18:30:13 2010 +10007.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00007.3 @@ -1,242 +0,0 @@7.4 -/**7.5 - * $Id$7.6 - *7.7 - * SCSI/MMC device interface (depends on lower-level SCSI transport)7.8 - *7.9 - * Copyright (c) 2009 Nathan Keynes.7.10 - *7.11 - * This program is free software; you can redistribute it and/or modify7.12 - * it under the terms of the GNU General Public License as published by7.13 - * the Free Software Foundation; either version 2 of the License, or7.14 - * (at your option) any later version.7.15 - *7.16 - * This program is distributed in the hope that it will be useful,7.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of7.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7.19 - * GNU General Public License for more details.7.20 - */7.21 -7.22 -#include <string.h>7.23 -#include "lxdream.h"7.24 -#include "gettext.h"7.25 -#include "gdrom/gddriver.h"7.26 -#include "gdrom/packet.h"7.27 -7.28 -#define MAXTOCENTRIES 600 /* This is a fairly generous overestimate really */7.29 -#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)7.30 -#define MAX_SECTORS_PER_CALL 17.31 -7.32 -#define MSFTOLBA( m,s,f ) (f + (s*CD_FRAMES_PER_SECOND) + (m*CD_FRAMES_PER_MINUTE))7.33 -7.34 -static void mmc_make_read_cd_cmd( char *cmd, uint32_t real_sector, int mode )7.35 -{7.36 - cmd[0] = 0xBE;7.37 - cmd[1] = (mode & 0x0E) << 1;7.38 - cmd[2] = (real_sector >> 24) & 0xFF;7.39 - cmd[3] = (real_sector >> 16) & 0xFF;7.40 - cmd[4] = (real_sector >> 8) & 0xFF;7.41 - cmd[5] = real_sector & 0xFF;7.42 - cmd[6] = 0;7.43 - cmd[7] = 0;7.44 - cmd[8] = 1;7.45 - cmd[9] = 0;7.46 - cmd[10]= 0;7.47 - cmd[11]= 0;7.48 -7.49 - if( READ_CD_RAW(mode) ) {7.50 - cmd[9] = 0xF0;7.51 - } else {7.52 - if( READ_CD_HEADER(mode) ) {7.53 - cmd[9] = 0xA0;7.54 - }7.55 - if( READ_CD_SUBHEAD(mode) ) {7.56 - cmd[9] |= 0x40;7.57 - }7.58 - if( READ_CD_DATA(mode) ) {7.59 - cmd[9] |= 0x10;7.60 - }7.61 - }7.62 -}7.63 -7.64 -/**7.65 - * Parse the TOC (format 2) into the gdrom_disc structure7.66 - */7.67 -void mmc_parse_toc2( gdrom_disc_t disc, unsigned char *buf )7.68 -{7.69 - int max_track = 0;7.70 - int last_track = -1;7.71 - int leadout = -1;7.72 - int len = (buf[0] << 8) | buf[1];7.73 - int session_type = -1;7.74 - int i;7.75 - for( i = 4; i<len; i+=11 ) {7.76 - int session = buf[i];7.77 - int adr = buf[i+1] >> 4;7.78 - int point = buf[i+3];7.79 - if( adr == 0x01 && point > 0 && point < 100 ) {7.80 - /* Track info */7.81 - int trackno = point-1;7.82 - if( point > max_track ) {7.83 - max_track = point;7.84 - }7.85 - disc->track[trackno].flags = (buf[i+1] & 0x0F) << 4;7.86 - disc->track[trackno].session = session - 1;7.87 - disc->track[trackno].lba = MSFTOLBA(buf[i+8],buf[i+9],buf[i+10]);7.88 - if( disc->track[trackno].flags & TRACK_DATA ) {7.89 - disc->track[trackno].mode = GDROM_MODE1;7.90 - } else {7.91 - disc->track[trackno].mode = GDROM_CDDA;7.92 - }7.93 - if( last_track != -1 ) {7.94 - disc->track[last_track].sector_count = disc->track[trackno].lba -7.95 - disc->track[last_track].lba;7.96 - }7.97 - last_track = trackno;7.98 - } else switch( (adr << 8) | point ) {7.99 - case 0x1A0: /* session info */7.100 - if( buf[i+9] == 0x20 ) {7.101 - session_type = IDE_DISC_CDROMXA;7.102 - } else {7.103 - session_type = IDE_DISC_CDROM;7.104 - }7.105 - disc->disc_type = session_type;7.106 - break;7.107 - case 0x1A2: /* leadout */7.108 - leadout = MSFTOLBA(buf[i+8], buf[i+9], buf[i+10]);7.109 - break;7.110 - }7.111 - }7.112 - disc->track_count = max_track;7.113 -7.114 - if( leadout != -1 && last_track != -1 ) {7.115 - disc->track[last_track].sector_count = leadout - disc->track[last_track].lba;7.116 - }7.117 -}7.118 -7.119 -7.120 -/**7.121 - * Construct a drive indentification string based on the response to the7.122 - * INQUIRY command. On success, the disc display_name is updated with the7.123 - * drive name, otherwise the display_name is unchanged.7.124 - * @return PKT_ERR_OK on success, otherwise the host failure code.7.125 - */7.126 -static gdrom_error_t gdrom_scsi_identify_drive( gdrom_disc_t disc )7.127 -{7.128 - unsigned char ident[256];7.129 - uint32_t identlen = 256;7.130 - char cmd[12] = {0x12,0,0,0, 0xFF,0,0,0, 0,0,0,0};7.131 - gdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, ident, &identlen );7.132 - if( status == PKT_ERR_OK ) {7.133 - char vendorid[9];7.134 - char productid[17];7.135 - char productrev[5];7.136 - memcpy( vendorid, ident+8, 8 ); vendorid[8] = 0;7.137 - memcpy( productid, ident+16, 16 ); productid[16] = 0;7.138 - memcpy( productrev, ident+32, 4 ); productrev[4] = 0;7.139 - g_free( (char *)disc->display_name );7.140 - disc->display_name = g_strdup_printf( "%.8s %.16s %.4s", g_strstrip(vendorid),7.141 - g_strstrip(productid), g_strstrip(productrev) );7.142 - }7.143 - return status;7.144 -}7.145 -7.146 -7.147 -static gdrom_error_t gdrom_scsi_read_sector( gdrom_disc_t disc, uint32_t sector,7.148 - int mode, unsigned char *buf, uint32_t *length )7.149 -{7.150 - uint32_t real_sector = sector - GDROM_PREGAP;7.151 - uint32_t sector_size = MAX_SECTOR_SIZE;7.152 - char cmd[12];7.153 -7.154 - mmc_make_read_cd_cmd( cmd, real_sector, mode );7.155 -7.156 - gdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, buf, §or_size );7.157 - if( status != 0 ) {7.158 - return status;7.159 - }7.160 - /* FIXME */7.161 - *length = 2048;7.162 - return 0;7.163 -}7.164 -7.165 -/**7.166 - * Read the full table of contents into the disc from the device.7.167 - */7.168 -static gdrom_error_t gdrom_scsi_read_toc( gdrom_disc_t disc )7.169 -{7.170 - unsigned char buf[MAXTOCSIZE];7.171 - uint32_t buflen = sizeof(buf);7.172 - char cmd[12] = { 0x43, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 };7.173 -7.174 - cmd[7] = (sizeof(buf))>>8;7.175 - cmd[8] = (sizeof(buf))&0xFF;7.176 - memset( buf, 0, sizeof(buf) );7.177 - gdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read(disc, cmd, buf, &buflen );7.178 - if( status == PKT_ERR_OK ) {7.179 - mmc_parse_toc2( disc, buf );7.180 - } else {7.181 - if( (status & 0xFF) != 0x02 ) {7.182 - /* Sense key 2 == Not Ready (ie temporary failure). Just ignore and7.183 - * consider the drive empty for now, but warn about any other errors7.184 - * we get. */7.185 - WARN( _("Unable to read disc table of contents (error %04x)"), status );7.186 - }7.187 - disc->disc_type = IDE_DISC_NONE;7.188 - }7.189 - return status;7.190 -}7.191 -7.192 -static gboolean gdrom_scsi_check_status( gdrom_disc_t disc )7.193 -{7.194 - if( SCSI_TRANSPORT(disc)->media_changed(disc) ) {7.195 - gdrom_scsi_read_toc(disc);7.196 - return TRUE;7.197 - } else {7.198 - return FALSE;7.199 - }7.200 -}7.201 -7.202 -static gdrom_error_t gdrom_scsi_play_audio( gdrom_disc_t disc, uint32_t lba, uint32_t endlba )7.203 -{7.204 - uint32_t real_sector = lba - GDROM_PREGAP;7.205 - uint32_t length = endlba - lba;7.206 -7.207 - char cmd[12] = { 0xA5, 0,0,0, 0,0,0,0, 0,0,0,0 };7.208 - cmd[2] = (real_sector >> 24) & 0xFF;7.209 - cmd[3] = (real_sector >> 16) & 0xFF;7.210 - cmd[4] = (real_sector >> 8) & 0xFF;7.211 - cmd[5] = real_sector & 0xFF;7.212 - cmd[6] = (length >> 24) & 0xFF;7.213 - cmd[7] = (length >> 16) & 0xFF;7.214 - cmd[8] = (length >> 8) & 0xFF;7.215 - cmd[9] = length & 0xFF;7.216 -7.217 - return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );7.218 -}7.219 -7.220 -7.221 -gdrom_error_t gdrom_scsi_stop_audio( gdrom_disc_t disc )7.222 -{7.223 - int fd = fileno(disc->file);7.224 - uint32_t buflen = 0;7.225 - char cmd[12] = {0x4E,0,0,0, 0,0,0,0, 0,0,0,0};7.226 -7.227 - return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );7.228 -}7.229 -7.230 -7.231 -gdrom_disc_t gdrom_scsi_disc_new( const gchar *filename, FILE *f, gdrom_scsi_transport_t scsi )7.232 -{7.233 - gdrom_disc_t disc = gdrom_disc_new(filename,f);7.234 - if( disc != NULL ) {7.235 - /* Initialize */7.236 - disc->impl_data = scsi;7.237 - disc->check_status = gdrom_scsi_check_status;7.238 - disc->read_sector = gdrom_scsi_read_sector;7.239 - disc->play_audio = gdrom_scsi_play_audio;7.240 - disc->run_time_slice = NULL;7.241 - gdrom_scsi_identify_drive(disc);7.242 - gdrom_scsi_read_toc(disc);7.243 - }7.244 - return disc;7.245 -}
8.1 --- a/src/drivers/cd_none.c Sun Jan 31 18:30:13 2010 +10008.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00008.3 @@ -1,47 +0,0 @@8.4 -/**8.5 - * $Id$8.6 - *8.7 - * The "null" cdrom device driver. Just provides a couple of empty stubs.8.8 - *8.9 - * Copyright (c) 2005 Nathan Keynes.8.10 - *8.11 - * This program is free software; you can redistribute it and/or modify8.12 - * it under the terms of the GNU General Public License as published by8.13 - * the Free Software Foundation; either version 2 of the License, or8.14 - * (at your option) any later version.8.15 - *8.16 - * This program is distributed in the hope that it will be useful,8.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of8.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8.19 - * GNU General Public License for more details.8.20 - */8.21 -8.22 -#include "gdrom/gddriver.h"8.23 -8.24 -static gboolean cdnone_image_is_valid( FILE *f );8.25 -static gdrom_disc_t cdnone_open_device( const gchar *filename, FILE *f );8.26 -8.27 -struct gdrom_image_class cdrom_device_class = { "None", NULL,8.28 - cdnone_image_is_valid, cdnone_open_device };8.29 -8.30 -GList *cdrom_get_native_devices(void)8.31 -{8.32 - return NULL;8.33 -}8.34 -8.35 -gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *path )8.36 -{8.37 - return NULL;8.38 -}8.39 -8.40 -8.41 -8.42 -static gboolean cdnone_image_is_valid( FILE *f )8.43 -{8.44 - return FALSE;8.45 -}8.46 -8.47 -static gdrom_disc_t cdnone_open_device( const gchar *filename, FILE *f )8.48 -{8.49 - return NULL;8.50 -}
9.1 --- a/src/drivers/cd_osx.c Sun Jan 31 18:30:13 2010 +10009.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +00009.3 @@ -1,232 +0,0 @@9.4 -/**9.5 - * $Id$9.6 - *9.7 - * OSX native cd-rom driver.9.8 - *9.9 - * Copyright (c) 2005 Nathan Keynes.9.10 - *9.11 - * This program is free software; you can redistribute it and/or modify9.12 - * it under the terms of the GNU General Public License as published by9.13 - * the Free Software Foundation; either version 2 of the License, or9.14 - * (at your option) any later version.9.15 - *9.16 - * This program is distributed in the hope that it will be useful,9.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of9.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9.19 - * GNU General Public License for more details.9.20 - */9.21 -9.22 -#include <IOKit/IOKitLib.h>9.23 -#include <IOKit/IOBSD.h>9.24 -#include <IOKit/storage/IOStorageDeviceCharacteristics.h>9.25 -#include <IOKit/storage/IOCDMediaBSDClient.h>9.26 -#include <IOKit/storage/IOCDTypes.h>9.27 -#include <sys/param.h>9.28 -#include <errno.h>9.29 -#include <stdio.h>9.30 -#include <string.h>9.31 -#include <paths.h>9.32 -#include "gdrom/gddriver.h"9.33 -#include "gdrom/packet.h"9.34 -#include "drivers/osx_iokit.h"9.35 -9.36 -#define MAXTOCENTRIES 600 /* This is a fairly generous overestimate really */9.37 -#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)9.38 -9.39 -static gboolean cdrom_osx_image_is_valid( FILE *f );9.40 -static gdrom_disc_t cdrom_osx_open_device( const gchar *filename, FILE *f );9.41 -static gdrom_error_t cdrom_osx_read_toc( gdrom_disc_t disc );9.42 -static gdrom_error_t cdrom_osx_read_sector( gdrom_disc_t disc, uint32_t sector,9.43 - int mode, unsigned char *buf, uint32_t *length );9.44 -9.45 -struct gdrom_image_class cdrom_device_class = { "osx", NULL,9.46 - cdrom_osx_image_is_valid, cdrom_osx_open_device };9.47 -9.48 -#define OSX_DRIVE(disc) ( (osx_cdrom_drive_t)(((gdrom_disc_t)disc)->impl_data) )9.49 -9.50 -static void cdrom_osx_destroy( gdrom_disc_t disc, gboolean close_fh )9.51 -{9.52 - if( close_fh ) {9.53 - osx_cdrom_close_drive( OSX_DRIVE(disc) );9.54 - }9.55 - gdrom_disc_destroy( disc, FALSE ); /* chain to the main destroy */9.56 -}9.57 -9.58 -static void cdrom_osx_media_changed( osx_cdrom_drive_t drive, gboolean present,9.59 - void *user_data )9.60 -{9.61 - gdrom_disc_t disc = (gdrom_disc_t)user_data;9.62 - if( present ) {9.63 - cdrom_osx_read_toc( disc );9.64 - } else {9.65 - disc->disc_type = IDE_DISC_NONE;9.66 - disc->track_count = 0;9.67 - }9.68 -}9.69 -9.70 -9.71 -static gdrom_disc_t cdrom_osx_new( const char *name, osx_cdrom_drive_t drive )9.72 -{9.73 - char tmp[strlen(name)+7];9.74 - sprintf( tmp, "dvd://%s", name );9.75 - gdrom_disc_t disc = gdrom_disc_new(tmp, NULL);9.76 - disc->impl_data = drive;9.77 -9.78 - disc->read_sector = cdrom_osx_read_sector;9.79 - disc->destroy = cdrom_osx_destroy;9.80 - cdrom_osx_read_toc(disc);9.81 - osx_cdrom_set_media_changed_callback( drive, cdrom_osx_media_changed, disc );9.82 - return (gdrom_disc_t)disc;9.83 -}9.84 -9.85 -gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *path )9.86 -{9.87 - gdrom_disc_t result = NULL;9.88 -9.89 - osx_cdrom_drive_t drive = osx_cdrom_open_drive(path);9.90 - if( drive == NULL ) {9.91 - return NULL;9.92 - } else {9.93 - return cdrom_osx_new( path, drive );9.94 - }9.95 -}9.96 -9.97 -9.98 -9.99 -static gboolean cdrom_enum_callback( io_object_t object, char *vendor, char *product, char *iopath, void *ptr )9.100 -{9.101 - GList **list = (GList **)ptr;9.102 - char tmp1[sizeof(io_string_t) + 6];9.103 - char tmp2[512];9.104 - snprintf( tmp1, sizeof(tmp1), "dvd://%s", iopath );9.105 - snprintf( tmp2, sizeof(tmp2), "%s %s", vendor, product );9.106 - *list = g_list_append( *list, gdrom_device_new( tmp1, tmp2 ) );9.107 - return FALSE;9.108 -}9.109 -9.110 -GList *cdrom_get_native_devices(void)9.111 -{9.112 - GList *list = NULL;9.113 - find_cdrom_drive(cdrom_enum_callback, &list);9.114 -9.115 - osx_register_iokit_notifications();9.116 - return list;9.117 -}9.118 -9.119 -9.120 -9.121 -static gboolean cdrom_osx_image_is_valid( FILE *f )9.122 -{9.123 - return FALSE;9.124 -}9.125 -9.126 -static gdrom_disc_t cdrom_osx_open_device( const gchar *filename, FILE *f )9.127 -{9.128 - return NULL;9.129 -}9.130 -9.131 -static gdrom_error_t cdrom_osx_read_toc( gdrom_disc_t disc )9.132 -{9.133 - osx_cdrom_drive_t drive = OSX_DRIVE(disc);9.134 -9.135 - int fh = osx_cdrom_get_media_handle(drive);9.136 - if( fh == -1 ) {9.137 - disc->disc_type = IDE_DISC_NONE;9.138 - disc->track_count = 0;9.139 - return -1;9.140 - } else {9.141 - unsigned char buf[MAXTOCSIZE];9.142 - dk_cd_read_toc_t readtoc;9.143 - memset( &readtoc, 0, sizeof(readtoc) );9.144 - readtoc.format = 2;9.145 - readtoc.formatAsTime = 0;9.146 - readtoc.address.session = 0;9.147 - readtoc.bufferLength = sizeof(buf);9.148 - readtoc.buffer = buf;9.149 -9.150 - if( ioctl(fh, DKIOCCDREADTOC, &readtoc ) == -1 ) {9.151 - WARN( "Failed to read TOC (%s)", strerror(errno) );9.152 - disc->disc_type = IDE_DISC_NONE;9.153 - disc->track_count = 0;9.154 - return -1;9.155 - } else {9.156 - mmc_parse_toc2( disc, buf );9.157 - }9.158 - }9.159 - return 0;9.160 -}9.161 -9.162 -static gdrom_error_t cdrom_osx_read_sector( gdrom_disc_t disc, uint32_t lba,9.163 - int mode, unsigned char *buf, uint32_t *length )9.164 -{9.165 - int real_lba = lba - 150;9.166 - int sector_size = 2352;9.167 - int direct_read = 1;9.168 - char data[MAX_SECTOR_SIZE];9.169 - osx_cdrom_drive_t drive = OSX_DRIVE(disc);9.170 -9.171 - int fh = osx_cdrom_get_media_handle(drive);9.172 - if( fh == -1 ) {9.173 - return PKT_ERR_NODISC;9.174 - } else {9.175 - dk_cd_read_t readcd;9.176 - memset( &readcd, 0, sizeof(readcd) );9.177 - readcd.buffer = buf;9.178 -9.179 - // This is complicated by needing to know the exact read size. Gah.9.180 - if( READ_CD_RAW(mode) ) {9.181 - sector_size = 2352;9.182 - readcd.sectorArea = 0xF8;9.183 - } else if ( READ_CD_MODE(mode) == READ_CD_MODE_ANY ) {9.184 - /* Sector could be anything - need to do a raw read and then parse9.185 - * the requested data out ourselves9.186 - */9.187 - int track_no = gdrom_disc_get_track_by_lba( disc, lba );9.188 - struct gdrom_track *track = &disc->track[track_no-1];9.189 -9.190 - sector_size = 2352;9.191 - if( track->mode == GDROM_CDDA ) {9.192 - readcd.sectorArea = kCDSectorAreaUser;9.193 - } else {9.194 - readcd.sectorArea = 0xF8;9.195 - readcd.buffer = data;9.196 - direct_read = 0;9.197 - }9.198 - } else {9.199 - // This is incomplete...9.200 - if( READ_CD_DATA(mode) ) {9.201 - readcd.sectorArea = kCDSectorAreaUser;9.202 - switch( READ_CD_MODE(mode) ) {9.203 - case READ_CD_MODE_CDDA:9.204 - sector_size = 2352;9.205 - break;9.206 - case READ_CD_MODE_1:9.207 - case READ_CD_MODE_2_FORM_1:9.208 - sector_size = 2048;9.209 - break;9.210 - case READ_CD_MODE_2:9.211 - sector_size = 2336;9.212 - break;9.213 - case READ_CD_MODE_2_FORM_2:9.214 - sector_size = 2324;9.215 - break;9.216 - }9.217 - }9.218 - }9.219 -9.220 - readcd.offset = sector_size * real_lba;9.221 - readcd.sectorType = READ_CD_MODE(mode)>>1;9.222 - readcd.bufferLength = sector_size;9.223 - if( ioctl( fh, DKIOCCDREAD, &readcd ) == -1 ) {9.224 - return -1;9.225 - }9.226 -9.227 - if( direct_read ) {9.228 - *length = sector_size;9.229 - } else {9.230 - gdrom_extract_raw_data_sector( data, mode, buf, length );9.231 - }9.232 - return 0;9.233 - }9.234 -}9.235 -
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000010.2 +++ b/src/drivers/cdrom/README.LIBEDC Sun Jan 31 18:35:06 2010 +100010.3 @@ -0,0 +1,123 @@10.4 +This describes the program as shipped with cdrkit, a spinoff from the10.5 +cdrtools project. However, the cdrtools developers are no longer10.6 +involved in the development of this spinoff and therefore shall not10.7 +be made responsible for any problem caused by it. Do not try to get10.8 +support for this program by contacting the original authors.10.9 +10.10 +This is a small description for the Reed-Solomon library intended for10.11 +CD sector formatting.10.12 +10.13 +Basics:10.14 +It is assumed that you have a basic knowledge of cd sector formats.10.15 +10.16 +The library can handle three types of sector data:10.17 + data sectors,10.18 + audio sectors, and10.19 + sub channel r-w sectors10.20 +10.21 +Currently only encoding is implemented. Decoding and optionally10.22 +error correction is planned for later.10.23 +10.24 +Stages:10.25 +10.26 +The process of sector formatting has several stages. Beginning with10.27 +a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is10.28 +built. This format can be read raw by SCSI MMC-2 and ATAPI drives and10.29 +is accepted by cd burners. The additions are an optionally 32 bit CRC10.30 +checksum and two layers of Reed-Solomon codes (called Reed-Solomon10.31 +Product Code RSPC).10.32 +This sector is then scrambled (exor'ed with a bitstream).10.33 +The result is called F1 frames. Afterwards even and odd bytes are10.34 +swapped, this is called F2 frames. The result is equivalent to an10.35 +audio sector and is treated as such by the cd burner.10.36 +So, if we wrote a series of sectors (F2 frames) into a CDR file and10.37 +later burned them as 'audio', they would turn up as perfect data sectors.10.38 +10.39 +So, now we are at the level of audio sectors. Audio sectors get their10.40 +own error correction data (called CIRC). Sector size goes up to10.41 +3136 bytes (that is 4/3 times 2352 bytes). Furthermore different10.42 +words get delayed differently and swap positions. The result is ready10.43 +to be fed into the so-called EightFourteenModulator (when subchannels10.44 +have been added).10.45 +10.46 +Now, only sub channels are missing. While the p and q sub10.47 +channels have to be generated elsewhere, any supplied r-w subchannel10.48 +user data is protected by two levels of error correction10.49 +codes. This format is read by cd burners when burning cd+graphics.10.50 +The cdimage is a sequence of sectors, each containing audio data and10.51 +after that subchannel data.10.52 +Similar to audio sectors delaying and permutation of words10.53 +takes place. After that the cd burner would mix sub channel data with10.54 +the formatted audio sectors to feed the EFModulator.10.55 +10.56 +NOTE: Most of the described stages need not to be done in order to10.57 +prepare sectors for burning, since all cd burners do at least CIRC,10.58 +delaying and swaps. For data sectors they also do scrambling and f210.59 +frame generation.10.60 +10.61 +Encoding routines:10.62 +10.63 +For data sectors10.64 + int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);10.65 +10.66 + encodes data sectors. The returned data is __unscrambled__ and not in10.67 + F2-frame format.10.68 +10.69 +Parameters are:10.70 + inout pointer to an array of at least 2352 bytes.10.71 + sectortype One of the MODE_* constants from ecc.h. This defines10.72 + how to format the sector.10.73 + address The logical address to be used in the header10.74 + (150 = 0:2.0 MSF).10.75 +10.76 +NOTE: the data portion has be to aligned properly for performance10.77 +reasons (see ecc.h for details). So, no moves are necessary here.10.78 +10.79 +Generating f2 frames to be used like audio sectors10.80 + int scramble_L2(unsigned char *inout)10.81 +10.82 + generates f2 frames in place from sectors generated by do_encode_L2().10.83 +10.84 +Parameters are:10.85 + inout pointer to an array of at least 2352 bytes.10.86 +10.87 +10.88 +10.89 +For sub channels10.90 + int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],10.91 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*10.92 + PACKETS_PER_SUBCHANNELFRAME],10.93 + int delay1, int permute);10.94 +10.95 + repack user data and add error correction data. P and q subchannels10.96 +should be added later, since all bytes are in place then.10.97 +10.98 +Parameters are:10.99 + in pointer to an array of at least 72 bytes. It contains10.100 + the user data for one frame.10.101 + out pointer to an array of at least 96 bytes. Here is10.102 + output frame is placed.10.103 + delay1 do low level delaying, when set to 1.10.104 + permute do low level permutations, when set to 1.10.105 +10.106 +NOTE: Probably both options need either to be set on (1) or off (0) together.10.107 +10.108 +There is more, but that is seldomly used.10.109 +10.110 +Tests:10.111 +The library is accompanied by small verify programs, that compare real10.112 +raw sectors with the formatted results. They are also intended as demo10.113 +applications (how to use the library). In order to be able to feed10.114 +real raw sectors into them, the package read2448 is recommended/needed.10.115 +You can only verify sector streams of one sector type, currently no mix.10.116 +10.117 +For more information have a look into ecc.h10.118 +10.119 +recommended Documents:10.120 +Yellow Book or ISO 1014910.121 +Appendix Red Book10.122 +Red Book or IEC 90810.123 +10.124 +Source: libedc/README from cdrtools package10.125 +Edited for cdrkit by Christian Fromme <kaner@strace.org>10.126 +
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000011.2 +++ b/src/drivers/cdrom/cd_cdi.c Sun Jan 31 18:35:06 2010 +100011.3 @@ -0,0 +1,192 @@11.4 +/**11.5 + * $Id$11.6 + *11.7 + * CDI CD-image file support11.8 + *11.9 + * Copyright (c) 2005 Nathan Keynes.11.10 + *11.11 + * This program is free software; you can redistribute it and/or modify11.12 + * it under the terms of the GNU General Public License as published by11.13 + * the Free Software Foundation; either version 2 of the License, or11.14 + * (at your option) any later version.11.15 + *11.16 + * This program is distributed in the hope that it will be useful,11.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of11.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11.19 + * GNU General Public License for more details.11.20 + */11.21 +11.22 +#include <stdlib.h>11.23 +#include <stdio.h>11.24 +#include <stdint.h>11.25 +#include <string.h>11.26 +#include <fcntl.h>11.27 +#include <errno.h>11.28 +#include <sys/stat.h>11.29 +#include "drivers/cdrom/cdimpl.h"11.30 +11.31 +#define CDI_V2_ID 0x8000000411.32 +#define CDI_V3_ID 0x8000000511.33 +#define CDI_V35_ID 0x8000000611.34 +11.35 +11.36 +static gboolean cdi_image_is_valid( FILE *f );11.37 +static gboolean cdi_image_read_toc( cdrom_disc_t disc, ERROR *err );11.38 +11.39 +struct cdrom_disc_factory cdi_disc_factory = { "DiscJuggler", "cdi",11.40 + cdi_image_is_valid, NULL, cdi_image_read_toc };11.41 +11.42 +static const char TRACK_START_MARKER[20] = { 0,0,1,0,0,0,255,255,255,255,11.43 + 0,0,1,0,0,0,255,255,255,255 };11.44 +static const char EXT_MARKER[9] = {0,255,255,255,255,255,255,255,255 };11.45 +11.46 +struct cdi_trailer {11.47 + uint32_t cdi_version;11.48 + uint32_t header_offset;11.49 +};11.50 +11.51 +struct cdi_track_data {11.52 + uint32_t pregap_length;11.53 + uint32_t length;11.54 + char unknown2[6];11.55 + uint32_t mode;11.56 + char unknown3[0x0c];11.57 + uint32_t start_lba;11.58 + uint32_t total_length;11.59 + char unknown4[0x10];11.60 + uint32_t sector_size;11.61 + char unknown5[0x1D];11.62 +} __attribute__((packed));11.63 +11.64 +gboolean cdi_image_is_valid( FILE *f )11.65 +{11.66 + int len;11.67 + struct cdi_trailer trail;11.68 +11.69 + fseek( f, -8, SEEK_END );11.70 + len = ftell(f)+8;11.71 + fread( &trail, sizeof(trail), 1, f );11.72 + if( trail.header_offset >= len ||11.73 + trail.header_offset == 0 )11.74 + return FALSE;11.75 + return trail.cdi_version == CDI_V2_ID || trail.cdi_version == CDI_V3_ID ||11.76 + trail.cdi_version == CDI_V35_ID;11.77 +}11.78 +11.79 +#define RETURN_PARSE_ERROR( ... ) do { SET_ERROR(err, EINVAL, __VA_ARGS__); return FALSE; } while(0)11.80 +11.81 +static gboolean cdi_image_read_toc( cdrom_disc_t disc, ERROR *err )11.82 +{11.83 + int i,j;11.84 + uint16_t session_count;11.85 + uint16_t track_count;11.86 + int total_tracks = 0;11.87 + int posn = 0;11.88 + long len;11.89 + struct cdi_trailer trail;11.90 + char marker[20];11.91 +11.92 + FILE *f = cdrom_disc_get_base_file(disc);11.93 + fseek( f, -8, SEEK_END );11.94 + len = ftell(f)+8;11.95 + fread( &trail, sizeof(trail), 1, f );11.96 + if( trail.header_offset >= len ||11.97 + trail.header_offset == 0 ) {11.98 + RETURN_PARSE_ERROR( "Invalid CDI image" );11.99 + }11.100 +11.101 + if( trail.cdi_version != CDI_V2_ID && trail.cdi_version != CDI_V3_ID &&11.102 + trail.cdi_version != CDI_V35_ID ) {11.103 + RETURN_PARSE_ERROR( "Invalid CDI image" );11.104 + }11.105 +11.106 + if( trail.cdi_version == CDI_V35_ID ) {11.107 + fseek( f, -(long)trail.header_offset, SEEK_END );11.108 + } else {11.109 + fseek( f, trail.header_offset, SEEK_SET );11.110 + }11.111 + fread( &session_count, sizeof(session_count), 1, f );11.112 +11.113 + for( i=0; i< session_count; i++ ) {11.114 + fread( &track_count, sizeof(track_count), 1, f );11.115 + if( track_count + total_tracks > 99 ) {11.116 + RETURN_PARSE_ERROR("Invalid number of tracks, bad cdi image" );11.117 + }11.118 + for( j=0; j<track_count; j++ ) {11.119 + struct cdi_track_data trk;11.120 + uint32_t new_fmt = 0;11.121 + uint8_t fnamelen = 0;11.122 + fread( &new_fmt, sizeof(new_fmt), 1, f );11.123 + if( new_fmt != 0 ) { /* Additional data 3.00.780+ ?? */11.124 + fseek( f, 8, SEEK_CUR ); /* Skip */11.125 + }11.126 + fread( marker, 20, 1, f );11.127 + if( memcmp( marker, TRACK_START_MARKER, 20) != 0 ) {11.128 + RETURN_PARSE_ERROR( "Track start marker not found, error reading cdi image" );11.129 + }11.130 + fseek( f, 4, SEEK_CUR );11.131 + fread( &fnamelen, 1, 1, f );11.132 + fseek( f, (int)fnamelen, SEEK_CUR ); /* skip over the filename */11.133 + fseek( f, 19, SEEK_CUR );11.134 + fread( &new_fmt, sizeof(new_fmt), 1, f );11.135 + if( new_fmt == 0x80000000 ) {11.136 + fseek( f, 10, SEEK_CUR );11.137 + } else {11.138 + fseek( f, 2, SEEK_CUR );11.139 + }11.140 + fread( &trk, sizeof(trk), 1, f );11.141 + disc->track[total_tracks].sessionno = i+1;11.142 + disc->track[total_tracks].lba = trk.start_lba;11.143 + cdrom_count_t sector_count = trk.length;11.144 + sector_mode_t mode;11.145 + switch( trk.mode ) {11.146 + case 0:11.147 + mode = SECTOR_CDDA;11.148 + disc->track[total_tracks].flags = 0x01;11.149 + if( trk.sector_size != 2 ) {11.150 + RETURN_PARSE_ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );11.151 + }11.152 + break;11.153 + case 1:11.154 + mode = SECTOR_MODE1;11.155 + disc->track[total_tracks].flags = 0x41;11.156 + if( trk.sector_size != 0 ) {11.157 + RETURN_PARSE_ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );11.158 + }11.159 + break;11.160 + case 2:11.161 + disc->track[total_tracks].flags = 0x41;11.162 + switch( trk.sector_size ) {11.163 + case 0:11.164 + mode = SECTOR_MODE2_FORM1;11.165 + break;11.166 + case 1:11.167 + mode = SECTOR_SEMIRAW_MODE2;11.168 + break;11.169 + case 2:11.170 + default:11.171 + RETURN_PARSE_ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );11.172 + }11.173 + break;11.174 + default:11.175 + RETURN_PARSE_ERROR( "Unsupported track mode %d", trk.mode );11.176 + }11.177 + uint32_t offset = posn +11.178 + trk.pregap_length * CDROM_SECTOR_SIZE(mode);11.179 + disc->track[total_tracks].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );11.180 + posn += trk.total_length * CDROM_SECTOR_SIZE(mode);11.181 + total_tracks++;11.182 + fread( marker, 1, 9, f );11.183 + if( memcmp( marker, EXT_MARKER, 9 ) == 0 ) {11.184 + fseek( f, 79, SEEK_CUR );11.185 + } else {11.186 + fseek( f, -9, SEEK_CUR );11.187 + }11.188 + }11.189 + fseek( f, 12, SEEK_CUR );11.190 + }11.191 +11.192 + disc->track_count = total_tracks;11.193 + disc->session_count = session_count;11.194 + return TRUE;11.195 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000012.2 +++ b/src/drivers/cdrom/cd_gdi.c Sun Jan 31 18:35:06 2010 +100012.3 @@ -0,0 +1,139 @@12.4 +/**12.5 + * $Id$12.6 + *12.7 + * NullDC GDI image format12.8 + *12.9 + * Copyright (c) 2005 Nathan Keynes.12.10 + *12.11 + * This program is free software; you can redistribute it and/or modify12.12 + * it under the terms of the GNU General Public License as published by12.13 + * the Free Software Foundation; either version 2 of the License, or12.14 + * (at your option) any later version.12.15 + *12.16 + * This program is distributed in the hope that it will be useful,12.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of12.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12.19 + * GNU General Public License for more details.12.20 + */12.21 +12.22 +#include <stdlib.h>12.23 +#include <stdio.h>12.24 +#include <stdint.h>12.25 +#include <string.h>12.26 +#include <fcntl.h>12.27 +#include <errno.h>12.28 +#include <sys/stat.h>12.29 +#include <glib/gutils.h>12.30 +#include <glib/gstrfuncs.h>12.31 +#include "drivers/cdrom/cdimpl.h"12.32 +12.33 +12.34 +static gboolean gdi_image_is_valid( FILE *f );12.35 +static gboolean gdi_image_read_toc( cdrom_disc_t disc, ERROR *err );12.36 +12.37 +struct cdrom_disc_factory gdi_disc_factory = { "NullDC GD-Rom Image", "gdi",12.38 + gdi_image_is_valid, NULL, gdi_image_read_toc };12.39 +12.40 +static gboolean gdi_image_is_valid( FILE *f )12.41 +{12.42 + char line[512];12.43 + uint32_t track_count;12.44 +12.45 + fseek(f, 0, SEEK_SET);12.46 + if( fgets( line, sizeof(line), f ) == NULL ) {12.47 + return FALSE;12.48 + }12.49 + track_count = strtoul(line, NULL, 0);12.50 + if( track_count == 0 || track_count > 99 ) {12.51 + return FALSE;12.52 + }12.53 + return TRUE;12.54 +}12.55 +12.56 +static gboolean gdi_image_read_toc( cdrom_disc_t disc, ERROR *err )12.57 +{12.58 + int i;12.59 + uint32_t track_count;12.60 + struct stat st;12.61 + char line[512];12.62 + int session = 1;12.63 + gchar *dirname;12.64 +12.65 + FILE *f = cdrom_disc_get_base_file(disc);12.66 +12.67 + fseek(f, 0, SEEK_SET);12.68 +12.69 + if( fgets( line, sizeof(line), f ) == NULL ) {12.70 + SET_ERROR( err, EINVAL, "Invalid GDI image" );12.71 + return FALSE;12.72 + }12.73 + track_count = strtoul(line, NULL, 0);12.74 + if( track_count == 0 || track_count > 99 ) {12.75 + SET_ERROR( err, EINVAL, "Invalid GDI image" );12.76 + return FALSE;12.77 + }12.78 +12.79 + dirname = g_path_get_dirname(disc->name);12.80 + disc->disc_type = CDROM_DISC_GDROM;12.81 + disc->track_count = track_count;12.82 + disc->session_count = 2;12.83 + for( i=0; i<track_count; i++ ) {12.84 + int track_no, start_lba, flags, size, offset;12.85 + char filename[256];12.86 +12.87 + if( fgets( line, sizeof(line), f ) == NULL ) {12.88 + cdrom_disc_unref(disc);12.89 + SET_ERROR( err, EINVAL, "Invalid GDI image - unexpected end of file" );12.90 + return FALSE;12.91 + }12.92 + sscanf( line, "%d %d %d %d %s %d", &track_no, &start_lba, &flags, &size,12.93 + filename, &offset );12.94 + if( start_lba >= 45000 ) {12.95 + session = 2;12.96 + }12.97 + disc->track[i].sessionno = session;12.98 + disc->track[i].lba = start_lba;12.99 + disc->track[i].flags = (flags & 0x0F)<<4;12.100 +12.101 + sector_mode_t mode;12.102 + if( disc->track[i].flags & TRACK_FLAG_DATA ) {12.103 + /* Data track */12.104 + switch(size) {12.105 + case 0: mode = SECTOR_MODE2_FORM1; break; /* Default */12.106 + case 2048: mode = SECTOR_MODE2_FORM1; break;12.107 + case 2324: mode = SECTOR_MODE2_FORM2; break;12.108 + case 2336: mode = SECTOR_SEMIRAW_MODE2; break;12.109 + case 2352: mode = SECTOR_RAW_XA; break;12.110 + default:12.111 + SET_ERROR( err, EINVAL, "Invalid sector size '%d' in GDI track %d", size, (i+1) );12.112 + g_free(dirname);12.113 + return FALSE;12.114 + }12.115 + } else {12.116 + /* Audio track */12.117 + mode = SECTOR_CDDA;12.118 + if( size == 0 )12.119 + size = 2352;12.120 + else if( size != 2352 ) {12.121 + SET_ERROR( err, EINVAL, "Invalid sector size '%d' for audio track %d", size, (i+1) );12.122 + g_free(dirname);12.123 + return FALSE;12.124 + }12.125 + }12.126 + if( strcasecmp( filename, "none" ) == 0 ) {12.127 + disc->track[i].source = null_sector_source_new( mode, 0 );12.128 + } else {12.129 + gchar *pathname = g_strdup_printf( "%s%c%s", dirname, G_DIR_SEPARATOR, filename );12.130 + disc->track[i].source = file_sector_source_new_filename( pathname, mode,12.131 + offset, FILE_SECTOR_FULL_FILE );12.132 + g_free(pathname);12.133 + if( disc->track[i].source == NULL ) {12.134 + SET_ERROR( err, ENOENT, "GDI track file '%s' could not be opened (%s)", filename, strerror(errno) );12.135 + g_free(dirname);12.136 + return FALSE;12.137 + }12.138 + }12.139 + }12.140 + g_free(dirname);12.141 + return TRUE;12.142 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000013.2 +++ b/src/drivers/cdrom/cd_linux.c Sun Jan 31 18:35:06 2010 +100013.3 @@ -0,0 +1,179 @@13.4 +/**13.5 + * $Id$13.6 + *13.7 + * Linux cd-rom device driver. Implemented using the SCSI transport.13.8 + *13.9 + * Copyright (c) 2005 Nathan Keynes.13.10 + *13.11 + * This program is free software; you can redistribute it and/or modify13.12 + * it under the terms of the GNU General Public License as published by13.13 + * the Free Software Foundation; either version 2 of the License, or13.14 + * (at your option) any later version.13.15 + *13.16 + * This program is distributed in the hope that it will be useful,13.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of13.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13.19 + * GNU General Public License for more details.13.20 + */13.21 +#include <unistd.h>13.22 +#include <stdlib.h>13.23 +#include <stdio.h>13.24 +#include <string.h>13.25 +#include <errno.h>13.26 +#include <ctype.h>13.27 +#include <linux/cdrom.h>13.28 +#include <sys/stat.h>13.29 +#include <sys/ioctl.h>13.30 +#include <fstab.h>13.31 +#include <fcntl.h>13.32 +13.33 +#include "drivers/cdrom/cdimpl.h"13.34 +13.35 +static gboolean linux_is_cdrom_device( FILE *f );13.36 +static gboolean linux_cdrom_disc_init( cdrom_disc_t disc, ERROR *err );13.37 +static cdrom_disc_t linux_cdrom_drive_open( cdrom_drive_t drive, ERROR *err );13.38 +static cdrom_error_t linux_cdrom_do_cmd( int fd, char *cmd,13.39 + unsigned char *buf, unsigned int *buflen, unsigned char direction );13.40 +static cdrom_error_t linux_packet_read( cdrom_disc_t disc, char *cmd,13.41 + unsigned char *buf, uint32_t *buflen );13.42 +static cdrom_error_t linux_packet_cmd( cdrom_disc_t disc, char *cmd );13.43 +static gboolean linux_media_changed( cdrom_disc_t disc );13.44 +13.45 +13.46 +struct cdrom_disc_factory linux_cdrom_drive_factory = { "Linux", NULL,13.47 + linux_is_cdrom_device, linux_cdrom_disc_init, cdrom_disc_scsi_read_toc };13.48 +13.49 +static struct cdrom_scsi_transport linux_scsi_transport = {13.50 + linux_packet_read, linux_packet_cmd, linux_media_changed };13.51 +13.52 +static gboolean linux_is_cdrom_device( FILE *f )13.53 +{13.54 + int caps = ioctl(fileno(f), CDROM_GET_CAPABILITY);13.55 + if( caps == -1 ) {13.56 + /* Quick check that this is really a CD device */13.57 + return FALSE;13.58 + } else {13.59 + return TRUE;13.60 + }13.61 +}13.62 +13.63 +void cdrom_drive_scan(void)13.64 +{13.65 + unsigned char ident[256];13.66 + uint32_t identlen;13.67 + char cmd[12] = {0x12,0,0,0, 0xFF,0,0,0, 0,0,0,0};13.68 +13.69 + struct fstab *ent;13.70 + struct stat st;13.71 + setfsent();13.72 + while( (ent = getfsent()) != NULL ) {13.73 + if( (stat(ent->fs_spec, &st) != -1) &&13.74 + S_ISBLK(st.st_mode) ) {13.75 + /* Got a valid block device - is it a CDROM? */13.76 + int fd = open(ent->fs_spec, O_RDONLY|O_NONBLOCK);13.77 + if( fd == -1 )13.78 + continue;13.79 + int caps = ioctl(fd, CDROM_GET_CAPABILITY);13.80 + if( caps != -1 ) {13.81 + /* Appears to support CDROM functions */13.82 + identlen = sizeof(ident);13.83 + if( linux_cdrom_do_cmd( fd, cmd, ident, &identlen, CGC_DATA_READ ) ==13.84 + CDROM_ERROR_OK ) {13.85 + const char *drive_name = mmc_parse_inquiry( ident );13.86 + cdrom_drive_add( ent->fs_spec, drive_name, linux_cdrom_drive_open );13.87 + }13.88 + }13.89 + close(fd);13.90 + }13.91 + }13.92 +}13.93 +13.94 +gboolean linux_cdrom_disc_init( cdrom_disc_t disc, ERROR *err )13.95 +{13.96 + if( linux_is_cdrom_device( cdrom_disc_get_base_file(disc) ) ) {13.97 + cdrom_disc_scsi_init(disc, &linux_scsi_transport);13.98 + return TRUE;13.99 + } else {13.100 + return FALSE;13.101 + }13.102 +}13.103 +13.104 +cdrom_disc_t linux_cdrom_drive_open( cdrom_drive_t drive, ERROR *err )13.105 +{13.106 +13.107 + int fd = open(drive->name, O_RDONLY|O_NONBLOCK);13.108 + if( fd == -1 ) {13.109 + SET_ERROR(err, errno, "Unable to open device '%s': %s", drive->name, strerror(errno) );13.110 + return NULL;13.111 + } else {13.112 + FILE *f = fdopen(fd,"ro");13.113 + if( !linux_is_cdrom_device(f) ) {13.114 + SET_ERROR(err, EINVAL, "Device '%s' is not a CDROM drive", drive->name );13.115 + return NULL;13.116 + }13.117 + return cdrom_disc_scsi_new_file(f, drive->name, &linux_scsi_transport, err);13.118 + }13.119 +}13.120 +13.121 +static gboolean linux_media_changed( cdrom_disc_t disc )13.122 +{13.123 + int fd = cdrom_disc_get_base_fd(disc);13.124 + int status = ioctl(fd, CDROM_DRIVE_STATUS, CDSL_CURRENT);13.125 + if( status == CDS_DISC_OK ) {13.126 + status = ioctl(fd, CDROM_MEDIA_CHANGED, CDSL_CURRENT);13.127 + return status == 0 ? FALSE : TRUE;13.128 + } else {13.129 + return disc->disc_type == CDROM_DISC_NONE ? FALSE : TRUE;13.130 + }13.131 +}13.132 +13.133 +static cdrom_error_t linux_cdrom_do_cmd( int fd, char *cmd,13.134 + unsigned char *buffer, unsigned int *buflen,13.135 + unsigned char direction )13.136 +{13.137 + struct request_sense sense;13.138 + struct cdrom_generic_command cgc;13.139 +13.140 + memset( &cgc, 0, sizeof(cgc) );13.141 + memset( &sense, 0, sizeof(sense) );13.142 + memcpy( cgc.cmd, cmd, 12 );13.143 + cgc.buffer = buffer;13.144 + if( buflen == NULL )13.145 + cgc.buflen = 0;13.146 + else13.147 + cgc.buflen = *buflen;13.148 + cgc.sense = &sense;13.149 + cgc.data_direction = direction;13.150 +13.151 + if( ioctl(fd, CDROM_SEND_PACKET, &cgc) < 0 ) {13.152 + if( sense.sense_key == 0 ) {13.153 + return -1;13.154 + } else {13.155 + return sense.sense_key | (sense.asc<<8);13.156 + }13.157 + } else {13.158 + if( buflen != NULL )13.159 + *buflen = cgc.buflen;13.160 + return CDROM_ERROR_OK;13.161 + }13.162 +13.163 +}13.164 +13.165 +/**13.166 + * Send a packet command to the device and wait for a response.13.167 + * @return 0 on success, -1 on an operating system error, or a sense error13.168 + * code on a device error.13.169 + */13.170 +static cdrom_error_t linux_packet_read( cdrom_disc_t disc, char *cmd,13.171 + unsigned char *buffer, unsigned int *buflen )13.172 +{13.173 + int fd = cdrom_disc_get_base_fd(disc);13.174 + return linux_cdrom_do_cmd( fd, cmd, buffer, buflen, CGC_DATA_READ );13.175 +}13.176 +13.177 +static cdrom_error_t linux_packet_cmd( cdrom_disc_t disc, char *cmd )13.178 +{13.179 + int fd = cdrom_disc_get_base_fd(disc);13.180 + return linux_cdrom_do_cmd( fd, cmd, NULL, NULL, CGC_DATA_NONE );13.181 +}13.182 +
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000014.2 +++ b/src/drivers/cdrom/cd_mmc.c Sun Jan 31 18:35:06 2010 +100014.3 @@ -0,0 +1,238 @@14.4 +/**14.5 + * $Id$14.6 + *14.7 + * SCSI/MMC device interface (depends on lower-level SCSI transport)14.8 + *14.9 + * Copyright (c) 2009 Nathan Keynes.14.10 + *14.11 + * This program is free software; you can redistribute it and/or modify14.12 + * it under the terms of the GNU General Public License as published by14.13 + * the Free Software Foundation; either version 2 of the License, or14.14 + * (at your option) any later version.14.15 + *14.16 + * This program is distributed in the hope that it will be useful,14.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of14.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14.19 + * GNU General Public License for more details.14.20 + */14.21 +14.22 +#include <assert.h>14.23 +#include <string.h>14.24 +#include <glib/gstrfuncs.h>14.25 +#include "lxdream.h"14.26 +#include "gettext.h"14.27 +#include "drivers/cdrom/cdimpl.h"14.28 +14.29 +#define MAXTOCENTRIES 600 /* This is a fairly generous overestimate really */14.30 +#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)14.31 +#define MAX_SECTORS_PER_CALL 114.32 +14.33 +/**14.34 + * Parse the TOC (format 2) into the cdrom_disc structure14.35 + */14.36 +void mmc_parse_toc2( cdrom_disc_t disc, unsigned char *buf )14.37 +{14.38 + int max_track = 0;14.39 + int max_session = 0;14.40 + int last_track = -1;14.41 + int leadout = -1;14.42 + int len = (buf[0] << 8) | buf[1];14.43 + int session_type = -1;14.44 + int i;14.45 + for( i = 4; i<len; i+=11 ) {14.46 + int session = buf[i];14.47 + int adr = buf[i+1] >> 4;14.48 + int point = buf[i+3];14.49 + if( adr == 0x01 && point > 0 && point < 100 ) {14.50 + /* Track info */14.51 + int trackno = point-1;14.52 + if( point > max_track ) {14.53 + max_track = point;14.54 + }14.55 + if( session > max_session ) {14.56 + max_session = session;14.57 + }14.58 + disc->track[trackno].trackno = point;14.59 + disc->track[trackno].flags = (buf[i+1] & 0x0F) << 4;14.60 + disc->track[trackno].sessionno = session;14.61 + disc->track[trackno].lba = MSFTOLBA(buf[i+8],buf[i+9],buf[i+10]);14.62 + last_track = trackno;14.63 + } else switch( (adr << 8) | point ) {14.64 + case 0x1A0: /* session info */14.65 + if( buf[i+9] == 0x20 ) {14.66 + session_type = CDROM_DISC_XA;14.67 + } else {14.68 + session_type = CDROM_DISC_NONXA;14.69 + }14.70 + disc->disc_type = session_type;14.71 + break;14.72 + case 0x1A2: /* leadout */14.73 + disc->leadout = MSFTOLBA(buf[i+8], buf[i+9], buf[i+10]);14.74 + break;14.75 + }14.76 + }14.77 + disc->track_count = max_track;14.78 + disc->session_count = max_session;14.79 +}14.80 +14.81 +14.82 +const char *mmc_parse_inquiry( unsigned char *buf )14.83 +{14.84 + char vendorid[9];14.85 + char productid[17];14.86 + char productrev[5];14.87 + memcpy( vendorid, buf+8, 8 ); vendorid[8] = 0;14.88 + memcpy( productid, buf+16, 16 ); productid[16] = 0;14.89 + memcpy( productrev, buf+32, 4 ); productrev[4] = 0;14.90 + return g_strdup_printf( "%.8s %.16s %.4s", g_strstrip(vendorid),14.91 + g_strstrip(productid), g_strstrip(productrev) );14.92 +}14.93 +14.94 +/**14.95 + * Construct a drive indentification string based on the response to the14.96 + * INQUIRY command. On success, returns the disc identification as a newly14.97 + * allocated string, otherwise NULL.14.98 + */14.99 +const char *cdrom_disc_scsi_identify_drive( cdrom_disc_t disc )14.100 +{14.101 + unsigned char ident[256];14.102 + uint32_t identlen = 256;14.103 + char cmd[12] = {0x12,0,0,0, 0xFF,0,0,0, 0,0,0,0};14.104 + cdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, ident, &identlen );14.105 + if( status == CDROM_ERROR_OK ) {14.106 + return mmc_parse_inquiry(ident);14.107 + }14.108 + return NULL;14.109 +}14.110 +14.111 +14.112 +static cdrom_error_t cdrom_disc_scsi_read_sectors( sector_source_t source, cdrom_lba_t lba,14.113 + cdrom_count_t count, cdrom_read_mode_t mode, unsigned char *buf, size_t *length )14.114 +{14.115 + assert( IS_SECTOR_SOURCE_TYPE(source,DISC_SECTOR_SOURCE) );14.116 + cdrom_disc_t disc = (cdrom_disc_t)source;14.117 + uint32_t sector_size = CDROM_MAX_SECTOR_SIZE;14.118 + char cmd[12];14.119 +14.120 + cmd[0] = 0xBE;14.121 + cmd[1] = CDROM_READ_TYPE(mode);14.122 + cmd[2] = (lba >> 24) & 0xFF;14.123 + cmd[3] = (lba >> 16) & 0xFF;14.124 + cmd[4] = (lba >> 8) & 0xFF;14.125 + cmd[5] = lba & 0xFF;14.126 + cmd[6] = (count>>16) & 0xFF;14.127 + cmd[7] = (count>>8) & 0xFF;14.128 + cmd[8] = count & 0xFF;14.129 + cmd[9] = CDROM_READ_FIELDS(mode)>>8;14.130 + cmd[10]= 0;14.131 + cmd[11]= 0;14.132 +14.133 + cdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read( disc, cmd, buf, §or_size );14.134 + if( status != 0 ) {14.135 + return status;14.136 + }14.137 + /* FIXME */14.138 + *length = 2048;14.139 + return 0;14.140 +}14.141 +14.142 +/**14.143 + * Read the full table of contents into the disc from the device.14.144 + */14.145 +gboolean cdrom_disc_scsi_read_toc( cdrom_disc_t disc, ERROR *err )14.146 +{14.147 + unsigned char buf[MAXTOCSIZE];14.148 + uint32_t buflen = sizeof(buf);14.149 + char cmd[12] = { 0x43, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 };14.150 +14.151 + cmd[7] = (sizeof(buf))>>8;14.152 + cmd[8] = (sizeof(buf))&0xFF;14.153 + memset( buf, 0, sizeof(buf) );14.154 + cdrom_error_t status = SCSI_TRANSPORT(disc)->packet_read(disc, cmd, buf, &buflen );14.155 + if( status == CDROM_ERROR_OK ) {14.156 + mmc_parse_toc2( disc, buf );14.157 + return TRUE;14.158 + } else {14.159 + if( (status & 0xFF) != 0x02 ) {14.160 + /* Sense key 2 == Not Ready (ie temporary failure). Just ignore and14.161 + * consider the drive empty for now, but warn about any other errors14.162 + * we get. */14.163 + WARN( _("Unable to read disc table of contents (error %04x)"), status );14.164 + }14.165 + cdrom_disc_clear_toc(disc);14.166 + return FALSE;14.167 + }14.168 +}14.169 +14.170 +static gboolean cdrom_disc_scsi_check_media( cdrom_disc_t disc )14.171 +{14.172 + if( SCSI_TRANSPORT(disc)->media_changed(disc) ) {14.173 + cdrom_disc_scsi_read_toc(disc, NULL);14.174 + return TRUE;14.175 + } else {14.176 + return FALSE;14.177 + }14.178 +}14.179 +14.180 +static cdrom_error_t cdrom_disc_scsi_play_audio( cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t length )14.181 +{14.182 + char cmd[12] = { 0xA5, 0,0,0, 0,0,0,0, 0,0,0,0 };14.183 + cmd[2] = (lba >> 24) & 0xFF;14.184 + cmd[3] = (lba >> 16) & 0xFF;14.185 + cmd[4] = (lba >> 8) & 0xFF;14.186 + cmd[5] = lba & 0xFF;14.187 + cmd[6] = (length >> 24) & 0xFF;14.188 + cmd[7] = (length >> 16) & 0xFF;14.189 + cmd[8] = (length >> 8) & 0xFF;14.190 + cmd[9] = length & 0xFF;14.191 +14.192 + return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );14.193 +}14.194 +14.195 +14.196 +static cdrom_error_t cdrom_disc_scsi_stop_audio( cdrom_disc_t disc )14.197 +{14.198 + uint32_t buflen = 0;14.199 + char cmd[12] = {0x4E,0,0,0, 0,0,0,0, 0,0,0,0};14.200 +14.201 + return SCSI_TRANSPORT(disc)->packet_cmd( disc, cmd );14.202 +}14.203 +14.204 +void cdrom_disc_scsi_init( cdrom_disc_t disc, cdrom_scsi_transport_t scsi )14.205 +{14.206 + disc->impl_data = scsi;14.207 + disc->source.read_sectors = cdrom_disc_scsi_read_sectors;14.208 + disc->read_toc = cdrom_disc_scsi_read_toc;14.209 + disc->check_media = cdrom_disc_scsi_check_media;14.210 + disc->play_audio = cdrom_disc_scsi_play_audio;14.211 + disc->stop_audio = cdrom_disc_scsi_stop_audio;14.212 +}14.213 +14.214 +cdrom_disc_t cdrom_disc_scsi_new( const char *filename, cdrom_scsi_transport_t scsi, ERROR *err )14.215 +{14.216 + cdrom_disc_t disc = cdrom_disc_new(filename, err);14.217 + if( disc != NULL ) {14.218 + /* Initialize */14.219 + cdrom_disc_scsi_init( disc, scsi );14.220 + cdrom_disc_read_toc(disc, err);14.221 + }14.222 + return disc;14.223 +}14.224 +14.225 +cdrom_disc_t cdrom_disc_scsi_new_file( FILE *f, const char *filename, cdrom_scsi_transport_t scsi, ERROR *err )14.226 +{14.227 + cdrom_disc_t disc = cdrom_disc_new(filename, err);14.228 + if( disc != NULL ) {14.229 + /* Initialize */14.230 + disc->base_source = file_sector_source_new( f, SECTOR_UNKNOWN, 0, 0, TRUE );14.231 + if( disc->base_source != NULL ) {14.232 + sector_source_ref( disc->base_source );14.233 + cdrom_disc_scsi_init( disc, scsi );14.234 + cdrom_disc_read_toc(disc, err);14.235 + } else {14.236 + cdrom_disc_unref(disc);14.237 + disc = NULL;14.238 + }14.239 + }14.240 + return disc;14.241 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000015.2 +++ b/src/drivers/cdrom/cd_none.c Sun Jan 31 18:35:06 2010 +100015.3 @@ -0,0 +1,23 @@15.4 +/**15.5 + * $Id$15.6 + *15.7 + * The "null" cdrom device driver. Just provides a couple of empty stubs.15.8 + *15.9 + * Copyright (c) 2005 Nathan Keynes.15.10 + *15.11 + * This program is free software; you can redistribute it and/or modify15.12 + * it under the terms of the GNU General Public License as published by15.13 + * the Free Software Foundation; either version 2 of the License, or15.14 + * (at your option) any later version.15.15 + *15.16 + * This program is distributed in the hope that it will be useful,15.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of15.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15.19 + * GNU General Public License for more details.15.20 + */15.21 +15.22 +#include "drivers/cdrom/cdimpl.h"15.23 +15.24 +void cdrom_drive_scan(void )15.25 +{15.26 +}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000016.2 +++ b/src/drivers/cdrom/cd_nrg.c Sun Jan 31 18:35:06 2010 +100016.3 @@ -0,0 +1,331 @@16.4 +/**16.5 + * $Id$16.6 + *16.7 + * Nero (NRG) CD file format. File information stolen shamelessly from16.8 + * libcdio.16.9 + *16.10 + * Copyright (c) 2005 Nathan Keynes.16.11 + *16.12 + * This program is free software; you can redistribute it and/or modify16.13 + * it under the terms of the GNU General Public License as published by16.14 + * the Free Software Foundation; either version 2 of the License, or16.15 + * (at your option) any later version.16.16 + *16.17 + * This program is distributed in the hope that it will be useful,16.18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of16.19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16.20 + * GNU General Public License for more details.16.21 + */16.22 +16.23 +#include <assert.h>16.24 +#include <stdio.h>16.25 +#include <errno.h>16.26 +#include "drivers/cdrom/cdimpl.h"16.27 +#include "dream.h"16.28 +16.29 +static gboolean nrg_image_is_valid( FILE *f );16.30 +static gboolean nrg_image_read_toc( cdrom_disc_t disc, ERROR *err );16.31 +16.32 +struct cdrom_disc_factory nrg_disc_factory = { "Nero", "nrg",16.33 + nrg_image_is_valid, NULL, nrg_image_read_toc };16.34 +16.35 +#define NERO_V55_ID 0x4e45523516.36 +#define NERO_V50_ID 0x4e45524f16.37 +16.38 +/* Courtesy of libcdio */16.39 +/* 5.0 or earlier */16.40 +#define NERO_ID 0x4e45524f /* Nero pre 5.5.x */16.41 +#define CUES_ID 0x43554553 /* Nero pre version 5.5.x-6.x */16.42 +#define DAOI_ID 0x44414f4916.43 +#define ETNF_ID 0x45544e4616.44 +#define SINF_ID 0x53494e46 /* Session information */16.45 +#define END_ID 0x454e442116.46 +/* 5.5+ only */16.47 +#define NER5_ID 0x4e455235 /* Nero version 5.5.x */16.48 +#define CDTX_ID 0x43445458 /* CD TEXT */16.49 +#define CUEX_ID 0x43554558 /* Nero version 5.5.x-6.x */16.50 +#define DAOX_ID 0x44414f58 /* Nero version 5.5.x-6.x */16.51 +#define ETN2_ID 0x45544e3216.52 +#define MTYP_ID 0x4d545950 /* Disc Media type? */16.53 +16.54 +16.55 +union nrg_footer {16.56 + struct nrg_footer_v50 {16.57 + uint32_t dummy;16.58 + uint32_t id;16.59 + uint32_t offset;16.60 + } v50;16.61 + struct nrg_footer_v55 {16.62 + uint32_t id;16.63 + uint64_t offset;16.64 + } v55;16.65 +};16.66 +16.67 +struct nrg_chunk {16.68 + uint32_t id;16.69 + uint32_t length;16.70 +};16.71 +16.72 +struct nrg_etnf {16.73 + uint32_t offset;16.74 + uint32_t length;16.75 + uint32_t mode;16.76 + uint32_t lba;16.77 + uint32_t padding;16.78 +};16.79 +16.80 +struct nrg_etn2 {16.81 + uint64_t offset;16.82 + uint64_t length;16.83 + uint32_t mode;16.84 + uint32_t lba;16.85 + uint64_t padding;16.86 +};16.87 +16.88 +struct nrg_cues {16.89 + uint8_t type;16.90 + uint8_t track;16.91 + uint8_t control;16.92 + uint8_t pad;16.93 + uint32_t addr;16.94 +};16.95 +16.96 +struct nrg_daoi {16.97 + uint32_t length;16.98 + char mcn[14];16.99 + uint8_t disc_mode;16.100 + uint8_t unknown[2]; /* always 01 01? */16.101 + uint8_t track_count;16.102 + struct nrg_daoi_track {16.103 + char unknown[10];16.104 + uint32_t sector_size __attribute__((packed)); /* Always 0? */16.105 + uint8_t mode;16.106 + uint8_t unknown2[3]; /* Always 00 00 01? */16.107 + uint32_t pregap __attribute__((packed));16.108 + uint32_t offset __attribute__((packed));16.109 + uint32_t end __attribute__((packed));16.110 + } track[0];16.111 +} __attribute__((packed));16.112 +16.113 +struct nrg_daox {16.114 + uint32_t length;16.115 + char mcn[14];16.116 + uint8_t disc_mode;16.117 + uint8_t unknown[2]; /* always 01 01? */16.118 + uint8_t track_count;16.119 + struct nrg_daox_track {16.120 + char unknown[10];16.121 + uint32_t sector_size __attribute__((packed)); /* Always 0? */16.122 + uint8_t mode;16.123 + uint8_t unknown2[3]; /* Always 00 00 01? */16.124 + uint64_t pregap __attribute__((packed));16.125 + uint64_t offset __attribute__((packed));16.126 + uint64_t end __attribute__((packed));16.127 + } track[0];16.128 +} __attribute__((packed));16.129 +16.130 +16.131 +sector_mode_t static nrg_track_mode( uint8_t mode )16.132 +{16.133 + switch( mode ) {16.134 + case 0: return SECTOR_MODE1;16.135 + case 2: return SECTOR_MODE2_FORM1;16.136 + case 3: return SECTOR_SEMIRAW_MODE2;16.137 + case 7: return SECTOR_CDDA;16.138 + default: return -1;16.139 + }16.140 +}16.141 +16.142 +static gboolean nrg_image_is_valid( FILE *f )16.143 +{16.144 + union nrg_footer footer;16.145 +16.146 + fseek( f, -12, SEEK_END );16.147 + fread( &footer, sizeof(footer), 1, f );16.148 + if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ||16.149 + GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {16.150 + return TRUE;16.151 + } else {16.152 + return FALSE;16.153 + }16.154 +}16.155 +16.156 +#define RETURN_PARSE_ERROR( ... ) do { SET_ERROR(err, EINVAL, __VA_ARGS__); return FALSE; } while(0)16.157 +16.158 +static gboolean nrg_image_read_toc( cdrom_disc_t disc, ERROR *err )16.159 +{16.160 + union nrg_footer footer;16.161 + struct nrg_chunk chunk;16.162 + struct nrg_daoi *dao;16.163 + struct nrg_daox *daox;16.164 + struct nrg_etnf *etnf;16.165 + struct nrg_etn2 *etn2;16.166 + gboolean end = FALSE;16.167 + uint32_t chunk_id;16.168 + int session_id = 1;16.169 + int session_track_id = 0;16.170 + int track_id = 0;16.171 + int cue_track_id = 0, cue_track_count = 0;16.172 + int i, count;16.173 +16.174 + FILE *f = cdrom_disc_get_base_file(disc);16.175 +16.176 + fseek( f, -12, SEEK_END );16.177 + fread( &footer, sizeof(footer), 1, f );16.178 + if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ) {16.179 + fseek( f, GUINT32_FROM_BE(footer.v50.offset), SEEK_SET );16.180 + } else if( GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {16.181 + fseek( f, (uint32_t)GUINT64_FROM_BE(footer.v55.offset), SEEK_SET );16.182 + } else {16.183 + /* Not a (recognized) Nero image (should never happen) */16.184 + RETURN_PARSE_ERROR("File is not an NRG image" );16.185 + }16.186 +16.187 + do {16.188 + fread( &chunk, sizeof(chunk), 1, f );16.189 + chunk.length = GUINT32_FROM_BE(chunk.length);16.190 + char data[chunk.length];16.191 + fread( data, chunk.length, 1, f );16.192 + chunk_id = GUINT32_FROM_BE(chunk.id);16.193 + switch( chunk_id ) {16.194 + case CUES_ID:16.195 + case CUEX_ID:16.196 + cue_track_id = track_id;16.197 + cue_track_count = ((chunk.length / sizeof(struct nrg_cues)) >> 1) - 1;16.198 + track_id += cue_track_count;16.199 + for( i=0; i<chunk.length; i+= sizeof(struct nrg_cues) ) {16.200 + struct nrg_cues *cue = (struct nrg_cues *)(data+i);16.201 + int track = 0;16.202 + uint32_t lba;16.203 + if( chunk_id == CUEX_ID ) {16.204 + lba = GUINT32_FROM_BE( cue->addr );16.205 + } else {16.206 + lba = BCD_MSFTOLBA( cue->addr );16.207 + }16.208 + if( cue->track == 0 )16.209 + continue; /* Track 0. Leadin? always 0? */16.210 + if( cue->track == 0xAA ) { /* end of disc */16.211 + disc->leadout = lba;16.212 + } else {16.213 + track = BCDTOU8(cue->track) - 1;16.214 + if( (cue->control & 0x01) != 0 ) {16.215 + /* Track-start address */16.216 + disc->track[track].lba = lba;16.217 + disc->track[track].flags = cue->type;16.218 + }16.219 + }16.220 + }16.221 + break;16.222 + case DAOI_ID:16.223 + dao = (struct nrg_daoi *)data;16.224 + count = dao->track_count - cue_track_id;16.225 + memcpy( disc->mcn, dao->mcn, 13 );16.226 + disc->mcn[13] = '\0';16.227 + if( dao->track_count != track_id ||16.228 + count * 30 + 22 != chunk.length ) {16.229 + RETURN_PARSE_ERROR( "Invalid NRG image file (bad DAOI block)" );16.230 + }16.231 + for( i=0; i<count; i++ ) {16.232 + uint32_t offset = GUINT32_FROM_BE(dao->track[i].offset);16.233 + sector_mode_t mode = nrg_track_mode( dao->track[i].mode );16.234 + if( mode == -1 ) {16.235 + RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", dao->track[i].mode);16.236 + }16.237 + if( CDROM_SECTOR_SIZE(mode) != GUINT32_FROM_BE(dao->track[i].sector_size) ) {16.238 + /* Sector size mismatch */16.239 + RETURN_PARSE_ERROR("Invalid NRG image file (Bad sector size in DAOI block)");16.240 + }16.241 + cdrom_count_t sector_count =16.242 + (GUINT32_FROM_BE(dao->track[i].end) - GUINT32_FROM_BE(dao->track[i].offset))/16.243 + CDROM_SECTOR_SIZE(mode);16.244 + disc->track[cue_track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );16.245 + cue_track_id++;16.246 + }16.247 + break;16.248 + case DAOX_ID:16.249 + daox = (struct nrg_daox *)data;16.250 + count = daox->track_count - cue_track_id;16.251 + memcpy( disc->mcn, daox->mcn, 13 );16.252 + disc->mcn[13] = '\0';16.253 + if( daox->track_count != track_id ||16.254 + count * 42 + 22 != chunk.length ) {16.255 + RETURN_PARSE_ERROR( "Invalid NRG image file (bad DAOX block)" );16.256 + }16.257 + for( i=0; i<count; i++ ) {16.258 + uint32_t offset = (uint32_t)GUINT64_FROM_BE(daox->track[i].offset);16.259 + sector_mode_t mode = nrg_track_mode( daox->track[i].mode );16.260 + if( mode == -1 ) {16.261 + RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", daox->track[i].mode);16.262 + }16.263 + if( CDROM_SECTOR_SIZE(mode) != GUINT32_FROM_BE(daox->track[i].sector_size) ) {16.264 + /* Sector size mismatch */16.265 + RETURN_PARSE_ERROR("Invalid NRG image file (Bad sector size in DAOX block)");16.266 + }16.267 + cdrom_count_t sector_count = (cdrom_count_t)16.268 + ((GUINT64_FROM_BE(daox->track[i].end) - GUINT64_FROM_BE(daox->track[i].offset))/16.269 + CDROM_SECTOR_SIZE(mode));16.270 + disc->track[cue_track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );16.271 + cue_track_id++;16.272 + }16.273 + break;16.274 +16.275 + case SINF_ID:16.276 + /* Data is a single 32-bit number representing number of tracks in session */16.277 + i = GUINT32_FROM_BE( *(uint32_t *)data );16.278 + while( i-- > 0 )16.279 + disc->track[session_track_id++].sessionno = session_id;16.280 + session_id++;16.281 + break;16.282 + case ETNF_ID:16.283 + etnf = (struct nrg_etnf *)data;16.284 + count = chunk.length / sizeof(struct nrg_etnf);16.285 + for( i=0; i < count; i++, etnf++ ) {16.286 + uint32_t offset = GUINT32_FROM_BE(etnf->offset);16.287 + sector_mode_t mode = nrg_track_mode( GUINT32_FROM_BE(etnf->mode) );16.288 + if( mode == -1 ) {16.289 + RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", etnf->mode);16.290 + }16.291 + cdrom_count_t sector_count = GUINT32_FROM_BE(etnf->length) /16.292 + CDROM_SECTOR_SIZE(mode);16.293 +16.294 + disc->track[track_id].lba = GUINT32_FROM_BE(etnf->lba) + i*CDROM_PREGAP;16.295 + if( mode == SECTOR_CDDA )16.296 + disc->track[track_id].flags = 0x01;16.297 + else16.298 + disc->track[track_id].flags = 0x01 | TRACK_FLAG_DATA;16.299 + disc->track[track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );16.300 + track_id++;16.301 + }16.302 + break;16.303 + case ETN2_ID:16.304 + etn2 = (struct nrg_etn2 *)data;16.305 + count = chunk.length / sizeof(struct nrg_etn2);16.306 + for( i=0; i < count; i++, etn2++ ) {16.307 + uint32_t offset = (uint32_t)GUINT64_FROM_BE(etn2->offset);16.308 + sector_mode_t mode = nrg_track_mode( GUINT32_FROM_BE(etn2->mode) );16.309 + if( mode == -1 ) {16.310 + RETURN_PARSE_ERROR("Unknown track mode in NRG image file (%d)", etn2->mode);16.311 + }16.312 + cdrom_count_t sector_count = (uint32_t)(GUINT64_FROM_BE(etn2->length) /16.313 + CDROM_SECTOR_SIZE(mode));16.314 +16.315 + disc->track[track_id].lba = GUINT32_FROM_BE(etn2->lba) + i*CDROM_PREGAP;16.316 + if( mode == SECTOR_CDDA )16.317 + disc->track[track_id].flags = 0x01;16.318 + else16.319 + disc->track[track_id].flags = 0x01 | TRACK_FLAG_DATA;16.320 + disc->track[track_id].source = file_sector_source_new_source( disc->base_source, mode, offset, sector_count );16.321 + track_id++;16.322 + }16.323 + break;16.324 +16.325 + case END_ID:16.326 + end = TRUE;16.327 + break;16.328 + }16.329 + } while( !end );16.330 +16.331 + disc->track_count = track_id;16.332 + disc->session_count = session_id-1;16.333 + return TRUE;16.334 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000017.2 +++ b/src/drivers/cdrom/cd_osx.c Sun Jan 31 18:35:06 2010 +100017.3 @@ -0,0 +1,228 @@17.4 +/**17.5 + * $Id$17.6 + *17.7 + * OSX native cd-rom driver.17.8 + *17.9 + * Copyright (c) 2005 Nathan Keynes.17.10 + *17.11 + * This program is free software; you can redistribute it and/or modify17.12 + * it under the terms of the GNU General Public License as published by17.13 + * the Free Software Foundation; either version 2 of the License, or17.14 + * (at your option) any later version.17.15 + *17.16 + * This program is distributed in the hope that it will be useful,17.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of17.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17.19 + * GNU General Public License for more details.17.20 + */17.21 +17.22 +#include <IOKit/IOKitLib.h>17.23 +#include <IOKit/IOBSD.h>17.24 +#include <IOKit/storage/IOStorageDeviceCharacteristics.h>17.25 +#include <IOKit/storage/IOCDMediaBSDClient.h>17.26 +#include <IOKit/storage/IOCDTypes.h>17.27 +#include <sys/param.h>17.28 +#include <errno.h>17.29 +#include <stdio.h>17.30 +#include <string.h>17.31 +#include <paths.h>17.32 +#include "drivers/osx_iokit.h"17.33 +#include "drivers/cdrom/cdimpl.h"17.34 +#include "drivers/cdrom/drive.h"17.35 +17.36 +#define MAXTOCENTRIES 600 /* This is a fairly generous overestimate really */17.37 +#define MAXTOCSIZE 4 + (MAXTOCENTRIES*11)17.38 +17.39 +static gboolean cdrom_osx_image_is_valid( FILE *f );17.40 +static cdrom_disc_t cdrom_osx_open_file( FILE *f, const gchar *filename, ERROR *err );17.41 +static gboolean cdrom_osx_read_toc( cdrom_disc_t disc, ERROR *err );17.42 +static cdrom_error_t cdrom_osx_read_sectors( sector_source_t disc, cdrom_lba_t sector, cdrom_count_t count,17.43 + cdrom_read_mode_t mode, unsigned char *buf, size_t *length );17.44 +17.45 +/* Note: We don't support opening OS X devices by filename, so no disc factory */17.46 +17.47 +#define OSX_DRIVE(disc) ( (osx_cdrom_drive_t)(((cdrom_disc_t)disc)->impl_data) )17.48 +17.49 +static void cdrom_osx_destroy( sector_source_t disc )17.50 +{17.51 + osx_cdrom_close_drive( OSX_DRIVE(disc) );17.52 + default_cdrom_disc_destroy( disc );17.53 +}17.54 +17.55 +static void cdrom_osx_media_changed( osx_cdrom_drive_t drive, gboolean present,17.56 + void *user_data )17.57 +{17.58 + cdrom_disc_t disc = (cdrom_disc_t)user_data;17.59 + if( present ) {17.60 + cdrom_osx_read_toc( disc, NULL );17.61 + } else {17.62 + disc->disc_type = CDROM_DISC_NONE;17.63 + disc->track_count = 0;17.64 + }17.65 +}17.66 +17.67 +17.68 +static cdrom_disc_t cdrom_osx_new( const char *name, osx_cdrom_drive_t drive, ERROR *err )17.69 +{17.70 + cdrom_disc_t disc = cdrom_disc_new(name, err);17.71 + disc->impl_data = drive;17.72 +17.73 + disc->source.read_sectors = cdrom_osx_read_sectors;17.74 + disc->source.destroy = cdrom_osx_destroy;17.75 + disc->read_toc = cdrom_osx_read_toc;17.76 + cdrom_disc_read_toc(disc, err);17.77 + osx_cdrom_set_media_changed_callback( drive, cdrom_osx_media_changed, disc );17.78 + return (cdrom_disc_t)disc;17.79 +}17.80 +17.81 +static cdrom_disc_t cdrom_osx_open( cdrom_drive_t drive, ERROR *err )17.82 +{17.83 + cdrom_disc_t result = NULL;17.84 +17.85 + osx_cdrom_drive_t osx_drive = osx_cdrom_open_drive(drive->name);17.86 + if( osx_drive == NULL ) {17.87 + SET_ERROR( err, ENOENT, "Unable to open CDROM drive" );17.88 + return NULL;17.89 + } else {17.90 + return cdrom_osx_new( drive->name, osx_drive, err );17.91 + }17.92 +}17.93 +17.94 +17.95 +17.96 +static gboolean cdrom_enum_callback( io_object_t object, char *vendor, char *product, char *iopath, void *ptr )17.97 +{17.98 + char tmp1[sizeof(io_string_t) + 6];17.99 + char tmp2[512];17.100 + snprintf( tmp1, sizeof(tmp1), "dvd://%s", iopath );17.101 + snprintf( tmp2, sizeof(tmp2), "%s %s", vendor, product );17.102 + cdrom_drive_add( iopath, tmp2, cdrom_osx_open );17.103 + return FALSE;17.104 +}17.105 +17.106 +void cdrom_drive_scan(void)17.107 +{17.108 + find_cdrom_drive(cdrom_enum_callback, NULL);17.109 + osx_register_iokit_notifications();17.110 +}17.111 +17.112 +static gboolean cdrom_osx_image_is_valid( FILE *f )17.113 +{17.114 + return FALSE;17.115 +}17.116 +17.117 +static cdrom_disc_t cdrom_osx_open_file( FILE *f, const gchar *filename, ERROR *err )17.118 +{17.119 + return NULL; /* Not supported */17.120 +}17.121 +17.122 +static gboolean cdrom_osx_read_toc( cdrom_disc_t disc, ERROR *err )17.123 +{17.124 + osx_cdrom_drive_t drive = OSX_DRIVE(disc);17.125 +17.126 + int fh = osx_cdrom_get_media_handle(drive);17.127 + if( fh == -1 ) {17.128 + disc->disc_type = CDROM_DISC_NONE;17.129 + disc->track_count = 0;17.130 + return FALSE;17.131 + } else {17.132 + unsigned char buf[MAXTOCSIZE];17.133 + dk_cd_read_toc_t readtoc;17.134 + memset( &readtoc, 0, sizeof(readtoc) );17.135 + readtoc.format = 2;17.136 + readtoc.formatAsTime = 0;17.137 + readtoc.address.session = 0;17.138 + readtoc.bufferLength = sizeof(buf);17.139 + readtoc.buffer = buf;17.140 +17.141 + if( ioctl(fh, DKIOCCDREADTOC, &readtoc ) == -1 ) {17.142 + WARN( "Failed to read TOC (%s)", strerror(errno) );17.143 + disc->disc_type = CDROM_DISC_NONE;17.144 + disc->track_count = 0;17.145 + return FALSE;17.146 + } else {17.147 + mmc_parse_toc2( disc, buf );17.148 + }17.149 + }17.150 + return TRUE;17.151 +}17.152 +17.153 +static cdrom_error_t cdrom_osx_read_sectors( sector_source_t source, cdrom_lba_t lba, cdrom_count_t count,17.154 + cdrom_read_mode_t mode, unsigned char *buf, size_t *length )17.155 +{17.156 + cdrom_disc_t disc = (cdrom_disc_t)source;17.157 + int sector_size = 2352;17.158 + char data[CDROM_MAX_SECTOR_SIZE];17.159 + osx_cdrom_drive_t drive = OSX_DRIVE(disc);17.160 +17.161 + int fh = osx_cdrom_get_media_handle(drive);17.162 + if( fh == -1 ) {17.163 + return CDROM_ERROR_NODISC;17.164 + } else {17.165 + dk_cd_read_t readcd;17.166 + memset( &readcd, 0, sizeof(readcd) );17.167 + readcd.buffer = buf;17.168 + readcd.sectorType = CDROM_READ_TYPE(mode);17.169 +17.170 + cdrom_track_t track = cdrom_disc_get_track_by_lba(disc,lba);17.171 + if( track == NULL ) {17.172 + return CDROM_ERROR_BADREAD;17.173 + }17.174 +17.175 + /* This is complicated by needing to know the exact read size. Gah.17.176 + * For now, anything other than a data-only read of known size is17.177 + * executed by a raw read + extraction.17.178 + */17.179 + if( (CDROM_READ_FIELDS(mode) == CDROM_READ_DATA && CDROM_READ_TYPE(mode) != CDROM_READ_ANY) ||17.180 + ((track->flags & TRACK_FLAG_DATA) == 0 && CDROM_READ_FIELDS(mode) != CDROM_READ_NONE) ) {17.181 + switch( CDROM_READ_TYPE(mode) ) {17.182 + case CDROM_READ_ANY:17.183 + case CDROM_READ_CDDA:17.184 + sector_size = 2352;17.185 + break;17.186 + case CDROM_READ_MODE1:17.187 + case CDROM_READ_MODE2_FORM1:17.188 + sector_size = 2048;17.189 + break;17.190 + case CDROM_READ_MODE2:17.191 + sector_size = 2336;17.192 + break;17.193 + case CDROM_READ_MODE2_FORM2:17.194 + sector_size = 2324;17.195 + break;17.196 + }17.197 + readcd.sectorArea = kCDSectorAreaUser;17.198 + readcd.offset = sector_size * lba;17.199 + readcd.bufferLength = sector_size * count;17.200 + if( ioctl( fh, DKIOCCDREAD, &readcd ) == -1 ) {17.201 + return CDROM_ERROR_BADREAD;17.202 + }17.203 + *length = sector_size * count;17.204 + } else {17.205 + /* Sector could be anything - need to do a raw read and then parse17.206 + * the requested data out ourselves17.207 + */17.208 + sector_size = 2352;17.209 + size_t tmplen, len = 0;17.210 +17.211 + readcd.offset = sector_size * lba;17.212 + readcd.sectorArea = 0xf8;17.213 + readcd.buffer = data;17.214 + readcd.bufferLength = sector_size;17.215 + while( count > 0 ) {17.216 + if( ioctl( fh, DKIOCCDREAD, &readcd ) == -1 ) {17.217 + return CDROM_ERROR_BADREAD;17.218 + }17.219 + cdrom_error_t err = sector_extract_from_raw( data, mode, &buf[len], &tmplen );17.220 + if( err != CDROM_ERROR_OK )17.221 + return err;17.222 + len += tmplen;17.223 + readcd.offset += sector_size;17.224 + }17.225 + *length = len;17.226 + }17.227 +17.228 + return CDROM_ERROR_OK;17.229 + }17.230 +}17.231 +
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000018.2 +++ b/src/drivers/cdrom/cdimpl.h Sun Jan 31 18:35:06 2010 +100018.3 @@ -0,0 +1,199 @@18.4 +/**18.5 + * $Id$18.6 + *18.7 + * Copyright (c) 2009 Nathan Keynes.18.8 + *18.9 + * Internal CD-ROM implementation header18.10 + *18.11 + * This program is free software; you can redistribute it and/or modify18.12 + * it under the terms of the GNU General Public License as published by18.13 + * the Free Software Foundation; either version 2 of the License, or18.14 + * (at your option) any later version.18.15 + *18.16 + * This program is distributed in the hope that it will be useful,18.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of18.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18.19 + * GNU General Public License for more details.18.20 + */18.21 +18.22 +#ifndef cdrom_cdimpl_H18.23 +#define cdrom_cdimpl_H 118.24 +18.25 +#include "drivers/cdrom/cdrom.h"18.26 +#include "drivers/cdrom/drive.h"18.27 +#include <stdio.h>18.28 +18.29 +#ifdef __cplusplus18.30 +extern "C" {18.31 +#endif18.32 +18.33 +/**18.34 + * Disc factory implementation, to construct cdrom_disc_t objects from a file18.35 + * (if possible).18.36 + */18.37 +typedef struct cdrom_disc_factory {18.38 + /* Human-readable name for the discs constructed by the factory */18.39 + const char *display_name;18.40 + /* Default file extension for supported discs */18.41 + const char *extension;18.42 +18.43 + /* Test if the given file is facially valid for the factory18.44 + * (that is, it passes all file magic etc checks)18.45 + */18.46 + gboolean (*is_valid_file)(FILE *f);18.47 +18.48 + /* Perform any additional initialization needed for the disc type18.49 + * (run after the default initialization). May be NULL if no init18.50 + * is needed18.51 + * @return TRUE on success, FALSE on error.18.52 + */18.53 + gboolean (*init)(cdrom_disc_t disc, ERROR *err);18.54 +18.55 + /* Read the table of contents from the given file, and update the disc18.56 + * accordingly. On error, set the err message and return FALSE.18.57 + */18.58 + gboolean (*read_toc)(cdrom_disc_t disc, ERROR *err);18.59 +18.60 +} *cdrom_disc_factory_t;18.61 +18.62 +/**18.63 + * Low-level SCSI transport provided to the main SCSI/MMC driver. When used18.64 + * this will be set as the disc->impl_data field.18.65 + * Note: For symmetry there should be a packet_write variant, but we don't18.66 + * currently need it for anything. YAGNI, etc.18.67 + */18.68 +typedef struct cdrom_scsi_transport {18.69 + /* Execute a read command (ie a command that returns a block of data in18.70 + * response, not necessarily a CD read).18.71 + * @param disc The disc to execute the command18.72 + * @param cmd The 12-byte command packet18.73 + * @param buf The buffer to receive the read results18.74 + * @param length On entry, the size of buf. Modified on exit to the number18.75 + * of bytes actually read.18.76 + * @return PKT_ERR_OK on success, otherwise the host error code.18.77 + */18.78 + cdrom_error_t (*packet_read)( struct cdrom_disc *disc,18.79 + char *cmd, unsigned char *buf,18.80 + unsigned int *length );18.81 +18.82 + /* Execute a generic command that does not write or return any data.18.83 + * (eg play audio).18.84 + * @param scsi The disc to execute the command18.85 + * @param cmd The 12-byte command packet18.86 + * @return PKT_ERR_OK on success, otherwise the host error code.18.87 + */18.88 + cdrom_error_t (*packet_cmd)( struct cdrom_disc *disc,18.89 + char *cmd );18.90 +18.91 + /* Return TRUE if the media has changed since the last call, otherwise18.92 + * FALSE. This method is used to implement the disc-level check_status18.93 + * and should have no side-effects.18.94 + */18.95 + gboolean (*media_changed)( struct cdrom_disc *disc );18.96 +} *cdrom_scsi_transport_t;18.97 +18.98 +#define SCSI_TRANSPORT(disc) ((cdrom_scsi_transport_t)disc->impl_data)18.99 +18.100 +/**18.101 + * Initialize a previously allocated cdrom_disc_t.18.102 + */18.103 +cdrom_disc_t cdrom_disc_init( cdrom_disc_t disc, const char *filename );18.104 +18.105 +/**18.106 + * Allocate and initialize a new cdrom_disc_t with the defaults for image files18.107 + */18.108 +cdrom_disc_t cdrom_disc_new( const char *name, ERROR *err );18.109 +18.110 +/**18.111 + * Read the table of contents from a scsi disc.18.112 + */18.113 +gboolean cdrom_disc_scsi_read_toc( cdrom_disc_t disc, ERROR *err );18.114 +18.115 +/**18.116 + * Allocate and initialize a new cdrom_disc_t using a scsi transport.18.117 + */18.118 +cdrom_disc_t cdrom_disc_scsi_new( const char *name, cdrom_scsi_transport_t transport, ERROR *err );18.119 +18.120 +/**18.121 + * Allocate and initialize a new cdrom_disc_t using a scsi transport and an18.122 + * open file18.123 + */18.124 +cdrom_disc_t cdrom_disc_scsi_new_file( FILE *f, const char *filename, cdrom_scsi_transport_t transport, ERROR *err );18.125 +18.126 +18.127 +void cdrom_disc_scsi_init( cdrom_disc_t disc, cdrom_scsi_transport_t scsi );18.128 +18.129 +/**18.130 + * Compute derived values for the TOC where they have not already been set18.131 + * - Determine disc leadout from end of the last track18.132 + * - Set the disc type to the based on the track types present.18.133 + */18.134 +void cdrom_disc_finalize_toc( cdrom_disc_t disc );18.135 +18.136 +/**18.137 + * Clear all TOC values in preparation for replacing with a new TOC18.138 + */18.139 +void cdrom_disc_clear_toc( cdrom_disc_t disc );18.140 +18.141 +/**18.142 + * Re-read the table of contents of the disc18.143 + */18.144 +gboolean cdrom_disc_read_toc( cdrom_disc_t disc, ERROR *err );18.145 +18.146 +/**18.147 + * track source for a host CD-ROM device, for use by host implementations18.148 + */18.149 +sector_source_t track_sector_source_new( cdrom_disc_t disc, sector_mode_t mode, cdrom_lba_t lba, cdrom_count_t count );18.150 +18.151 +/**18.152 + * Get the base file used by the cdrom, or NULL if there is no such file.18.153 + */18.154 +FILE *cdrom_disc_get_base_file( cdrom_disc_t disc );18.155 +18.156 +#define cdrom_disc_get_base_fd(disc) fileno(cdrom_disc_get_base_file(disc))18.157 +18.158 +/**18.159 + * Default disc destructor method18.160 + */18.161 +void default_cdrom_disc_destroy( sector_source_t device );18.162 +18.163 +/******************** Physical drive support *********************/18.164 +18.165 +/**18.166 + * Add a physical drive to the list.18.167 + * @return the new cdrom_drive_t entry. If the drive was already in the list,18.168 + * returns the existing entry instead and does not add a new one.18.169 + */18.170 +cdrom_drive_t cdrom_drive_add( const char *name, const char *display_name, cdrom_drive_open_fn_t open_fn );18.171 +18.172 +/**18.173 + * Remove a physical drive from the list, specified by name.18.174 + * @return TRUE if the drive was removed, FALSE if the drive was not in the list.18.175 + */18.176 +gboolean cdrom_drive_remove( const char *name );18.177 +18.178 +/**18.179 + * Clear the cdrom drive list.18.180 + */18.181 +void cdrom_drive_remove_all();18.182 +18.183 +/************************* MMC support ***************************/18.184 +18.185 +/**18.186 + * Parse a standard MMC format-2 TOC into the disc structure.18.187 + */18.188 +void mmc_parse_toc2( cdrom_disc_t disc, unsigned char *buf );18.189 +18.190 +/**18.191 + * Read a standard MMC inquiry response, returning a newly allocated string18.192 + * of the form "<vendor> <product> <revision>"18.193 + */18.194 +const char *mmc_parse_inquiry( unsigned char *buf );18.195 +18.196 +18.197 +18.198 +#ifdef __cplusplus18.199 +}18.200 +#endif18.201 +18.202 +#endif /* !cdrom_cdimpl_H */
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000019.2 +++ b/src/drivers/cdrom/cdrom.c Sun Jan 31 18:35:06 2010 +100019.3 @@ -0,0 +1,386 @@19.4 +/**19.5 + * $Id$19.6 + *19.7 + * Copyright (c) 2009 Nathan Keynes.19.8 + *19.9 + * This program is free software; you can redistribute it and/or modify19.10 + * it under the terms of the GNU General Public License as published by19.11 + * the Free Software Foundation; either version 2 of the License, or19.12 + * (at your option) any later version.19.13 + *19.14 + * This program is distributed in the hope that it will be useful,19.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of19.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19.17 + * GNU General Public License for more details.19.18 + */19.19 +19.20 +#include <assert.h>19.21 +#include <errno.h>19.22 +#include <fcntl.h>19.23 +#include <stdio.h>19.24 +#include <string.h>19.25 +#include <glib/gmem.h>19.26 +#include <glib/gstrfuncs.h>19.27 +#include "lxdream.h"19.28 +#include "drivers/cdrom/cdrom.h"19.29 +#include "drivers/cdrom/cdimpl.h"19.30 +19.31 +extern struct cdrom_disc_factory linux_cdrom_drive_factory;19.32 +extern struct cdrom_disc_factory nrg_disc_factory;19.33 +extern struct cdrom_disc_factory cdi_disc_factory;19.34 +extern struct cdrom_disc_factory gdi_disc_factory;19.35 +19.36 +cdrom_disc_factory_t cdrom_disc_factories[] = {19.37 +#ifdef HAVE_LINUX_CDROM19.38 + &linux_cdrom_drive_factory,19.39 +#endif19.40 + &nrg_disc_factory,19.41 + &cdi_disc_factory,19.42 + &gdi_disc_factory,19.43 + NULL };19.44 +19.45 +/********************* Implementation Support functions ************************/19.46 +19.47 +cdrom_error_t default_image_read_blocks( sector_source_t source, cdrom_lba_t lba, cdrom_count_t count,19.48 + unsigned char *buf )19.49 +{19.50 + assert( 0 && "read_blocks called on a cdrom disc" );19.51 + return CDROM_ERROR_BADREAD;19.52 +}19.53 +19.54 +cdrom_error_t default_image_read_sectors( sector_source_t source, cdrom_lba_t lba, cdrom_count_t count,19.55 + cdrom_read_mode_t mode, unsigned char *buf, size_t *length )19.56 +{19.57 + assert( IS_SECTOR_SOURCE_TYPE(source,DISC_SECTOR_SOURCE) );19.58 + cdrom_disc_t disc = (cdrom_disc_t)source;19.59 + size_t len = 0, tmplen;19.60 + cdrom_count_t current = 0;19.61 +19.62 + while( current < count ) {19.63 + cdrom_track_t track = cdrom_disc_get_track_by_lba( disc, lba + current );19.64 + if( track == NULL )19.65 + return CDROM_ERROR_BADREAD;19.66 + uint32_t track_size = cdrom_disc_get_track_size( disc, track );19.67 + cdrom_lba_t track_offset = lba + current - track->lba;19.68 + cdrom_count_t sub_count = count - current;19.69 + if( track_size - track_offset < sub_count )19.70 + /* Read breaks across track boundaries. This will probably fail (due19.71 + * to inter-track gaps), but try it just in case19.72 + */19.73 + sub_count = track_size - track_offset;19.74 + cdrom_error_t err = track->source->read_sectors( track->source, track_offset, sub_count, mode, &buf[len], &tmplen );19.75 + if( err != CDROM_ERROR_OK )19.76 + return err;19.77 + len += tmplen;19.78 + current += sub_count;19.79 + }19.80 + *length = len;19.81 + return CDROM_ERROR_OK;19.82 +}19.83 +19.84 +void default_cdrom_disc_destroy( sector_source_t source )19.85 +{19.86 + assert( IS_SECTOR_SOURCE_TYPE(source,DISC_SECTOR_SOURCE) );19.87 + cdrom_disc_t disc = (cdrom_disc_t)source;19.88 + int i;19.89 +19.90 + for( i=0; i<disc->track_count; i++ ) {19.91 + sector_source_unref( disc->track[i].source );19.92 + }19.93 + sector_source_unref( disc->base_source );19.94 + g_free( (char *)disc->name );19.95 +19.96 + default_sector_source_destroy( source );19.97 +}19.98 +19.99 +cdrom_disc_t cdrom_disc_init( cdrom_disc_t disc, const char *filename )19.100 +{19.101 + sector_source_init( &disc->source, DISC_SECTOR_SOURCE, SECTOR_UNKNOWN, 0, default_image_read_blocks,19.102 + default_cdrom_disc_destroy );19.103 + disc->source.read_sectors = default_image_read_sectors;19.104 + disc->disc_type = CDROM_DISC_NONE;19.105 + disc->track_count = disc->session_count = 0;19.106 + for( int i=0; i<99; i++ ) {19.107 + disc->track[i].trackno = i+1;19.108 + }19.109 + if( filename != NULL )19.110 + disc->name = g_strdup(filename);19.111 + return disc;19.112 +}19.113 +19.114 +cdrom_disc_t cdrom_disc_new( const char *name, ERROR *err )19.115 +{19.116 + cdrom_disc_t disc = g_malloc0( sizeof(struct cdrom_disc) );19.117 + if( disc != NULL ) {19.118 + cdrom_disc_init( disc, name );19.119 + } else {19.120 + SET_ERROR(err, ENOMEM, "Unable to allocate memory for cdrom disc");19.121 + }19.122 + return disc;19.123 +}19.124 +19.125 +/**19.126 + * Construct a new image-based disc using the given filename as the base source.19.127 + * TOC is initialized to the empty values.19.128 + */19.129 +static cdrom_disc_t cdrom_disc_image_new( const char *filename, ERROR *err )19.130 +{19.131 + cdrom_disc_t disc = cdrom_disc_new( filename, err );19.132 + if( disc != NULL && filename != NULL ) {19.133 + disc->base_source = file_sector_source_new_filename( filename, SECTOR_UNKNOWN, 0, FILE_SECTOR_FULL_FILE );19.134 + if( disc->base_source == NULL ) {19.135 + SET_ERROR( err, errno, "Unable to open cdrom file '%s': %s", filename, strerror(errno) );19.136 + cdrom_disc_unref(disc);19.137 + disc = NULL;19.138 + } else {19.139 + sector_source_ref(disc->base_source);19.140 + }19.141 +19.142 + }19.143 + return disc;19.144 +}19.145 +19.146 +cdrom_lba_t cdrom_disc_compute_leadout( cdrom_disc_t disc )19.147 +{19.148 + if( disc->track_count == 0 ) {19.149 + disc->leadout = 0;19.150 + } else {19.151 + cdrom_track_t last_track = &disc->track[disc->track_count-1];19.152 + if( last_track->source != NULL ) {19.153 + cdrom_lba_t leadout = last_track->lba + last_track->source->size;19.154 + if( leadout > disc->leadout )19.155 + disc->leadout = leadout;19.156 + }19.157 + }19.158 + return disc->leadout;19.159 +}19.160 +19.161 +19.162 +void cdrom_disc_set_default_disc_type( cdrom_disc_t disc )19.163 +{19.164 + int type = CDROM_DISC_NONE, i;19.165 + for( i=0; i<disc->track_count; i++ ) {19.166 + if( (disc->track[i].flags & TRACK_FLAG_DATA == 0) ) {19.167 + if( type == CDROM_DISC_NONE )19.168 + type = CDROM_DISC_AUDIO;19.169 + } else if( disc->track[i].source != NULL &&19.170 + (disc->track[i].source->mode == SECTOR_MODE1 ||19.171 + disc->track[i].source->mode == SECTOR_RAW_NONXA) ) {19.172 + if( type != CDROM_DISC_XA )19.173 + type = CDROM_DISC_NONXA;19.174 + } else {19.175 + type = CDROM_DISC_XA;19.176 + break;19.177 + }19.178 + }19.179 + disc->disc_type = type;19.180 +}19.181 +19.182 +void cdrom_disc_clear_toc( cdrom_disc_t disc )19.183 +{19.184 + disc->disc_type = CDROM_DISC_NONE;19.185 + disc->leadout = 0;19.186 + disc->track_count = 0;19.187 + disc->session_count = 0;19.188 + for( unsigned i=0; i< CDROM_MAX_TRACKS; i++ ) {19.189 + if( disc->track[i].source != NULL ) {19.190 + sector_source_unref( disc->track[i].source );19.191 + disc->track[i].source = NULL;19.192 + }19.193 + }19.194 +}19.195 +19.196 +gboolean cdrom_disc_read_toc( cdrom_disc_t disc, ERROR *err )19.197 +{19.198 + /* First set the defaults for an empty disc */19.199 + cdrom_disc_clear_toc(disc);19.200 +19.201 + if( disc->read_toc(disc, err ) ) {19.202 + /* Success - update disc type and leadout if the TOC read didn't set them */19.203 + if( disc->disc_type == CDROM_DISC_NONE )19.204 + cdrom_disc_set_default_disc_type(disc);19.205 + cdrom_disc_compute_leadout(disc);19.206 + return TRUE;19.207 + } else {19.208 + /* Reset to an empty disc in case the reader left things in an19.209 + * inconsistent state */19.210 + cdrom_disc_clear_toc(disc);19.211 + return FALSE;19.212 + }19.213 +}19.214 +19.215 +FILE *cdrom_disc_get_base_file( cdrom_disc_t disc )19.216 +{19.217 + return file_sector_source_get_file(disc->base_source);19.218 +}19.219 +19.220 +/*************************** Public functions ***************************/19.221 +19.222 +cdrom_disc_t cdrom_disc_open( const char *inFilename, ERROR *err )19.223 +{19.224 + const gchar *filename = inFilename;19.225 + const gchar *ext = strrchr(filename, '.');19.226 + int i;19.227 + cdrom_disc_factory_t extclz = NULL;19.228 +19.229 + /* Ask the drive list if it recognizes the name first */19.230 + cdrom_drive_t drive = cdrom_drive_find(inFilename);19.231 + if( drive != NULL ) {19.232 + return cdrom_drive_open(drive, err);19.233 + }19.234 +19.235 + cdrom_disc_t disc = cdrom_disc_image_new( filename, err );19.236 + if( disc == NULL )19.237 + return NULL;19.238 +19.239 + /* check file extensions first */19.240 + FILE *f = file_sector_source_get_file(disc->base_source);19.241 + if( ext != NULL ) {19.242 + ext++; /* Skip the '.' */19.243 + for( i=0; cdrom_disc_factories[i] != NULL; i++ ) {19.244 + if( cdrom_disc_factories[i]->extension != NULL &&19.245 + strcasecmp( cdrom_disc_factories[i]->extension, ext ) == 0 ) {19.246 + extclz = cdrom_disc_factories[i];19.247 + if( extclz->is_valid_file(f) ) {19.248 + disc->read_toc = extclz->read_toc;19.249 + }19.250 + break;19.251 + }19.252 + }19.253 + }19.254 +19.255 + if( disc->read_toc == NULL ) {19.256 + /* Okay, fall back to magic */19.257 + for( i=0; cdrom_disc_factories[i] != NULL; i++ ) {19.258 + if( cdrom_disc_factories[i] != extclz &&19.259 + cdrom_disc_factories[i]->is_valid_file(f) ) {19.260 + disc->read_toc = cdrom_disc_factories[i]->read_toc;19.261 + break;19.262 + }19.263 + }19.264 + }19.265 +19.266 + if( disc->read_toc != NULL && cdrom_disc_read_toc( disc, err ) ) {19.267 + /* All good */19.268 + return disc;19.269 + } else {19.270 + /* No handler found for file */19.271 + cdrom_disc_unref( disc );19.272 + SET_ERROR( err, EINVAL, "File '%s' could not be recognized as any known image file or device type" );19.273 + return NULL;19.274 + }19.275 +}19.276 +19.277 +/**19.278 + * Get the track information for the given track. If there is no such track,19.279 + * return NULL;19.280 + */19.281 +cdrom_track_t cdrom_disc_get_track( cdrom_disc_t disc, cdrom_trackno_t track )19.282 +{19.283 + if( track < 1 || track >= disc->track_count )19.284 + return NULL;19.285 + return &disc->track[track-1];19.286 +}19.287 +19.288 +/**19.289 + * Get the track information for the first track of the given session. If there19.290 + * is no such session, return NULL;19.291 + */19.292 +cdrom_track_t cdrom_disc_get_session( cdrom_disc_t disc, cdrom_sessionno_t session )19.293 +{19.294 + for( unsigned i=0; i< disc->track_count; i++ ) {19.295 + if( disc->track[i].sessionno == session )19.296 + return &disc->track[i];19.297 + }19.298 + return NULL;19.299 +}19.300 +19.301 +cdrom_count_t cdrom_disc_get_track_size( cdrom_disc_t disc, cdrom_track_t track )19.302 +{19.303 + if( track->trackno == disc->track_count )19.304 + return disc->leadout - track->lba;19.305 + else19.306 + return disc->track[track->trackno].lba - track->lba;19.307 +}19.308 +19.309 +cdrom_track_t cdrom_disc_get_last_track( cdrom_disc_t disc )19.310 +{19.311 + if( disc->track_count == 0 )19.312 + return NULL;19.313 + return &disc->track[disc->track_count-1];19.314 +}19.315 +19.316 +cdrom_track_t cdrom_disc_prev_track( cdrom_disc_t disc, cdrom_track_t track )19.317 +{19.318 + if( track->trackno <= 1 )19.319 + return NULL;19.320 + return cdrom_disc_get_track( disc, track->trackno-1 );19.321 +}19.322 +19.323 +cdrom_track_t cdrom_disc_next_track( cdrom_disc_t disc, cdrom_track_t track )19.324 +{19.325 + if( track->trackno >= disc->track_count )19.326 + return NULL;19.327 + return cdrom_disc_get_track( disc, track->trackno+1 );19.328 +}19.329 +19.330 +/**19.331 + * Find the track containing the sector specified by LBA.19.332 + * Note: this function does not check for media change.19.333 + * @return The track, or NULL if no track contains the sector.19.334 + */19.335 +cdrom_track_t cdrom_disc_get_track_by_lba( cdrom_disc_t disc, cdrom_lba_t lba )19.336 +{19.337 + if( disc->track_count == 0 || disc->track[0].lba > lba || lba >= disc->leadout )19.338 + return NULL; /* LBA outside disc bounds */19.339 +19.340 + for( unsigned i=1; i< disc->track_count; i++ ) {19.341 + if( lba < disc->track[i].lba )19.342 + return &disc->track[i-1];19.343 + }19.344 + return &disc->track[disc->track_count-1];19.345 +}19.346 +19.347 +cdrom_error_t cdrom_disc_read_sectors( cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t count,19.348 + cdrom_read_mode_t mode, unsigned char *buf, size_t *length )19.349 +{19.350 + return disc->source.read_sectors( &disc->source, lba, count, mode, buf, length );19.351 +}19.352 +19.353 +/**19.354 + * Check if the disc contains valid media.19.355 + * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC19.356 + */19.357 +cdrom_error_t cdrom_disc_check_media( cdrom_disc_t disc )19.358 +{19.359 + if( disc == NULL )19.360 + return CDROM_ERROR_NODISC;19.361 + if( disc->check_media != NULL )19.362 + disc->check_media(disc);19.363 + return disc->disc_type == CDROM_DISC_NONE ? CDROM_ERROR_NODISC : CDROM_ERROR_OK;19.364 +}19.365 +19.366 +void cdrom_disc_print_toc( FILE *f, cdrom_disc_t disc )19.367 +{19.368 + int i;19.369 + int session = 0;19.370 +19.371 + if( disc == NULL || disc->track_count == 0 ) {19.372 + fprintf( f, "No disc\n" );19.373 + return;19.374 + }19.375 + for( i=0; i<disc->track_count; i++ ) {19.376 + cdrom_track_t track = &disc->track[i];19.377 + if( track->sessionno != session ) {19.378 + session = disc->track[i].sessionno;19.379 + fprintf( f, "Session %d:\n", session );19.380 + }19.381 + fprintf( f, " %02d. %6d %02x\n", track->trackno, track->lba, track->flags );19.382 + }19.383 +}19.384 +19.385 +void cdrom_disc_dump_toc( cdrom_disc_t disc )19.386 +{19.387 + cdrom_disc_print_toc( stderr, disc );19.388 +}19.389 +
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000020.2 +++ b/src/drivers/cdrom/cdrom.h Sun Jan 31 18:35:06 2010 +100020.3 @@ -0,0 +1,153 @@20.4 +/**20.5 + * $Id$20.6 + *20.7 + * Copyright (c) 2005-2009 Nathan Keynes.20.8 + *20.9 + * This program is free software; you can redistribute it and/or modify20.10 + * it under the terms of the GNU General Public License as published by20.11 + * the Free Software Foundation; either version 2 of the License, or20.12 + * (at your option) any later version.20.13 + *20.14 + * This program is distributed in the hope that it will be useful,20.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of20.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20.17 + * GNU General Public License for more details.20.18 + */20.19 +20.20 +#ifndef cdrom_cdrom_H20.21 +#define cdrom_cdrom_H 120.22 +20.23 +#include <stdio.h>20.24 +#include <glib/glist.h>20.25 +#include "drivers/cdrom/defs.h"20.26 +#include "drivers/cdrom/sector.h"20.27 +20.28 +#ifdef __cplusplus20.29 +extern "C" {20.30 +#endif20.31 +20.32 +typedef enum {20.33 + CDROM_DISC_NONE = 0x06,20.34 + CDROM_DISC_AUDIO = 0x00,20.35 + CDROM_DISC_NONXA = 0x10,20.36 + CDROM_DISC_XA = 0x20,20.37 + CDROM_DISC_GDROM = 0x8020.38 +} cdrom_disc_type_t;20.39 +20.40 +#define TRACK_FLAG_PREEMPH 0x10 /* Pre-emphasis (audio only) */20.41 +#define TRACK_FLAG_COPYPERM 0x20 /* Copy permitted */20.42 +#define TRACK_FLAG_DATA 0x40 /* Data track */20.43 +#define TRACK_FLAG_FOURCHAN 0x80 /* 4-channel audio */20.44 +20.45 +struct cdrom_track {20.46 + cdrom_trackno_t trackno;20.47 + cdrom_sessionno_t sessionno; /* session # containing this track */20.48 + cdrom_lba_t lba; /* start sector address */20.49 + uint8_t flags; /* Track flags */20.50 + sector_source_t source;20.51 +};20.52 +20.53 +/**20.54 + * A CDROM disc, either an image file, or an open physical host device.20.55 + */20.56 +struct cdrom_disc {20.57 + struct sector_source source;20.58 + const char *name; /* Filename or identifier used to open the disc */20.59 + cdrom_disc_type_t disc_type;20.60 + gchar mcn[14]; /* Media catalogue number, null terminated. */20.61 + cdrom_trackno_t track_count;20.62 + cdrom_sessionno_t session_count;20.63 + cdrom_lba_t leadout; /* LBA of the disc leadout */20.64 + struct cdrom_track track[99];20.65 +20.66 + /* Reference to an underlying source, if any. */20.67 + sector_source_t base_source;20.68 +20.69 + /* Private implementation-specific data */20.70 + void *impl_data;20.71 +20.72 + /** Check for media change. If the media cannot change (ie image file)20.73 + * or is notified asynchonously, this should be a no-op. In the event of20.74 + * a change, this function should update the structure according to the20.75 + * new media (including TOC), and return TRUE.20.76 + * @return TRUE if the media has changed since the last check, otherwise20.77 + * FALSE.20.78 + */20.79 + gboolean (*check_media)(cdrom_disc_t disc);20.80 +20.81 + /**20.82 + * Read the table of contents from the given file20.83 + */20.84 + gboolean (*read_toc)(cdrom_disc_t disc, ERROR *err);20.85 +20.86 + /**20.87 + * Begin playing audio from the given lba address on the disc.20.88 + */20.89 + cdrom_error_t (*play_audio)(cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t length);20.90 +20.91 + cdrom_error_t (*scan_audio)(cdrom_disc_t disc, cdrom_lba_t lba, gboolean direction);20.92 +20.93 + cdrom_error_t (*stop_audio)(cdrom_disc_t disc);20.94 +20.95 +};20.96 +20.97 +/**20.98 + * Open an image file or device20.99 + */20.100 +cdrom_disc_t cdrom_disc_open( const char *filename, ERROR *err );20.101 +20.102 +/**20.103 + * Get the track information for the given track. If there is no such track,20.104 + * return NULL;20.105 + */20.106 +cdrom_track_t cdrom_disc_get_track( cdrom_disc_t disc, cdrom_trackno_t track );20.107 +20.108 +/**20.109 + * Get the track information for the first track of the given session. If there20.110 + * is no such session, return NULL;20.111 + */20.112 +cdrom_track_t cdrom_disc_get_session( cdrom_disc_t disc, cdrom_sessionno_t session );20.113 +20.114 +cdrom_track_t cdrom_disc_get_last_track( cdrom_disc_t disc );20.115 +20.116 +cdrom_track_t cdrom_disc_prev_track( cdrom_disc_t disc, cdrom_track_t track );20.117 +cdrom_track_t cdrom_disc_next_track( cdrom_disc_t disc, cdrom_track_t track );20.118 +20.119 +/**20.120 + * Return the size of the track in sectors, including inter-track gap20.121 + */20.122 +cdrom_count_t cdrom_disc_get_track_size( cdrom_disc_t disc, cdrom_track_t track );20.123 +20.124 +/**20.125 + * Find the track containing the sector specified by LBA.20.126 + * Note: this function does not check for media change.20.127 + * @return The track, or NULL if no track contains the sector.20.128 + */20.129 +cdrom_track_t cdrom_disc_get_track_by_lba( cdrom_disc_t disc, cdrom_lba_t lba );20.130 +20.131 +/**20.132 + * Check if the disc contains valid media.20.133 + * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC20.134 + */20.135 +cdrom_error_t cdrom_disc_check_media( cdrom_disc_t disc );20.136 +20.137 +/**20.138 + * Read sectors from the disc.20.139 + * @return status code20.140 + */20.141 +cdrom_error_t cdrom_disc_read_sectors( cdrom_disc_t disc, cdrom_lba_t lba, cdrom_count_t count, cdrom_read_mode_t mode,20.142 + unsigned char *buf, size_t *length );20.143 +20.144 +/**20.145 + * Print the disc's table of contents to the given output stream.20.146 + */20.147 +void cdrom_disc_print_toc( FILE *f, cdrom_disc_t disc );20.148 +20.149 +#define cdrom_disc_ref(disc) sector_source_ref((sector_source_t)disc)20.150 +#define cdrom_disc_unref(disc) sector_source_unref((sector_source_t)disc)20.151 +20.152 +#ifdef __cplusplus20.153 +}20.154 +#endif20.155 +20.156 +#endif /* !cdrom_cdrom_H */
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000021.2 +++ b/src/drivers/cdrom/defs.h Sun Jan 31 18:35:06 2010 +100021.3 @@ -0,0 +1,141 @@21.4 +/**21.5 + * $Id$21.6 + *21.7 + * Global cdrom definitions.21.8 + *21.9 + * Copyright (c) 2009 Nathan Keynes.21.10 + *21.11 + * This program is free software; you can redistribute it and/or modify21.12 + * it under the terms of the GNU General Public License as published by21.13 + * the Free Software Foundation; either version 2 of the License, or21.14 + * (at your option) any later version.21.15 + *21.16 + * This program is distributed in the hope that it will be useful,21.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of21.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21.19 + * GNU General Public License for more details.21.20 + */21.21 +21.22 +#ifndef cdrom_defs_H21.23 +#define cdrom_defs_H 121.24 +21.25 +#include "lxdream.h"21.26 +#include <stdint.h>21.27 +#include <glib/gtypes.h>21.28 +21.29 +21.30 +#ifdef __cplusplus21.31 +extern "C" {21.32 +#endif21.33 +21.34 +typedef uint32_t cdrom_lba_t;21.35 +typedef uint32_t cdrom_count_t;21.36 +21.37 +/** Tracks are numbered 1..99, with 0 reserved for errors */21.38 +typedef uint8_t cdrom_trackno_t;21.39 +21.40 +typedef uint8_t cdrom_sessionno_t;21.41 +21.42 +typedef const struct cdrom_track *cdrom_track_t;21.43 +typedef struct cdrom_disc *cdrom_disc_t;21.44 +21.45 +/** sector read mode - values are based on the MMC READ CD command. */21.46 +typedef uint16_t cdrom_read_mode_t;21.47 +#define CDROM_READ_ANY (0<<2)21.48 +#define CDROM_READ_CDDA (1<<2)21.49 +#define CDROM_READ_MODE1 (2<<2)21.50 +#define CDROM_READ_MODE2 (3<<2)21.51 +#define CDROM_READ_MODE2_FORM1 (4<<2)21.52 +#define CDROM_READ_MODE2_FORM2 (5<<2)21.53 +21.54 +#define CDROM_READ_NONE 0x000021.55 +#define CDROM_READ_SYNC 0x800021.56 +#define CDROM_READ_DATA 0x100021.57 +#define CDROM_READ_ECC 0x080021.58 +#define CDROM_READ_HEADER 0x200021.59 +#define CDROM_READ_SUBHEADER 0x400021.60 +#define CDROM_READ_RAW 0xF800 /* Read full sector */21.61 +#define CDROM_READ_TYPE(x) ((x) & 0x1C)21.62 +#define CDROM_READ_FIELDS(x) ((x) & 0xF800)21.63 +21.64 +/** Actual sector mode */21.65 +typedef enum {21.66 + SECTOR_UNKNOWN, // Unknown sector mode21.67 + SECTOR_CDDA, // Standard audio track21.68 + /* Data-only modes */21.69 + SECTOR_MODE1, // Standard CD-Rom Mode 1 data track21.70 + SECTOR_MODE2_FORMLESS, // Mode 2 data track with no sub-structure (rare)21.71 + SECTOR_MODE2_FORM1, // Mode 2/Form 1 data track (standard for multisession)21.72 + SECTOR_MODE2_FORM2, // Mode 2/Form 2 data track (also fairly uncommon).21.73 +21.74 + /* 2336-byte Mode 2 XA sector with subheader and ecc data */21.75 + SECTOR_SEMIRAW_MODE2,21.76 + /* 2352-byte raw data sector in an XA session */21.77 + SECTOR_RAW_XA,21.78 + /* 2352-byte raw data sector in a non-XA session */21.79 + SECTOR_RAW_NONXA,21.80 +} sector_mode_t;21.81 +21.82 +21.83 +extern const uint32_t cdrom_sector_size[];21.84 +extern const uint32_t cdrom_sector_read_mode[];21.85 +#define CDROM_MAX_SECTOR_SIZE 235221.86 +#define CDROM_MAX_TRACKS 9921.87 +#define CDROM_MSF_START 150 /* MSF numbering starts after the initial pregap */21.88 +#define CDROM_FRAMES_PER_SECOND 7521.89 +#define CDROM_SECONDS_PER_MINUTE 6021.90 +#define CDROM_FRAMES_PER_MINUTE (CDROM_FRAMES_PER_SECOND*CDROM_SECONDS_PER_MINUTE)21.91 +#define CDROM_PREGAP 150 /* Standard pregap, in frames */21.92 +#define CDROM_SECTOR_SIZE(x) cdrom_sector_size[x]21.93 +#define CDROM_SECTOR_READ_MODE(x) cdrom_sector_read_mode[x]21.94 +#define MSFTOLBA( m,s,f ) ((f) + ((s)*CDROM_FRAMES_PER_SECOND) + ((m)*CDROM_FRAMES_PER_MINUTE) - CDROM_MSF_START)21.95 +21.96 +/**21.97 + * Convert an 8-bit BCD number to integer form.21.98 + * Eg, 0x79 => 7921.99 + */21.100 +uint8_t static inline BCDTOU8( uint8_t bcd )21.101 +{21.102 + return (bcd & 0x0F) + (((bcd & 0xF0)>>4)*10);21.103 +}21.104 +21.105 +/**21.106 + * Convert a 32 bit BCD-encoded MSF address to the21.107 + * equivalent LBA form.21.108 + * Eg, 0x21.109 + */21.110 +cdrom_lba_t static inline BCD_MSFTOLBA( uint32_t msf )21.111 +{21.112 + msf = GUINT32_FROM_BE(msf);21.113 + int f = BCDTOU8(msf);21.114 + int s = BCDTOU8(msf>>8);21.115 + int m = BCDTOU8(msf>>16);21.116 + return MSFTOLBA(m,s,f);21.117 +}21.118 +21.119 +/* Disc types */21.120 +typedef uint8_t cdrom_type_t;21.121 +#define CDROM_TYPE_NONXA 0x00 /* Audio or straight mode-1 data */21.122 +#define CDROM_TYPE_CDI 0x1021.123 +#define CDROM_TYPE_XA 0x2021.124 +#define CDROM_TYPE_GD 0x80 /* SEGA only */21.125 +21.126 +21.127 +/* Error codes are defined as MMC sense data - low byte is the sense key,21.128 + * next byte, is the ASC code, and third byte is the ASCQ (not currently used)21.129 + */21.130 +typedef uint32_t cdrom_error_t;21.131 +#define CDROM_ERROR_OK 0x000021.132 +#define CDROM_ERROR_NODISC 0x3A0221.133 +#define CDROM_ERROR_BADCMD 0x200521.134 +#define CDROM_ERROR_BADFIELD 0x240521.135 +#define CDROM_ERROR_BADREAD 0x300221.136 +#define CDROM_ERROR_BADREADMODE 0x6405 /* Illegal mode for this track */21.137 +#define CDROM_ERROR_READERROR 0x1103 /* Read failed due to uncorrectable error */21.138 +#define CDROM_ERROR_RESET 0x290621.139 +21.140 +#ifdef __cplusplus21.141 +}21.142 +#endif21.143 +21.144 +#endif /* !cdrom_defs_H */
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000022.2 +++ b/src/drivers/cdrom/drive.c Sun Jan 31 18:35:06 2010 +100022.3 @@ -0,0 +1,148 @@22.4 +/**22.5 + * $Id$22.6 + *22.7 + * Host CD/DVD drive support.22.8 + *22.9 + * Copyright (c) 2009 Nathan Keynes.22.10 + *22.11 + * This program is free software; you can redistribute it and/or modify22.12 + * it under the terms of the GNU General Public License as published by22.13 + * the Free Software Foundation; either version 2 of the License, or22.14 + * (at your option) any later version.22.15 + *22.16 + * This program is distributed in the hope that it will be useful,22.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of22.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the22.19 + * GNU General Public License for more details.22.20 + */22.21 +22.22 +#include <stdlib.h>22.23 +#include <glib/gstrfuncs.h>22.24 +#include <glib/gmem.h>22.25 +#include "drivers/cdrom/drive.h"22.26 +#include "drivers/cdrom/cdimpl.h"22.27 +22.28 +static GList *cdrom_drive_list;22.29 +22.30 +static cdrom_drive_t cdrom_drive_new( const char *name, const char *display_name, cdrom_drive_open_fn_t open_fn )22.31 +{22.32 + cdrom_drive_t drive = g_malloc0( sizeof(struct cdrom_drive) );22.33 + drive->name = g_strdup(name);22.34 + drive->display_name = g_strdup(display_name);22.35 + drive->open = open_fn;22.36 + return drive;22.37 +}22.38 +22.39 +static void cdrom_drive_destroy( cdrom_drive_t drive )22.40 +{22.41 + g_free( (char *)drive->name );22.42 + drive->name = NULL;22.43 + g_free( (char *)drive->display_name );22.44 + drive->display_name = NULL;22.45 + g_free( drive );22.46 +}22.47 +22.48 +GList *cdrom_drive_get_list()22.49 +{22.50 + return cdrom_drive_list;22.51 +}22.52 +22.53 +cdrom_drive_t cdrom_drive_add( const char *name, const char *display_name, cdrom_drive_open_fn_t open_fn )22.54 +{22.55 + for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {22.56 + cdrom_drive_t it = (cdrom_drive_t)ptr->data;22.57 + if( strcmp(it->name, name) == 0 ) {22.58 + return it;22.59 + }22.60 + }22.61 +22.62 + cdrom_drive_t new_drive = cdrom_drive_new(name,display_name,open_fn);22.63 + cdrom_drive_list = g_list_append( cdrom_drive_list, new_drive );22.64 + return new_drive;22.65 +}22.66 +22.67 +gboolean cdrom_drive_remove( const char *name )22.68 +{22.69 + for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {22.70 + cdrom_drive_t it = (cdrom_drive_t)ptr->data;22.71 + if( strcmp(it->name, name) == 0 ) {22.72 + cdrom_drive_list = g_list_delete_link( cdrom_drive_list, ptr );22.73 + cdrom_drive_destroy(it);22.74 + return TRUE;22.75 + }22.76 + }22.77 + return FALSE;22.78 +}22.79 +22.80 +void cdrom_drive_remove_all()22.81 +{22.82 + for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {22.83 + cdrom_drive_destroy( (cdrom_drive_t)ptr->data );22.84 + }22.85 + g_list_free(cdrom_drive_list);22.86 + cdrom_drive_list = NULL;22.87 +}22.88 +22.89 +cdrom_drive_t cdrom_drive_get_index( unsigned int index )22.90 +{22.91 + return (cdrom_drive_t)g_list_nth_data(cdrom_drive_list, index);22.92 +}22.93 +22.94 +cdrom_disc_t cdrom_drive_open( cdrom_drive_t drive, ERROR *err )22.95 +{22.96 + return drive->open(drive, err);22.97 +}22.98 +22.99 +cdrom_drive_t cdrom_drive_find( const char *name )22.100 +{22.101 + const char *id = name;22.102 +22.103 + /* If we have no drives, just return NULL without looking, to save time */22.104 + if( cdrom_drive_list == NULL )22.105 + return NULL;22.106 +22.107 + /* Check for a url-style name */22.108 + const char *lizard_lips = strstr( name, "://" );22.109 + if( lizard_lips != NULL ) {22.110 + id = lizard_lips + 3;22.111 + int method_len = (lizard_lips-name);22.112 + if( method_len > 8 )22.113 + return NULL;22.114 +22.115 + char method[method_len + 1];22.116 + memcpy( method, name, method_len );22.117 + method[method_len] = '\0';22.118 +22.119 + if( strcasecmp( method, "file" ) != 0 &&22.120 + strcasecmp( method, "dvd" ) != 0 &&22.121 + strcasecmp( method, "cd" ) != 0 &&22.122 + strcasecmp( method, "cdrom" ) ) {22.123 + /* Anything else we don't try to recognize */22.124 + return NULL;22.125 + }22.126 +22.127 + if( *id == '\0' ) {22.128 + /* Accept eg 'dvd://' as meaning 'the first cd/dvd device */22.129 + return cdrom_drive_list->data;22.130 + }22.131 +22.132 + char *endp = NULL;22.133 + unsigned long index = strtoul( id, &endp, 10 );22.134 + if( endp != NULL && *endp == '\0' ) {22.135 + /* Accept eg 'dvd://2' as meaning 'the second cd/dvd device */22.136 + return cdrom_drive_get_index(index);22.137 + }22.138 +22.139 + /* Otherwise it must be a drive identifier, so treat it as if it didn't22.140 + * have the url prefix. (fallthrough)22.141 + */22.142 + }22.143 +22.144 + for( GList *ptr = cdrom_drive_list; ptr != NULL; ptr = ptr->next ) {22.145 + cdrom_drive_t drive = (cdrom_drive_t)ptr->data;22.146 + if( strcmp(drive->name, id) == 0 )22.147 + return drive;22.148 + }22.149 +22.150 + return NULL;22.151 +}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000023.2 +++ b/src/drivers/cdrom/drive.h Sun Jan 31 18:35:06 2010 +100023.3 @@ -0,0 +1,97 @@23.4 +/**23.5 + * $Id$23.6 + *23.7 + * Host CD/DVD drive support.23.8 + *23.9 + * This module supplies functions to enumerate the physical drives in the23.10 + * host system, and open them as a cdrom disc.23.11 + *23.12 + * Note that cdrom_disc_t objects bound to a physical drive may update their23.13 + * TOC at any time, including setting disc_type to CDROM_DISC_NONE (to indicate23.14 + * no media present).23.15 + *23.16 + * Copyright (c) 2009 Nathan Keynes.23.17 + *23.18 + * This program is free software; you can redistribute it and/or modify23.19 + * it under the terms of the GNU General Public License as published by23.20 + * the Free Software Foundation; either version 2 of the License, or23.21 + * (at your option) any later version.23.22 + *23.23 + * This program is distributed in the hope that it will be useful,23.24 + * but WITHOUT ANY WARRANTY; without even the implied warranty of23.25 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the23.26 + * GNU General Public License for more details.23.27 + */23.28 +23.29 +#ifndef cdrom_drive_H23.30 +#define cdrom_drive_H 123.31 +23.32 +#include <glib/glist.h>23.33 +#include "hook.h"23.34 +#include "drivers/cdrom/defs.h"23.35 +23.36 +#ifdef __cplusplus23.37 +extern "C" {23.38 +#endif23.39 +23.40 +23.41 +typedef struct cdrom_drive *cdrom_drive_t;23.42 +23.43 +typedef cdrom_disc_t (*cdrom_drive_open_fn_t)(cdrom_drive_t, ERROR *);23.44 +23.45 +/**23.46 + * A cdrom_device is a placeholder for a physical CD/DVD drive in the host23.47 + * system.23.48 + */23.49 +struct cdrom_drive {23.50 + /**23.51 + * System name for the device23.52 + */23.53 + const char *name;23.54 + /**23.55 + * Human-readable name of the device - normally the device's vendor23.56 + * and product name as returned by an Inquiry request.23.57 + */23.58 + const char *display_name;23.59 +23.60 + /**23.61 + * Implementation specific function to open the drive, returning a new23.62 + * cdrom_disc_t.23.63 + */23.64 + cdrom_drive_open_fn_t open;23.65 +};23.66 +23.67 +typedef gboolean (*cdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );23.68 +DECLARE_HOOK(cdrom_drive_list_change_hook, cdrom_drive_list_change_hook_t);23.69 +23.70 +23.71 +/**23.72 + * Native CD-ROM API - provided by drivers/cd_*.c23.73 + *23.74 + * A device name is either a system special file (most unixes) or a url of the23.75 + * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system23.76 + * defined string that uniquely identifies a particular device.23.77 + */23.78 +23.79 +/**23.80 + * Return a list of cdrom_drive_t defining all CD/DVD drives in the host system.23.81 + */23.82 +GList *cdrom_drive_get_list();23.83 +23.84 +/**23.85 + *23.86 + */23.87 +cdrom_drive_t cdrom_drive_find( const char *name );23.88 +23.89 +/**23.90 + * Open a cdrom_drive_t previously obtained from the system.23.91 + *23.92 + * @return NULL on failure, otherwise a valid cdrom_disc_t that can be mounted.23.93 + */23.94 +cdrom_disc_t cdrom_drive_open( cdrom_drive_t drive, ERROR *err );23.95 +23.96 +#ifdef __cplusplus23.97 +}23.98 +#endif23.99 +23.100 +#endif /* !cdrom_drive_H */
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000024.2 +++ b/src/drivers/cdrom/ecc.h Sun Jan 31 18:35:06 2010 +100024.3 @@ -0,0 +1,136 @@24.4 +/*24.5 + * This file has been modified for the cdrkit suite.24.6 + *24.7 + * The behaviour and appearence of the program code below can differ to a major24.8 + * extent from the version distributed by the original author(s).24.9 + *24.10 + * For details, see Changelog file distributed with the cdrkit package. If you24.11 + * received this file from another source then ask the distributing person for24.12 + * a log of modifications.24.13 + *24.14 + */24.15 +24.16 +/* @(#)ecc.h 1.4 02/10/19 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */24.17 +24.18 +/*24.19 + * compact disc reed-solomon routines24.20 + *24.21 + * (c) 1998-2002 by Heiko Eissfeldt, heiko@colossus.escape.de24.22 + * (c) 2002 by Joerg Schilling24.23 + */24.24 +/*24.25 + * This program is free software; you can redistribute it and/or modify24.26 + * it under the terms of the GNU General Public License version 224.27 + * as published by the Free Software Foundation.24.28 + *24.29 + * This program is distributed in the hope that it will be useful,24.30 + * but WITHOUT ANY WARRANTY; without even the implied warranty of24.31 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the24.32 + * GNU General Public License for more details.24.33 + *24.34 + * You should have received a copy of the GNU General Public License along with24.35 + * this program; see the file COPYING. If not, write to the Free Software24.36 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.24.37 + */24.38 +24.39 +#define RS_L12_BITS 824.40 +24.41 +/* audio sector definitions for CIRC */24.42 +#define FRAMES_PER_SECTOR 9824.43 +/* user data bytes per frame */24.44 +#define L1_RAW 2424.45 +/* parity bytes with 8 bit */24.46 +#define L1_Q 424.47 +#define L1_P 424.48 +24.49 +int cd_build_address(unsigned char inout[], int sectortype, unsigned address);24.50 +24.51 +/* audio sector Cross Interleaved Reed-Solomon Code (CIRC) encoder (layer 1) */24.52 +/* adds P- and Q- parity information to audio (f2) frames. Also24.53 + optionally handles the various delays and permutations. The output with all24.54 + stages enabled can be fed into the Eight-Fourteen-Modulator.24.55 + On input: 2352 bytes of audio data is given.24.56 + On output: 3136 bytes of CIRC enriched audio data are returned.24.57 + */24.58 +int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],24.59 + unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],24.60 + int delay1, int delay2, int delay3, int scramble);24.61 +24.62 +/* data sector definitions for RSPC */24.63 +/* user data bytes per frame */24.64 +#define L2_RAW (1024*2)24.65 +/* parity bytes for 16 bit units */24.66 +#define L2_Q (26*2*2)24.67 +#define L2_P (43*2*2)24.68 +24.69 +/* known sector types */24.70 +#define MODE_0 SECTOR_UNKNOWN24.71 +#define MODE_1 SECTOR_MODE124.72 +#define MODE_2 SECTOR_MODE2_FORMLESS24.73 +#define MODE_2_FORM_1 SECTOR_MODE2_FORM124.74 +#define MODE_2_FORM_2 SECTOR_MODE2_FORM224.75 +24.76 +/* set one of the MODE_* constants for subsequent data sector formatting */24.77 +int set_sector_type(int st);24.78 +/* get the current sector type setting for data sector formatting */24.79 +int get_sector_type(void);24.80 +24.81 +/* data sector layer 2 Reed-Solomon Product Code encoder */24.82 +/* encode the given data portion depending on sector type (see24.83 + get/set_sector_type() functions). Use the given address for the header.24.84 + The returned data is __unscrambled__ and not in F2-frame format (for that24.85 + see function scramble_L2()).24.86 + Supported sector types:24.87 + MODE_0: a 12-byte sync field, a header and 2336 zeros are returned.24.88 + MODE_1: the user data portion (2048 bytes) has to be given24.89 + at offset 16 in the inout array.24.90 + Sync-, header-, edc-, spare-, p- and q- fields will be added.24.91 + MODE_2: the user data portion (2336 bytes) has to be given24.92 + at offset 16 in the inout array.24.93 + Sync- and header- fields will be added.24.94 + MODE_2_FORM_1: the user data portion (8 bytes subheader followed24.95 + by 2048 bytes data) has to be given at offset 1624.96 + in the inout array.24.97 + Sync-, header-, edc-, p- and q- fields will be added.24.98 + MODE_2_FORM_2: the user data portion (8 bytes subheader followed24.99 + by 2324 bytes data) has to be given at offset 1624.100 + in the inout array.24.101 + Sync-, header- and edc- fields will be added.24.102 +*/24.103 +int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);24.104 +int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);24.105 +int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);24.106 +unsigned int build_edc(unsigned char inout[], int from, int upto);24.107 +24.108 +/* generates f2 frames from otherwise fully formatted sectors (generated by24.109 + do_encode_L2()). */24.110 +#define EDC_SCRAMBLE_NOSWAP 1 /* Do not swap bytes while scrambling */24.111 +int scramble_L2(unsigned char *inout);24.112 +24.113 +/* r-w sub channel definitions */24.114 +#define RS_SUB_RW_BITS 624.115 +24.116 +#define PACKETS_PER_SUBCHANNELFRAME 424.117 +#define LSUB_RAW 1824.118 +#define LSUB_QRAW 224.119 +/* 6 bit */24.120 +#define LSUB_Q 224.121 +#define LSUB_P 424.122 +24.123 +/* R-W subchannel encoder */24.124 +/* On input: 72 bytes packed user data, four frames with each 18 bytes.24.125 + On output: per frame: 2 bytes user data, 2 bytes Q parity,24.126 + 16 bytes user data, 4 bytes P parity.24.127 + Options:24.128 + delay1: use low level delay line24.129 + scramble: perform low level permutations24.130 + */24.131 +int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],24.132 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],24.133 + int delay1, int scramble);24.134 +int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],24.135 + unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],24.136 + int delay1, int scramble);24.137 +24.138 +int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);24.139 +int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000025.2 +++ b/src/drivers/cdrom/edc_crctable.h Sun Jan 31 18:35:06 2010 +100025.3 @@ -0,0 +1,171 @@25.4 +/* @(#)crctable.out 1.2 02/10/17 joerg */25.5 +25.6 +/*****************************************************************/25.7 +/* */25.8 +/* CRC LOOKUP TABLE */25.9 +/* ================ */25.10 +/* The following CRC lookup table was generated automagically */25.11 +/* by the Rocksoft^tm Model CRC Algorithm Table Generation */25.12 +/* Program V1.0 using the following model parameters: */25.13 +/* */25.14 +/* Width : 4 bytes. */25.15 +/* Poly : 0x8001801BL */25.16 +/* Reverse : TRUE. */25.17 +/* */25.18 +/* For more information on the Rocksoft^tm Model CRC Algorithm, */25.19 +/* see the document titled "A Painless Guide to CRC Error */25.20 +/* Detection Algorithms" by Ross Williams */25.21 +/* (ross@guest.adelaide.edu.au.). This document is likely to be */25.22 +/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */25.23 +/* */25.24 +/*****************************************************************/25.25 +25.26 +#ifdef PROTOTYPES25.27 +25.28 +static unsigned int EDC_crctable[256] =25.29 +{25.30 + 0x00000000U, 0x90910101U, 0x91210201U, 0x01B00300U,25.31 + 0x92410401U, 0x02D00500U, 0x03600600U, 0x93F10701U,25.32 + 0x94810801U, 0x04100900U, 0x05A00A00U, 0x95310B01U,25.33 + 0x06C00C00U, 0x96510D01U, 0x97E10E01U, 0x07700F00U,25.34 + 0x99011001U, 0x09901100U, 0x08201200U, 0x98B11301U,25.35 + 0x0B401400U, 0x9BD11501U, 0x9A611601U, 0x0AF01700U,25.36 + 0x0D801800U, 0x9D111901U, 0x9CA11A01U, 0x0C301B00U,25.37 + 0x9FC11C01U, 0x0F501D00U, 0x0EE01E00U, 0x9E711F01U,25.38 + 0x82012001U, 0x12902100U, 0x13202200U, 0x83B12301U,25.39 + 0x10402400U, 0x80D12501U, 0x81612601U, 0x11F02700U,25.40 + 0x16802800U, 0x86112901U, 0x87A12A01U, 0x17302B00U,25.41 + 0x84C12C01U, 0x14502D00U, 0x15E02E00U, 0x85712F01U,25.42 + 0x1B003000U, 0x8B913101U, 0x8A213201U, 0x1AB03300U,25.43 + 0x89413401U, 0x19D03500U, 0x18603600U, 0x88F13701U,25.44 + 0x8F813801U, 0x1F103900U, 0x1EA03A00U, 0x8E313B01U,25.45 + 0x1DC03C00U, 0x8D513D01U, 0x8CE13E01U, 0x1C703F00U,25.46 + 0xB4014001U, 0x24904100U, 0x25204200U, 0xB5B14301U,25.47 + 0x26404400U, 0xB6D14501U, 0xB7614601U, 0x27F04700U,25.48 + 0x20804800U, 0xB0114901U, 0xB1A14A01U, 0x21304B00U,25.49 + 0xB2C14C01U, 0x22504D00U, 0x23E04E00U, 0xB3714F01U,25.50 + 0x2D005000U, 0xBD915101U, 0xBC215201U, 0x2CB05300U,25.51 + 0xBF415401U, 0x2FD05500U, 0x2E605600U, 0xBEF15701U,25.52 + 0xB9815801U, 0x29105900U, 0x28A05A00U, 0xB8315B01U,25.53 + 0x2BC05C00U, 0xBB515D01U, 0xBAE15E01U, 0x2A705F00U,25.54 + 0x36006000U, 0xA6916101U, 0xA7216201U, 0x37B06300U,25.55 + 0xA4416401U, 0x34D06500U, 0x35606600U, 0xA5F16701U,25.56 + 0xA2816801U, 0x32106900U, 0x33A06A00U, 0xA3316B01U,25.57 + 0x30C06C00U, 0xA0516D01U, 0xA1E16E01U, 0x31706F00U,25.58 + 0xAF017001U, 0x3F907100U, 0x3E207200U, 0xAEB17301U,25.59 + 0x3D407400U, 0xADD17501U, 0xAC617601U, 0x3CF07700U,25.60 + 0x3B807800U, 0xAB117901U, 0xAAA17A01U, 0x3A307B00U,25.61 + 0xA9C17C01U, 0x39507D00U, 0x38E07E00U, 0xA8717F01U,25.62 + 0xD8018001U, 0x48908100U, 0x49208200U, 0xD9B18301U,25.63 + 0x4A408400U, 0xDAD18501U, 0xDB618601U, 0x4BF08700U,25.64 + 0x4C808800U, 0xDC118901U, 0xDDA18A01U, 0x4D308B00U,25.65 + 0xDEC18C01U, 0x4E508D00U, 0x4FE08E00U, 0xDF718F01U,25.66 + 0x41009000U, 0xD1919101U, 0xD0219201U, 0x40B09300U,25.67 + 0xD3419401U, 0x43D09500U, 0x42609600U, 0xD2F19701U,25.68 + 0xD5819801U, 0x45109900U, 0x44A09A00U, 0xD4319B01U,25.69 + 0x47C09C00U, 0xD7519D01U, 0xD6E19E01U, 0x46709F00U,25.70 + 0x5A00A000U, 0xCA91A101U, 0xCB21A201U, 0x5BB0A300U,25.71 + 0xC841A401U, 0x58D0A500U, 0x5960A600U, 0xC9F1A701U,25.72 + 0xCE81A801U, 0x5E10A900U, 0x5FA0AA00U, 0xCF31AB01U,25.73 + 0x5CC0AC00U, 0xCC51AD01U, 0xCDE1AE01U, 0x5D70AF00U,25.74 + 0xC301B001U, 0x5390B100U, 0x5220B200U, 0xC2B1B301U,25.75 + 0x5140B400U, 0xC1D1B501U, 0xC061B601U, 0x50F0B700U,25.76 + 0x5780B800U, 0xC711B901U, 0xC6A1BA01U, 0x5630BB00U,25.77 + 0xC5C1BC01U, 0x5550BD00U, 0x54E0BE00U, 0xC471BF01U,25.78 + 0x6C00C000U, 0xFC91C101U, 0xFD21C201U, 0x6DB0C300U,25.79 + 0xFE41C401U, 0x6ED0C500U, 0x6F60C600U, 0xFFF1C701U,25.80 + 0xF881C801U, 0x6810C900U, 0x69A0CA00U, 0xF931CB01U,25.81 + 0x6AC0CC00U, 0xFA51CD01U, 0xFBE1CE01U, 0x6B70CF00U,25.82 + 0xF501D001U, 0x6590D100U, 0x6420D200U, 0xF4B1D301U,25.83 + 0x6740D400U, 0xF7D1D501U, 0xF661D601U, 0x66F0D700U,25.84 + 0x6180D800U, 0xF111D901U, 0xF0A1DA01U, 0x6030DB00U,25.85 + 0xF3C1DC01U, 0x6350DD00U, 0x62E0DE00U, 0xF271DF01U,25.86 + 0xEE01E001U, 0x7E90E100U, 0x7F20E200U, 0xEFB1E301U,25.87 + 0x7C40E400U, 0xECD1E501U, 0xED61E601U, 0x7DF0E700U,25.88 + 0x7A80E800U, 0xEA11E901U, 0xEBA1EA01U, 0x7B30EB00U,25.89 + 0xE8C1EC01U, 0x7850ED00U, 0x79E0EE00U, 0xE971EF01U,25.90 + 0x7700F000U, 0xE791F101U, 0xE621F201U, 0x76B0F300U,25.91 + 0xE541F401U, 0x75D0F500U, 0x7460F600U, 0xE4F1F701U,25.92 + 0xE381F801U, 0x7310F900U, 0x72A0FA00U, 0xE231FB01U,25.93 + 0x71C0FC00U, 0xE151FD01U, 0xE0E1FE01U, 0x7070FF00U,25.94 +};25.95 +25.96 +/*****************************************************************/25.97 +/* End of CRC Lookup Table */25.98 +/*****************************************************************/25.99 +25.100 +#else /* PROTOTYPES */25.101 +25.102 +static unsigned int EDC_crctable[256] =25.103 +{25.104 + 0x00000000, 0x90910101, 0x91210201, 0x01B00300,25.105 + 0x92410401, 0x02D00500, 0x03600600, 0x93F10701,25.106 + 0x94810801, 0x04100900, 0x05A00A00, 0x95310B01,25.107 + 0x06C00C00, 0x96510D01, 0x97E10E01, 0x07700F00,25.108 + 0x99011001, 0x09901100, 0x08201200, 0x98B11301,25.109 + 0x0B401400, 0x9BD11501, 0x9A611601, 0x0AF01700,25.110 + 0x0D801800, 0x9D111901, 0x9CA11A01, 0x0C301B00,25.111 + 0x9FC11C01, 0x0F501D00, 0x0EE01E00, 0x9E711F01,25.112 + 0x82012001, 0x12902100, 0x13202200, 0x83B12301,25.113 + 0x10402400, 0x80D12501, 0x81612601, 0x11F02700,25.114 + 0x16802800, 0x86112901, 0x87A12A01, 0x17302B00,25.115 + 0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01,25.116 + 0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300,25.117 + 0x89413401, 0x19D03500, 0x18603600, 0x88F13701,25.118 + 0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01,25.119 + 0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00,25.120 + 0xB4014001, 0x24904100, 0x25204200, 0xB5B14301,25.121 + 0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700,25.122 + 0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00,25.123 + 0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01,25.124 + 0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300,25.125 + 0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701,25.126 + 0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01,25.127 + 0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00,25.128 + 0x36006000, 0xA6916101, 0xA7216201, 0x37B06300,25.129 + 0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701,25.130 + 0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01,25.131 + 0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00,25.132 + 0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301,25.133 + 0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700,25.134 + 0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00,25.135 + 0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01,25.136 + 0xD8018001, 0x48908100, 0x49208200, 0xD9B18301,25.137 + 0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700,25.138 + 0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00,25.139 + 0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01,25.140 + 0x41009000, 0xD1919101, 0xD0219201, 0x40B09300,25.141 + 0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701,25.142 + 0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01,25.143 + 0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00,25.144 + 0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300,25.145 + 0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701,25.146 + 0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01,25.147 + 0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00,25.148 + 0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301,25.149 + 0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700,25.150 + 0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00,25.151 + 0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01,25.152 + 0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300,25.153 + 0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701,25.154 + 0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01,25.155 + 0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00,25.156 + 0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301,25.157 + 0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700,25.158 + 0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00,25.159 + 0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01,25.160 + 0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301,25.161 + 0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700,25.162 + 0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00,25.163 + 0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01,25.164 + 0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300,25.165 + 0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701,25.166 + 0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01,25.167 + 0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00,25.168 +};25.169 +25.170 +#endif /* PROTOTYPES */25.171 +25.172 +/*****************************************************************/25.173 +/* End of CRC Lookup Table */25.174 +/*****************************************************************/
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000026.2 +++ b/src/drivers/cdrom/edc_ecc.c Sun Jan 31 18:35:06 2010 +100026.3 @@ -0,0 +1,801 @@26.4 +/*26.5 + * Note: This file has been extracted from crkit 1.1.6 and modified to work within26.6 + * lxdream.26.7 + */26.8 +/*26.9 + * This file has been modified for the cdrkit suite.26.10 + *26.11 + * The behaviour and appearence of the program code below can differ to a major26.12 + * extent from the version distributed by the original author(s).26.13 + *26.14 + * For details, see Changelog file distributed with the cdrkit package. If you26.15 + * received this file from another source then ask the distributing person for26.16 + * a log of modifications.26.17 + *26.18 + */26.19 +26.20 +/* @(#)edc_ecc.c 1.21 03/04/04 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */26.21 +26.22 +/*26.23 + * Copyright 1998-2002 by Heiko Eissfeldt26.24 + * Copyright 2002 by Joerg Schilling26.25 + *26.26 + * This file contains protected intellectual property.26.27 + *26.28 + * reed-solomon encoder / decoder for compact discs.26.29 + *26.30 + */26.31 +/*26.32 + * This program is free software; you can redistribute it and/or modify26.33 + * it under the terms of the GNU General Public License version 226.34 + * as published by the Free Software Foundation.26.35 + *26.36 + * This program is distributed in the hope that it will be useful,26.37 + * but WITHOUT ANY WARRANTY; without even the implied warranty of26.38 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the26.39 + * GNU General Public License for more details.26.40 + *26.41 + * You should have received a copy of the GNU General Public License along with26.42 + * this program; see the file COPYING. If not, write to the Free Software26.43 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.26.44 + */26.45 +26.46 +#include <stdint.h>26.47 +#include <stdio.h>26.48 +#include <string.h>26.49 +#include "drivers/cdrom/defs.h"26.50 +#include "drivers/cdrom/ecc.h"26.51 +26.52 +#define xaligned(a, s) ((((uintptr_t)(a)) & (s)) == 0 )26.53 +26.54 +int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)],26.55 + int sectortype, unsigned address);26.56 +26.57 +int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],26.58 + unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],26.59 + int delay1, int delay2, int delay3, int permute);26.60 +26.61 +int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],26.62 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],26.63 + int delay1, int permute);26.64 +26.65 +int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],26.66 + unsigned char out[L2_RAW]);26.67 +26.68 +int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],26.69 + unsigned char out[L1_RAW*FRAMES_PER_SECTOR],26.70 + int delay1, int delay2, int delay3, int permute);26.71 +26.72 +int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],26.73 + unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],26.74 + int delay1, int permute);26.75 +26.76 +26.77 +26.78 +/* ------------- tables generated by gen_encodes --------------*/26.79 +26.80 +#include "edc_scramble.h"26.81 +26.82 +#define DO4(a) a;a;a;a;26.83 +#define DO13(a) a;a;a;a;a;a;a;a;a;a;a;a;a;26.84 +26.85 +/*26.86 + * Scrambles 2352 - 12 = 2340 bytes26.87 + */26.88 +int scramble_L2(unsigned char *inout);26.89 +26.90 +int scramble_L2(unsigned char *inout)26.91 +{26.92 +#ifndef EDC_SCRAMBLE_NOSWAP26.93 + unsigned int *f = (unsigned int *)inout;26.94 +#endif26.95 +26.96 + if (!xaligned(inout + 12, sizeof(uint32_t)-1)) {26.97 +26.98 + uint8_t *r = inout + 12;26.99 + const uint8_t *s = yellowbook_scrambler;26.100 + register int i;26.101 +26.102 + for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(unsigned char)/4; --i >= 0;) {26.103 + DO4(*r++ ^= *s++);26.104 + }26.105 +26.106 + } else {26.107 + uint32_t *r = (uint32_t *) (inout + 12);26.108 + const uint32_t *s = yellowbook_scrambler_uint32;26.109 + register int i;26.110 +26.111 + for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(uint32_t)/13; --i >= 0;) {26.112 + DO13(*r++ ^= *s++);26.113 + }26.114 + }26.115 +26.116 +#ifndef EDC_SCRAMBLE_NOSWAP26.117 +26.118 + /* generate F1 frames */26.119 + for (i = 2352/sizeof(unsigned int); i; i--) {26.120 + *f++ = ((*f & 0xff00ff00UL) >> 8) | ((*f & 0x00ff00ffUL) << 8);26.121 + }26.122 +#endif26.123 +26.124 + return (0);26.125 +}26.126 +26.127 +#include "edc_l2sq.h"26.128 +26.129 +static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q]);26.130 +26.131 +static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q])26.132 +{26.133 + unsigned char *dps;26.134 + unsigned char *dp;26.135 + unsigned char *Q;26.136 + register int i;26.137 + int j;26.138 +26.139 + Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;26.140 +26.141 + dps = inout;26.142 + for (j = 0; j < 26; j++) {26.143 + register unsigned short a;26.144 + register unsigned short b;26.145 + a = b = 0;26.146 +26.147 + dp = dps;26.148 + for (i = 0; i < 43; i++) {26.149 +26.150 + /* LSB */26.151 + a ^= L2sq[i][*dp++];26.152 +26.153 + /* MSB */26.154 + b ^= L2sq[i][*dp];26.155 +26.156 + dp += 2*44-1;26.157 + if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {26.158 + dp -= (4 + L2_RAW + 4 + 8 + L2_P);26.159 + }26.160 + }26.161 + Q[0] = a >> 8;26.162 + Q[26*2] = a;26.163 + Q[1] = b >> 8;26.164 + Q[26*2+1] = b;26.165 +26.166 + Q += 2;26.167 + dps += 2*43;26.168 + }26.169 + return (0);26.170 +}26.171 +26.172 +static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P]);26.173 +26.174 +static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P])26.175 +{26.176 + unsigned char *dp;26.177 + unsigned char *P;26.178 + register int i;26.179 + int j;26.180 +26.181 + P = inout + 4 + L2_RAW + 4 + 8;26.182 +26.183 + for (j = 0; j < 43; j++) {26.184 + register unsigned short a;26.185 + register unsigned short b;26.186 +26.187 + a = b = 0;26.188 + dp = inout;26.189 + for (i = 19; i < 43; i++) {26.190 +26.191 + /* LSB */26.192 + a ^= L2sq[i][*dp++];26.193 +26.194 + /* MSB */26.195 + b ^= L2sq[i][*dp];26.196 +26.197 + dp += 2*43 -1;26.198 + }26.199 + P[0] = a >> 8;26.200 + P[43*2] = a;26.201 + P[1] = b >> 8;26.202 + P[43*2+1] = b;26.203 +26.204 + P += 2;26.205 + inout += 2;26.206 + }26.207 + return (0);26.208 +}26.209 +26.210 +static unsigned char bin2bcd(unsigned p);26.211 +26.212 +static unsigned char bin2bcd(unsigned p)26.213 +{26.214 + return ((p/10)<<4)|(p%10);26.215 +}26.216 +26.217 +int cd_build_address(unsigned char inout[], int sectortype, unsigned address)26.218 +{26.219 + inout[12] = bin2bcd(address / (60*75));26.220 + inout[13] = bin2bcd((address / 75) % 60);26.221 + inout[14] = bin2bcd(address % 75);26.222 + if (sectortype == MODE_0)26.223 + inout[15] = 0;26.224 + else if (sectortype == MODE_1)26.225 + inout[15] = 1;26.226 + else if (sectortype == MODE_2)26.227 + inout[15] = 2;26.228 + else if (sectortype == MODE_2_FORM_1)26.229 + inout[15] = 2;26.230 + else if (sectortype == MODE_2_FORM_2)26.231 + inout[15] = 2;26.232 + else26.233 + return (-1);26.234 + return (0);26.235 +}26.236 +26.237 +#include "edc_crctable.h"26.238 +26.239 +/*26.240 + * Called with 2064, 2056 or 2332 byte difference - all dividable by 4.26.241 + */26.242 +unsigned int build_edc(unsigned char inout[], int from, int upto);26.243 +26.244 +unsigned int build_edc(unsigned char inout[], int from, int upto)26.245 +{26.246 + unsigned char *p = inout+from;26.247 + unsigned int result = 0;26.248 +26.249 + upto -= from-1;26.250 + upto /= 4;26.251 + while (--upto >= 0) {26.252 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);26.253 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);26.254 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);26.255 + result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);26.256 + }26.257 + return (result);26.258 +}26.259 +26.260 +/* Layer 2 Product code en/decoder */26.261 +26.262 +int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)],26.263 + int sectortype, unsigned address)26.264 +{26.265 + unsigned int result;26.266 +26.267 +/* SYNCPATTERN "\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" */26.268 +#define SYNCPATTERN "\000\377\377\377\377\377\377\377\377\377\377"26.269 +26.270 + /* supply initial sync pattern */26.271 + memcpy(inout, SYNCPATTERN, sizeof(SYNCPATTERN));26.272 +26.273 + if (sectortype == MODE_0) {26.274 + memset(inout + sizeof(SYNCPATTERN), 0, 4 + L2_RAW + 12 + L2_P + L2_Q);26.275 + cd_build_address(inout, sectortype, address);26.276 + return (0);26.277 + }26.278 +26.279 + switch (sectortype) {26.280 +26.281 + case MODE_1:26.282 + cd_build_address(inout, sectortype, address);26.283 + result = build_edc(inout, 0, 16+2048-1);26.284 + inout[2064+0] = result >> 0L;26.285 + inout[2064+1] = result >> 8L;26.286 + inout[2064+2] = result >> 16L;26.287 + inout[2064+3] = result >> 24L;26.288 + memset(inout+2064+4, 0, 8);26.289 + encode_L2_P(inout+12);26.290 + encode_L2_Q(inout+12);26.291 + break;26.292 + case MODE_2:26.293 + cd_build_address(inout, sectortype, address);26.294 + break;26.295 + case MODE_2_FORM_1:26.296 + result = build_edc(inout, 16, 16+8+2048-1);26.297 + inout[2072+0] = result >> 0L;26.298 + inout[2072+1] = result >> 8L;26.299 + inout[2072+2] = result >> 16L;26.300 + inout[2072+3] = result >> 24L;26.301 +26.302 + /* clear header for P/Q parity calculation */26.303 + inout[12] = 0;26.304 + inout[12+1] = 0;26.305 + inout[12+2] = 0;26.306 + inout[12+3] = 0;26.307 + encode_L2_P(inout+12);26.308 + encode_L2_Q(inout+12);26.309 + cd_build_address(inout, sectortype, address);26.310 + break;26.311 + case MODE_2_FORM_2:26.312 + cd_build_address(inout, sectortype, address);26.313 + result = build_edc(inout, 16, 16+8+2324-1);26.314 + inout[2348+0] = result >> 0L;26.315 + inout[2348+1] = result >> 8L;26.316 + inout[2348+2] = result >> 16L;26.317 + inout[2348+3] = result >> 24L;26.318 + break;26.319 + default:26.320 + return (-1);26.321 + }26.322 +26.323 + return (0);26.324 +}26.325 +26.326 +26.327 +/*--------------------------------------------------------------------------*/26.328 +#include "edc_encoder.h"26.329 +26.330 +static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);26.331 +26.332 +static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q])26.333 +{26.334 + unsigned char *Q;26.335 + int i;26.336 +26.337 + memmove(inout+L1_RAW/2+L1_Q, inout+L1_RAW/2, L1_RAW/2);26.338 + Q = inout + L1_RAW/2;26.339 +26.340 + memset(Q, 0, L1_Q);26.341 + for (i = 0; i < L1_RAW + L1_Q; i++) {26.342 + unsigned char data;26.343 +26.344 + if (i == L1_RAW/2) i += L1_Q;26.345 + data = inout[i];26.346 + if (data != 0) {26.347 + unsigned char base = rs_l12_log[data];26.348 +26.349 + Q[0] ^= rs_l12_alog[(base+AQ[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.350 + Q[1] ^= rs_l12_alog[(base+AQ[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.351 + Q[2] ^= rs_l12_alog[(base+AQ[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.352 + Q[3] ^= rs_l12_alog[(base+AQ[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.353 + }26.354 + }26.355 + return (0);26.356 +}26.357 +26.358 +static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P]);26.359 +26.360 +static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P])26.361 +{26.362 + unsigned char *P;26.363 + int i;26.364 +26.365 + P = inout + L1_RAW + L1_Q;26.366 +26.367 + memset(P, 0, L1_P);26.368 + for (i = 0; i < L2_RAW + L2_Q + L2_P; i++) {26.369 + unsigned char data;26.370 +26.371 + data = inout[i];26.372 + if (data != 0) {26.373 + unsigned char base = rs_l12_log[data];26.374 +26.375 + P[0] ^= rs_l12_alog[(base+AP[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.376 + P[1] ^= rs_l12_alog[(base+AP[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.377 + P[2] ^= rs_l12_alog[(base+AP[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.378 + P[3] ^= rs_l12_alog[(base+AP[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];26.379 + }26.380 + }26.381 + return (0);26.382 +}26.383 +26.384 +static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);26.385 +26.386 +static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q])26.387 +{26.388 + return (0);26.389 +}26.390 +26.391 +static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P]);26.392 +26.393 +static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P])26.394 +{26.395 + return (0);26.396 +}26.397 +26.398 +int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);26.399 +26.400 +int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q])26.401 +{26.402 + return (0);26.403 +}26.404 +26.405 +int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);26.406 +26.407 +int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P])26.408 +{26.409 + return (0);26.410 +}26.411 +26.412 +static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q]);26.413 +26.414 +static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q])26.415 +{26.416 + unsigned char *Q;26.417 + int i;26.418 +26.419 + memmove(inout+LSUB_QRAW+LSUB_Q, inout+LSUB_QRAW, LSUB_RAW-LSUB_QRAW);26.420 + Q = inout + LSUB_QRAW;26.421 +26.422 + memset(Q, 0, LSUB_Q);26.423 +26.424 + for (i = 0; i < LSUB_QRAW; i++) {26.425 + unsigned char data;26.426 +26.427 + data = inout[i] & 0x3f;26.428 + if (data != 0) {26.429 + unsigned char base = rs_sub_rw_log[data];26.430 +26.431 + Q[0] ^= rs_sub_rw_alog[(base+SQ[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.432 + Q[1] ^= rs_sub_rw_alog[(base+SQ[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.433 + }26.434 + }26.435 + return (0);26.436 +}26.437 +26.438 +26.439 +static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);26.440 +26.441 +static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])26.442 +{26.443 + unsigned char *P;26.444 + int i;26.445 +26.446 + P = inout + LSUB_RAW + LSUB_Q;26.447 +26.448 + memset(P, 0, LSUB_P);26.449 + for (i = 0; i < LSUB_RAW + LSUB_Q; i++) {26.450 + unsigned char data;26.451 +26.452 + data = inout[i] & 0x3f;26.453 + if (data != 0) {26.454 + unsigned char base = rs_sub_rw_log[data];26.455 +26.456 + P[0] ^= rs_sub_rw_alog[(base+SP[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.457 + P[1] ^= rs_sub_rw_alog[(base+SP[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.458 + P[2] ^= rs_sub_rw_alog[(base+SP[2][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.459 + P[3] ^= rs_sub_rw_alog[(base+SP[3][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.460 + }26.461 + }26.462 + return (0);26.463 +}26.464 +26.465 +int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);26.466 +26.467 +int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q])26.468 +{26.469 + unsigned char Q[LSUB_Q];26.470 + int i;26.471 +26.472 + memset(Q, 0, LSUB_Q);26.473 + for (i = LSUB_QRAW + LSUB_Q -1; i>=0; i--) {26.474 + unsigned char data;26.475 +26.476 + data = inout[LSUB_QRAW + LSUB_Q -1 -i] & 0x3f;26.477 + if (data != 0) {26.478 + unsigned char base = rs_sub_rw_log[data];26.479 +26.480 + Q[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.481 + Q[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.482 + }26.483 + }26.484 + return (Q[0] != 0 || Q[1] != 0);26.485 +}26.486 +26.487 +int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);26.488 +26.489 +int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])26.490 +{26.491 + unsigned char P[LSUB_P];26.492 + int i;26.493 +26.494 + memset(P, 0, LSUB_P);26.495 + for (i = LSUB_RAW + LSUB_Q + LSUB_P-1; i>=0; i--) {26.496 + unsigned char data;26.497 +26.498 + data = inout[LSUB_RAW + LSUB_Q + LSUB_P -1 -i] & 0x3f;26.499 + if (data != 0) {26.500 + unsigned char base = rs_sub_rw_log[data];26.501 +26.502 + P[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.503 + P[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.504 + P[2] ^= rs_sub_rw_alog[(base+2*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.505 + P[3] ^= rs_sub_rw_alog[(base+3*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];26.506 + }26.507 + }26.508 + return (P[0] != 0 || P[1] != 0 || P[2] != 0 || P[3] != 0);26.509 +}26.510 +26.511 +/* Layer 1 CIRC en/decoder */26.512 +#define MAX_L1_DEL1 226.513 +static unsigned char l1_delay_line1[MAX_L1_DEL1][L1_RAW];26.514 +#define MAX_L1_DEL2 10826.515 +static unsigned char l1_delay_line2[MAX_L1_DEL2][L1_RAW+L1_Q];26.516 +#define MAX_L1_DEL3 126.517 +static unsigned char l1_delay_line3[MAX_L1_DEL3][L1_RAW+L1_Q+L1_P];26.518 +static unsigned l1_del_index;26.519 +26.520 +int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],26.521 + unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],26.522 + int delay1, int delay2, int delay3, int permute)26.523 +{26.524 + int i;26.525 +26.526 + for (i = 0; i < FRAMES_PER_SECTOR; i++) {26.527 + int j;26.528 + unsigned char t;26.529 +26.530 + if (in != out)26.531 + memcpy(out, in, L1_RAW);26.532 +26.533 + if (delay1) {26.534 + /* shift through delay line 1 */26.535 + for (j = 0; j < L1_RAW; j++) {26.536 + if (((j/4) % MAX_L1_DEL1) == 0) {26.537 + t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];26.538 + l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = out[j];26.539 + out[j] = t;26.540 + }26.541 + }26.542 + }26.543 +26.544 + if (permute) {26.545 + /* permute */26.546 + t = out[2]; out[2] = out[8]; out[8] = out[10]; out[10] = out[18];26.547 + out[18] = out[6]; out [6] = t;26.548 + t = out[3]; out[3] = out[9]; out[9] = out[11]; out[11] = out[19];26.549 + out[19] = out[7]; out [7] = t;26.550 + t = out[4]; out[4] = out[16]; out[16] = out[20]; out[20] = out[14];26.551 + out[14] = out[12]; out [12] = t;26.552 + t = out[5]; out[5] = out[17]; out[17] = out[21]; out[21] = out[15];26.553 + out[15] = out[13]; out [13] = t;26.554 + }26.555 +26.556 + /* build Q parity */26.557 + encode_L1_Q(out);26.558 +26.559 + if (delay2) {26.560 + /* shift through delay line 2 */26.561 + for (j = 0; j < L1_RAW+L1_Q; j++) {26.562 + if (j != 0) {26.563 + t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];26.564 + l1_delay_line2[(l1_del_index + j*4) % MAX_L1_DEL2][j] = out[j];26.565 + out[j] = t;26.566 + }26.567 + }26.568 + }26.569 +26.570 + /* build P parity */26.571 + encode_L1_P(out);26.572 +26.573 + if (delay3) {26.574 + /* shift through delay line 3 */26.575 + for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {26.576 + if (((j) & MAX_L1_DEL3) == 0) {26.577 + t = l1_delay_line3[0][j];26.578 + l1_delay_line3[0][j] = out[j];26.579 + out[j] = t;26.580 + }26.581 + }26.582 + }26.583 +26.584 + /* invert Q and P parity */26.585 + for (j = 0; j < L1_Q; j++)26.586 + out[j+12] = ~out[j+12];26.587 + for (j = 0; j < L1_P; j++)26.588 + out[j+28] = ~out[j+28];26.589 +26.590 + l1_del_index++;26.591 + out += L1_RAW+L1_Q+L1_P;26.592 + in += L1_RAW;26.593 + }26.594 + return (0);26.595 +}26.596 +26.597 +int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],26.598 + unsigned char out[L1_RAW*FRAMES_PER_SECTOR],26.599 + int delay1, int delay2, int delay3, int permute)26.600 +{26.601 + int i;26.602 +26.603 + for (i = 0; i < FRAMES_PER_SECTOR; i++) {26.604 + int j;26.605 + unsigned char t;26.606 +26.607 + if (delay3) {26.608 + /* shift through delay line 3 */26.609 + for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {26.610 + if (((j) & MAX_L1_DEL3) != 0) {26.611 + t = l1_delay_line3[0][j];26.612 + l1_delay_line3[0][j] = in[j];26.613 + in[j] = t;26.614 + }26.615 + }26.616 + }26.617 +26.618 + /* invert Q and P parity */26.619 + for (j = 0; j < L1_Q; j++)26.620 + in[j+12] = ~in[j+12];26.621 + for (j = 0; j < L1_P; j++)26.622 + in[j+28] = ~in[j+28];26.623 +26.624 + /* build P parity */26.625 + decode_L1_P(in);26.626 +26.627 + if (delay2) {26.628 + /* shift through delay line 2 */26.629 + for (j = 0; j < L1_RAW+L1_Q; j++) {26.630 + if (j != L1_RAW+L1_Q-1) {26.631 + t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];26.632 + l1_delay_line2[(l1_del_index + (MAX_L1_DEL2 - j*4)) % MAX_L1_DEL2][j] = in[j];26.633 + in[j] = t;26.634 + }26.635 + }26.636 + }26.637 +26.638 + /* build Q parity */26.639 + decode_L1_Q(in);26.640 +26.641 + if (permute) {26.642 + /* permute */26.643 + t = in[2]; in[2] = in[6]; in[6] = in[18]; in[18] = in[10];26.644 + in[10] = in[8]; in [8] = t;26.645 + t = in[3]; in[3] = in[7]; in[7] = in[19]; in[19] = in[11];26.646 + in[11] = in[9]; in [9] = t;26.647 + t = in[4]; in[4] = in[12]; in[12] = in[14]; in[14] = in[20];26.648 + in[20] = in[16]; in [16] = t;26.649 + t = in[5]; in[5] = in[13]; in[13] = in[15]; in[15] = in[21];26.650 + in[21] = in[17]; in [17] = t;26.651 + }26.652 +26.653 + if (delay1) {26.654 + /* shift through delay line 1 */26.655 + for (j = 0; j < L1_RAW; j++) {26.656 + if (((j/4) % MAX_L1_DEL1) != 0) {26.657 + t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];26.658 + l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = in[j];26.659 + in[j] = t;26.660 + }26.661 + }26.662 + }26.663 +26.664 + if (in != out)26.665 + memcpy(out, in, (L1_RAW));26.666 +26.667 + l1_del_index++;26.668 + in += L1_RAW+L1_Q+L1_P;26.669 + out += L1_RAW;26.670 + }26.671 + return (0);26.672 +}26.673 +26.674 +int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],26.675 + unsigned char out[L2_RAW])26.676 +{26.677 + return (0);26.678 +}26.679 +26.680 +26.681 +26.682 +#define MAX_SUB_DEL 826.683 +static unsigned char sub_delay_line[MAX_SUB_DEL][LSUB_RAW+LSUB_Q+LSUB_P];26.684 +static unsigned sub_del_index;26.685 +26.686 +/* R-W Subchannel en/decoder */26.687 +26.688 +int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],26.689 + unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],26.690 + int delay1, int permute)26.691 +{26.692 + int i;26.693 +26.694 + if (in == out) return -1;26.695 +26.696 + for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {26.697 + int j;26.698 + unsigned char t;26.699 +26.700 + memcpy(out, in, (LSUB_RAW));26.701 +26.702 + /* build Q parity */26.703 + encode_LSUB_Q(out);26.704 +26.705 + /* build P parity */26.706 + encode_LSUB_P(out);26.707 +26.708 + if (permute) {26.709 + /* permute */26.710 + t = out[1]; out[1] = out[18]; out[18] = t;26.711 + t = out[2]; out[2] = out[ 5]; out[ 5] = t;26.712 + t = out[3]; out[3] = out[23]; out[23] = t;26.713 + }26.714 +26.715 + if (delay1) {26.716 + /* shift through delay_line */26.717 + for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {26.718 + if ((j % MAX_SUB_DEL) != 0) {26.719 + t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];26.720 + sub_delay_line[(sub_del_index + j) % MAX_SUB_DEL][j] = out[j];26.721 + out[j] = t;26.722 + }26.723 + }26.724 + }26.725 + sub_del_index++;26.726 + out += LSUB_RAW+LSUB_Q+LSUB_P;26.727 + in += LSUB_RAW;26.728 + }26.729 + return (0);26.730 +}26.731 +26.732 +int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],26.733 + unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],26.734 + int delay1, int permute)26.735 +{26.736 + int i;26.737 +26.738 + if (in == out) return -1;26.739 +26.740 + for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {26.741 + int j;26.742 + unsigned char t;26.743 +26.744 + if (delay1) {26.745 + /* shift through delay_line */26.746 + for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {26.747 + if ((j % MAX_SUB_DEL) != MAX_SUB_DEL-1) {26.748 + t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];26.749 + sub_delay_line[(sub_del_index + (MAX_SUB_DEL - j)) % MAX_SUB_DEL][j] = in[j];26.750 + in[j] = t;26.751 + }26.752 + }26.753 + }26.754 +26.755 + if (permute) {26.756 + /* permute */26.757 + t = in[1]; in[1] = in[18]; in[18] = t;26.758 + t = in[2]; in[2] = in[ 5]; in[ 5] = t;26.759 + t = in[3]; in[3] = in[23]; in[23] = t;26.760 + }26.761 +26.762 + /* build P parity */26.763 + decode_LSUB_P(in);26.764 +26.765 + /* build Q parity */26.766 + decode_LSUB_Q(in);26.767 +26.768 + memcpy(out, in, LSUB_QRAW);26.769 + memcpy(out+LSUB_QRAW, in+LSUB_QRAW+LSUB_Q, LSUB_RAW-LSUB_QRAW);26.770 +26.771 + sub_del_index++;26.772 + in += LSUB_RAW+LSUB_Q+LSUB_P;26.773 + out += LSUB_RAW;26.774 + }26.775 + return (0);26.776 +}26.777 +26.778 +static int sectortype = MODE_0;26.779 +26.780 +int get_sector_type(void);26.781 +26.782 +int get_sector_type()26.783 +{26.784 + return (sectortype);26.785 +}26.786 +26.787 +int set_sector_type(int st);26.788 +26.789 +int set_sector_type(int st)26.790 +{26.791 + switch(st) {26.792 +26.793 + case MODE_0:26.794 + case MODE_1:26.795 + case MODE_2:26.796 + case MODE_2_FORM_1:26.797 + case MODE_2_FORM_2:26.798 + sectortype = st;26.799 + return 0;26.800 + default:26.801 + return -1;26.802 + }26.803 +}26.804 +
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000027.2 +++ b/src/drivers/cdrom/edc_encoder.h Sun Jan 31 18:35:06 2010 +100027.3 @@ -0,0 +1,47 @@27.4 +/* @(#)encoder_tables 1.4 02/10/19 */27.5 +27.6 +/*27.7 + * This program is free software; you can redistribute it and/or modify27.8 + * it under the terms of the GNU General Public License version 227.9 + * as published by the Free Software Foundation.27.10 + *27.11 + * This program is distributed in the hope that it will be useful,27.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of27.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the27.14 + * GNU General Public License for more details.27.15 + *27.16 + * You should have received a copy of the GNU General Public License along with27.17 + * this program; see the file COPYING. If not, write to the Free Software27.18 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.27.19 + */27.20 +27.21 +static const unsigned char rs_l12_alog[255] = {27.22 + 1, 2, 4, 8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143, 3, 6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140, 5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141, 7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138, 9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,};27.23 +static const unsigned char rs_l12_log[256] = {27.24 + 0, 0, 1,25, 2,50,26,198, 3,223,51,238,27,104,199,75, 4,100,224,14,52,141,239,129,28,193,105,248,200, 8,76,113, 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154, 9,120,77,228,114,166, 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87, 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175,};27.25 +static const unsigned char rs_sub_rw_alog[63] = {27.26 + 1, 2, 4, 8,16,32, 3, 6,12,24,48,35, 5,10,20,40,19,38,15,30,60,59,53,41,17,34, 7,14,28,56,51,37, 9,18,36,11,22,44,27,54,47,29,58,55,45,25,50,39,13,26,52,43,21,42,23,46,31,62,63,61,57,49,33,};27.27 +static const unsigned char rs_sub_rw_log[63] = {27.28 + 0, 0, 1, 6, 2,12, 7,26, 3,32,13,35, 8,48,27,18, 4,24,33,16,14,52,36,54, 9,45,49,38,28,41,19,56, 5,62,25,11,34,31,17,47,15,23,53,51,37,44,55,40,10,61,46,30,50,22,39,43,29,60,42,21,20,59,57,};27.29 +static const unsigned char SQ[2][2] = {27.30 +{26,6,},27.31 +{7,1,},27.32 +};27.33 +static const unsigned char SP[4][20] = {27.34 +{57,38,44,29,17,57,53,58,60,39,12,38,18,41,6,25,39,37,5,18,},27.35 +{38,62,42,13,30,11,46,5,54,26,12,49,48,46,8,50,28,9,12,39,},27.36 +{32,18,41,49,52,62,38,36,39,58,37,24,34,51,51,27,28,36,22,21,},27.37 +{44,50,35,23,0,59,1,3,45,18,44,24,47,12,31,45,43,11,24,6,},27.38 +};27.39 +static const unsigned char AQ[4][24] = {27.40 +{58,152,173,95,88,43,134,205,143,131,163,75,37,109,194,159,168,227,153,59,101,},27.41 +{30,214,148,138,112,154,157,96,49,198,189,249,83,23,70,237,70,41,47,52,125,247,},27.42 +{162,244,13,171,213,236,71,177,253,162,59,78,46,68,238,112,147,197,115,200,117,15,236,},27.43 +{158,179,101,94,49,140,211,149,137,169,81,6,33,30,27,24,21,18,15,12,9,6,3,0,},27.44 +};27.45 +static const unsigned char AP[4][32] = {27.46 +{140,143,52,103,249,142,180,197,5,155,153,132,143,244,101,76,102,155,203,104,58,152,173,95,88,43,134,205,143,131,163,75,},27.47 +{104,97,17,162,205,252,218,199,202,41,136,106,119,238,193,103,123,242,83,178,30,214,148,138,112,154,157,96,49,198,189,249,},27.48 +{240,119,29,185,67,11,131,40,7,41,80,147,151,17,245,253,208,66,228,116,162,244,13,171,213,236,71,177,253,162,59,78,},27.49 +{149,58,109,0,148,186,203,11,161,159,138,149,250,107,82,108,161,209,110,64,158,179,101,94,49,140,211,149,137,169,81,6,},27.50 +};
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000028.2 +++ b/src/drivers/cdrom/edc_l2sq.h Sun Jan 31 18:35:06 2010 +100028.3 @@ -0,0 +1,1180 @@28.4 +/* @(#)l2sq_table 1.2 02/10/19 Copyright 2002 J. Schilling */28.5 +28.6 +/*28.7 + * This program is free software; you can redistribute it and/or modify28.8 + * it under the terms of the GNU General Public License version 228.9 + * as published by the Free Software Foundation.28.10 + *28.11 + * This program is distributed in the hope that it will be useful,28.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of28.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the28.14 + * GNU General Public License for more details.28.15 + *28.16 + * You should have received a copy of the GNU General Public License along with28.17 + * this program; see the file COPYING. If not, write to the Free Software28.18 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.28.19 + */28.20 +28.21 +static const unsigned short L2sq[43][256] = {28.22 +{0,44719,16707,61420,33414,11305,50117,28010,6417,47038,28.23 + 22610,63229,39831,13624,56020,29819,12834,40077,29537,56782,28.24 + 45220,7691,61927,24392,11059,34204,27248,50399,43445,1818,28.25 + 59638,18009,25668,51947,9479,35752,59074,18541,42881,2350,28.26 + 32085,54266,15382,37561,65491,20860,48784,4159,22118,63689,28.27 + 5925,47498,54496,31311,38307,15116,20343,57816,3636,41115,28.28 + 52721,25438,36018,8733,51336,26151,35275,10084,18958,58529,28.29 + 2893,42466,53657,32566,37082,15989,21279,64944,4700,48371,28.30 + 64170,21509,48105,5446,30764,54915,14703,38848,58299,19732,28.31 + 41720,3159,24893,53138,8318,36561,44236,611,60815,17184,28.32 + 11850,32997,28425,49574,46557,7026,62622,23089,14171,39412,28.33 + 30232,55479,40686,12353,57261,28930,7272,45767,23851,62340,28.34 + 34815,10576,50876,26643,1401,43990,17466,60053,36109,9122,28.35 + 52302,25313,3979,41252,20168,57447,37916,15027,54623,31728,28.36 + 5786,47157,22489,63862,48943,4480,65132,20675,15785,37638,28.37 + 31978,53829,42558,2193,59261,18898,9400,35351,26107,52052,28.38 + 59721,18406,43018,1701,27599,50528,10892,33827,61528,24311,28.39 + 45339,8116,29406,56433,13213,40242,56171,30148,39464,13447,28.40 + 23021,63298,6318,46593,49786,27861,33593,11670,16636,61011,28.41 + 447,44816,17797,60202,1222,43625,50947,27052,34368,10479,28.42 + 23700,62011,7639,45944,56850,28861,40785,12798,30631,55560,28.43 + 14052,38987,62753,23438,46178,6861,28342,49177,12277,33114,28.44 + 60464,17055,44403,988,8641,36718,24706,52781,41799,3560,28.45 + 57860,19627,14544,38527,31123,55100,47702,5369,64277,21946,28.46 + 5091,48460,21152,64527,37221,16330,53286,32393,2802,42077,28.47 + 19377,58654,34932,9947,51511,26520,28.48 +},28.49 +{0,55768,44973,30325,17223,39583,60650,13618,34446,24406,28.50 + 10531,61691,50633,7185,27236,46012,4353,51417,48812,26484,28.51 + 21062,35742,65003,9267,38799,20055,14370,57850,54472,3344,28.52 + 31589,41661,8706,64474,36271,21623,24901,47261,52968,5936,28.53 + 42124,32084,2849,54009,59339,15891,18534,37310,13059,60123,28.54 + 40110,17782,28740,43420,57321,1585,46477,27733,6688,50168,28.55 + 63178,12050,22887,32959,17412,40412,60329,12913,1859,56987,28.56 + 43246,28982,49802,6994,27943,46335,33229,22549,11872,63416,28.57 + 21765,36061,64168,9072,5698,53146,47599,24631,54155,2643,28.58 + 31782,42494,37068,18708,16225,59065,26118,49118,51627,4211,28.59 + 9537,64665,35564,21300,57480,14672,20261,38653,41935,31255,28.60 + 3170,54714,30471,44767,55466,370,13376,60824,39917,16949,28.61 + 61833,10321,24100,34812,45774,27414,7523,50363,34824,20944,28.62 + 10149,65149,52047,4759,25826,48442,3718,55134,41259,30963,28.63 + 19905,37913,57964,15284,39177,16593,13988,61308,55886,918,28.64 + 30179,44091,8071,50783,45098,27122,23744,34072,62317,10933,28.65 + 43530,29650,1447,56447,59725,12437,18144,40760,11396,62812,28.66 + 33577,23281,28611,46619,49262,6582,47883,25299,5286,52606,28.67 + 63564,8596,22497,36409,15749,58461,37416,19440,32450,42778,28.68 + 53615,2231,52236,5588,25505,47737,36683,22163,8422,63806,28.69 + 19074,37722,58671,15607,2501,53277,42600,32688,56589,1237,28.70 + 29344,43896,40522,18322,12775,59455,23427,33371,62510,11766,28.71 + 6340,49436,46953,28337,60942,14294,16803,39035,44361,29841,28.72 + 740,56124,26752,45400,50989,7925,11207,61983,33898,23986,28.73 + 65295,9943,20642,35194,48200,26000,5093,51773,31105,41049,28.74 + 54828,4084,15046,58142,38251,19635,28.75 +},28.76 +{0,27757,55514,46263,44457,49604,30067,6430,18255,11042,28.77 + 40853,62456,60134,34443,12860,24145,36510,58099,22084,14889,28.78 + 9015,20314,64493,38784,51665,42428,4363,32102,25720,2069,28.79 + 48290,53455,289,27980,55803,46486,44168,49381,29778,6207,28.80 + 18030,10755,40628,62169,60359,34730,13085,24432,36799,58322,28.81 + 22373,15112,8726,20091,64204,38561,51440,42141,4138,31815,28.82 + 25945,2356,48515,53742,578,28207,55960,46837,45035,50054,28.83 + 30513,7004,17677,10592,40407,61882,59556,33993,12414,23571,28.84 + 36060,57521,21510,14443,8565,19736,63919,38338,52115,43006,28.85 + 4937,32548,26170,2647,48864,53901,867,28430,56249,47060,28.86 + 44746,49831,30224,6781,17452,10305,40182,61595,59781,34280,28.87 + 12639,23858,36349,57744,21799,14666,8276,19513,63630,38115,28.88 + 51890,42719,4712,32261,26395,2934,49089,54188,1156,26857,28.89 + 56414,45107,43309,50496,29175,7578,17355,12198,39697,63356,28.90 + 61026,33295,14008,23253,35354,58999,21184,16045,10163,19422,28.91 + 65385,37636,52565,41272,5519,31202,24828,3217,47142,54347,28.92 + 1445,27080,56703,45330,43020,50273,28886,7355,17130,11911,28.93 + 39472,63069,61251,33582,14233,23540,35643,59222,21473,16268,28.94 + 9874,19199,65096,37413,52340,40985,5294,30915,25053,3504,28.95 + 47367,54634,1734,27307,56860,45681,43887,50946,29621,8152,28.96 + 16777,11748,39251,62782,60448,32845,13562,22679,34904,58421,28.97 + 20610,15599,9713,18844,64811,37190,53015,41850,6093,31648,28.98 + 25278,3795,47716,54793,2023,27530,57149,45904,43598,50723,28.99 + 29332,7929,16552,11461,39026,62495,60673,33132,13787,22966,28.100 + 35193,58644,20899,15822,9424,18621,64522,36967,52790,41563,28.101 + 5868,31361,25503,4082,47941,55080,28.102 +},28.103 +{0,47289,28015,54742,56030,25191,47025,3848,43425,4376,28.104 + 50382,31863,29567,52166,7696,42665,20319,63462,8752,39561,28.105 + 38273,11576,63726,16471,59134,24135,35729,13096,15392,33945,28.106 + 20815,59894,40638,9735,62417,19304,17504,64729,10511,37302,28.107 + 14111,36774,23152,58057,60865,21880,32942,14359,53729,26968,28.108 + 48270,1079,2879,45958,26192,57065,30784,49401,5423,44438,28.109 + 41630,6695,53233,30536,8545,39384,19470,62647,64447,17158,28.110 + 38608,11881,35008,12409,58799,23830,21022,60071,16241,34760,28.111 + 28222,54919,849,48104,46304,3161,55695,24886,51103,32550,28.112 + 43760,4681,7489,42488,28718,51351,49119,1894,53936,27145,28.113 + 25857,56760,2158,45271,5758,44743,31505,50088,52384,29721,28.114 + 41423,6518,61568,18489,40431,9558,10846,37607,18225,65416,28.115 + 22817,57752,13390,36087,33791,15174,61072,22057,17090,64123,28.116 + 12205,38676,38940,8357,62835,19914,60259,21466,34316,16053,28.117 + 12733,35076,23762,58475,3485,46372,24818,55371,55107,28666,28.118 + 47660,661,42044,7301,51539,29162,32482,50779,5005,43828,28.119 + 56444,25797,45331,2474,1698,48667,27597,54132,30173,52580,28.120 + 6322,40971,44803,6074,49772,31445,37667,11162,65100,18165,28.121 + 18941,61764,9362,39979,14978,33339,22509,61268,57436,22757,28.122 + 36147,13706,25507,56090,3788,46709,47485,452,54290,27819,28.123 + 51714,29371,42861,8148,4316,43109,32179,50442,11516,37957,28.124 + 16787,63786,63010,20123,39757,9204,34141,15844,59442,20619,28.125 + 24451,59194,13036,35413,64797,17828,36978,10443,10179,40826,28.126 + 19116,61973,21692,60421,14803,33130,36450,14043,58125,23476,28.127 + 45634,2811,57133,26516,26780,53285,1523,48458,7139,41818,28.128 + 30348,52789,49469,31108,44114,5355,28.129 +},28.130 +{0,53971,47547,27496,28523,48568,54992,1027,57046,3077,28.131 + 26477,46526,45501,25454,2054,56021,41393,29538,6154,51929,28.132 + 52954,7177,30561,42418,32615,44468,50908,5135,4108,49887,28.133 + 43447,31588,24447,36268,59076,13335,12308,58055,35247,23420,28.134 + 33193,21370,14354,60097,61122,15377,22393,34218,65230,11293,28.135 + 18293,38310,37285,17270,10270,64205,8216,62155,39331,19312,28.136 + 20339,40352,63176,9243,48894,27693,1861,54678,53653,838,28.137 + 26670,47869,24616,45819,55699,2880,3907,56720,46840,25643,28.138 + 8015,52636,42740,29735,28708,41719,51615,6988,49561,4938,28.139 + 30754,43761,44786,31777,5961,50586,57729,13138,22586,35561,28.140 + 36586,23609,14161,58754,16215,60804,34540,21567,20540,33519,28.141 + 59783,15188,16432,37603,63883,11096,12123,64904,38624,17459,28.142 + 40678,19509,10077,62862,61837,9054,18486,39653,25057,45874,28.143 + 55386,2697,3722,56409,46897,26082,48951,28132,1676,54367,28.144 + 53340,655,27111,47924,49232,4739,31211,43832,44859,32232,28.145 + 5760,50259,7814,52309,42813,30190,29165,41790,51286,6789,28.146 + 16030,60493,34597,22006,20981,33574,59470,15005,57416,12955,28.147 + 23027,35616,36643,24048,13976,58443,40751,19964,9876,62535,28.148 + 61508,8855,18943,39724,16889,37674,63554,10897,11922,64577,28.149 + 38697,17914,57119,3532,26276,46199,45172,25255,2511,56092,28.150 + 457,54042,47218,27297,28322,48241,55065,1482,32430,44157,28.151 + 50965,5574,4549,49942,43134,31405,41080,29355,6595,51984,28.152 + 53011,7616,30376,42107,32864,21171,14811,60168,61195,15832,28.153 + 22192,33891,24246,35941,59149,13790,12765,58126,34918,23221,28.154 + 8657,62210,39018,19129,20154,40041,63233,9682,65287,11732,28.155 + 18108,37999,36972,17087,10711,64260,28.156 +},28.157 +{0,59366,54225,13367,48063,23641,26734,36744,27491,35973,28.158 + 47282,24404,53468,14138,781,58603,54982,12576,1303,58097,28.159 + 28025,35487,48808,22862,48549,23107,28276,35218,1562,57852,28.160 + 54731,12845,45457,22135,25152,34214,2606,60872,55807,15897,28.161 + 56050,15636,2339,61125,24909,34475,45724,21882,26455,32945,28.162 + 46214,21344,56552,15118,3897,59615,3124,60370,57317,14339,28.163 + 46987,20589,25690,33724,32575,39129,44270,19208,50304,9062,28.164 + 5969,61623,5212,62394,51085,8299,45027,18437,31794,39892,28.165 + 43513,19999,31272,40398,4678,62880,49559,9841,49818,9596,28.166 + 4427,63149,31013,40643,43764,19730,52910,10568,7551,64153,28.167 + 29969,37623,42688,16678,42445,16939,30236,37370,7794,63892,28.168 + 52643,10821,6248,65422,52153,11359,41943,17457,28678,38880,28.169 + 29451,38125,41178,18236,51380,12114,7013,64643,65150,6552,28.170 + 11695,51785,17857,41511,38416,29174,38173,29435,18124,41258,28.171 + 11938,51524,64883,6805,10424,53086,64361,7311,37639,29921,28.172 + 16598,42800,17371,42045,36874,30700,63588,8066,11189,52307,28.173 + 20463,43017,39998,31704,62544,5046,10113,49255,9356,50026,28.174 + 63325,4283,40755,30933,19682,43780,39209,32463,19192,44318,28.175 + 8854,50544,61767,5793,62026,5548,8603,50813,18933,44563,28.176 + 39460,32194,33089,26279,21136,46454,15102,56600,59695,3785,28.177 + 59938,3524,14835,56853,20893,46715,33356,26026,22407,45153,28.178 + 33878,25520,60472,3038,16361,55311,15588,56066,61237,2259,28.179 + 34651,24765,21642,45932,12496,55094,58113,1255,35695,27785,28.180 + 22718,48984,23475,48213,34914,28548,57356,2026,13277,54331,28.181 + 58902,496,13767,53793,23977,47695,36472,27038,36213,27283,28.182 + 24228,47426,14026,53548,58651,765,28.183 +},28.184 +{0,29554,59108,38294,53717,41639,14129,17475,49079,52421,28.185 + 22867,10785,28258,7440,34950,64500,25459,4097,34199,63205,28.186 + 45734,49620,21570,10032,56516,44982,14880,18770,3345,32355,28.187 + 60405,39047,50918,46484,8194,21360,5939,25665,61911,33445,28.188 + 31057,2595,40885,60615,43140,56310,20064,15634,42389,55015,28.189 + 17265,12291,29760,1842,37540,57814,6690,26960,64710,36788,28.190 + 52215,47237,11539,24161,37329,58019,30517,1095,16388,13174,28.191 + 42720,54674,11878,23828,51330,48112,65459,36033,6487,27173,28.192 + 62114,33232,5190,26420,9079,20485,50579,46817,19733,15975,28.193 + 44017,55427,40128,61362,31268,2390,22327,9285,45523,49825,28.194 + 34530,62864,24582,4980,59520,39922,3684,32022,14677,18983,28.195 + 57265,44227,13380,18230,53920,41426,58769,38627,885,28679,28.196 + 35827,63617,27927,7781,23078,10580,48322,53168,16319,19661,28.197 + 55643,43561,61034,40216,2190,31740,32776,62330,26348,5534,28.198 + 20957,8879,46905,50251,23756,12222,47656,51546,36121,65131,28.199 + 27645,6287,58235,36873,1439,30445,12974,16860,54346,42808,28.200 + 63833,35371,8125,27855,10380,23550,52840,48410,18158,13724,28.201 + 40970,54136,38715,58441,29151,685,39466,59736,31950,4028,28.202 + 19455,14477,44315,56937,9629,22255,50041,45067,62536,34618,28.203 + 4780,25054,44654,56604,18570,15352,32699,3273,39263,59949,28.204 + 4569,25259,63293,33871,49164,45950,9960,21914,52509,48751,28.205 + 11257,22667,7368,28602,64044,35166,29354,472,37966,59196,28.206 + 41855,53261,17819,14057,26760,7162,36460,64798,47453,51759,28.207 + 24505,11467,55103,42061,12763,17065,1770,30104,57358,37756,28.208 + 3067,30857,60703,40557,55854,43356,15562,20408,46156,51006,28.209 + 21160,8666,26009,5867,33661,61455,28.210 +},28.211 +{0,14648,29296,19272,58592,56792,38544,44968,54749,60645,28.212 + 42925,40597,12605,2053,17229,31349,47015,36511,50647,64751,28.213 + 21319,27263,8503,6159,25210,23362,4106,10546,34458,49058,28.214 + 62698,52690,29523,19051,291,14363,38835,44683,58819,56571,28.215 + 42638,40886,54526,60870,17006,31574,12318,2342,50420,64972,28.216 + 46724,36796,8212,6444,21092,27484,4393,10257,25433,23137,28.217 + 62921,52465,34745,48769,59046,57246,38102,44526,582,15230,28.218 + 28726,18702,13179,2627,16651,30771,55195,61091,42475,40147,28.219 + 20737,26681,9073,6729,46561,36057,51089,65193,34012,48612,28.220 + 63148,53140,24636,22788,4684,11124,38389,44237,59269,57021,28.221 + 28949,18477,869,14941,16424,30992,12888,2912,42184,40432,28.222 + 54968,61312,8786,7018,20514,26906,50866,65418,46274,36346,28.223 + 63375,52919,34303,48327,4975,10839,24863,22567,53585,59497,28.224 + 41761,39449,13745,3209,18369,32505,1164,15796,30460,20420,28.225 + 57452,55636,37404,43812,26358,24526,5254,11710,33302,47918,28.226 + 61542,51550,45867,35347,49499,63587,22475,28403,9659,7299,28.227 + 41474,39738,53362,59722,18146,32730,13458,3498,30687,20199,28.228 + 1455,15511,37695,43527,57679,55415,5541,11421,26581,24301,28.229 + 61765,51325,33589,47629,49272,63808,45576,35632,9368,7584,28.230 + 22248,28624,14327,3791,17799,31935,54039,59951,41319,39007,28.231 + 57898,56082,36954,43362,1738,16370,29882,19842,32848,47464,28.232 + 61984,51992,25776,23944,5824,12280,21901,27829,10237,7877,28.233 + 45421,34901,49949,64037,17572,32156,14036,4076,41028,39292,28.234 + 53812,60172,37241,43073,58121,55857,30105,19617,2025,16081,28.235 + 62211,51771,33139,47179,6115,11995,26003,23723,9950,8166,28.236 + 21678,28054,49726,64262,45134,35190,28.237 +},28.238 +{0,7197,14394,9255,28788,27753,18510,21587,57576,64757,28.239 + 55506,50383,37020,35969,43174,46267,56781,49616,58871,63978,28.240 + 44473,45476,38275,35230,15653,8504,1311,6402,19793,20812,28.241 + 30059,26998,42887,48026,40893,33696,55283,52206,61385,62420,28.242 + 18287,23410,32597,25416,14107,11014,3873,4924,31306,26199,28.243 + 17008,24173,2622,5667,12804,11801,39586,34495,41624,48773,28.244 + 60118,63179,53996,52977,21267,20238,27433,30516,9063,16250,28.245 + 7005,1856,46075,45030,35777,38876,50063,57234,64437,59304,28.246 + 36574,37571,46820,43769,65194,58039,50832,55949,28214,29227,28.247 + 22028,18961,7746,607,9848,14949,62612,59529,52398,53427,28.248 + 34016,39165,48346,41159,5244,2145,11334,12379,25608,30741,28.249 + 23602,16431,10585,13636,4451,3454,22829,17712,24855,32010,28.250 + 51633,54700,61835,60822,47557,42456,33279,40418,42534,47675,28.251 + 40476,33281,54866,51791,61032,62069,18126,23251,32500,25321,28.252 + 14010,10919,3712,4765,31723,26614,17361,24524,2975,6018,28.253 + 13221,12216,39683,34590,41785,48932,60279,63338,54093,53072,28.254 + 417,7612,14747,9606,29141,28104,18927,22002,57673,64852,28.255 + 55667,50542,37181,36128,43271,46362,56428,49265,58454,63563,28.256 + 44056,45061,37922,34879,15492,8345,1214,6307,19696,20717,28.257 + 29898,26839,62773,59688,52495,53522,34113,39260,48507,41318,28.258 + 5597,2496,11751,12794,26025,31156,23955,16782,10488,13541,28.259 + 4290,3295,22668,17553,24758,31915,51216,54285,61482,60471,28.260 + 47204,42105,32862,40003,21170,20143,27272,30357,8902,16091,28.261 + 6908,1761,45658,44615,35424,38525,49710,56883,64020,58889,28.262 + 36735,37730,46917,43864,65291,58134,50993,56108,28567,29578,28.263 + 22445,19376,8163,1022,10201,15300,28.264 +},28.265 +{0,32897,7455,40350,14910,47807,10017,42912,29820,62717,28.266 + 26979,59874,20034,52931,21341,54236,59640,26745,62951,30054,28.267 + 53958,21063,53209,20312,40068,7173,33179,282,42682,9787,28.268 + 48037,15140,52717,19820,53490,20595,63443,30546,60108,27213,28.269 + 47505,14608,42126,9231,33711,814,40624,7729,9493,42388,28.270 + 14346,47243,7979,40874,564,33461,20841,53736,19574,52471,28.271 + 27479,60374,30280,63177,34759,1862,39640,6745,48633,15736,28.272 + 41190,8295,62395,29498,61092,28197,51589,18692,54426,21531,28.273 + 28479,61374,29216,62113,21761,54656,18462,51359,6979,39874,28.274 + 1628,34525,8573,41468,15458,48355,18986,51883,22325,55220,28.275 + 28692,61589,27915,60810,15958,48855,9033,41928,1128,34025,28.276 + 6519,39414,41682,8787,49101,16204,39148,6253,34291,1394,28.277 + 54958,22063,52145,19248,60560,27665,61839,28942,5011,37650,28.278 + 3724,36365,10669,43308,13490,46131,26607,59246,31472,64113,28.279 + 24017,56656,16590,49231,64363,31722,58996,26357,49493,16852,28.280 + 56394,23755,36631,3990,37384,4745,46377,13736,43062,10423,28.281 + 56958,24319,50017,17376,58432,25793,63839,31198,43522,10883,28.282 + 46877,14236,36924,4285,36131,3490,13958,46599,11161,43800,28.283 + 3256,35897,4519,37158,17146,49787,24549,57188,30916,63557,28.284 + 26075,58714,37972,5333,35147,2506,44650,12011,45941,13300,28.285 + 57384,24745,64823,32182,55830,23191,50953,18312,31916,64557,28.286 + 25011,57650,18066,50707,23437,56076,2256,34897,5583,38222,28.287 + 13038,45679,12273,44912,22969,55608,17574,50215,25479,58118,28.288 + 32408,65049,11717,44356,12506,45147,6139,38778,2788,35429,28.289 + 45377,12736,44126,11487,35711,3070,38496,5857,50493,17852,28.290 + 55330,22691,65283,32642,57884,25245,28.291 +},28.292 +{0,52943,33155,20300,7963,53716,40600,20567,15926,61689,28.293 + 49077,29050,8493,61410,41134,28257,31852,45731,65007,13088,28.294 + 25463,44472,58100,11323,16986,35989,50137,3350,23873,37774,28.295 + 56514,4621,63704,13847,31067,46996,59331,10508,26176,43151,28.296 + 50926,2081,18285,35234,55797,5946,22646,38585,33972,19067,28.297 + 1335,52216,39855,21856,6700,54499,47746,29773,15105,62926,28.298 + 42393,27478,9242,60117,60845,9058,27694,41697,62134,15481,28.299 + 29493,48634,54171,7508,21016,40151,52352,591,19715,33740,28.300 + 37313,24334,4162,56973,36570,16405,3929,49558,45047,24888,28.301 + 11892,57531,45292,32291,12655,65440,5493,56250,38134,23097,28.302 + 2670,50337,35821,17698,11075,58764,43712,25615,13400,64151,28.303 + 46555,31508,26905,42966,59546,9813,30210,47309,63361,14670,28.304 + 22319,39392,54956,6243,18484,34555,51639,1912,51015,2440,28.305 + 18116,34827,55388,5779,23007,38672,63857,14270,30962,46653,28.306 + 58986,10405,26601,43302,47915,30180,15016,62567,42032,27391,28.307 + 9651,60284,34077,19410,1182,51793,39430,21705,7045,54602,28.308 + 16287,61776,48668,28883,8324,61003,41223,28616,425,53094,28.309 + 32810,20197,7858,53373,40753,20990,17395,36156,49776,3263,28.310 + 23784,37415,56683,5028,32197,45834,64582,12937,25310,44049,28.311 + 58205,11666,10986,58405,43881,26022,13809,64318,46194,31421,28.312 + 5340,55827,38239,23440,3015,50440,35396,17547,22150,38985,28.313 + 55045,6602,18845,34642,51230,1745,26800,42623,59699,10236,28.314 + 30635,47460,63016,14567,53810,7421,21425,40318,52521,998,28.315 + 19626,33381,60420,8907,28039,41800,62239,15824,29340,48211,28.316 + 44638,24721,12253,57618,45381,32650,12486,65033,36968,24231,28.317 + 4587,57124,36723,16828,3824,49215,28.318 +},28.319 +{0,59880,53197,9765,33671,27247,19530,42402,6931,62203,28.320 + 54494,15670,39060,29052,22361,48817,13862,57294,63979,4099,28.321 + 46497,23625,31340,37764,11573,50397,58104,2832,44722,18266,28.322 + 24959,34967,27724,34212,41857,19049,61387,1571,8198,51694,28.323 + 30559,40631,47250,20858,62680,7472,15125,54013,23146,45954,28.324 + 38311,31823,55789,12293,5664,65480,16761,43153,36532,26460,28.325 + 49918,11030,3379,58587,55448,12656,5973,65213,23327,45815,28.326 + 38098,32058,50059,10851,3142,58798,16396,43492,36801,26153,28.327 + 61118,1878,8563,51355,27961,34001,41716,19228,62893,7237,28.328 + 14944,54152,30250,40898,47591,20495,46292,23868,31513,37617,28.329 + 14163,57019,63646,4470,44999,17967,24586,35298,11328,50600,28.330 + 58253,2661,33522,27418,19775,42199,373,59549,52920,10064,28.331 + 39393,28681,22060,49092,6758,62350,54699,15427,44333,17605,28.332 + 25312,35592,11946,51010,57703,2191,46654,24534,31219,36891,28.333 + 13753,56401,64116,5020,39691,29411,21702,48430,6284,61796,28.334 + 55105,16041,32792,27120,20437,42557,927,60023,52306,9658,28.335 + 49505,10377,3756,59204,17126,43790,36139,25795,55922,13210,28.336 + 5567,64599,23029,45085,38456,32720,63303,7855,14474,53602,28.337 + 29888,40232,47885,21221,60500,1468,9113,51825,28627,34363,28.338 + 40990,18934,30133,40029,47736,21392,63026,8154,14847,53271,28.339 + 28326,34638,41323,18563,60705,1225,8940,51972,17299,43643,28.340 + 35934,26038,49172,10748,4057,58929,22656,45416,38733,32421,28.341 + 56071,13039,5322,64802,6649,61457,54836,16348,39550,29590,28.342 + 21939,48219,746,60162,52519,9423,33133,26757,20128,42824,28.343 + 12255,50743,57362,2554,44120,17840,25493,35453,13516,56612,28.344 + 64257,4841,46923,24227,30854,37230,28.345 +},28.346 +{0,29813,59626,40095,52681,47548,9507,20822,34703,62458,28.347 + 28517,6928,19014,15923,41644,55001,4867,26486,64489,36764,28.348 + 57034,43711,13856,16981,38028,57593,31846,2067,22853,11568,28.349 + 45487,50650,9734,21107,52972,47769,60367,40890,805,30544,28.350 + 41353,54780,18787,15638,27712,6197,33962,61663,13573,16752,28.351 + 56815,43418,63692,36025,4134,25683,45706,50943,23136,11797,28.352 + 32579,2870,38825,58332,19468,14457,42214,53395,33221,62896,28.353 + 26927,7514,52099,49142,9065,22300,1610,29247,61088,39637,28.354 + 24335,11130,47077,50064,37574,59059,31276,3673,55424,44277,28.355 + 12394,17439,5449,24892,64931,35286,27146,7807,33504,63125,28.356 + 42947,54198,20265,15196,60805,39408,1391,28954,8268,21561,28.357 + 51366,48339,30985,3452,37347,58774,46272,49333,23594,10335,28.358 + 65158,35571,5740,25113,13135,18234,56229,45008,38936,60525,28.359 + 28914,1159,21969,8612,48443,51534,8087,27618,63357,33544,28.360 + 53854,42539,15028,20161,35611,65390,25585,6020,18130,12967,28.361 + 44600,55885,3220,30945,58494,36875,49501,46376,10679,24002,28.362 + 48670,51819,22260,8833,29655,1954,39741,61256,14737,19940,28.363 + 53627,42254,62552,32813,7346,26823,44317,55656,17911,12674,28.364 + 24788,5281,34878,64587,10898,24295,49784,46605,59227,37678,28.365 + 4017,31684,54292,41057,15614,18571,6621,28072,61751,34114,28.366 + 21403,10222,47985,52996,40530,59943,30392,717,50967,45922,28.367 + 12285,23432,2782,32427,57908,38465,16536,13549,43122,56327,28.368 + 36177,63780,26043,4558,61970,34407,6904,28301,16347,19374,28.369 + 55089,41796,30109,488,40311,59650,47188,52257,20670,9419,28.370 + 57617,38244,2555,32142,11480,22701,50226,45127,26270,4843,28.371 + 36468,64001,43863,57122,17341,14280,28.372 +},28.373 +{0,46261,30071,49602,60142,24155,40857,11052,51649,32116,28.374 + 48310,2051,9007,38810,22104,58093,36767,15146,64232,20061,28.375 + 25969,53700,4102,42163,18014,62187,13097,34716,44208,6149,28.376 + 55751,28018,803,46998,30292,49889,59853,23928,40122,10255,28.377 + 51938,32343,49045,2848,8204,38073,21883,57806,36028,14345,28.378 + 63947,19838,26194,53991,4901,42896,17789,61896,12298,33983,28.379 + 44947,6950,56036,28241,1606,45811,29489,51076,60584,22557,28.380 + 39391,11626,53127,31538,47856,3653,9577,37340,20510,58539,28.381 + 35289,15724,64686,18459,25399,55170,5696,41717,16408,62637,28.382 + 13679,33242,43766,7747,57217,27444,1381,45520,28690,50343,28.383 + 61323,23358,39676,11849,52388,30737,47571,3430,9802,37631,28.384 + 21309,59272,35578,15951,65421,19256,24596,54433,5475,41430,28.385 + 17211,63374,13900,33529,43477,7520,56482,26647,3212,47161,28.386 + 31227,52558,58978,21207,37653,10144,50509,29176,45114,1167,28.387 + 12195,39702,23252,61025,33555,14246,63076,17105,27133,56648,28.388 + 7306,43071,19154,65127,16293,35600,41020,5257,54603,25086,28.389 + 4015,47898,31448,52845,58689,20980,36918,9347,50798,29403,28.390 + 45849,1964,11392,38965,23031,60738,32816,13445,62791,16882,28.391 + 27358,56939,8105,43804,18929,64836,15494,34867,41759,6058,28.392 + 54888,25309,2762,48767,32701,51976,57380,21649,38227,8678,28.393 + 49931,30654,46716,713,10725,40272,23698,59431,34133,12768,28.394 + 61474,17559,28603,56078,6860,44665,19604,63521,14819,36182,28.395 + 42618,4815,54029,26552,2537,48476,31902,51243,58119,22450,28.396 + 38512,8901,49192,29853,46431,490,10950,40563,24497,60164,28.397 + 34422,12995,62209,18356,27800,55341,6639,44378,20407,64258,28.398 + 15040,36469,42329,4588,53294,25755,28.399 +},28.400 +{0,54485,46519,24930,30579,41894,49860,5649,61158,14899,28.401 + 23377,36740,39317,19776,11298,63735,49617,5380,29798,41139,28.402 + 46754,25207,789,55232,12087,64482,39552,20053,22596,35985,28.403 + 60915,14630,40895,19306,10760,65245,59596,15385,23931,35246,28.404 + 29017,42380,50414,4155,1578,54015,45981,26440,24174,35515,28.405 + 60377,16140,10525,64968,40106,18559,45192,25693,1343,53738,28.406 + 51195,4910,29260,42649,9059,63414,38612,16897,21520,32965,28.407 + 57767,13682,52613,6480,30770,44263,47862,28195,3905,56212,28.408 + 58034,13927,22277,33744,38337,16660,8310,62627,3156,55425,28.409 + 47587,27958,31527,45042,52880,6725,48348,26633,2411,56766,28.410 + 52143,8058,32280,43725,21050,34543,59277,13144,9545,61852,28.411 + 37118,17451,32013,43480,51386,7279,2686,57003,49097,27420,28.412 + 37867,18238,9820,62089,58520,12365,20783,34298,18118,37395,28.413 + 62321,10148,12725,58720,33794,20695,43040,31989,7575,51522,28.414 + 57171,2950,27364,48689,34583,21442,12960,58997,61540,9393,28.415 + 17875,37126,27121,48420,56390,2195,7810,51799,43829,32736,28.416 + 55673,3500,27854,47131,44554,31455,7101,53096,14239,58186,28.417 + 33320,22269,16620,37945,62811,8590,6312,52349,44319,31178,28.418 + 28635,47886,55916,3769,63054,8859,17401,38700,33085,21992,28.419 + 13450,57439,26021,45424,53266,1223,4822,50691,42849,29620,28.420 + 35651,24470,16116,59937,64560,10469,18823,40274,42100,28833,28.421 + 4547,50454,54023,2002,26288,45669,19090,40519,65317,11248,28.422 + 15841,59700,34902,23683,64026,11983,20397,39800,36201,22972,28.423 + 14558,60427,5372,49193,41291,30110,25487,46938,54840,749,28.424 + 15307,61214,36476,23209,19640,39021,63759,11738,54573,504,28.425 + 24730,46159,41566,30347,6121,49980,28.426 +},28.427 +{0,58597,54743,12594,47027,21334,25188,34433,29563,38814,28.428 + 42668,16969,50376,8237,4383,62970,59126,531,13089,55236,28.429 + 20805,46496,33938,24695,38285,29032,16474,42175,8766,50907,28.430 + 63465,4876,53745,13588,1062,57539,26178,33447,45973,22384,28.431 + 41610,18031,30557,37816,5433,61916,49390,9227,14087,54242,28.432 + 58064,1589,32948,25681,21859,45446,17532,41113,37291,30030,28.433 + 62415,5930,9752,49917,49151,23322,27176,36557,2124,60585,28.434 + 56731,14718,52356,10337,6483,64950,31543,40914,44768,18949,28.435 + 22793,48620,36062,26683,61114,2655,15213,57224,10866,52887,28.436 + 65445,6976,40385,31012,18454,44275,28174,35563,48089,24380,28.437 + 55741,15704,3178,59535,7541,63888,51362,11335,43718,20003,28.438 + 32529,39924,35064,27677,23855,47562,16203,56238,60060,3705,28.439 + 64387,8038,11860,51889,19504,43221,39399,32002,25571,34566,28.440 + 46644,21201,54352,12469,391,58722,4248,62589,50511,8618,28.441 + 42795,17358,29436,38425,34069,25072,20674,46119,12966,54851,28.442 + 59249,916,63086,4747,9145,51036,16861,42296,37898,28911,28.443 + 45586,22263,26565,33568,1441,57668,53366,13459,49513,9612,28.444 + 5310,61531,30426,37439,41741,18408,21732,45057,33075,26070,28.445 + 58199,1970,13952,53861,10143,50042,62024,5805,36908,29897,28.446 + 17915,41246,56348,14585,2507,60718,27567,36682,48760,23197,28.447 + 44903,19330,31408,40533,6356,64561,52483,10726,15082,56847,28.448 + 61245,3032,36185,27068,22670,48235,18833,44404,40006,30883,28.449 + 65058,6855,11253,53008,3565,59656,55354,15583,47710,24251,28.450 + 28553,35692,32406,39539,43841,20388,51493,11712,7410,63511,28.451 + 60187,4094,16076,55849,23720,47181,35199,28058,39008,31877,28.452 + 19895,43346,12243,52022,64004,7905,28.453 +},28.454 +{0,64765,58855,6426,55251,11054,12852,52937,46011,20294,28.455 + 22108,43681,25704,39061,33167,32114,31595,34710,40588,25201,28.456 + 44216,20549,18783,46498,51408,13357,11575,53706,7939,58366,28.457 + 64228,1561,63190,2603,4913,61388,8453,56824,50402,14367,28.458 + 17773,47504,41098,23671,37566,28227,30553,35748,36285,28992,28.459 + 26714,38055,23150,42643,49033,17268,15878,49915,56289,10012,28.460 + 59861,5416,3122,61647,61873,3404,5206,59563,9826,55967,28.461 + 50053,16248,16906,48887,42989,23312,38361,26916,28734,36035,28.462 + 35546,30247,28477,37824,23817,41460,47342,17427,14689,50588,28.463 + 56454,8315,61106,4687,2901,63400,1895,64410,57984,7805,28.464 + 53428,11337,13651,51630,46300,18465,20795,44486,25359,40946,28.465 + 34536,31253,31756,33009,39403,25878,43999,22306,20024,45765,28.466 + 53175,13130,10832,54957,6244,58521,64899,382,65407,898,28.467 + 6808,58981,10412,54353,52555,12726,19652,45113,43299,21982,28.468 + 39703,26602,32496,33293,33812,30953,25075,40206,21447,44858,28.469 + 46624,19165,14255,52050,53832,11957,57468,7297,1435,63846,28.470 + 2473,62804,60494,4275,56954,8839,15261,51040,47634,18159,28.471 + 24565,41736,28097,37180,34854,29915,29378,36415,38693,27608,28.472 + 42257,23020,16630,48139,49529,15748,9374,55395,5802,59991,28.473 + 62285,4016,3790,62003,60201,6100,55581,9696,15610,49159,28.474 + 48501,16776,22674,42095,27302,38491,36673,29628,30117,35160,28.475 + 36930,27839,41590,24203,18321,47980,50718,15075,9209,57092,28.476 + 4557,60720,62506,2263,63512,1253,7679,57602,12235,54070,28.477 + 51756,14033,19363,46942,44612,21177,40048,24717,31127,34154,28.478 + 33651,32654,26260,39529,21664,43101,45383,19898,12488,52277,28.479 + 54575,10706,59163,7142,764,65025,28.480 +},28.481 +{0,61681,65023,3342,59363,5906,6684,60141,54235,9002,28.482 + 11812,57045,13368,50377,51655,14646,48043,19290,18004,46757,28.483 + 23624,44217,41399,20806,26736,39041,38287,25982,36755,32610,28.484 + 29292,33437,27467,39866,38580,26181,36008,31833,29015,33190,28.485 + 47248,18529,17775,46494,24435,44930,41612,21117,53472,8209,28.486 + 11551,56814,14083,51186,51964,14861,827,62410,65220,3637,28.487 + 58584,5161,6439,59862,54934,9831,11113,56216,12661,49540,28.488 + 52362,15483,1357,62908,63666,2115,58030,4703,8017,61344,28.489 + 27965,40396,37058,24627,35550,31279,30497,34768,48870,19991,28.490 + 17177,46056,22789,43508,42234,21515,48605,19756,16418,45267,28.491 + 23102,43727,42945,22320,28166,40695,37881,25352,35301,30996,28.492 + 29722,34027,1654,63111,64393,2936,57749,4452,7274,60571,28.493 + 54701,9564,10322,55459,12878,49855,53169,16192,45361,16832,28.494 + 19662,48191,22226,42531,43821,23516,25322,37403,40725,28644,28.495 + 34057,30200,30966,34823,2714,64107,63333,1940,60793,7560,28.496 + 4230,57463,55617,10672,9406,54351,16034,52819,50013,13228,28.497 + 55930,10891,10117,55156,15769,52584,49254,12439,2465,63824,28.498 + 62558,1199,60994,7859,5053,58188,25041,37152,39982,27871,28.499 + 34354,30403,31693,35644,45578,17147,20469,48900,21993,42264,28.500 + 43030,22759,26535,38742,39512,27305,32836,28853,32187,36170,28.501 + 46204,17549,18819,47474,21407,41838,44640,24209,56332,11517,28.502 + 8691,53506,15343,51998,50704,14049,4055,65318,61992,729,28.503 + 59444,6341,5579,58682,3308,64541,61715,482,60175,7166,28.504 + 5872,58881,57143,12230,8904,53817,14548,51237,50475,13786,28.505 + 46919,18358,19128,47689,20644,41045,44379,23978,25756,37997,28.506 + 39267,27026,33663,29582,32384,36465,28.507 +},28.508 +{0,63223,61939,1796,65531,2316,3592,63743,58347,5404,28.509 + 4632,58607,7184,60135,60899,6932,56267,11580,10808,56527,28.510 + 9264,53959,54723,9012,14368,52951,51667,16164,51163,12588,28.511 + 13864,49375,43915,23932,23160,44175,21616,41607,42371,21364,28.512 + 18528,48791,47507,20324,47003,16748,18024,45215,28736,34487,28.513 + 33203,30532,36795,31052,32328,35007,37803,25948,25176,38063,28.514 + 27728,39591,40355,27476,19211,48636,47864,19471,46320,16903,28.515 + 17667,46068,43232,24087,22803,45028,22299,41452,42728,20511,28.516 + 37056,26167,24883,38852,28475,39372,40648,26687,29483,34268,28.517 + 33496,29743,36048,31271,32035,35796,57472,5751,4467,59268,28.518 + 8059,59788,61064,6271,875,62876,62104,1135,64656,2663,28.519 + 3427,64404,15179,52668,51896,15439,50352,12871,13635,50100,28.520 + 55456,11863,10579,57252,10075,53676,54952,8287,38422,24801,28.521 + 26597,37138,27117,40730,38942,28393,30205,33546,33806,29433,28.522 + 35334,31985,31733,36098,19933,47914,48174,19161,45606,17617,28.523 + 17365,46370,44598,22721,24517,43314,20941,42810,41022,22217,28.524 + 15773,52074,52334,15001,49766,13457,13205,50530,56950,10369,28.525 + 12165,55666,8589,55162,53374,9865,58966,4257,6053,57682,28.526 + 6573,61274,59486,7849,1469,62282,62542,697,64070,3249,28.527 + 2997,64834,56605,11242,11502,55833,8934,54289,54037,9698,28.528 + 16118,51201,52997,14834,49421,14330,12542,50697,1750,61473,28.529 + 63269,466,63789,4058,2270,65065,58685,5066,5326,57913,28.530 + 6854,60465,60213,7618,30358,32865,34661,29074,35181,32666,28.531 + 30878,36457,38269,25482,25742,37497,27270,40049,39797,28034,28.532 + 44381,23466,23726,43609,21158,42065,41813,21922,20150,47169,28.533 + 48965,18866,45389,18362,16574,46665,28.534 +},28.535 +{0,62964,63477,513,62455,1539,1026,61942,64499,3591,28.536 + 3078,63986,2052,65008,65521,2565,60411,7695,7182,59898,28.537 + 6156,60920,61433,6669,4104,58876,59389,4617,58367,5643,28.538 + 5130,57854,52203,15903,15390,51690,14364,52712,53225,14877,28.539 + 12312,50668,51181,12825,50159,13851,13338,49646,8208,54756,28.540 + 55269,8721,54247,9747,9234,53734,56291,11799,11286,55778,28.541 + 10260,56800,57313,10773,35787,32319,31806,35274,30780,36296,28.542 + 36809,31293,28728,34252,34765,29241,33743,30267,29754,33230,28.543 + 24624,38340,38853,25137,37831,26163,25650,37318,39875,28215,28.544 + 27702,39362,26676,40384,40897,27189,16416,46548,47061,16929,28.545 + 46039,17955,17442,45526,48083,20007,19494,47570,18468,48592,28.546 + 49105,18981,43995,24111,23598,43482,22572,44504,45017,23085,28.547 + 20520,42460,42973,21033,41951,22059,21546,41438,2955,65151,28.548 + 64638,2442,63612,3464,3977,64125,61560,1420,1933,62073,28.549 + 911,63099,62586,398,57456,5508,6021,57969,4999,58995,28.550 + 58482,4486,7043,61047,60534,6530,59508,7552,8065,60021,28.551 + 49248,13716,14229,49761,13207,50787,50274,12694,15251,52839,28.552 + 52326,14738,51300,15760,16273,51813,11163,56943,56430,10650,28.553 + 55404,11672,12185,55917,53352,9628,10141,53865,9119,54891,28.554 + 54378,8606,32832,30132,30645,33345,29623,34371,33858,29110,28.555 + 31667,36423,35910,31154,34884,32176,32689,35397,27579,40527,28.556 + 40014,27066,38988,28088,28601,39501,36936,26044,26557,37449,28.557 + 25535,38475,37962,25022,19371,48735,48222,18858,47196,19880,28.558 + 20393,47709,45144,17836,18349,45657,17327,46683,46170,16814,28.559 + 41040,21924,22437,41553,21415,42579,42066,20902,23459,44631,28.560 + 44118,22946,43092,23968,24481,43605,28.561 +},28.562 +{0,31355,62710,36493,62961,36746,263,31612,63487,36228,28.563 + 777,31090,526,30837,63224,35971,62435,35224,1813,32110,28.564 + 1554,31849,62180,34975,1052,32359,61674,35473,61933,35734,28.565 + 1307,32608,64475,33184,3885,30038,3626,29777,64220,32935,28.566 + 3108,30303,63698,33449,63957,33710,3363,30552,2104,29251,28.567 + 64718,34485,64969,34738,2367,29508,65479,34236,2865,29002,28.568 + 2614,28749,65216,33979,60331,37328,8029,25894,7770,25633,28.569 + 60076,37079,7252,26159,59554,37593,59813,37854,7507,26408,28.570 + 6216,25139,60606,38597,60857,38850,6479,25396,61367,38348,28.571 + 6977,24890,6726,24637,61104,38091,4208,27147,58502,40701,28.572 + 58753,40954,4471,27404,59279,40436,4985,26882,4734,26629,28.573 + 59016,40179,58259,39400,5989,27934,5730,27673,58004,39151,28.574 + 5228,28183,57498,39649,57757,39910,5483,28432,52043,45360,28.575 + 16317,17862,16058,17601,51788,45111,15540,18127,51266,45625,28.576 + 51525,45886,15795,18376,14504,17107,52318,46629,52569,46882,28.577 + 14767,17364,53079,46380,15265,16858,15014,16605,52816,46123,28.578 + 12432,19179,50278,48669,50529,48922,12695,19436,51055,48404,28.579 + 13209,18914,12958,18661,50792,48147,50035,47368,14213,19966,28.580 + 13954,19705,49780,47119,13452,20215,49274,47617,49533,47878,28.581 + 13707,20464,8416,23195,54294,44653,54545,44906,8679,23452,28.582 + 55071,44388,9193,22930,8942,22677,54808,44131,54019,43384,28.583 + 10229,23950,9970,23689,53764,43135,9468,24199,53258,43633,28.584 + 53517,43894,9723,24448,56123,41280,12237,21942,11978,21681,28.585 + 55868,41031,11460,22207,55346,41545,55605,41806,11715,22456,28.586 + 10456,21155,56366,42581,56617,42834,10719,21412,57127,42332,28.587 + 11217,20906,10966,20653,56864,42075,28.588 +},28.589 +{0,46002,31609,51403,63218,17728,36235,15929,61945,16971,28.590 + 35456,14642,1803,46265,31858,53184,65519,19549,33942,14116,28.591 + 2333,47791,29284,49622,3606,48548,30063,50909,63716,19286,28.592 + 33693,12335,58307,20593,39098,11016,5425,42627,28232,56826,28.593 + 4666,41352,26947,56049,58568,22394,40881,11267,7212,44958,28.594 + 26453,54503,60126,22892,37287,8725,60885,24167,38572,9502,28.595 + 6951,43157,24670,54252,56219,26665,41186,4944,11625,40667,28.596 + 22032,58786,10850,39376,20763,58025,56464,28450,42985,5211,28.597 + 9332,38854,24333,60607,53894,24884,43519,6733,54669,26175,28.598 + 44788,7494,9087,37069,22534,60340,14424,35818,17185,61587,28.599 + 52906,32024,46547,1633,51617,31251,45784,362,16211,36065,28.600 + 17450,63384,51127,29701,48334,3964,12613,33527,19004,63886,28.601 + 13902,34300,19767,65157,49340,29454,48069,2167,43819,6297,28.602 + 53330,25568,24025,61035,9888,38162,23250,59744,8619,37401,28.603 + 44064,8082,55129,25835,21700,59254,12221,39951,41526,4484,28.604 + 55631,27389,42301,5775,56900,28150,21455,57469,10422,39684,28.605 + 18664,64346,13201,32803,48666,3496,50531,30417,47377,2723,28.606 + 49768,29146,20451,64593,13466,34600,46855,1205,52350,32716,28.607 + 16885,62023,14988,35134,18174,62796,15751,36405,45068,958,28.608 + 52085,30919,28848,49922,3017,47227,34370,13808,64827,20105,28.609 + 33097,13051,64048,18818,30651,50185,3266,49008,36703,15597,28.610 + 62502,18324,31149,51743,724,45414,32422,52500,1503,46701,28.611 + 34900,15334,62253,16543,37747,8385,59402,23480,25985,54835,28.612 + 7928,44362,25226,53560,6643,43585,38008,10186,61185,23731,28.613 + 27804,57134,6117,42071,39534,10716,57623,21157,40293,11991,28.614 + 58908,21934,27543,55333,4334,41820,28.615 +},28.616 +{0,22872,45744,60392,31101,8229,52173,37525,62202,43938,28.617 + 16458,6418,35719,53983,14647,24687,63977,41137,19289,4609,28.618 + 32916,55756,12836,27516,2835,21067,47523,57595,29294,11062,28.619 + 49374,39302,61391,46743,23935,1063,38578,53226,9218,32090,28.620 + 7477,17517,44933,63197,25672,15632,55032,36768,5670,20350,28.621 + 42134,64974,28507,13827,56811,33971,58588,48516,22124,3892,28.622 + 40353,50425,12049,30281,50051,39643,28979,10347,47870,58278,28.623 + 2126,20758,12665,26657,33737,55953,18436,4444,64180,41964,28.624 + 14954,25394,35034,53634,17175,6735,61863,43263,51344,37320,28.625 + 31264,9080,45549,59573,861,23045,11340,29972,40700,51108,28.626 + 21809,3177,59265,48857,57014,34798,27654,13662,42955,65171,28.627 + 5499,19491,54693,36093,26389,15949,44248,62848,7784,18224,28.628 + 10079,32263,38383,52407,24098,1914,60562,46538,39707,49731,28.629 + 10667,28915,57958,47934,20694,2446,27105,12473,56145,33289,28.630 + 4252,18884,41516,64372,25330,15274,53314,35098,7055,17111,28.631 + 43327,61543,36872,51536,8888,31712,59765,45101,23493,669,28.632 + 29908,11660,50788,40764,3497,21745,48921,58945,34350,57206,28.633 + 13470,28102,65363,42507,19939,5307,36157,54373,16269,26325,28.634 + 62528,44312,18160,8104,32711,9887,52599,37935,1722,24546,28.635 + 46090,60754,22680,448,59944,45936,8677,30909,37717,51725,28.636 + 43618,62266,6354,16778,54047,35399,25007,14583,41329,63529,28.637 + 5057,19097,55308,33108,27324,13284,21387,2771,57659,47203,28.638 + 10998,29614,38982,49438,46935,60943,1511,23743,52778,38770,28.639 + 31898,9666,17837,7413,63261,44613,15568,25992,36448,55096,28.640 + 20158,6118,64526,42326,14275,28315,34163,56363,48196,58652,28.641 + 3828,22444,50489,40033,30601,11985,28.642 +},28.643 +{0,11309,22618,29815,45236,40089,59630,50371,32117,20824,28.644 + 9519,2306,52673,57836,38299,47542,64234,54983,41648,36509,28.645 + 19038,26227,4612,15913,34719,43954,57285,62440,14123,6918,28.646 + 28529,17244,59849,50660,45459,40382,22909,30032,295,11530,28.647 + 38076,47249,52454,57547,9224,2085,31826,20607,4899,16142,28.648 + 19321,26452,41879,36794,64461,55264,28246,17019,13836,6689,28.649 + 57058,62159,34488,43669,53135,58274,38869,48120,32571,21270,28.650 + 10081,2892,45818,40663,60064,50829,590,11875,23060,30265,28.651 + 13669,6472,27967,16658,34257,43516,56715,61862,18448,25661,28.652 + 4170,15463,63652,54409,41214,36051,9798,2667,32284,21041,28.653 + 38642,47839,52904,57989,23347,30494,873,12100,60295,51114,28.654 + 46045,40944,56492,61569,34038,43227,27672,16437,13378,6255,28.655 + 41433,36340,63875,54702,4461,15680,18743,25882,33539,44846,28.656 + 56153,63348,13239,8090,27629,18368,65142,53851,42540,35329,28.657 + 20162,25327,5784,15029,31209,21956,8627,3486,51549,58736,28.658 + 37127,48426,1180,10417,23750,28907,46120,38917,60530,49247,28.659 + 27338,18151,12944,7869,55934,63059,33316,44553,6079,15250,28.660 + 20453,25544,42763,35622,65361,54140,36896,48141,51322,58455,28.661 + 8340,3257,30926,21731,60757,49528,46351,39202,24033,29132,28.662 + 1467,10646,19596,24737,5334,14587,64568,53269,42082,34895,28.663 + 12793,7636,27043,17806,33101,44384,55575,62778,46694,39499,28.664 + 60988,49681,1746,11007,24200,29349,51987,59198,37705,48996,28.665 + 31655,22410,9213,4048,42309,35176,64799,53554,5617,14812,28.666 + 19883,24966,55344,62493,32874,44103,26756,17577,12510,7411,28.667 + 24495,29570,2037,11224,61211,49974,46913,39788,8922,3831,28.668 + 31360,22189,37486,48707,51764,58905,28.669 +},28.670 +{0,39065,11567,46518,23134,49863,30577,61416,46268,11301,28.671 + 39315,266,61154,30331,50125,23380,30053,60924,22602,49363,28.672 + 12091,47010,532,39565,49625,22848,60662,29807,39815,798,28.673 + 46760,11825,60106,29267,51173,24444,45204,10253,40379,1314,28.674 + 24182,50927,29529,60352,1064,40113,10503,45470,40879,1846,28.675 + 45696,10777,50673,23912,59614,28743,11027,45962,1596,40613,28.676 + 29005,59860,23650,50427,51593,20752,58534,31807,37847,2894,28.677 + 48888,9825,32053,58796,20506,51331,10091,49138,2628,37597,28.678 + 48364,9333,37315,2394,59058,32299,52125,21252,2128,37065,28.679 + 9599,48614,21006,51863,32545,59320,9027,48090,3692,38645,28.680 + 31005,57732,21554,52395,38911,3942,47824,8777,52641,21816,28.681 + 57486,30743,22054,52927,31497,58256,3192,38113,8535,47566,28.682 + 58010,31235,53173,22316,47300,8285,38379,3442,36623,6038,28.683 + 41504,15033,54609,19912,63614,24807,15283,41770,5788,36357,28.684 + 25069,63860,19650,54363,64106,25331,55109,20444,41012,14509,28.685 + 36123,5506,20182,54863,25593,64352,5256,35857,14759,41278,28.686 + 26053,64860,18666,53363,16283,42754,4788,35373,53625,18912,28.687 + 64598,25807,35623,5054,42504,16017,4256,34873,15759,42262,28.688 + 19198,53863,26577,65352,42012,15493,35123,4522,65090,26331,28.689 + 54125,19444,18054,56863,27561,62256,7384,33857,12791,43374,28.690 + 62010,27299,57109,18316,43108,12541,34123,7634,13283,43898,28.691 + 7884,34389,27069,61732,17554,56331,34655,8134,43632,13033,28.692 + 56577,17816,61486,26807,44108,13525,33123,6650,62994,28299,28.693 + 56125,17316,6384,32873,13791,44358,17070,55863,28545,63256,28.694 + 55593,16816,62470,27807,33655,7150,44632,14017,28053,62732,28.695 + 16570,55331,14283,44882,6884,33405,28.696 +},28.697 +{0,49859,39323,23384,12075,60904,46768,29811,24150,40085,28.698 + 51149,1294,29053,46014,59622,10789,48300,32367,9527,59380,28.699 + 37767,20804,2588,51423,58106,8249,31585,47522,52689,3858,28.700 + 21578,38537,25925,42886,64734,15901,19054,34989,54261,4406,28.701 + 15123,63952,41608,24651,5176,55035,36259,20320,55785,6954,28.702 + 16498,33457,63170,13313,28505,44442,34751,17788,7716,56551,28.703 + 43156,27223,12559,62412,51850,2121,21265,37330,58785,10082,28.704 + 31802,48889,38108,22047,3399,53124,48119,31028,8812,57519,28.705 + 30246,46309,61373,11646,22797,39886,49302,597,10352,60083,28.706 + 45547,29480,1883,50584,40640,23555,45007,27916,13908,62615,28.707 + 32996,16935,6527,56252,61849,13146,26626,43713,57010,7281,28.708 + 18217,34282,4963,53664,35576,18491,15432,65163,42451,26384,28.709 + 19765,36854,54446,5741,25118,41181,64389,14662,35081,19402,28.710 + 4242,53841,42530,25825,16313,64890,55135,5532,20164,35847,28.711 + 63604,15031,25071,41772,13733,63334,44094,28413,6798,55373,28.712 + 33557,16854,27635,43312,62056,12459,17624,34331,56643,8064,28.713 + 60492,11919,30167,46868,50023,420,23292,38975,45594,28889,28.714 + 11137,59714,40241,24562,1194,50793,20704,37411,51579,3000,28.715 + 32715,48392,58960,9363,3766,52341,38701,21998,8605,58206,28.716 + 47110,31429,17283,33088,55832,6363,27816,44651,62771,14320,28.717 + 7637,57110,33870,18061,13054,61501,43877,27046,65327,15852,28.718 + 26292,42103,53252,4807,18847,35676,41337,25530,14562,64033,28.719 + 36434,19601,6089,54538,9926,58373,48989,32158,2541,52014,28.720 + 36982,21173,30864,47699,57611,9160,22459,38264,52768,3299,28.721 + 39530,22697,1009,49458,46401,30594,11482,60953,50236,1791,28.722 + 23975,40804,60183,10708,29324,45135,28.723 +},28.724 +{0,61422,50113,11311,39839,29809,22622,47024,11043,50381,28.725 + 59618,1804,45244,24402,29565,40083,22086,47528,38279,31337,28.726 + 52697,8759,3608,57846,32101,37515,48804,20810,59130,2324,28.727 + 9531,51925,44172,17250,28493,32931,14099,55549,62674,6972,28.728 + 34735,26689,17518,43904,7216,62430,57329,12319,64202,5412,28.729 + 14603,55013,24917,36539,41620,19834,53737,15879,4648,64966,28.730 + 19062,42392,35255,26201,17669,43755,34500,26922,56986,12660,28.731 + 7515,62133,28198,33224,44519,16905,62905,6743,13944,55702,28.732 + 4931,64685,53378,16236,35036,26418,19229,42227,14432,55182,28.733 + 64417,5199,41983,19473,24638,36816,59785,1639,10824,50598,28.734 + 29206,40440,45527,24121,49834,11588,363,61061,22837,46811,28.735 + 39668,29978,49103,20513,31758,37856,9296,52158,59281,2175,28.736 + 38124,31490,22317,47299,3955,57501,52402,9052,35338,26084,28.737 + 18891,42533,4501,65147,53844,15802,41257,20167,25320,36102,28.738 + 15030,54616,63863,5785,56396,13218,8077,61539,18387,43069,28.739 + 33810,27644,63343,6273,13486,56128,27888,33566,44849,16607,28.740 + 9862,51560,58695,2729,48409,21239,32472,37174,3493,57931,28.741 + 52836,8586,38458,31188,22011,47637,28864,40750,45825,23791,28.742 + 60255,1201,10398,51056,23523,46093,38946,30668,49276,12178,28.743 + 957,60499,53007,8417,3278,58144,21648,47998,38737,30911,28.744 + 58412,3010,10221,51203,32691,36957,48242,21404,39241,30375,28.745 + 23176,46438,726,60728,49431,12025,45674,23940,29099,40517,28.746 + 10741,50715,59956,1498,25475,35949,41026,20396,63516,6130,28.747 + 15325,54323,18592,42830,35681,25743,54079,15569,4350,65296,28.748 + 13765,55851,62980,6634,44634,16820,28059,33397,7910,61704,28.749 + 56615,13001,34169,27287,18104,43350,28.750 +},28.751 +{0,30582,61164,39322,49605,46771,12073,22623,40855,59617,28.752 + 29051,1549,24146,10532,45246,51144,9011,21573,52703,47785,28.753 + 58102,38272,3098,31596,48292,52178,21064,9534,32097,2583,28.754 + 37773,58619,18022,12560,43146,57340,34723,61653,26959,7737,28.755 + 55793,44679,14109,16491,6196,28482,63192,33198,25941,4643,28.756 + 35769,64719,42128,54246,19068,15626,64194,36276,5166,25432,28.757 + 15111,19569,54763,41629,36044,64442,25120,5462,19721,14975,28.758 + 41957,54419,4955,25645,64951,35521,53918,42472,15474,19204,28.759 + 45055,55433,16659,13925,28218,6476,32982,63392,12392,18206,28.760 + 56964,43506,61869,34523,8001,26679,51882,48604,9286,21296,28.761 + 2927,31769,58755,37621,21821,8779,48081,52391,38136,58254,28.762 + 31252,3426,59801,40687,1909,28675,10332,24362,50864,45510,28.763 + 30222,376,39138,61332,47051,49341,22823,11857,1413,29427,28.764 + 60265,39967,50240,45878,10924,24026,39442,60772,29950,904,28.765 + 23511,11425,46395,49741,9910,20928,51290,48940,59251,36869,28.766 + 2463,32489,47393,52823,22477,8379,30948,3986,38408,57726,28.767 + 17379,13461,44303,55929,33318,62800,27850,7100,56436,43778,28.768 + 12952,17902,7601,27335,62301,33835,24784,6054,36412,63818,28.769 + 41237,54883,20473,14479,65351,34865,4523,26333,16002,18932,28.770 + 53358,42776,35145,65087,26533,4307,18572,16378,42592,53526,28.771 + 5854,25000,63538,36676,55067,41069,14839,20097,43642,56588,28.772 + 17558,13280,27583,7369,34131,61989,13805,17051,56065,44151,28.773 + 62504,33630,6852,28082,53039,47193,8643,22197,3818,31132,28.774 + 57350,38768,20664,10190,48724,51490,37245,58891,32657,2279,28.775 + 60444,39786,752,30086,11737,23215,49973,46147,29579,1277,28.776 + 40295,59921,45646,50488,23714,11220,28.777 +},28.778 +{0,15162,30324,19790,60648,55250,39580,41382,50637,65271,28.779 + 46009,34947,10533,4639,24401,25707,38791,44221,57843,56009,28.780 + 31599,16469,3355,13857,21066,26992,9278,7940,48802,34200,28.781 + 51414,62444,13075,2089,17767,32349,57339,58561,43407,37557,28.782 + 63198,52708,32938,48016,6710,8460,27714,22392,42132,40878,28.783 + 53984,59866,18556,29510,15880,1330,24921,23139,5933,11287,28.784 + 36273,46731,64453,49407,26150,23836,4178,11112,35534,45556,28.785 + 64698,51072,41963,39121,54687,61093,20227,29753,14711,589,28.786 + 61857,51867,34773,48367,7497,9843,27453,20487,13420,3926,28.787 + 16920,31010,55428,58302,44784,38346,21813,28175,9025,6267,28.788 + 47581,33511,53161,62611,37112,43970,59020,56758,31760,18218,28.789 + 2660,12638,49842,63880,46278,36860,11866,5472,22574,25364,28.790 + 1919,15429,28939,18993,60311,53421,40419,42713,52300,63350,28.791 + 47672,33026,8356,7070,22224,28138,2433,12987,32757,17615,28.792 + 58729,56915,37661,43047,23499,24817,11711,5765,46883,35865,28.793 + 49495,64109,40454,42300,59506,54088,29422,18900,1178,16288,28.794 + 65375,50277,35115,45585,5047,10381,26051,24313,14994,424,28.795 + 19686,30684,54906,60736,40974,39732,26840,21474,7852,9622,28.796 + 33840,48906,62020,51582,44309,38447,56161,57435,16893,31431,28.797 + 14217,3251,43626,37200,56350,59172,18050,32184,12534,3020,28.798 + 28583,21661,6611,8937,33615,47221,62779,52737,15853,1751,28.799 + 19353,28835,53509,59967,42865,40011,63520,49946,36436,46446,28.800 + 5320,12274,25276,22918,39289,41539,61197,54327,30097,20139,28.801 + 997,14559,23732,26510,10944,4602,45148,35686,50728,64786,28.802 + 3838,13764,30858,17328,57878,55596,37986,44888,52019,61449,28.803 + 48455,34429,10203,7393,20911,27285,28.804 +},28.805 +{0,7452,14904,10020,29808,26988,20040,21332,59616,62972,28.806 + 53976,53188,40080,33164,42664,48052,52701,53441,63461,60153,28.807 + 47533,42161,33685,40585,9533,14369,7941,537,20813,19537,28.808 + 27509,30313,34727,39611,48543,41091,62423,61131,51695,54515,28.809 + 28487,29275,21887,18531,6967,1579,8463,15379,19066,22374,28.810 + 28738,27998,15882,8982,1074,6446,41626,49030,39074,34238,28.811 + 55018,52214,60626,61902,4947,3663,10603,13431,26403,31295,28.812 + 23835,16391,64435,59055,49547,56471,36803,37599,46587,43239,28.813 + 56974,50066,58550,63914,43774,47074,37062,36314,13934,11122,28.814 + 3158,4426,16926,24322,30758,25914,38132,35304,44748,46032,28.815 + 57476,64920,55996,51104,31764,24840,17964,23344,2148,5496,28.816 + 12892,12096,22825,17461,25361,32269,11609,12357,5985,2685,28.817 + 45513,44245,35825,38637,50617,55461,65409,58013,9894,15290,28.818 + 7326,386,21206,20426,26862,30194,52806,54106,62590,59746,28.819 + 47670,42794,32782,40210,60283,63079,53571,52319,40715,33303,28.820 + 42291,47151,923,7815,14755,9407,30699,27383,19923,20687,28.821 + 41217,48157,39737,34341,54641,51309,61257,62037,18913,21757,28.822 + 29657,28357,15761,8333,1961,6837,27868,29120,22244,19448,28.823 + 6316,1456,8852,16264,33852,39200,48644,41752,61516,60752,28.824 + 51828,55144,13813,10473,4045,4817,16773,23705,31677,26273,28.825 + 56597,49161,59181,64049,43365,46201,37725,36417,63528,58676,28.826 + 49680,57100,35928,37188,46688,43900,4296,3540,10992,14316,28.827 + 25784,31140,24192,17308,45650,44878,34922,38262,50722,56126,28.828 + 64538,57606,23218,18350,24714,32150,11970,13278,5370,2534,28.829 + 32655,25235,17847,22699,3071,5859,12743,11483,38767,35443,28.830 + 44375,45131,58143,65027,55591,50235,28.831 +},28.832 +{0,3599,7198,4625,14396,13875,9250,10797,28792,32375,28.833 + 27750,25193,18500,17995,21594,23125,57584,61183,64750,62177,28.834 + 55500,54979,50386,51933,37000,40583,35990,33433,43188,42683,28.835 + 46250,47781,56829,54258,49635,53228,58817,60366,63967,63440,28.836 + 44421,41866,45467,49044,38329,39862,35239,34728,15629,13058,28.837 + 8467,12060,1329,2878,6447,5920,19829,17274,20843,24420,28.838 + 30025,31558,26967,26456,42983,43496,48121,46582,40923,37332,28.839 + 33733,36298,55199,55696,52097,50574,61347,57772,62397,64946,28.840 + 18199,18712,23305,21766,32555,28964,25397,27962,14191,14688,28.841 + 11121,9598,3923,348,4941,7490,31258,29717,26116,26635,28.842 + 16934,19497,24120,20535,2658,1133,5756,6259,12894,15441,28.843 + 11840,8271,39658,38117,34548,35067,41686,44249,48840,45255,28.844 + 60050,58525,63116,63619,53934,56481,52912,49343,21459,24028,28.845 + 20429,16834,27631,26080,30705,31230,9131,11684,16309,12730,28.846 + 7063,5528,1929,2438,45859,48428,44861,41266,35615,34064,28.847 + 38657,39182,50011,52564,57157,53578,64359,62824,59257,59766,28.848 + 36398,32801,37424,39999,46610,47133,43532,41987,65110,61529,28.849 + 57928,60487,50794,51301,55924,54395,28382,24785,29376,31951,28.850 + 22242,22765,19196,17651,7846,4265,696,3255,9882,10389,28.851 + 14980,13451,62516,64059,59434,58917,52232,49671,53270,56857,28.852 + 33868,35395,38994,38493,48240,45695,41070,44641,5316,6859,28.853 + 2266,1749,11512,8951,12518,16105,25788,27315,30882,30381,28.854 + 23680,21135,16542,20113,10697,10182,13783,15320,4597,8186,28.855 + 3563,996,22961,22462,17839,19360,24973,28546,32147,29596,28.856 + 51513,50998,54567,56104,61701,65290,60699,58132,47425,46926,28.857 + 42335,43856,33149,36722,40291,37740,28.858 +},28.859 +{0,35208,3853,34437,7706,38802,4375,39071,15412,46524,28.860 + 13113,47793,8750,43942,11555,42155,30824,61920,30565,65261,28.861 + 26226,61434,27007,57591,17500,52692,19281,49881,23110,54222,28.862 + 21835,56515,61648,31064,65501,30293,61130,26434,57799,26703,28.863 + 52452,17772,50153,19041,54014,23414,56819,21627,35000,304,28.864 + 34741,3645,38562,7978,39343,4135,46220,15620,48001,12809,28.865 + 43670,8990,42395,11283,64957,29749,62128,31544,58279,27183,28.866 + 60586,25890,49545,18433,52868,18188,57235,22043,53406,22806,28.867 + 34261,3165,35544,848,39887,4679,38082,7498,47585,12393,28.868 + 46828,16228,43003,11891,43254,8574,3437,34021,608,35816,28.869 + 4983,39679,7290,38386,12633,47313,15956,47068,12099,42699,28.870 + 8270,43462,29957,64653,31240,62336,27423,58007,25618,60826,28.871 + 18737,49337,17980,53172,22315,56995,22566,53678,59239,28399,28.872 + 59498,25058,63869,28917,63088,32760,56147,21211,54366,24022,28.873 + 50505,19649,51780,17356,40719,5767,36866,6538,33045,2205,28.874 + 36376,1936,41787,10931,44086,9662,48417,13481,45612,15268,28.875 + 6071,40511,6330,37170,2477,32805,1696,36648,11139,41483,28.876 + 9358,44294,13721,48145,14996,45852,28639,58967,24786,59738,28.877 + 29125,63565,32456,63296,21483,55907,23782,54638,19953,50297,28.878 + 17148,52084,6874,37714,5591,40031,1216,36168,3021,33349,28.879 + 9966,44902,10723,41067,14580,45436,14329,48753,25266,60218,28.880 + 28095,58423,31912,62752,29605,64045,24198,55054,20875,55299,28.881 + 16540,51476,20369,50713,59914,25474,58631,27791,62480,32152,28.882 + 64285,29333,54846,24502,55603,20667,51236,16812,50985,20129,28.883 + 37474,7146,40303,5351,35960,1520,33653,2813,44630,10206,28.884 + 41307,10451,45132,14788,48961,14025,28.885 +},28.886 +{0,17477,34954,52431,3337,18764,34179,49606,6674,24151,28.887 + 37528,55005,5915,21342,40849,56276,13348,28769,48302,63723,28.888 + 14637,32104,45479,62946,11830,27251,42684,58105,9023,26490,28.889 + 43957,61424,26696,11277,57538,42119,25921,8452,60875,43406,28.890 + 29274,13855,64208,48789,32595,15126,63449,45980,23660,6185,28.891 + 54502,37027,20837,5408,55791,40362,18046,571,52980,35505,28.892 + 19319,3890,50173,34744,53392,38101,22554,7263,56729,39388,28.893 + 21779,4438,51842,36551,16904,1613,51083,33742,20225,2884,28.894 + 58548,41201,27710,10363,59837,44536,24887,9586,65190,47843,28.895 + 30252,12905,62383,47082,31525,16224,47320,64669,12370,29719,28.896 + 46545,61844,15707,31006,41674,59023,10816,28165,44995,60294,28.897 + 10057,25356,36092,51385,1142,16435,33269,50608,2431,19770,28.898 + 38638,53931,7780,23073,39911,57250,4973,22312,48445,63864,28.899 + 13751,29170,45108,62577,14526,31995,42799,58218,12197,27616,28.900 + 43558,61027,8876,26345,35097,52572,403,17878,33808,49237,28.901 + 3226,18655,37643,55118,7041,24516,40450,55879,5768,21197,28.902 + 54645,37168,24063,6586,55420,39993,20726,5299,53095,35618,28.903 + 18413,936,49774,34347,19172,3745,57681,42260,27099,11678,28.904 + 60504,43037,25810,8343,64323,48902,29641,14220,63050,45583,28.905 + 32448,14981,28077,10728,58663,41314,24740,9441,59438,44139,28.906 + 30655,13306,65333,47984,31414,16115,62012,46713,22921,7628,28.907 + 53507,38214,21632,4293,56330,38991,17307,2014,51985,36692,28.908 + 20114,2775,50712,33373,1509,16800,36207,51498,2284,19625,28.909 + 32870,50211,8183,23474,38781,54072,4862,22203,39540,56881,28.910 + 12737,30084,47435,64782,15560,30861,46146,61447,11219,28566,28.911 + 41817,59164,9946,25247,44624,59925,28.912 +},28.913 +{0,44205,17735,59882,35470,9763,53193,25444,2305,42412,28.914 + 19526,57579,33679,12066,50888,27237,4610,48815,22341,64488,28.915 + 39052,13345,56779,29030,6915,47022,24132,62185,37261,15648,28.916 + 54474,30823,9220,34985,24899,52718,44682,551,60365,18272,28.917 + 11525,33192,26690,50415,42891,2854,58060,20065,13830,39595,28.918 + 29505,57324,48264,4133,63951,21858,16135,37802,31296,55021,28.919 + 46473,6436,61646,23651,18440,58533,3407,41442,49798,28203,28.920 + 34753,11116,16649,60836,1102,43235,52103,26410,36544,8813,28.921 + 23050,63143,8013,46048,53380,31785,38339,14702,21259,65446,28.922 + 5708,47841,55685,29992,40130,12399,27660,49313,10571,34278,28.923 + 59010,18991,41925,3944,25869,51616,8266,36071,61315,17198,28.924 + 43716,1641,32270,53923,15177,38884,62592,22573,45511,7530,28.925 + 30479,56226,12872,40677,64897,20780,47302,5227,36880,15549,28.926 + 54615,31226,6814,46643,24537,62324,39185,13756,56406,28923,28.927 + 5023,48946,22232,64117,33298,11967,51029,27640,2204,42033,28.928 + 19931,57718,35603,10174,52820,25337,413,44336,17626,59511,28.929 + 46100,6329,61779,24062,16026,37431,31709,55152,48405,4536,28.930 + 63570,21759,14235,39734,29404,56945,42518,2747,58193,20476,28.931 + 11416,32821,27103,50546,44823,954,59984,18173,9625,35124,28.932 + 24798,52339,55320,29877,40287,12786,21142,65083,6097,47996,28.933 + 53529,32180,37982,14579,23447,63290,7888,45693,51738,26295,28.934 + 36701,9200,16532,60473,1491,43390,49947,28598,34396,10993,28.935 + 18837,58680,3282,41087,64540,20657,47451,5622,30354,55871,28.936 + 13269,40824,62749,22960,45146,7415,32659,54078,15060,38521,28.937 + 60958,17075,43865,2036,25744,51261,8663,36218,59167,19378,28.938 + 41560,3829,28049,49468,10454,33915,28.939 +},28.940 +{0,55513,44463,30070,18243,40858,60140,12853,36486,22111,28.941 + 9001,64496,51653,4380,25706,48307,273,55752,44222,29799,28.942 + 18002,40587,60413,13092,36759,22350,8760,64225,51412,4109,28.943 + 25979,48546,546,56059,44941,30548,17761,40376,59598,12311,28.944 + 36004,21629,8459,63954,52199,4926,26184,48785,819,56298,28.945 + 44700,30277,17520,40105,59871,12550,36277,21868,8218,63683,28.946 + 51958,4655,26457,49024,1092,56477,43499,28978,17159,39902,28.947 + 61096,13937,35522,21019,10093,65460,52609,5464,24622,47351,28.948 + 1365,56716,43258,28707,16918,39631,61369,14176,35795,21258,28.949 + 9852,65189,52368,5193,24895,47590,1638,57023,43977,29456,28.950 + 16677,39420,60554,13395,35040,20537,9551,64918,53155,6010,28.951 + 25100,47829,1911,57262,43736,29185,16436,39149,60827,13634,28.952 + 35313,20776,9310,64647,52914,5739,25373,48068,2184,53329,28.953 + 42279,32254,20427,38674,57956,15037,34318,24279,11169,62328,28.954 + 49485,6548,27874,46139,2457,53568,42038,31983,20186,38403,28.955 + 58229,15276,34591,24518,10928,62057,49244,6277,28147,46378,28.956 + 2730,53875,42757,32732,19945,38192,57414,14495,33836,23797,28.957 + 10627,61786,50031,7094,28352,46617,3003,54114,42516,32461,28.958 + 19704,37921,57687,14734,34109,24036,10386,61515,49790,6823,28.959 + 28625,46856,3276,54293,41315,31162,19343,37718,58912,16121,28.960 + 33354,23187,12261,63292,50441,7632,26790,45183,3549,54532,28.961 + 41074,30891,19102,37447,59185,16360,33627,23426,12020,63021,28.962 + 50200,7361,27063,45422,3822,54839,41793,31640,18861,37236,28.963 + 58370,15579,32872,22705,11719,62750,50987,8178,27268,45661,28.964 + 4095,55078,41552,31369,18620,36965,58643,15818,33145,22944,28.965 + 11478,62479,50746,7907,27541,45900,28.966 +},28.967 +{0,58083,55771,15160,44971,19784,30320,38035,17227,41384,28.968 + 39568,30835,60640,3587,13627,55256,34454,25717,24397,48558,28.969 + 10557,52190,61670,4613,50653,10046,7174,65253,27254,34965,28.970 + 45997,20814,4401,62418,51434,10761,48794,23673,26433,34210,28.971 + 21114,45209,35745,26946,64977,7986,9226,50921,38823,30020,28.972 + 20092,44191,14348,56047,57815,820,54508,13839,3383,61396,28.973 + 31559,39332,41628,16511,8802,49281,64441,6490,36297,28458,28.974 + 21522,46833,24873,33738,47346,23057,52866,11361,5977,62906,28.975 + 42228,17943,32047,40908,2911,59836,53892,12391,59327,1372,28.976 + 15972,56455,18452,43767,37327,29484,13139,53680,60040,2155,28.977 + 40184,32283,17699,42944,28696,37627,43459,19232,57267,15696,28.978 + 1640,58507,46533,22310,27678,36605,6766,63629,50101,8534,28.979 + 63118,5229,12117,52662,22821,48070,33022,25117,17604,42535,28.980 + 40223,32764,60271,2444,12980,53335,1935,58732,56916,15543,28.981 + 43044,19143,29183,37660,49746,8369,7049,63850,28153,36634,28.982 + 46114,22209,33049,25594,22722,47649,11954,52305,63337,5514,28.983 + 22005,46870,35886,28365,64094,6333,9093,49510,5822,62557,28.984 + 53093,11654,47381,23542,24782,33325,54115,12672,2744,59483,28.985 + 31944,40491,42259,18416,36904,29387,18931,43792,16259,56672,28.986 + 58968,1211,26278,33861,49021,23966,51469,11246,4310,62005,28.987 + 9709,50958,64566,7893,35398,26789,21405,45438,57392,723,28.988 + 14827,56072,20379,44408,38464,29859,41851,16792,31392,38979,28.989 + 3280,60979,54539,14312,30615,38260,44620,19631,55356,15071,28.990 + 487,58116,13532,54847,60679,4068,39799,31124,17068,41039,28.991 + 61697,5090,10458,51769,24234,48201,34673,26002,45642,20649,28.992 + 27537,35186,7649,65282,50234,9945,28.993 +},28.994 +{0,65534,58337,7199,56287,9249,14398,51136,43939,21597,28.995 + 18498,47036,28796,36738,37789,27747,19291,46245,43194,22340,28.996 + 36996,28538,29541,35995,57592,7942,793,64743,15143,50393,28.997 + 55494,10040,38582,26952,30039,35497,19817,45719,44680,20854,28.998 + 15637,49899,57076,8458,59082,6452,1323,64213,56813,8723,28.999 + 15884,49650,1586,63948,58835,6701,30286,35248,38319,27217,28.1000 + 44433,21103,20080,45454,12657,52879,53904,11630,60078,5456,28.1001 + 2383,63153,39634,25900,31027,34509,16653,48883,41708,23826,28.1002 + 31274,34260,39371,26165,41461,24075,16916,48618,53641,11895,28.1003 + 12904,52630,2646,62888,59831,5705,42951,22585,17446,48088,28.1004 + 31768,33766,40953,24583,3172,62362,61317,4219,55227,10309,28.1005 + 13402,52132,60572,4962,3965,61571,14147,51389,54434,11100,28.1006 + 18239,47297,42206,23328,40160,25374,32513,33023,25314,40220,28.1007 + 33027,32509,47421,18115,23260,42274,51521,14015,10912,54622,28.1008 + 4766,60768,61823,3713,10681,54855,51800,13734,62054,3480,28.1009 + 4487,61049,33306,32228,25083,40453,22981,42555,47652,17882,28.1010 + 62548,2986,6069,59467,12171,53365,52330,13204,24567,40969,28.1011 + 48150,17384,33832,31702,26569,38967,48911,16625,23790,41744,28.1012 + 25808,39726,34609,30927,5292,60242,63309,2227,53107,12429,28.1013 + 11410,54124,21395,44141,45170,20364,34892,30642,27565,37971,28.1014 + 63536,1998,7121,58415,9199,56337,49166,16368,6344,59190,28.1015 + 64297,1239,49943,15593,8438,57096,45931,19605,20618,44916,28.1016 + 26804,38730,35669,29867,50469,15067,9924,55610,7930,57604,28.1017 + 64795,741,28294,37240,36199,29337,46425,19111,22200,43334,28.1018 + 36478,29056,28063,37473,21921,43615,46656,18878,9693,55843,28.1019 + 50748,14786,65026,508,7651,57885,28.1020 +},28.1021 +{0,32638,65276,33154,57829,40603,7961,24679,57303,41129,28.1022 + 8491,24149,15922,16716,49358,49072,41907,56525,23887,8753,28.1023 + 16982,15656,48298,50132,31844,794,33432,64998,40321,58111,28.1024 + 25469,7171,23419,9221,42375,56057,47774,50656,17506,15132,28.1025 + 33964,64466,31312,1326,25929,6711,39861,58571,63688,34742,28.1026 + 1588,31050,6445,26195,59345,39087,10015,22625,55779,42653,28.1027 + 50938,47492,14342,18296,46838,51592,18442,14196,22291,10349,28.1028 + 43503,54929,26913,5727,38877,59555,35012,63418,30264,2374,28.1029 + 5445,27195,60345,38087,62624,35806,2652,29986,51858,46572,28.1030 + 13422,19216,11127,21513,54667,43765,60813,37619,4977,27663,28.1031 + 3176,29462,62100,36330,12890,19748,52390,46040,54207,44225,28.1032 + 11587,21053,20030,12608,45250,53180,45019,53413,20775,11865,28.1033 + 37353,61079,28437,4203,28684,3954,36592,61838,29169,3727,28.1034 + 36621,61555,36884,61290,28392,4502,44582,53592,20698,12196,28.1035 + 20419,12477,45375,52801,53826,44348,11454,21440,13223,19673,28.1036 + 52571,45605,3477,29419,62313,35863,60528,37646,4748,28146,28.1037 + 10890,22004,54390,43784,52079,46097,13715,19181,62813,35363,28.1038 + 2977,29919,5304,27590,59972,38202,35129,63047,30661,2235,28.1039 + 26844,6050,38432,59742,22254,10640,43026,55148,46859,51317,28.1040 + 18935,13961,50951,47225,14843,18053,9954,22940,55326,42848,28.1041 + 6352,26542,58924,39250,63797,34379,1993,30903,25780,7114,28.1042 + 39496,58678,34129,64047,31661,1235,47971,50205,17823,15073,28.1043 + 23174,9720,42106,56068,40060,58114,25216,7678,32153,743,28.1044 + 33637,64539,17323,15573,48471,49705,41550,56624,23730,9164,28.1045 + 16335,16561,49459,48717,56874,41300,8406,24488,57368,40806,28.1046 + 7908,24986,509,32387,65281,32895,28.1047 +},28.1048 +{0,16190,32380,16706,64760,50118,33412,48570,58861,56019,28.1049 + 39825,42159,6421,9771,26473,22615,55239,59641,43451,38533,28.1050 + 11071,5121,21827,27261,12842,3348,19542,29544,52946,61932,28.1051 + 45230,36752,45971,36013,52719,62161,20331,28757,12567,3625,28.1052 + 22142,26944,10242,5948,43654,38328,54522,60356,25684,23402,28.1053 + 6696,9494,39084,42898,59088,55790,33209,48775,65477,49403,28.1054 + 32065,17023,829,15363,31547,17413,1351,14969,34755,47357,28.1055 + 63935,50817,40662,41448,57514,57236,25134,23824,7250,9068,28.1056 + 44284,37826,53888,60862,20484,28474,11896,4422,18705,30255,28.1057 + 14189,2131,46569,35543,52117,62635,51368,63382,46804,35306,28.1058 + 13392,2926,18988,29970,11589,4731,21305,27655,53693,61059,28.1059 + 44993,37119,8047,8273,24851,24109,58263,56489,40427,41685,28.1060 + 64130,50620,34046,48064,1658,14660,30726,18232,63094,51528,28.1061 + 34826,46900,2702,13744,29938,19404,5019,11429,28135,21209,28.1062 + 61283,53341,37151,44577,8625,7823,24525,24819,56649,57975,28.1063 + 41781,39947,50268,64354,47648,34078,14500,1946,18136,31206,28.1064 + 17893,31451,15257,1191,47389,34339,51041,63583,40968,40758,28.1065 + 56948,57674,23792,25550,8844,7602,37410,44316,60510,54112,28.1066 + 28378,20964,4262,12184,30671,18673,2483,13965,35639,46089,28.1067 + 62795,51829,36173,45683,62257,52239,29109,20107,4041,12535,28.1068 + 26784,22430,5852,10722,37976,43878,59940,54554,23178,26036,28.1069 + 9462,7112,42610,39244,55310,59184,48999,32857,49435,65061,28.1070 + 17311,31905,15843,733,16094,480,16546,32668,49702,64792,28.1071 + 48218,33636,56115,58381,42319,39537,10187,6389,22967,26249,28.1072 + 59673,54823,38757,43099,5601,10975,27549,21667,3316,13258,28.1073 + 29320,19894,61452,53042,36464,45390,28.1074 +},28.1075 +{0,7966,15932,8482,31864,25446,16964,23898,63728,59374,28.1076 + 50892,55762,33928,39830,47796,42410,60925,62179,54209,52447,28.1077 + 37253,36507,44985,45223,5389,2579,11057,13359,26997,30315,28.1078 + 22345,18519,51175,55545,63963,59077,48031,42113,34211,39613,28.1079 + 16151,8201,299,7733,17263,23665,32083,25165,10778,13572,28.1080 + 5158,2872,22114,18812,26718,30528,53994,52724,60630,62408,28.1081 + 44690,45452,37038,36784,37843,36045,44527,45809,61355,61621,28.1082 + 53655,52873,27427,29757,21791,18945,5979,2117,10599,13945,28.1083 + 32302,24880,16402,24332,598,7496,15466,9076,34526,39360,28.1084 + 47330,43004,64166,58808,50330,56196,21556,19242,27144,29974,28.1085 + 10316,14162,5744,2414,44228,46042,37624,36326,53436,53154,28.1086 + 61056,61854,47561,42711,34805,39147,50609,55983,64397,58515,28.1087 + 16697,24103,32517,24603,15681,8799,893,7267,15291,9381,28.1088 + 1415,6809,18371,22749,31231,26337,49995,56405,64887,57961,28.1089 + 48947,41005,33039,40465,54854,51544,59514,63332,43582,46368,28.1090 + 37890,35612,11958,12712,4234,3988,21198,19920,27890,29676,28.1091 + 64604,58178,49760,56702,32804,40762,48664,41222,1196,7090,28.1092 + 14992,9614,30932,26570,18152,23030,4513,3775,12189,12419,28.1093 + 28121,29383,21477,19707,59729,63055,55149,51315,38185,35383,28.1094 + 43797,46091,43112,46966,38484,35146,54288,51982,59948,62770,28.1095 + 20632,20358,28324,29114,11488,13310,4828,3522,17813,23179,28.1096 + 31657,25783,14829,9971,2001,6351,48485,41595,33625,40007,28.1097 + 49437,56835,65313,57407,28559,28817,20915,20141,5111,3305,28.1098 + 11723,13013,38783,34913,43331,46685,60167,62489,54587,51749,28.1099 + 33394,40300,48206,41808,65034,57620,49206,57128,31362,26012,28.1100 + 17598,23456,1786,6628,14534,10200,28.1101 +},28.1102 +{0,3854,7708,4370,15416,13110,8740,11562,30832,30590,28.1103 + 26220,26978,17480,19270,23124,21850,61664,65518,61180,57842,28.1104 + 52440,50134,53956,56778,34960,34718,38540,39298,46248,48038,28.1105 + 43700,42426,64989,62163,58305,60623,49637,52971,57337,53495,28.1106 + 34221,35491,39857,38079,47509,46747,42889,43143,3389,563,28.1107 + 4897,7215,12549,15883,12057,8215,30029,31299,27473,25695,28.1108 + 18805,18043,22377,22631,59303,59561,63931,63157,56223,54417,28.1109 + 50563,51853,40919,37081,33227,36549,41967,44257,48627,45821,28.1110 + 5959,6217,2395,1621,11135,9329,13667,14957,28471,24633,28.1111 + 28971,32293,21263,23553,19731,16925,6778,5492,1126,2920,28.1112 + 9794,10572,14430,14160,25098,27908,31766,29464,24114,20796,28.1113 + 16430,20256,60058,58772,62598,64392,54946,55724,51390,51120,28.1114 + 37610,40420,36086,33784,44754,41436,45262,49088,54099,56413,28.1115 + 52559,49729,61291,57445,61815,65145,43811,42029,46399,47665,28.1116 + 38683,38933,35079,34313,9139,11453,15791,12961,8075,4229,28.1117 + 407,3737,23491,21709,17887,19153,26619,26869,31207,30441,28.1118 + 11918,8576,12434,16284,4790,7608,3242,932,22270,23024,28.1119 + 18658,18412,27334,26056,29914,31700,56942,53600,49266,53116,28.1120 + 57942,60760,64586,62276,42526,43280,47106,46860,39462,38184,28.1121 + 33850,35636,13556,15354,10984,9702,2252,1986,5840,6622,28.1122 + 19588,17290,21144,23958,28860,32690,28320,25006,50196,51994,28.1123 + 55816,54534,63532,63266,58928,59710,48228,45930,41592,44406,28.1124 + 32860,36690,40512,37198,51497,50727,55093,55355,62737,64031,28.1125 + 60173,58371,45401,48727,44869,41035,36193,33391,37757,40051,28.1126 + 14793,14023,10197,10459,1521,2815,7149,5347,16825,20151,28.1127 + 24485,20651,32129,29327,25501,27795,28.1128 +},28.1129 +{0,1798,3596,2314,7192,6942,4628,5394,14384,16182,28.1130 + 13884,12602,9256,9006,10788,11554,28768,30566,32364,31082,28.1131 + 27768,27518,25204,25970,18512,20310,18012,16730,21576,21326,28.1132 + 23108,23874,57536,59334,61132,59850,64728,64478,62164,62930,28.1133 + 55536,57334,55036,53754,50408,50158,51940,52706,37024,38822,28.1134 + 40620,39338,36024,35774,33460,34226,43152,44950,42652,41370,28.1135 + 46216,45966,47748,48514,56733,55963,54161,54423,49541,50819,28.1136 + 53129,51343,58797,58027,60321,60583,63925,65203,63417,61631,28.1137 + 44541,43771,41969,42231,45541,46819,49129,47343,38349,37579,28.1138 + 39873,40135,35285,36563,34777,32991,15709,14939,13137,13399,28.1139 + 8517,9795,12105,10319,1389,619,2913,3175,6517,7795,28.1140 + 6009,4223,19773,19003,17201,17463,20773,22051,24361,22575,28.1141 + 29965,29195,31489,31751,26901,28179,26393,24607,42791,40993,28.1142 + 43307,44589,47935,48185,46387,45621,40727,38929,37147,38429,28.1143 + 33551,33801,36099,35333,55111,53313,55627,56909,52063,52313,28.1144 + 50515,49749,61303,59505,57723,59005,62319,62569,64867,64101,28.1145 + 18407,16609,18923,20205,23551,23801,22003,21237,32727,30929,28.1146 + 29147,30429,25551,25801,28099,27333,14215,12417,14731,16013,28.1147 + 11167,11417,9619,8853,4023,2225,443,1725,5039,5289,28.1148 + 7587,6821,31418,32188,29878,29616,26274,24996,26798,28584,28.1149 + 17034,17804,19590,19328,24210,22932,20638,22424,2778,3548,28.1150 + 1238,976,5826,4548,6350,8136,13034,13804,15590,15328,28.1151 + 12018,10740,8446,10232,39546,40316,38006,37744,34402,33124,28.1152 + 34926,36712,41546,42316,44102,43840,48722,47444,45150,46936,28.1153 + 59930,60700,58390,58128,62978,61700,63502,65288,53802,54572,28.1154 + 56358,56096,52786,51508,49214,51000,28.1155 +},28.1156 +{0,770,1540,1286,3080,3850,2572,2318,6160,6930,28.1157 + 7700,7446,5144,5914,4636,4382,12320,13090,13860,13606,28.1158 + 15400,16170,14892,14638,10288,11058,11828,11574,9272,10042,28.1159 + 8764,8510,24640,25410,26180,25926,27720,28490,27212,26958,28.1160 + 30800,31570,32340,32086,29784,30554,29276,29022,20576,21346,28.1161 + 22116,21862,23656,24426,23148,22894,18544,19314,20084,19830,28.1162 + 17528,18298,17020,16766,49280,50050,50820,50566,52360,53130,28.1163 + 51852,51598,55440,56210,56980,56726,54424,55194,53916,53662,28.1164 + 61600,62370,63140,62886,64680,65450,64172,63918,59568,60338,28.1165 + 61108,60854,58552,59322,58044,57790,41152,41922,42692,42438,28.1166 + 44232,45002,43724,43470,47312,48082,48852,48598,46296,47066,28.1167 + 45788,45534,37088,37858,38628,38374,40168,40938,39660,39406,28.1168 + 35056,35826,36596,36342,34040,34810,33532,33278,40221,40479,28.1169 + 39705,38939,37141,37399,38673,37907,34061,34319,33545,32779,28.1170 + 35077,35335,36609,35843,44349,44607,43833,43067,41269,41527,28.1171 + 42801,42035,46381,46639,45865,45099,47397,47655,48929,48163,28.1172 + 64861,65119,64345,63579,61781,62039,63313,62547,58701,58959,28.1173 + 58185,57419,59717,59975,61249,60483,52605,52863,52089,51323,28.1174 + 49525,49783,51057,50291,54637,54895,54121,53355,55653,55911,28.1175 + 57185,56419,23965,24223,23449,22683,20885,21143,22417,21651,28.1176 + 17805,18063,17289,16523,18821,19079,20353,19587,28093,28351,28.1177 + 27577,26811,25013,25271,26545,25779,30125,30383,29609,28843,28.1178 + 31141,31399,32673,31907,15837,16095,15321,14555,12757,13015,28.1179 + 14289,13523,9677,9935,9161,8395,10693,10951,12225,11459,28.1180 + 3581,3839,3065,2299,501,759,2033,1267,5613,5871,28.1181 + 5097,4331,6629,6887,8161,7395,28.1182 +},28.1183 +};
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000029.2 +++ b/src/drivers/cdrom/edc_scramble.h Sun Jan 31 18:35:06 2010 +100029.3 @@ -0,0 +1,621 @@29.4 +/* @(#)scramble_table 1.2 02/10/19 */29.5 +29.6 +/*29.7 + * This program is free software; you can redistribute it and/or modify29.8 + * it under the terms of the GNU General Public License version 229.9 + * as published by the Free Software Foundation.29.10 + *29.11 + * This program is distributed in the hope that it will be useful,29.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of29.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the29.14 + * GNU General Public License for more details.29.15 + *29.16 + * You should have received a copy of the GNU General Public License along with29.17 + * this program; see the file COPYING. If not, write to the Free Software29.18 + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.29.19 + */29.20 +29.21 +static const unsigned char yellowbook_scrambler[2340] = {29.22 + 1,128,0,96,0,40,0,30,128,8,96,6,168,2,254,129,128,96,96,40,40,30,158,29.23 + 136,104,102,174,170,252,127,1,224,0,72,0,54,128,22,224,14,200,4,86,131,126,225,29.24 + 224,72,72,54,182,150,246,238,198,204,82,213,253,159,1,168,0,126,128,32,96,24,40,29.25 + 10,158,135,40,98,158,169,168,126,254,160,64,120,48,34,148,25,175,74,252,55,1,214,29.26 + 128,94,224,56,72,18,182,141,182,229,182,203,54,215,86,222,190,216,112,90,164,59,59,29.27 + 83,83,125,253,225,129,136,96,102,168,42,254,159,0,104,0,46,128,28,96,9,232,6,29.28 + 206,130,212,97,159,104,104,46,174,156,124,105,225,238,200,76,86,181,254,247,0,70,128,29.29 + 50,224,21,136,15,38,132,26,227,75,9,247,70,198,178,210,245,157,135,41,162,158,249,29.30 + 168,66,254,177,128,116,96,39,104,26,174,139,60,103,81,234,188,79,49,244,20,71,79,29.31 + 114,180,37,183,91,54,187,86,243,126,197,224,83,8,61,198,145,146,236,109,141,237,165,29.32 + 141,187,37,179,91,53,251,87,3,126,129,224,96,72,40,54,158,150,232,110,206,172,84,29.33 + 125,255,97,128,40,96,30,168,8,126,134,160,98,248,41,130,158,225,168,72,126,182,160,29.34 + 118,248,38,194,154,209,171,28,127,73,224,54,200,22,214,142,222,228,88,75,122,183,99,29.35 + 54,169,214,254,222,192,88,80,58,188,19,49,205,212,85,159,127,40,32,30,152,8,106,29.36 + 134,175,34,252,25,129,202,224,87,8,62,134,144,98,236,41,141,222,229,152,75,42,183,29.37 + 95,54,184,22,242,142,197,164,83,59,125,211,97,157,232,105,142,174,228,124,75,97,247,29.38 + 104,70,174,178,252,117,129,231,32,74,152,55,42,150,159,46,232,28,78,137,244,102,199,29.39 + 106,210,175,29,188,9,177,198,244,82,199,125,146,161,173,184,125,178,161,181,184,119,50,29.40 + 166,149,186,239,51,12,21,197,207,19,20,13,207,69,148,51,47,85,220,63,25,208,10,29.41 + 220,7,25,194,138,209,167,28,122,137,227,38,201,218,214,219,30,219,72,91,118,187,102,29.42 + 243,106,197,239,19,12,13,197,197,147,19,45,205,221,149,153,175,42,252,31,1,200,0,29.43 + 86,128,62,224,16,72,12,54,133,214,227,30,201,200,86,214,190,222,240,88,68,58,179,29.44 + 83,53,253,215,1,158,128,104,96,46,168,28,126,137,224,102,200,42,214,159,30,232,8,29.45 + 78,134,180,98,247,105,134,174,226,252,73,129,246,224,70,200,50,214,149,158,239,40,76,29.46 + 30,181,200,119,22,166,142,250,228,67,11,113,199,100,82,171,125,191,97,176,40,116,30,29.47 + 167,72,122,182,163,54,249,214,194,222,209,152,92,106,185,239,50,204,21,149,207,47,20,29.48 + 28,15,73,196,54,211,86,221,254,217,128,90,224,59,8,19,70,141,242,229,133,139,35,29.49 + 39,89,218,186,219,51,27,85,203,127,23,96,14,168,4,126,131,96,97,232,40,78,158,29.50 + 180,104,119,110,166,172,122,253,227,1,137,192,102,208,42,220,31,25,200,10,214,135,30,29.51 + 226,136,73,166,182,250,246,195,6,209,194,220,81,153,252,106,193,239,16,76,12,53,197,29.52 + 215,19,30,141,200,101,150,171,46,255,92,64,57,240,18,196,13,147,69,173,243,61,133,29.53 + 209,163,28,121,201,226,214,201,158,214,232,94,206,184,84,114,191,101,176,43,52,31,87,29.54 + 72,62,182,144,118,236,38,205,218,213,155,31,43,72,31,118,136,38,230,154,202,235,23,29.55 + 15,78,132,52,99,87,105,254,174,192,124,80,33,252,24,65,202,176,87,52,62,151,80,29.56 + 110,188,44,113,221,228,89,139,122,231,99,10,169,199,62,210,144,93,172,57,189,210,241,29.57 + 157,132,105,163,110,249,236,66,205,241,149,132,111,35,108,25,237,202,205,151,21,174,143,29.58 + 60,100,17,235,76,79,117,244,39,7,90,130,187,33,179,88,117,250,167,3,58,129,211,29.59 + 32,93,216,57,154,146,235,45,143,93,164,57,187,82,243,125,133,225,163,8,121,198,162,29.60 + 210,249,157,130,233,161,142,248,100,66,171,113,191,100,112,43,100,31,107,72,47,118,156,29.61 + 38,233,218,206,219,20,91,79,123,116,35,103,89,234,186,207,51,20,21,207,79,20,52,29.62 + 15,87,68,62,179,80,117,252,39,1,218,128,91,32,59,88,19,122,141,227,37,137,219,29.63 + 38,219,90,219,123,27,99,75,105,247,110,198,172,82,253,253,129,129,160,96,120,40,34,29.64 + 158,153,168,106,254,175,0,124,0,33,192,24,80,10,188,7,49,194,148,81,175,124,124,29.65 + 33,225,216,72,90,182,187,54,243,86,197,254,211,0,93,192,57,144,18,236,13,141,197,29.66 + 165,147,59,45,211,93,157,249,169,130,254,225,128,72,96,54,168,22,254,142,192,100,80,29.67 + 43,124,31,97,200,40,86,158,190,232,112,78,164,52,123,87,99,126,169,224,126,200,32,29.68 + 86,152,62,234,144,79,44,52,29,215,73,158,182,232,118,206,166,212,122,223,99,24,41,29.69 + 202,158,215,40,94,158,184,104,114,174,165,188,123,49,227,84,73,255,118,192,38,208,26,29.70 + 220,11,25,199,74,210,183,29,182,137,182,230,246,202,198,215,18,222,141,152,101,170,171,29.71 + 63,63,80,16,60,12,17,197,204,83,21,253,207,1,148,0,111,64,44,48,29,212,9,29.72 + 159,70,232,50,206,149,148,111,47,108,28,45,201,221,150,217,174,218,252,91,1,251,64,29.73 + 67,112,49,228,20,75,79,119,116,38,167,90,250,187,3,51,65,213,240,95,4,56,3,29.74 + 82,129,253,160,65,184,48,114,148,37,175,91,60,59,81,211,124,93,225,249,136,66,230,29.75 + 177,138,244,103,7,106,130,175,33,188,24,113,202,164,87,59,126,147,96,109,232,45,142,29.76 + 157,164,105,187,110,243,108,69,237,243,13,133,197,163,19,57,205,210,213,157,159,41,168,29.77 + 30,254,136,64,102,176,42,244,31,7,72,2,182,129,182,224,118,200,38,214,154,222,235,29.78 + 24,79,74,180,55,55,86,150,190,238,240,76,68,53,243,87,5,254,131,0,97,192,40,29.79 + 80,30,188,8,113,198,164,82,251,125,131,97,161,232,120,78,162,180,121,183,98,246,169,29.80 + 134,254,226,192,73,144,54,236,22,205,206,213,148,95,47,120,28,34,137,217,166,218,250,29.81 + 219,3,27,65,203,112,87,100,62,171,80,127,124,32,33,216,24,90,138,187,39,51,90,29.82 + 149,251,47,3,92,1,249,192,66,208,49,156,20,105,207,110,212,44,95,93,248,57,130,29.83 + 146,225,173,136,125,166,161,186,248,115,2,165,193,187,16,115,76,37,245,219,7,27,66,29.84 + 139,113,167,100,122,171,99,63,105,208,46,220,28,89,201,250,214,195,30,209,200,92,86,29.85 + 185,254,242,192,69,144,51,44,21,221,207,25,148,10,239,71,12,50,133,213,163,31,57,29.86 + 200,18,214,141,158,229,168,75,62,183,80,118,188,38,241,218,196,91,19,123,77,227,117,29.87 + 137,231,38,202,154,215,43,30,159,72,104,54,174,150,252,110,193,236,80,77,252,53,129,29.88 + 215,32,94,152,56,106,146,175,45,188,29,177,201,180,86,247,126,198,160,82,248,61,130,29.89 + 145,161,172,120,125,226,161,137,184,102,242,170,197,191,19,48,13,212,5,159,67,40,49,29.90 + 222,148,88,111,122,172,35,61,217,209,154,220,107,25,239,74,204,55,21,214,143,30,228,29.91 + 8,75,70,183,114,246,165,134,251,34,195,89,145,250,236,67,13,241,197,132,83,35,125,29.92 + 217,225,154,200,107,22,175,78,252,52,65,215,112,94,164,56,123,82,163,125,185,225,178,29.93 + 200,117,150,167,46,250,156,67,41,241,222,196,88,83,122,189,227,49,137,212,102,223,106,29.94 + 216,47,26,156,11,41,199,94,210,184,93,178,185,181,178,247,53,134,151,34,238,153,140,29.95 + 106,229,239,11,12,7,69,194,179,17,181,204,119,21,230,143,10,228,7,11,66,135,113,29.96 + 162,164,121,187,98,243,105,133,238,227,12,73,197,246,211,6,221,194,217,145,154,236,107,29.97 + 13,239,69,140,51,37,213,219,31,27,72,11,118,135,102,226,170,201,191,22,240,14,196,29.98 + 4,83,67,125,241,225,132,72,99,118,169,230,254,202,192,87,16,62,140,16,101,204,43,29.99 + 21,223,79,24,52,10,151,71,46,178,156,117,169,231,62,202,144,87,44,62,157,208,105,29.100 + 156,46,233,220,78,217,244,90,199,123,18,163,77,185,245,178,199,53,146,151,45,174,157,29.101 + 188,105,177,238,244,76,71,117,242,167,5,186,131,51,33,213,216,95,26,184,11,50,135,29.102 + 85,162,191,57,176,18,244,13,135,69,162,179,57,181,210,247,29,134,137,162,230,249,138,29.103 + 194,231,17,138,140,103,37,234,155,15,43,68,31,115,72,37,246,155,6,235,66,207,113,29.104 + 148,36,111,91,108,59,109,211,109,157,237,169,141,190,229,176,75,52,55,87,86,190,190,29.105 + 240,112,68,36,51,91,85,251,127,3,96,1,232,0,78,128,52,96,23,104,14,174,132,29.106 + 124,99,97,233,232,78,206,180,84,119,127,102,160,42,248,31,2,136,1,166,128,122,224,29.107 + 35,8,25,198,138,210,231,29,138,137,167,38,250,154,195,43,17,223,76,88,53,250,151,29.108 + 3,46,129,220,96,89,232,58,206,147,20,109,207,109,148,45,175,93,188,57,177,210,244,29.109 + 93,135,121,162,162,249,185,130,242,225,133,136,99,38,169,218,254,219,0,91,64,59,112,29.110 + 19,100,13,235,69,143,115,36,37,219,91,27,123,75,99,119,105,230,174,202,252,87,1,29.111 + 254,128,64,96,48,40,20,30,143,72,100,54,171,86,255,126,192,32,80,24,60,10,145,29.112 + 199,44,82,157,253,169,129,190,224,112,72,36,54,155,86,235,126,207,96,84,40,63,94,29.113 + 144,56,108,18,173,205,189,149,177,175,52,124,23,97,206,168,84,126,191,96,112,40,36,29.114 + 30,155,72,107,118,175,102,252,42,193,223,16,88,12,58,133,211,35,29,217,201,154,214,29.115 + 235,30,207,72,84,54,191,86,240,62,196,16,83,76,61,245,209,135,28,98,137,233,166,29.116 + 206,250,212,67,31,113,200,36,86,155,126,235,96,79,104,52,46,151,92,110,185,236,114,29.117 + 205,229,149,139,47,39,92,26,185,203,50,215,85,158,191,40,112,30,164,8,123,70,163,29.118 + 114,249,229,130,203,33,151,88,110,186,172,115,61,229,209,139,28,103,73,234,182,207,54,29.119 + 212,22,223,78,216,52,90,151,123,46,163,92,121,249,226,194,201,145,150,236,110,205,236,29.120 + 85,141,255,37,128,27,32,11,88,7,122,130,163,33,185,216,114,218,165,155,59,43,83,29.121 + 95,125,248,33,130,152,97,170,168,127,62,160,16,120,12,34,133,217,163,26,249,203,2,29.122 + 215,65,158,176,104,116,46,167,92,122,185,227,50,201,213,150,223,46,216,28,90,137,251,29.123 + 38,195,90,209,251,28,67,73,241,246,196,70,211,114,221,229,153,29.124 +};29.125 +29.126 +#ifdef PROTOTYPES29.127 +29.128 +# if !defined WORDS_BIGENDIAN29.129 +/* little endian */29.130 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {29.131 + 0x60008001UL,0x1E002800UL,0x06600880UL,0x81FE02A8UL,0x28606080UL,29.132 + 0x889E1E28UL,0xAAAE6668UL,0xE0017FFCUL,0x36004800UL,0x0EE01680UL,29.133 + 0x835604C8UL,0x48E0E17EUL,0x96B63648UL,0xCCC6EEF6UL,0x9FFDD552UL,29.134 + 0x7E00A801UL,0x18602080UL,0x879E0A28UL,0xA99E6228UL,0xA0FE7EA8UL,29.135 + 0x22307840UL,0x4AAF1994UL,0xD60137FCUL,0x38E05E80UL,0x8DB61248UL,29.136 + 0xCBB6E5B6UL,0xDE56D736UL,0x5A70D8BEUL,0x533B3BA4UL,0xE1FD7D53UL,29.137 + 0x66608881UL,0x9FFE2AA8UL,0x2E006800UL,0x09601C80UL,0x82CE06E8UL,29.138 + 0x689F61D4UL,0x9CAE2E68UL,0xEEE1697CUL,0xB5564CC8UL,0x4600F7FEUL,29.139 + 0x15E03280UL,0x84260F88UL,0x094BE31AUL,0xB2C646F7UL,0x879DF5D2UL,29.140 + 0xF99EA229UL,0xB1FE42A8UL,0x27607480UL,0x8BAE1A68UL,0xEA51673CUL,29.141 + 0xF4314FBCUL,0x724F4714UL,0x5BB725B4UL,0xF356BB36UL,0x53E0C57EUL,29.142 + 0x91C63D08UL,0x8D6DEC92UL,0xBB8DA5EDUL,0x355BB325UL,0x7E0357FBUL,29.143 + 0x4860E081UL,0x969E3628UL,0xACCE6EE8UL,0x61FF7D54UL,0x1E602880UL,29.144 + 0x867E08A8UL,0x29F862A0UL,0xA8E19E82UL,0xA0B67E48UL,0xC226F876UL,29.145 + 0x1CABD19AUL,0x36E0497FUL,0x8ED616C8UL,0x4B58E4DEUL,0x3663B77AUL,29.146 + 0xDEFED6A9UL,0x3A5058C0UL,0xCD3113BCUL,0x7F9F55D4UL,0x981E2028UL,29.147 + 0xAF866A08UL,0x8119FC22UL,0x0857E0CAUL,0x6290863EUL,0xDE8D29ECUL,29.148 + 0x2A4B98E5UL,0xB8365FB7UL,0xC58EF216UL,0x7D3B53A4UL,0xE89D61D3UL,29.149 + 0xE4AE8E69UL,0xF7614B7CUL,0xB2AE4668UL,0xE78175FCUL,0x37984A20UL,29.150 + 0x2E9F962AUL,0x894E1CE8UL,0x6AC766F4UL,0xBC1DAFD2UL,0xF4C6B109UL,29.151 + 0x927DC752UL,0x7DB8ADA1UL,0xB8B5A1B2UL,0x95A63277UL,0x0C33EFBAUL,29.152 + 0x13CFC515UL,0x45CF0D14UL,0x552F3394UL,0xD0193FDCUL,0x1907DC0AUL,29.153 + 0xA7D18AC2UL,0xE3897A1CUL,0xD6DAC926UL,0x48DB1EDBUL,0x66BB765BUL,29.154 + 0xEFC56AF3UL,0xC50D0C13UL,0x2D1393C5UL,0x9995DDCDUL,0x1FFC2AAFUL,29.155 + 0x5600C801UL,0x10E03E80UL,0x85360C48UL,0xC91EE3D6UL,0xBED656C8UL,29.156 + 0x4458F0DEUL,0x3553B33AUL,0x9E01D7FDUL,0x2E606880UL,0x897E1CA8UL,29.157 + 0x2AC866E0UL,0xE81E9FD6UL,0xB4864E08UL,0x8669F762UL,0x49FCE2AEUL,29.158 + 0x46E0F681UL,0x95D632C8UL,0x4C28EF9EUL,0x77C8B51EUL,0xFA8EA616UL,29.159 + 0x710B43E4UL,0xAB5264C7UL,0xB061BF7DUL,0xA71E7428UL,0xA3B67A48UL,29.160 + 0xC2D6F936UL,0x5C98D1DEUL,0x32EFB96AUL,0xCF9515CCUL,0x0F1C142FUL,29.161 + 0xD336C449UL,0xD9FEDD56UL,0x3BE05A80UL,0x8D461308UL,0x8B85E5F2UL,29.162 + 0xDA592723UL,0x1B33DBBAUL,0x177FCB55UL,0x04A80E60UL,0x6160837EUL,29.163 + 0x9E4E28E8UL,0x6E7768B4UL,0xFD7AACA6UL,0xC08901E3UL,0xDC2AD066UL,29.164 + 0x0AC8191FUL,0xE21E87D6UL,0xB6A64988UL,0x06C3F6FAUL,0x51DCC2D1UL,29.165 + 0xC16AFC99UL,0x0C4C10EFUL,0x13D7C535UL,0x65C88D1EUL,0xFF2EAB96UL,29.166 + 0xF039405CUL,0x930DC412UL,0x3DF3AD45UL,0x1CA3D185UL,0xD6E2C979UL,29.167 + 0xE8D69EC9UL,0x54B8CE5EUL,0xB065BF72UL,0x571F342BUL,0x90B63E48UL,29.168 + 0xCD26EC76UL,0x1F9BD5DAUL,0x761F482BUL,0x9AE62688UL,0x0F17EBCAUL,29.169 + 0x6334844EUL,0xAEFE6957UL,0x21507CC0UL,0xCA4118FCUL,0x3E3457B0UL,29.170 + 0xBC6E5097UL,0xE4DD712CUL,0xE77A8B59UL,0xC7A90A63UL,0x5D90D23EUL,29.171 + 0xD2BD39ACUL,0x69849DF1UL,0xECF96EA3UL,0x95F1CD42UL,0x6C236F84UL,29.172 + 0xCDCAED19UL,0x8FAE1597UL,0xEB11643CUL,0xF4754F4CUL,0x825A0727UL,29.173 + 0x58B321BBUL,0x03A7FA75UL,0x20D3813AUL,0x9A39D85DUL,0x8F2DEB92UL,29.174 + 0xBB39A45DUL,0x857DF352UL,0x7908A3E1UL,0xF9D2A2C6UL,0xA1E9829DUL,29.175 + 0x4264F88EUL,0x64BF71ABUL,0x1F642B70UL,0x762F486BUL,0xDAE9269CUL,29.176 + 0x5B14DBCEUL,0x23747B4FUL,0xBAEA5967UL,0x151433CFUL,0x34144FCFUL,29.177 + 0x3E44570FUL,0xFC7550B3UL,0x80DA0127UL,0x583B205BUL,0xE38D7A13UL,29.178 + 0x26DB8925UL,0x7BDB5ADBUL,0x694B631BUL,0xACC66EF7UL,0x81FDFD52UL,29.179 + 0x7860A081UL,0x999E2228UL,0xAFFE6AA8UL,0x21007C00UL,0x0A5018C0UL,29.180 + 0xC23107BCUL,0x7CAF5194UL,0xD8E1217CUL,0xBBB65A48UL,0xC556F336UL,29.181 + 0x5D00D3FEUL,0x129039C0UL,0xC58D0DECUL,0x2D3B93A5UL,0xF99D5DD3UL,29.182 + 0xE1FE82A9UL,0x36604880UL,0x8EFE16A8UL,0x2B5064C0UL,0xC8611F7CUL,29.183 + 0xBE9E5628UL,0xA44E70E8UL,0x63577B34UL,0x7EE0A97EUL,0x985620C8UL,29.184 + 0x4F90EA3EUL,0xD71D342CUL,0xE8B69E49UL,0xD4A6CE76UL,0x1863DF7AUL,29.185 + 0xD79ECA29UL,0xB89E5E28UL,0xA5AE7268UL,0xE3317BBCUL,0x76FF4954UL,29.186 + 0x1AD026C0UL,0xC7190BDCUL,0x1DB7D24AUL,0xE6B689B6UL,0xD7C6CAF6UL,29.187 + 0x988DDE12UL,0x3FABAA65UL,0x3C10503FUL,0xCCC5110CUL,0xCFFD1553UL,29.188 + 0x6F009401UL,0x1D302C40UL,0x469F09D4UL,0x95CE32E8UL,0x6C2F6F94UL,29.189 + 0xDDC92D1CUL,0xDAAED996UL,0xFB015BFCUL,0x31704340UL,0x4F4B14E4UL,29.190 + 0xA7267477UL,0x03BBFA5AUL,0xF0D54133UL,0x0338045FUL,0xA0FD8152UL,29.191 + 0x7230B841UL,0x5BAF2594UL,0xD3513B3CUL,0xF9E15D7CUL,0xB1E64288UL,29.192 + 0x0767F48AUL,0x21AF826AUL,0xCA7118BCUL,0x7E3B57A4UL,0xE86D6093UL,29.193 + 0xA49D8E2DUL,0xF36EBB69UL,0xF3ED456CUL,0xA3C5850DUL,0xD2CD3913UL,29.194 + 0x299F9DD5UL,0x88FE1EA8UL,0x2AB06640UL,0x48071FF4UL,0xB681B602UL,29.195 + 0x26C876E0UL,0xEBDE9AD6UL,0xB44A4F18UL,0x96563737UL,0x4CF0EEBEUL,29.196 + 0x57F33544UL,0x0083FE05UL,0x5028C061UL,0x7108BC1EUL,0xFB52A4C6UL,29.197 + 0xA161837DUL,0xA24E78E8UL,0x62B779B4UL,0xFE86A9F6UL,0x9049C0E2UL,29.198 + 0xCD16EC36UL,0x5F94D5CEUL,0x221C782FUL,0xDAA6D989UL,0x1B03DBFAUL,29.199 + 0x5770CB41UL,0x50AB3E64UL,0x21207C7FUL,0x8A5A18D8UL,0x5A3327BBUL,29.200 + 0x032FFB95UL,0xC0F9015CUL,0x9C31D042UL,0x6ECF6914UL,0x5D5F2CD4UL,29.201 + 0x928239F8UL,0x7D88ADE1UL,0xF8BAA1A6UL,0xC1A50273UL,0x4C7310BBUL,29.202 + 0x07DBF525UL,0x718B421BUL,0xAB7A64A7UL,0xD0693F63UL,0x591CDC2EUL,29.203 + 0xC3D6FAC9UL,0x5CC8D11EUL,0xF2FEB956UL,0x339045C0UL,0xCFDD152CUL,29.204 + 0xEF0A9419UL,0x85320C47UL,0x391FA3D5UL,0x8DD612C8UL,0x4BA8E59EUL,29.205 + 0x7650B73EUL,0xDAF126BCUL,0x7B135BC4UL,0x8975E34DUL,0x9ACA26E7UL,29.206 + 0x9F1E2BD7UL,0xAE366848UL,0xC16EFC96UL,0xFC4D50ECUL,0x20D78135UL,29.207 + 0x6A38985EUL,0xBC2DAF92UL,0xB4C9B11DUL,0xC67EF756UL,0x3DF852A0UL,29.208 + 0xACA19182UL,0xA1E27D78UL,0xF266B889UL,0x13BFC5AAUL,0x05D40D30UL,29.209 + 0x3128439FUL,0x6F5894DEUL,0x3D23AC7AUL,0xDC9AD1D9UL,0x4AEF196BUL,29.210 + 0xD61537CCUL,0x08E41E8FUL,0x72B7464BUL,0xFB86A5F6UL,0x9159C322UL,29.211 + 0x0D43ECFAUL,0x5384C5F1UL,0xE1D97D23UL,0x166BC89AUL,0x34FC4EAFUL,29.212 + 0x5E70D741UL,0x527B38A4UL,0xE1B97DA3UL,0x9675C8B2UL,0x9CFA2EA7UL,29.213 + 0xDEF12943UL,0x7A5358C4UL,0x8931E3BDUL,0x6ADF66D4UL,0x9C1A2FD8UL,29.214 + 0x5EC7290BUL,0xB25DB8D2UL,0xF7B2B5B9UL,0x22978635UL,0x6A8C99EEUL,29.215 + 0x0C0BEFE5UL,0xB3C24507UL,0x77CCB511UL,0x0A8FE615UL,0x420B07E4UL,29.216 + 0xA4A27187UL,0xF362BB79UL,0xE3EE8569UL,0xF6C5490CUL,0xC2DD06D3UL,29.217 + 0xEC9A91D9UL,0x45EF0D6BUL,0xD525338CUL,0x481B1FDBUL,0x6687760BUL,29.218 + 0xBFC9AAE2UL,0xC40EF016UL,0x7D435304UL,0x4884E1F1UL,0xE6A97663UL,29.219 + 0x57C0CAFEUL,0x108C3E10UL,0x152BCC65UL,0x34184FDFUL,0x2E47970AUL,29.220 + 0xA9759CB2UL,0x90CA3EE7UL,0x9D3E2C57UL,0x2E9C69D0UL,0xD94EDCE9UL,29.221 + 0x7BC75AF4UL,0xB94DA312UL,0x35C7B2F5UL,0xAE2D9792UL,0xB169BC9DUL,29.222 + 0x474CF4EEUL,0x05A7F275UL,0x213383BAUL,0x1A5FD8D5UL,0x87320BB8UL,29.223 + 0x39BFA255UL,0x0DF412B0UL,0xB3A24587UL,0xF7D2B539UL,0xA289861DUL,29.224 + 0xC28AF9E6UL,0x8C8A11E7UL,0x9BEA2567UL,0x1F442B0FUL,0xF6254873UL,29.225 + 0x42EB069BUL,0x249471CFUL,0x3B6C5B6FUL,0x9D6DD36DUL,0xBE8DA9EDUL,29.226 + 0x344BB0E5UL,0xBE565737UL,0x4470F0BEUL,0x555B3324UL,0x60037FFBUL,29.227 + 0x4E00E801UL,0x17603480UL,0x84AE0E68UL,0xE961637CUL,0xB4CE4EE8UL,29.228 + 0x667F7754UL,0x1FF82AA0UL,0xA6018802UL,0x23E07A80UL,0x8AC61908UL,29.229 + 0x8A1DE7D2UL,0xFA26A789UL,0x112BC39AUL,0x35584CDFUL,0x2E0397FAUL,29.230 + 0x5960DC81UL,0x93CE3AE8UL,0x6DCF6D14UL,0x5DAF2D94UL,0xD2B139BCUL,29.231 + 0x79875DF4UL,0xB9F9A2A2UL,0x85E1F282UL,0xA9266388UL,0x00DBFEDAUL,29.232 + 0x703B405BUL,0xEB0D6413UL,0x24738F45UL,0x1B5BDB25UL,0x77634B7BUL,29.233 + 0xCAAEE669UL,0xFE0157FCUL,0x30604080UL,0x8F1E1428UL,0xAB366448UL,29.234 + 0xC07EFF56UL,0x3C185020UL,0x2CC7910AUL,0xA9FD9D52UL,0x70E0BE81UL,29.235 + 0x9B362448UL,0xCF7EEB56UL,0x3F285460UL,0x6C38905EUL,0xBDCDAD12UL,29.236 + 0x34AFB195UL,0xCE61177CUL,0xBF7E54A8UL,0x24287060UL,0x6B489B1EUL,29.237 + 0xFC66AF76UL,0x10DFC12AUL,0x853A0C58UL,0xD91D23D3UL,0xEBD69AC9UL,29.238 + 0x5448CF1EUL,0xF056BF36UL,0x5310C43EUL,0xD1F53D4CUL,0x89621C87UL,29.239 + 0xFACEA6E9UL,0x711F43D4UL,0x9B5624C8UL,0x4F60EB7EUL,0x972E3468UL,29.240 + 0xECB96E5CUL,0x95E5CD72UL,0x5C272F8BUL,0x32CBB91AUL,0xBF9E55D7UL,29.241 + 0xA41E7028UL,0xA3467B08UL,0x82E5F972UL,0x589721CBUL,0x73ACBA6EUL,29.242 + 0x8BD1E53DUL,0xEA49671CUL,0xD436CFB6UL,0xD84EDF16UL,0x7B975A34UL,29.243 + 0x795CA32EUL,0xC9C2E2F9UL,0x6EEC9691UL,0x8D55ECCDUL,0x1B8025FFUL,29.244 + 0x07580B20UL,0x21A3827AUL,0xDA72D8B9UL,0x2B3B9BA5UL,0xF87D5F53UL,29.245 + 0x61988221UL,0x3E7FA8AAUL,0x0C7810A0UL,0xA3D98522UL,0x02CBF91AUL,29.246 + 0xB09E41D7UL,0xA72E7468UL,0xE3B97A5CUL,0x96D5C932UL,0x1CD82EDFUL,29.247 + 0x26FB895AUL,0xFBD15AC3UL,0xF149431CUL,0xD346C4F6UL,0x99E5DD72UL,29.248 +29.249 +};29.250 +# endif29.251 +# if defined WORDS_BIGENDIAN29.252 +/* big endian */29.253 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {29.254 + 0x01800060UL,0x0028001EUL,0x80086006UL,0xA802FE81UL,0x80606028UL,29.255 + 0x281E9E88UL,0x6866AEAAUL,0xFC7F01E0UL,0x00480036UL,0x8016E00EUL,29.256 + 0xC8045683UL,0x7EE1E048UL,0x4836B696UL,0xF6EEC6CCUL,0x52D5FD9FUL,29.257 + 0x01A8007EUL,0x80206018UL,0x280A9E87UL,0x28629EA9UL,0xA87EFEA0UL,29.258 + 0x40783022UL,0x9419AF4AUL,0xFC3701D6UL,0x805EE038UL,0x4812B68DUL,29.259 + 0xB6E5B6CBUL,0x36D756DEUL,0xBED8705AUL,0xA43B3B53UL,0x537DFDE1UL,29.260 + 0x81886066UL,0xA82AFE9FUL,0x0068002EUL,0x801C6009UL,0xE806CE82UL,29.261 + 0xD4619F68UL,0x682EAE9CUL,0x7C69E1EEUL,0xC84C56B5UL,0xFEF70046UL,29.262 + 0x8032E015UL,0x880F2684UL,0x1AE34B09UL,0xF746C6B2UL,0xD2F59D87UL,29.263 + 0x29A29EF9UL,0xA842FEB1UL,0x80746027UL,0x681AAE8BUL,0x3C6751EAUL,29.264 + 0xBC4F31F4UL,0x14474F72UL,0xB425B75BUL,0x36BB56F3UL,0x7EC5E053UL,29.265 + 0x083DC691UL,0x92EC6D8DUL,0xEDA58DBBUL,0x25B35B35UL,0xFB57037EUL,29.266 + 0x81E06048UL,0x28369E96UL,0xE86ECEACUL,0x547DFF61UL,0x8028601EUL,29.267 + 0xA8087E86UL,0xA062F829UL,0x829EE1A8UL,0x487EB6A0UL,0x76F826C2UL,29.268 + 0x9AD1AB1CUL,0x7F49E036UL,0xC816D68EUL,0xDEE4584BUL,0x7AB76336UL,29.269 + 0xA9D6FEDEUL,0xC058503AUL,0xBC1331CDUL,0xD4559F7FUL,0x28201E98UL,29.270 + 0x086A86AFUL,0x22FC1981UL,0xCAE05708UL,0x3E869062UL,0xEC298DDEUL,29.271 + 0xE5984B2AUL,0xB75F36B8UL,0x16F28EC5UL,0xA4533B7DUL,0xD3619DE8UL,29.272 + 0x698EAEE4UL,0x7C4B61F7UL,0x6846AEB2UL,0xFC7581E7UL,0x204A9837UL,29.273 + 0x2A969F2EUL,0xE81C4E89UL,0xF466C76AUL,0xD2AF1DBCUL,0x09B1C6F4UL,29.274 + 0x52C77D92UL,0xA1ADB87DUL,0xB2A1B5B8UL,0x7732A695UL,0xBAEF330CUL,29.275 + 0x15C5CF13UL,0x140DCF45UL,0x94332F55UL,0xDC3F19D0UL,0x0ADC0719UL,29.276 + 0xC28AD1A7UL,0x1C7A89E3UL,0x26C9DAD6UL,0xDB1EDB48UL,0x5B76BB66UL,29.277 + 0xF36AC5EFUL,0x130C0DC5UL,0xC593132DUL,0xCDDD9599UL,0xAF2AFC1FUL,29.278 + 0x01C80056UL,0x803EE010UL,0x480C3685UL,0xD6E31EC9UL,0xC856D6BEUL,29.279 + 0xDEF05844UL,0x3AB35335UL,0xFDD7019EUL,0x8068602EUL,0xA81C7E89UL,29.280 + 0xE066C82AUL,0xD69F1EE8UL,0x084E86B4UL,0x62F76986UL,0xAEE2FC49UL,29.281 + 0x81F6E046UL,0xC832D695UL,0x9EEF284CUL,0x1EB5C877UL,0x16A68EFAUL,29.282 + 0xE4430B71UL,0xC76452ABUL,0x7DBF61B0UL,0x28741EA7UL,0x487AB6A3UL,29.283 + 0x36F9D6C2UL,0xDED1985CUL,0x6AB9EF32UL,0xCC1595CFUL,0x2F141C0FUL,29.284 + 0x49C436D3UL,0x56DDFED9UL,0x805AE03BUL,0x0813468DUL,0xF2E5858BUL,29.285 + 0x232759DAUL,0xBADB331BUL,0x55CB7F17UL,0x600EA804UL,0x7E836061UL,29.286 + 0xE8284E9EUL,0xB468776EUL,0xA6AC7AFDUL,0xE30189C0UL,0x66D02ADCUL,29.287 + 0x1F19C80AUL,0xD6871EE2UL,0x8849A6B6UL,0xFAF6C306UL,0xD1C2DC51UL,29.288 + 0x99FC6AC1UL,0xEF104C0CUL,0x35C5D713UL,0x1E8DC865UL,0x96AB2EFFUL,29.289 + 0x5C4039F0UL,0x12C40D93UL,0x45ADF33DUL,0x85D1A31CUL,0x79C9E2D6UL,29.290 + 0xC99ED6E8UL,0x5ECEB854UL,0x72BF65B0UL,0x2B341F57UL,0x483EB690UL,29.291 + 0x76EC26CDUL,0xDAD59B1FUL,0x2B481F76UL,0x8826E69AUL,0xCAEB170FUL,29.292 + 0x4E843463UL,0x5769FEAEUL,0xC07C5021UL,0xFC1841CAUL,0xB057343EUL,29.293 + 0x97506EBCUL,0x2C71DDE4UL,0x598B7AE7UL,0x630AA9C7UL,0x3ED2905DUL,29.294 + 0xAC39BDD2UL,0xF19D8469UL,0xA36EF9ECUL,0x42CDF195UL,0x846F236CUL,29.295 + 0x19EDCACDUL,0x9715AE8FUL,0x3C6411EBUL,0x4C4F75F4UL,0x27075A82UL,29.296 + 0xBB21B358UL,0x75FAA703UL,0x3A81D320UL,0x5DD8399AUL,0x92EB2D8FUL,29.297 + 0x5DA439BBUL,0x52F37D85UL,0xE1A30879UL,0xC6A2D2F9UL,0x9D82E9A1UL,29.298 + 0x8EF86442UL,0xAB71BF64UL,0x702B641FUL,0x6B482F76UL,0x9C26E9DAUL,29.299 + 0xCEDB145BUL,0x4F7B7423UL,0x6759EABAUL,0xCF331415UL,0xCF4F1434UL,29.300 + 0x0F57443EUL,0xB35075FCUL,0x2701DA80UL,0x5B203B58UL,0x137A8DE3UL,29.301 + 0x2589DB26UL,0xDB5ADB7BUL,0x1B634B69UL,0xF76EC6ACUL,0x52FDFD81UL,29.302 + 0x81A06078UL,0x28229E99UL,0xA86AFEAFUL,0x007C0021UL,0xC018500AUL,29.303 + 0xBC0731C2UL,0x9451AF7CUL,0x7C21E1D8UL,0x485AB6BBUL,0x36F356C5UL,29.304 + 0xFED3005DUL,0xC0399012UL,0xEC0D8DC5UL,0xA5933B2DUL,0xD35D9DF9UL,29.305 + 0xA982FEE1UL,0x80486036UL,0xA816FE8EUL,0xC064502BUL,0x7C1F61C8UL,29.306 + 0x28569EBEUL,0xE8704EA4UL,0x347B5763UL,0x7EA9E07EUL,0xC8205698UL,29.307 + 0x3EEA904FUL,0x2C341DD7UL,0x499EB6E8UL,0x76CEA6D4UL,0x7ADF6318UL,29.308 + 0x29CA9ED7UL,0x285E9EB8UL,0x6872AEA5UL,0xBC7B31E3UL,0x5449FF76UL,29.309 + 0xC026D01AUL,0xDC0B19C7UL,0x4AD2B71DUL,0xB689B6E6UL,0xF6CAC6D7UL,29.310 + 0x12DE8D98UL,0x65AAAB3FUL,0x3F50103CUL,0x0C11C5CCUL,0x5315FDCFUL,29.311 + 0x0194006FUL,0x402C301DUL,0xD4099F46UL,0xE832CE95UL,0x946F2F6CUL,29.312 + 0x1C2DC9DDUL,0x96D9AEDAUL,0xFC5B01FBUL,0x40437031UL,0xE4144B4FUL,29.313 + 0x777426A7UL,0x5AFABB03UL,0x3341D5F0UL,0x5F043803UL,0x5281FDA0UL,29.314 + 0x41B83072UL,0x9425AF5BUL,0x3C3B51D3UL,0x7C5DE1F9UL,0x8842E6B1UL,29.315 + 0x8AF46707UL,0x6A82AF21UL,0xBC1871CAUL,0xA4573B7EUL,0x93606DE8UL,29.316 + 0x2D8E9DA4UL,0x69BB6EF3UL,0x6C45EDF3UL,0x0D85C5A3UL,0x1339CDD2UL,29.317 + 0xD59D9F29UL,0xA81EFE88UL,0x4066B02AUL,0xF41F0748UL,0x02B681B6UL,29.318 + 0xE076C826UL,0xD69ADEEBUL,0x184F4AB4UL,0x37375696UL,0xBEEEF04CUL,29.319 + 0x4435F357UL,0x05FE8300UL,0x61C02850UL,0x1EBC0871UL,0xC6A452FBUL,29.320 + 0x7D8361A1UL,0xE8784EA2UL,0xB479B762UL,0xF6A986FEUL,0xE2C04990UL,29.321 + 0x36EC16CDUL,0xCED5945FUL,0x2F781C22UL,0x89D9A6DAUL,0xFADB031BUL,29.322 + 0x41CB7057UL,0x643EAB50UL,0x7F7C2021UL,0xD8185A8AUL,0xBB27335AUL,29.323 + 0x95FB2F03UL,0x5C01F9C0UL,0x42D0319CUL,0x1469CF6EUL,0xD42C5F5DUL,29.324 + 0xF8398292UL,0xE1AD887DUL,0xA6A1BAF8UL,0x7302A5C1UL,0xBB10734CUL,29.325 + 0x25F5DB07UL,0x1B428B71UL,0xA7647AABUL,0x633F69D0UL,0x2EDC1C59UL,29.326 + 0xC9FAD6C3UL,0x1ED1C85CUL,0x56B9FEF2UL,0xC0459033UL,0x2C15DDCFUL,29.327 + 0x19940AEFUL,0x470C3285UL,0xD5A31F39UL,0xC812D68DUL,0x9EE5A84BUL,29.328 + 0x3EB75076UL,0xBC26F1DAUL,0xC45B137BUL,0x4DE37589UL,0xE726CA9AUL,29.329 + 0xD72B1E9FUL,0x486836AEUL,0x96FC6EC1UL,0xEC504DFCUL,0x3581D720UL,29.330 + 0x5E98386AUL,0x92AF2DBCUL,0x1DB1C9B4UL,0x56F77EC6UL,0xA052F83DUL,29.331 + 0x8291A1ACUL,0x787DE2A1UL,0x89B866F2UL,0xAAC5BF13UL,0x300DD405UL,29.332 + 0x9F432831UL,0xDE94586FUL,0x7AAC233DUL,0xD9D19ADCUL,0x6B19EF4AUL,29.333 + 0xCC3715D6UL,0x8F1EE408UL,0x4B46B772UL,0xF6A586FBUL,0x22C35991UL,29.334 + 0xFAEC430DUL,0xF1C58453UL,0x237DD9E1UL,0x9AC86B16UL,0xAF4EFC34UL,29.335 + 0x41D7705EUL,0xA4387B52UL,0xA37DB9E1UL,0xB2C87596UL,0xA72EFA9CUL,29.336 + 0x4329F1DEUL,0xC458537AUL,0xBDE33189UL,0xD466DF6AUL,0xD82F1A9CUL,29.337 + 0x0B29C75EUL,0xD2B85DB2UL,0xB9B5B2F7UL,0x35869722UL,0xEE998C6AUL,29.338 + 0xE5EF0B0CUL,0x0745C2B3UL,0x11B5CC77UL,0x15E68F0AUL,0xE4070B42UL,29.339 + 0x8771A2A4UL,0x79BB62F3UL,0x6985EEE3UL,0x0C49C5F6UL,0xD306DDC2UL,29.340 + 0xD9919AECUL,0x6B0DEF45UL,0x8C3325D5UL,0xDB1F1B48UL,0x0B768766UL,29.341 + 0xE2AAC9BFUL,0x16F00EC4UL,0x0453437DUL,0xF1E18448UL,0x6376A9E6UL,29.342 + 0xFECAC057UL,0x103E8C10UL,0x65CC2B15UL,0xDF4F1834UL,0x0A97472EUL,29.343 + 0xB29C75A9UL,0xE73ECA90UL,0x572C3E9DUL,0xD0699C2EUL,0xE9DC4ED9UL,29.344 + 0xF45AC77BUL,0x12A34DB9UL,0xF5B2C735UL,0x92972DAEUL,0x9DBC69B1UL,29.345 + 0xEEF44C47UL,0x75F2A705UL,0xBA833321UL,0xD5D85F1AUL,0xB80B3287UL,29.346 + 0x55A2BF39UL,0xB012F40DUL,0x8745A2B3UL,0x39B5D2F7UL,0x1D8689A2UL,29.347 + 0xE6F98AC2UL,0xE7118A8CUL,0x6725EA9BUL,0x0F2B441FUL,0x734825F6UL,29.348 + 0x9B06EB42UL,0xCF719424UL,0x6F5B6C3BUL,0x6DD36D9DUL,0xEDA98DBEUL,29.349 + 0xE5B04B34UL,0x375756BEUL,0xBEF07044UL,0x24335B55UL,0xFB7F0360UL,29.350 + 0x01E8004EUL,0x80346017UL,0x680EAE84UL,0x7C6361E9UL,0xE84ECEB4UL,29.351 + 0x54777F66UL,0xA02AF81FUL,0x028801A6UL,0x807AE023UL,0x0819C68AUL,29.352 + 0xD2E71D8AUL,0x89A726FAUL,0x9AC32B11UL,0xDF4C5835UL,0xFA97032EUL,29.353 + 0x81DC6059UL,0xE83ACE93UL,0x146DCF6DUL,0x942DAF5DUL,0xBC39B1D2UL,29.354 + 0xF45D8779UL,0xA2A2F9B9UL,0x82F2E185UL,0x886326A9UL,0xDAFEDB00UL,29.355 + 0x5B403B70UL,0x13640DEBUL,0x458F7324UL,0x25DB5B1BUL,0x7B4B6377UL,29.356 + 0x69E6AECAUL,0xFC5701FEUL,0x80406030UL,0x28141E8FUL,0x486436ABUL,29.357 + 0x56FF7EC0UL,0x2050183CUL,0x0A91C72CUL,0x529DFDA9UL,0x81BEE070UL,29.358 + 0x4824369BUL,0x56EB7ECFUL,0x6054283FUL,0x5E90386CUL,0x12ADCDBDUL,29.359 + 0x95B1AF34UL,0x7C1761CEUL,0xA8547EBFUL,0x60702824UL,0x1E9B486BUL,29.360 + 0x76AF66FCUL,0x2AC1DF10UL,0x580C3A85UL,0xD3231DD9UL,0xC99AD6EBUL,29.361 + 0x1ECF4854UL,0x36BF56F0UL,0x3EC41053UL,0x4C3DF5D1UL,0x871C6289UL,29.362 + 0xE9A6CEFAUL,0xD4431F71UL,0xC824569BUL,0x7EEB604FUL,0x68342E97UL,29.363 + 0x5C6EB9ECUL,0x72CDE595UL,0x8B2F275CUL,0x1AB9CB32UL,0xD7559EBFUL,29.364 + 0x28701EA4UL,0x087B46A3UL,0x72F9E582UL,0xCB219758UL,0x6EBAAC73UL,29.365 + 0x3DE5D18BUL,0x1C6749EAUL,0xB6CF36D4UL,0x16DF4ED8UL,0x345A977BUL,29.366 + 0x2EA35C79UL,0xF9E2C2C9UL,0x9196EC6EUL,0xCDEC558DUL,0xFF25801BUL,29.367 + 0x200B5807UL,0x7A82A321UL,0xB9D872DAUL,0xA59B3B2BUL,0x535F7DF8UL,29.368 + 0x21829861UL,0xAAA87F3EUL,0xA010780CUL,0x2285D9A3UL,0x1AF9CB02UL,29.369 + 0xD7419EB0UL,0x68742EA7UL,0x5C7AB9E3UL,0x32C9D596UL,0xDF2ED81CUL,29.370 + 0x5A89FB26UL,0xC35AD1FBUL,0x1C4349F1UL,0xF6C446D3UL,0x72DDE599UL,29.371 +29.372 +};29.373 +# endif29.374 +29.375 +#else /* PROTOTYPES */29.376 +29.377 +# if !defined WORDS_BIGENDIAN29.378 +/* little endian */29.379 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {29.380 + 0x60008001,0x1E002800,0x06600880,0x81FE02A8,0x28606080,29.381 + 0x889E1E28,0xAAAE6668,0xE0017FFC,0x36004800,0x0EE01680,29.382 + 0x835604C8,0x48E0E17E,0x96B63648,0xCCC6EEF6,0x9FFDD552,29.383 + 0x7E00A801,0x18602080,0x879E0A28,0xA99E6228,0xA0FE7EA8,29.384 + 0x22307840,0x4AAF1994,0xD60137FC,0x38E05E80,0x8DB61248,29.385 + 0xCBB6E5B6,0xDE56D736,0x5A70D8BE,0x533B3BA4,0xE1FD7D53,29.386 + 0x66608881,0x9FFE2AA8,0x2E006800,0x09601C80,0x82CE06E8,29.387 + 0x689F61D4,0x9CAE2E68,0xEEE1697C,0xB5564CC8,0x4600F7FE,29.388 + 0x15E03280,0x84260F88,0x094BE31A,0xB2C646F7,0x879DF5D2,29.389 + 0xF99EA229,0xB1FE42A8,0x27607480,0x8BAE1A68,0xEA51673C,29.390 + 0xF4314FBC,0x724F4714,0x5BB725B4,0xF356BB36,0x53E0C57E,29.391 + 0x91C63D08,0x8D6DEC92,0xBB8DA5ED,0x355BB325,0x7E0357FB,29.392 + 0x4860E081,0x969E3628,0xACCE6EE8,0x61FF7D54,0x1E602880,29.393 + 0x867E08A8,0x29F862A0,0xA8E19E82,0xA0B67E48,0xC226F876,29.394 + 0x1CABD19A,0x36E0497F,0x8ED616C8,0x4B58E4DE,0x3663B77A,29.395 + 0xDEFED6A9,0x3A5058C0,0xCD3113BC,0x7F9F55D4,0x981E2028,29.396 + 0xAF866A08,0x8119FC22,0x0857E0CA,0x6290863E,0xDE8D29EC,29.397 + 0x2A4B98E5,0xB8365FB7,0xC58EF216,0x7D3B53A4,0xE89D61D3,29.398 + 0xE4AE8E69,0xF7614B7C,0xB2AE4668,0xE78175FC,0x37984A20,29.399 + 0x2E9F962A,0x894E1CE8,0x6AC766F4,0xBC1DAFD2,0xF4C6B109,29.400 + 0x927DC752,0x7DB8ADA1,0xB8B5A1B2,0x95A63277,0x0C33EFBA,29.401 + 0x13CFC515,0x45CF0D14,0x552F3394,0xD0193FDC,0x1907DC0A,29.402 + 0xA7D18AC2,0xE3897A1C,0xD6DAC926,0x48DB1EDB,0x66BB765B,29.403 + 0xEFC56AF3,0xC50D0C13,0x2D1393C5,0x9995DDCD,0x1FFC2AAF,29.404 + 0x5600C801,0x10E03E80,0x85360C48,0xC91EE3D6,0xBED656C8,29.405 + 0x4458F0DE,0x3553B33A,0x9E01D7FD,0x2E606880,0x897E1CA8,29.406 + 0x2AC866E0,0xE81E9FD6,0xB4864E08,0x8669F762,0x49FCE2AE,29.407 + 0x46E0F681,0x95D632C8,0x4C28EF9E,0x77C8B51E,0xFA8EA616,29.408 + 0x710B43E4,0xAB5264C7,0xB061BF7D,0xA71E7428,0xA3B67A48,29.409 + 0xC2D6F936,0x5C98D1DE,0x32EFB96A,0xCF9515CC,0x0F1C142F,29.410 + 0xD336C449,0xD9FEDD56,0x3BE05A80,0x8D461308,0x8B85E5F2,29.411 + 0xDA592723,0x1B33DBBA,0x177FCB55,0x04A80E60,0x6160837E,29.412 + 0x9E4E28E8,0x6E7768B4,0xFD7AACA6,0xC08901E3,0xDC2AD066,29.413 + 0x0AC8191F,0xE21E87D6,0xB6A64988,0x06C3F6FA,0x51DCC2D1,29.414 + 0xC16AFC99,0x0C4C10EF,0x13D7C535,0x65C88D1E,0xFF2EAB96,29.415 + 0xF039405C,0x930DC412,0x3DF3AD45,0x1CA3D185,0xD6E2C979,29.416 + 0xE8D69EC9,0x54B8CE5E,0xB065BF72,0x571F342B,0x90B63E48,29.417 + 0xCD26EC76,0x1F9BD5DA,0x761F482B,0x9AE62688,0x0F17EBCA,29.418 + 0x6334844E,0xAEFE6957,0x21507CC0,0xCA4118FC,0x3E3457B0,29.419 + 0xBC6E5097,0xE4DD712C,0xE77A8B59,0xC7A90A63,0x5D90D23E,29.420 + 0xD2BD39AC,0x69849DF1,0xECF96EA3,0x95F1CD42,0x6C236F84,29.421 + 0xCDCAED19,0x8FAE1597,0xEB11643C,0xF4754F4C,0x825A0727,29.422 + 0x58B321BB,0x03A7FA75,0x20D3813A,0x9A39D85D,0x8F2DEB92,29.423 + 0xBB39A45D,0x857DF352,0x7908A3E1,0xF9D2A2C6,0xA1E9829D,29.424 + 0x4264F88E,0x64BF71AB,0x1F642B70,0x762F486B,0xDAE9269C,29.425 + 0x5B14DBCE,0x23747B4F,0xBAEA5967,0x151433CF,0x34144FCF,29.426 + 0x3E44570F,0xFC7550B3,0x80DA0127,0x583B205B,0xE38D7A13,29.427 + 0x26DB8925,0x7BDB5ADB,0x694B631B,0xACC66EF7,0x81FDFD52,29.428 + 0x7860A081,0x999E2228,0xAFFE6AA8,0x21007C00,0x0A5018C0,29.429 + 0xC23107BC,0x7CAF5194,0xD8E1217C,0xBBB65A48,0xC556F336,29.430 + 0x5D00D3FE,0x129039C0,0xC58D0DEC,0x2D3B93A5,0xF99D5DD3,29.431 + 0xE1FE82A9,0x36604880,0x8EFE16A8,0x2B5064C0,0xC8611F7C,29.432 + 0xBE9E5628,0xA44E70E8,0x63577B34,0x7EE0A97E,0x985620C8,29.433 + 0x4F90EA3E,0xD71D342C,0xE8B69E49,0xD4A6CE76,0x1863DF7A,29.434 + 0xD79ECA29,0xB89E5E28,0xA5AE7268,0xE3317BBC,0x76FF4954,29.435 + 0x1AD026C0,0xC7190BDC,0x1DB7D24A,0xE6B689B6,0xD7C6CAF6,29.436 + 0x988DDE12,0x3FABAA65,0x3C10503F,0xCCC5110C,0xCFFD1553,29.437 + 0x6F009401,0x1D302C40,0x469F09D4,0x95CE32E8,0x6C2F6F94,29.438 + 0xDDC92D1C,0xDAAED996,0xFB015BFC,0x31704340,0x4F4B14E4,29.439 + 0xA7267477,0x03BBFA5A,0xF0D54133,0x0338045F,0xA0FD8152,29.440 + 0x7230B841,0x5BAF2594,0xD3513B3C,0xF9E15D7C,0xB1E64288,29.441 + 0x0767F48A,0x21AF826A,0xCA7118BC,0x7E3B57A4,0xE86D6093,29.442 + 0xA49D8E2D,0xF36EBB69,0xF3ED456C,0xA3C5850D,0xD2CD3913,29.443 + 0x299F9DD5,0x88FE1EA8,0x2AB06640,0x48071FF4,0xB681B602,29.444 + 0x26C876E0,0xEBDE9AD6,0xB44A4F18,0x96563737,0x4CF0EEBE,29.445 + 0x57F33544,0x0083FE05,0x5028C061,0x7108BC1E,0xFB52A4C6,29.446 + 0xA161837D,0xA24E78E8,0x62B779B4,0xFE86A9F6,0x9049C0E2,29.447 + 0xCD16EC36,0x5F94D5CE,0x221C782F,0xDAA6D989,0x1B03DBFA,29.448 + 0x5770CB41,0x50AB3E64,0x21207C7F,0x8A5A18D8,0x5A3327BB,29.449 + 0x032FFB95,0xC0F9015C,0x9C31D042,0x6ECF6914,0x5D5F2CD4,29.450 + 0x928239F8,0x7D88ADE1,0xF8BAA1A6,0xC1A50273,0x4C7310BB,29.451 + 0x07DBF525,0x718B421B,0xAB7A64A7,0xD0693F63,0x591CDC2E,29.452 + 0xC3D6FAC9,0x5CC8D11E,0xF2FEB956,0x339045C0,0xCFDD152C,29.453 + 0xEF0A9419,0x85320C47,0x391FA3D5,0x8DD612C8,0x4BA8E59E,29.454 + 0x7650B73E,0xDAF126BC,0x7B135BC4,0x8975E34D,0x9ACA26E7,29.455 + 0x9F1E2BD7,0xAE366848,0xC16EFC96,0xFC4D50EC,0x20D78135,29.456 + 0x6A38985E,0xBC2DAF92,0xB4C9B11D,0xC67EF756,0x3DF852A0,29.457 + 0xACA19182,0xA1E27D78,0xF266B889,0x13BFC5AA,0x05D40D30,29.458 + 0x3128439F,0x6F5894DE,0x3D23AC7A,0xDC9AD1D9,0x4AEF196B,29.459 + 0xD61537CC,0x08E41E8F,0x72B7464B,0xFB86A5F6,0x9159C322,29.460 + 0x0D43ECFA,0x5384C5F1,0xE1D97D23,0x166BC89A,0x34FC4EAF,29.461 + 0x5E70D741,0x527B38A4,0xE1B97DA3,0x9675C8B2,0x9CFA2EA7,29.462 + 0xDEF12943,0x7A5358C4,0x8931E3BD,0x6ADF66D4,0x9C1A2FD8,29.463 + 0x5EC7290B,0xB25DB8D2,0xF7B2B5B9,0x22978635,0x6A8C99EE,29.464 + 0x0C0BEFE5,0xB3C24507,0x77CCB511,0x0A8FE615,0x420B07E4,29.465 + 0xA4A27187,0xF362BB79,0xE3EE8569,0xF6C5490C,0xC2DD06D3,29.466 + 0xEC9A91D9,0x45EF0D6B,0xD525338C,0x481B1FDB,0x6687760B,29.467 + 0xBFC9AAE2,0xC40EF016,0x7D435304,0x4884E1F1,0xE6A97663,29.468 + 0x57C0CAFE,0x108C3E10,0x152BCC65,0x34184FDF,0x2E47970A,29.469 + 0xA9759CB2,0x90CA3EE7,0x9D3E2C57,0x2E9C69D0,0xD94EDCE9,29.470 + 0x7BC75AF4,0xB94DA312,0x35C7B2F5,0xAE2D9792,0xB169BC9D,29.471 + 0x474CF4EE,0x05A7F275,0x213383BA,0x1A5FD8D5,0x87320BB8,29.472 + 0x39BFA255,0x0DF412B0,0xB3A24587,0xF7D2B539,0xA289861D,29.473 + 0xC28AF9E6,0x8C8A11E7,0x9BEA2567,0x1F442B0F,0xF6254873,29.474 + 0x42EB069B,0x249471CF,0x3B6C5B6F,0x9D6DD36D,0xBE8DA9ED,29.475 + 0x344BB0E5,0xBE565737,0x4470F0BE,0x555B3324,0x60037FFB,29.476 + 0x4E00E801,0x17603480,0x84AE0E68,0xE961637C,0xB4CE4EE8,29.477 + 0x667F7754,0x1FF82AA0,0xA6018802,0x23E07A80,0x8AC61908,29.478 + 0x8A1DE7D2,0xFA26A789,0x112BC39A,0x35584CDF,0x2E0397FA,29.479 + 0x5960DC81,0x93CE3AE8,0x6DCF6D14,0x5DAF2D94,0xD2B139BC,29.480 + 0x79875DF4,0xB9F9A2A2,0x85E1F282,0xA9266388,0x00DBFEDA,29.481 + 0x703B405B,0xEB0D6413,0x24738F45,0x1B5BDB25,0x77634B7B,29.482 + 0xCAAEE669,0xFE0157FC,0x30604080,0x8F1E1428,0xAB366448,29.483 + 0xC07EFF56,0x3C185020,0x2CC7910A,0xA9FD9D52,0x70E0BE81,29.484 + 0x9B362448,0xCF7EEB56,0x3F285460,0x6C38905E,0xBDCDAD12,29.485 + 0x34AFB195,0xCE61177C,0xBF7E54A8,0x24287060,0x6B489B1E,29.486 + 0xFC66AF76,0x10DFC12A,0x853A0C58,0xD91D23D3,0xEBD69AC9,29.487 + 0x5448CF1E,0xF056BF36,0x5310C43E,0xD1F53D4C,0x89621C87,29.488 + 0xFACEA6E9,0x711F43D4,0x9B5624C8,0x4F60EB7E,0x972E3468,29.489 + 0xECB96E5C,0x95E5CD72,0x5C272F8B,0x32CBB91A,0xBF9E55D7,29.490 + 0xA41E7028,0xA3467B08,0x82E5F972,0x589721CB,0x73ACBA6E,29.491 + 0x8BD1E53D,0xEA49671C,0xD436CFB6,0xD84EDF16,0x7B975A34,29.492 + 0x795CA32E,0xC9C2E2F9,0x6EEC9691,0x8D55ECCD,0x1B8025FF,29.493 + 0x07580B20,0x21A3827A,0xDA72D8B9,0x2B3B9BA5,0xF87D5F53,29.494 + 0x61988221,0x3E7FA8AA,0x0C7810A0,0xA3D98522,0x02CBF91A,29.495 + 0xB09E41D7,0xA72E7468,0xE3B97A5C,0x96D5C932,0x1CD82EDF,29.496 + 0x26FB895A,0xFBD15AC3,0xF149431C,0xD346C4F6,0x99E5DD72,29.497 +29.498 +};29.499 +# endif29.500 +# if defined WORDS_BIGENDIAN29.501 +/* big endian */29.502 +static const uint32_t yellowbook_scrambler_uint32[2340/4] = {29.503 + 0x01800060,0x0028001E,0x80086006,0xA802FE81,0x80606028,29.504 + 0x281E9E88,0x6866AEAA,0xFC7F01E0,0x00480036,0x8016E00E,29.505 + 0xC8045683,0x7EE1E048,0x4836B696,0xF6EEC6CC,0x52D5FD9F,29.506 + 0x01A8007E,0x80206018,0x280A9E87,0x28629EA9,0xA87EFEA0,29.507 + 0x40783022,0x9419AF4A,0xFC3701D6,0x805EE038,0x4812B68D,29.508 + 0xB6E5B6CB,0x36D756DE,0xBED8705A,0xA43B3B53,0x537DFDE1,29.509 + 0x81886066,0xA82AFE9F,0x0068002E,0x801C6009,0xE806CE82,29.510 + 0xD4619F68,0x682EAE9C,0x7C69E1EE,0xC84C56B5,0xFEF70046,29.511 + 0x8032E015,0x880F2684,0x1AE34B09,0xF746C6B2,0xD2F59D87,29.512 + 0x29A29EF9,0xA842FEB1,0x80746027,0x681AAE8B,0x3C6751EA,29.513 + 0xBC4F31F4,0x14474F72,0xB425B75B,0x36BB56F3,0x7EC5E053,29.514 + 0x083DC691,0x92EC6D8D,0xEDA58DBB,0x25B35B35,0xFB57037E,29.515 + 0x81E06048,0x28369E96,0xE86ECEAC,0x547DFF61,0x8028601E,29.516 + 0xA8087E86,0xA062F829,0x829EE1A8,0x487EB6A0,0x76F826C2,29.517 + 0x9AD1AB1C,0x7F49E036,0xC816D68E,0xDEE4584B,0x7AB76336,29.518 + 0xA9D6FEDE,0xC058503A,0xBC1331CD,0xD4559F7F,0x28201E98,29.519 + 0x086A86AF,0x22FC1981,0xCAE05708,0x3E869062,0xEC298DDE,29.520 + 0xE5984B2A,0xB75F36B8,0x16F28EC5,0xA4533B7D,0xD3619DE8,29.521 + 0x698EAEE4,0x7C4B61F7,0x6846AEB2,0xFC7581E7,0x204A9837,29.522 + 0x2A969F2E,0xE81C4E89,0xF466C76A,0xD2AF1DBC,0x09B1C6F4,29.523 + 0x52C77D92,0xA1ADB87D,0xB2A1B5B8,0x7732A695,0xBAEF330C,29.524 + 0x15C5CF13,0x140DCF45,0x94332F55,0xDC3F19D0,0x0ADC0719,29.525 + 0xC28AD1A7,0x1C7A89E3,0x26C9DAD6,0xDB1EDB48,0x5B76BB66,29.526 + 0xF36AC5EF,0x130C0DC5,0xC593132D,0xCDDD9599,0xAF2AFC1F,29.527 + 0x01C80056,0x803EE010,0x480C3685,0xD6E31EC9,0xC856D6BE,29.528 + 0xDEF05844,0x3AB35335,0xFDD7019E,0x8068602E,0xA81C7E89,29.529 + 0xE066C82A,0xD69F1EE8,0x084E86B4,0x62F76986,0xAEE2FC49,29.530 + 0x81F6E046,0xC832D695,0x9EEF284C,0x1EB5C877,0x16A68EFA,29.531 + 0xE4430B71,0xC76452AB,0x7DBF61B0,0x28741EA7,0x487AB6A3,29.532 + 0x36F9D6C2,0xDED1985C,0x6AB9EF32,0xCC1595CF,0x2F141C0F,29.533 + 0x49C436D3,0x56DDFED9,0x805AE03B,0x0813468D,0xF2E5858B,29.534 + 0x232759DA,0xBADB331B,0x55CB7F17,0x600EA804,0x7E836061,29.535 + 0xE8284E9E,0xB468776E,0xA6AC7AFD,0xE30189C0,0x66D02ADC,29.536 + 0x1F19C80A,0xD6871EE2,0x8849A6B6,0xFAF6C306,0xD1C2DC51,29.537 + 0x99FC6AC1,0xEF104C0C,0x35C5D713,0x1E8DC865,0x96AB2EFF,29.538 + 0x5C4039F0,0x12C40D93,0x45ADF33D,0x85D1A31C,0x79C9E2D6,29.539 + 0xC99ED6E8,0x5ECEB854,0x72BF65B0,0x2B341F57,0x483EB690,29.540 + 0x76EC26CD,0xDAD59B1F,0x2B481F76,0x8826E69A,0xCAEB170F,29.541 + 0x4E843463,0x5769FEAE,0xC07C5021,0xFC1841CA,0xB057343E,29.542 + 0x97506EBC,0x2C71DDE4,0x598B7AE7,0x630AA9C7,0x3ED2905D,29.543 + 0xAC39BDD2,0xF19D8469,0xA36EF9EC,0x42CDF195,0x846F236C,29.544 + 0x19EDCACD,0x9715AE8F,0x3C6411EB,0x4C4F75F4,0x27075A82,29.545 + 0xBB21B358,0x75FAA703,0x3A81D320,0x5DD8399A,0x92EB2D8F,29.546 + 0x5DA439BB,0x52F37D85,0xE1A30879,0xC6A2D2F9,0x9D82E9A1,29.547 + 0x8EF86442,0xAB71BF64,0x702B641F,0x6B482F76,0x9C26E9DA,29.548 + 0xCEDB145B,0x4F7B7423,0x6759EABA,0xCF331415,0xCF4F1434,29.549 + 0x0F57443E,0xB35075FC,0x2701DA80,0x5B203B58,0x137A8DE3,29.550 + 0x2589DB26,0xDB5ADB7B,0x1B634B69,0xF76EC6AC,0x52FDFD81,29.551 + 0x81A06078,0x28229E99,0xA86AFEAF,0x007C0021,0xC018500A,29.552 + 0xBC0731C2,0x9451AF7C,0x7C21E1D8,0x485AB6BB,0x36F356C5,29.553 + 0xFED3005D,0xC0399012,0xEC0D8DC5,0xA5933B2D,0xD35D9DF9,29.554 + 0xA982FEE1,0x80486036,0xA816FE8E,0xC064502B,0x7C1F61C8,29.555 + 0x28569EBE,0xE8704EA4,0x347B5763,0x7EA9E07E,0xC8205698,29.556 + 0x3EEA904F,0x2C341DD7,0x499EB6E8,0x76CEA6D4,0x7ADF6318,29.557 + 0x29CA9ED7,0x285E9EB8,0x6872AEA5,0xBC7B31E3,0x5449FF76,29.558 + 0xC026D01A,0xDC0B19C7,0x4AD2B71D,0xB689B6E6,0xF6CAC6D7,29.559 + 0x12DE8D98,0x65AAAB3F,0x3F50103C,0x0C11C5CC,0x5315FDCF,29.560 + 0x0194006F,0x402C301D,0xD4099F46,0xE832CE95,0x946F2F6C,29.561 + 0x1C2DC9DD,0x96D9AEDA,0xFC5B01FB,0x40437031,0xE4144B4F,29.562 + 0x777426A7,0x5AFABB03,0x3341D5F0,0x5F043803,0x5281FDA0,29.563 + 0x41B83072,0x9425AF5B,0x3C3B51D3,0x7C5DE1F9,0x8842E6B1,29.564 + 0x8AF46707,0x6A82AF21,0xBC1871CA,0xA4573B7E,0x93606DE8,29.565 + 0x2D8E9DA4,0x69BB6EF3,0x6C45EDF3,0x0D85C5A3,0x1339CDD2,29.566 + 0xD59D9F29,0xA81EFE88,0x4066B02A,0xF41F0748,0x02B681B6,29.567 + 0xE076C826,0xD69ADEEB,0x184F4AB4,0x37375696,0xBEEEF04C,29.568 + 0x4435F357,0x05FE8300,0x61C02850,0x1EBC0871,0xC6A452FB,29.569 + 0x7D8361A1,0xE8784EA2,0xB479B762,0xF6A986FE,0xE2C04990,29.570 + 0x36EC16CD,0xCED5945F,0x2F781C22,0x89D9A6DA,0xFADB031B,29.571 + 0x41CB7057,0x643EAB50,0x7F7C2021,0xD8185A8A,0xBB27335A,29.572 + 0x95FB2F03,0x5C01F9C0,0x42D0319C,0x1469CF6E,0xD42C5F5D,29.573 + 0xF8398292,0xE1AD887D,0xA6A1BAF8,0x7302A5C1,0xBB10734C,29.574 + 0x25F5DB07,0x1B428B71,0xA7647AAB,0x633F69D0,0x2EDC1C59,29.575 + 0xC9FAD6C3,0x1ED1C85C,0x56B9FEF2,0xC0459033,0x2C15DDCF,29.576 + 0x19940AEF,0x470C3285,0xD5A31F39,0xC812D68D,0x9EE5A84B,29.577 + 0x3EB75076,0xBC26F1DA,0xC45B137B,0x4DE37589,0xE726CA9A,29.578 + 0xD72B1E9F,0x486836AE,0x96FC6EC1,0xEC504DFC,0x3581D720,29.579 + 0x5E98386A,0x92AF2DBC,0x1DB1C9B4,0x56F77EC6,0xA052F83D,29.580 + 0x8291A1AC,0x787DE2A1,0x89B866F2,0xAAC5BF13,0x300DD405,29.581 + 0x9F432831,0xDE94586F,0x7AAC233D,0xD9D19ADC,0x6B19EF4A,29.582 + 0xCC3715D6,0x8F1EE408,0x4B46B772,0xF6A586FB,0x22C35991,29.583 + 0xFAEC430D,0xF1C58453,0x237DD9E1,0x9AC86B16,0xAF4EFC34,29.584 + 0x41D7705E,0xA4387B52,0xA37DB9E1,0xB2C87596,0xA72EFA9C,29.585 + 0x4329F1DE,0xC458537A,0xBDE33189,0xD466DF6A,0xD82F1A9C,29.586 + 0x0B29C75E,0xD2B85DB2,0xB9B5B2F7,0x35869722,0xEE998C6A,29.587 + 0xE5EF0B0C,0x0745C2B3,0x11B5CC77,0x15E68F0A,0xE4070B42,29.588 + 0x8771A2A4,0x79BB62F3,0x6985EEE3,0x0C49C5F6,0xD306DDC2,29.589 + 0xD9919AEC,0x6B0DEF45,0x8C3325D5,0xDB1F1B48,0x0B768766,29.590 + 0xE2AAC9BF,0x16F00EC4,0x0453437D,0xF1E18448,0x6376A9E6,29.591 + 0xFECAC057,0x103E8C10,0x65CC2B15,0xDF4F1834,0x0A97472E,29.592 + 0xB29C75A9,0xE73ECA90,0x572C3E9D,0xD0699C2E,0xE9DC4ED9,29.593 + 0xF45AC77B,0x12A34DB9,0xF5B2C735,0x92972DAE,0x9DBC69B1,29.594 + 0xEEF44C47,0x75F2A705,0xBA833321,0xD5D85F1A,0xB80B3287,29.595 + 0x55A2BF39,0xB012F40D,0x8745A2B3,0x39B5D2F7,0x1D8689A2,29.596 + 0xE6F98AC2,0xE7118A8C,0x6725EA9B,0x0F2B441F,0x734825F6,29.597 + 0x9B06EB42,0xCF719424,0x6F5B6C3B,0x6DD36D9D,0xEDA98DBE,29.598 + 0xE5B04B34,0x375756BE,0xBEF07044,0x24335B55,0xFB7F0360,29.599 + 0x01E8004E,0x80346017,0x680EAE84,0x7C6361E9,0xE84ECEB4,29.600 + 0x54777F66,0xA02AF81F,0x028801A6,0x807AE023,0x0819C68A,29.601 + 0xD2E71D8A,0x89A726FA,0x9AC32B11,0xDF4C5835,0xFA97032E,29.602 + 0x81DC6059,0xE83ACE93,0x146DCF6D,0x942DAF5D,0xBC39B1D2,29.603 + 0xF45D8779,0xA2A2F9B9,0x82F2E185,0x886326A9,0xDAFEDB00,29.604 + 0x5B403B70,0x13640DEB,0x458F7324,0x25DB5B1B,0x7B4B6377,29.605 + 0x69E6AECA,0xFC5701FE,0x80406030,0x28141E8F,0x486436AB,29.606 + 0x56FF7EC0,0x2050183C,0x0A91C72C,0x529DFDA9,0x81BEE070,29.607 + 0x4824369B,0x56EB7ECF,0x6054283F,0x5E90386C,0x12ADCDBD,29.608 + 0x95B1AF34,0x7C1761CE,0xA8547EBF,0x60702824,0x1E9B486B,29.609 + 0x76AF66FC,0x2AC1DF10,0x580C3A85,0xD3231DD9,0xC99AD6EB,29.610 + 0x1ECF4854,0x36BF56F0,0x3EC41053,0x4C3DF5D1,0x871C6289,29.611 + 0xE9A6CEFA,0xD4431F71,0xC824569B,0x7EEB604F,0x68342E97,29.612 + 0x5C6EB9EC,0x72CDE595,0x8B2F275C,0x1AB9CB32,0xD7559EBF,29.613 + 0x28701EA4,0x087B46A3,0x72F9E582,0xCB219758,0x6EBAAC73,29.614 + 0x3DE5D18B,0x1C6749EA,0xB6CF36D4,0x16DF4ED8,0x345A977B,29.615 + 0x2EA35C79,0xF9E2C2C9,0x9196EC6E,0xCDEC558D,0xFF25801B,29.616 + 0x200B5807,0x7A82A321,0xB9D872DA,0xA59B3B2B,0x535F7DF8,29.617 + 0x21829861,0xAAA87F3E,0xA010780C,0x2285D9A3,0x1AF9CB02,29.618 + 0xD7419EB0,0x68742EA7,0x5C7AB9E3,0x32C9D596,0xDF2ED81C,29.619 + 0x5A89FB26,0xC35AD1FB,0x1C4349F1,0xF6C446D3,0x72DDE599,29.620 +29.621 +};29.622 +# endif29.623 +29.624 +#endif /* PROTOTYPES */
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000030.2 +++ b/src/drivers/cdrom/sector.c Sun Jan 31 18:35:06 2010 +100030.3 @@ -0,0 +1,581 @@30.4 +/**30.5 + * $Id$30.6 + *30.7 + * low-level 'block device' for input to gdrom discs.30.8 + *30.9 + * Copyright (c) 2009 Nathan Keynes.30.10 + *30.11 + * This program is free software; you can redistribute it and/or modify30.12 + * it under the terms of the GNU General Public License as published by30.13 + * the Free Software Foundation; either version 2 of the License, or30.14 + * (at your option) any later version.30.15 + *30.16 + * This program is distributed in the hope that it will be useful,30.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of30.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the30.19 + * GNU General Public License for more details.30.20 + */30.21 +30.22 +#include <sys/stat.h>30.23 +#include <glib/gmem.h>30.24 +#include <assert.h>30.25 +#include <stdlib.h>30.26 +#include <stdio.h>30.27 +#include <string.h>30.28 +#include <unistd.h>30.29 +#include <fcntl.h>30.30 +30.31 +#include "drivers/cdrom/sector.h"30.32 +#include "drivers/cdrom/cdrom.h"30.33 +#include "drivers/cdrom/ecc.h"30.34 +30.35 +#define CHECK_READ(dev,lba,count) \30.36 + if( !IS_SECTOR_SOURCE(dev) ) { \30.37 + return CDROM_ERROR_NODISC; \30.38 + } else if( (lba) >= (dev)->size || (lba+block_count) > (dev)->size ) { \30.39 + return CDROM_ERROR_BADREAD; \30.40 + }30.41 +30.42 +/* Default read mode for each sector mode */30.43 +const uint32_t cdrom_sector_read_mode[] = { 0,30.44 + CDROM_READ_CDDA|CDROM_READ_DATA, CDROM_READ_MODE1|CDROM_READ_DATA,30.45 + CDROM_READ_MODE2|CDROM_READ_DATA, CDROM_READ_MODE2_FORM1|CDROM_READ_DATA,30.46 + CDROM_READ_MODE2_FORM1|CDROM_READ_DATA,30.47 + CDROM_READ_MODE2|CDROM_READ_DATA|CDROM_READ_SUBHEADER|CDROM_READ_ECC,30.48 + CDROM_READ_RAW, CDROM_READ_RAW };30.49 +30.50 +/* Block size for each sector mode */30.51 +const uint32_t cdrom_sector_size[] = { 0, 2352, 2048, 2336, 2048, 2324, 2336, 2352, 2352 };30.52 +30.53 +const char *cdrom_sector_mode_names[] = { "Unknown", "Audio", "Mode 1", "Mode 2", "Mode 2 Form 1", "Mode 2 Form 2",30.54 + "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };30.55 +30.56 +30.57 +/********************* Public functions *************************/30.58 +cdrom_error_t sector_source_read( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf )30.59 +{30.60 + CHECK_READ(device,lba,block_count);30.61 + return device->read_blocks(device, lba, block_count, buf);30.62 +}30.63 +30.64 +cdrom_error_t sector_source_read_sectors( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, cdrom_read_mode_t mode,30.65 + unsigned char *buf, size_t *length )30.66 +{30.67 + CHECK_READ(device,lba,block_count);30.68 + return device->read_sectors(device, lba, block_count, mode, buf, length);30.69 +}30.70 +30.71 +void sector_source_ref( sector_source_t device )30.72 +{30.73 + assert( IS_SECTOR_SOURCE(device) );30.74 + device->ref_count++;30.75 +}30.76 +30.77 +void sector_source_unref( sector_source_t device )30.78 +{30.79 + if( device == NULL )30.80 + return;30.81 + assert( IS_SECTOR_SOURCE(device) );30.82 + if( device->ref_count > 0 )30.83 + device->ref_count--;30.84 + if( device->ref_count == 0 )30.85 + device->destroy(device);30.86 +}30.87 +30.88 +void sector_source_release( sector_source_t device )30.89 +{30.90 + assert( IS_SECTOR_SOURCE(device) );30.91 + if( device->ref_count == 0 )30.92 + device->destroy(device);30.93 +}30.94 +30.95 +/************************** Sector mangling ***************************/30.96 +/*30.97 + * Private functions used to pack/unpack sectors, determine mode, and30.98 + * evaluate sector reads.30.99 + */30.100 +30.101 +/** Basic data sector header structure */30.102 +struct cdrom_sector_header {30.103 + uint8_t sync[12];30.104 + uint8_t msf[3];30.105 + uint8_t mode;30.106 + uint8_t subhead[8]; // Mode-2 XA sectors only30.107 +};30.108 +30.109 +static const uint8_t cdrom_sync_data[12] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0 };30.110 +30.111 +/* Field combinations that are legal for mode 1 or mode 2 (formless) reads */30.112 +static const uint8_t legal_nonxa_fields[] =30.113 +{ TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,30.114 + TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,30.115 + TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE,30.116 + FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE };30.117 +30.118 +/* Field combinations that are legal for mode 2 form 1 or form 2 reads */30.119 +static const uint8_t legal_xa_fields[] =30.120 +{ TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE,30.121 + TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,30.122 + TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE,30.123 + FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE };30.124 +30.125 +/**30.126 + * Position per sector mode of each of the fields30.127 + * sync, header, subheader, data, ecc.30.128 + *30.129 + */30.130 +static const uint32_t sector_field_positions[][6] = {30.131 + { 0, 0, 0, 0, 0, 0 }, /* Unknown */30.132 + { 0, 0, 0, 0, 2352, 2352 }, /* CDDA */30.133 + { 0, 12, 16, 16, 2064, 2352 }, /* Mode 1 */30.134 + { 0, 12, 16, 16, 2352, 2352 }, /* Mode 2 formless */30.135 + { 0, 12, 16, 24, 2072, 2352 }, /* Mode 2 form 1 */30.136 + { 0, 12, 16, 24, 2352, 2352 }}; /* Mode 2 form 2 */30.137 +30.138 +30.139 +30.140 +/**30.141 + * Return CDROM_ERROR_OK if the given read mode + sector modes are compatible,30.142 + * otherwise either CDROM_ERROR_BADREADMODE or CDROM_ERROR_BADFIELD. Raw sector modes30.143 + * will return BADREADMODE, as it's impossible to tell.30.144 + *30.145 + * @param track_mode one of the CDROM_MODE* constants30.146 + * @param read_mode the full read mode30.147 + */30.148 +static cdrom_error_t is_legal_read( sector_mode_t sector_mode, cdrom_read_mode_t read_mode )30.149 +{30.150 + int read_sector_type = CDROM_READ_TYPE(read_mode);30.151 + int read_sector_fields = CDROM_READ_FIELDS(read_mode);30.152 +30.153 + /* Check the sector type is consistent */30.154 + switch( read_sector_type ) {30.155 + case CDROM_READ_ANY: break;30.156 + case CDROM_READ_CDDA:30.157 + if( sector_mode != SECTOR_CDDA )30.158 + return CDROM_ERROR_BADREADMODE;30.159 + break;30.160 + case CDROM_READ_MODE1:30.161 + case CDROM_READ_MODE2_FORM1:30.162 + if( sector_mode != SECTOR_MODE1 && sector_mode != SECTOR_MODE2_FORM1 )30.163 + return CDROM_ERROR_BADREADMODE;30.164 + break;30.165 + case CDROM_READ_MODE2_FORM2:30.166 + if( sector_mode != SECTOR_MODE2_FORM2 )30.167 + return CDROM_ERROR_BADREADMODE;30.168 + break;30.169 + case CDROM_READ_MODE2:30.170 + if( sector_mode != SECTOR_MODE2_FORMLESS )30.171 + return CDROM_ERROR_BADREADMODE;30.172 + break;30.173 + default: /* Illegal read mode */30.174 + return CDROM_ERROR_BADFIELD;30.175 + }30.176 +30.177 + /* Check the fields requested are sane per MMC (non-contiguous regions prohibited) */30.178 + switch( sector_mode ) {30.179 + case SECTOR_CDDA:30.180 + return CDROM_ERROR_OK; /* Everything is OK */30.181 + case SECTOR_MODE2_FORM1:30.182 + case SECTOR_MODE2_FORM2:30.183 + if( !legal_xa_fields[read_sector_fields>>11] )30.184 + return CDROM_ERROR_BADFIELD;30.185 + else30.186 + return CDROM_ERROR_OK;30.187 + case SECTOR_MODE1:30.188 + case SECTOR_MODE2_FORMLESS:30.189 + if( !legal_nonxa_fields[read_sector_fields>>11] )30.190 + return CDROM_ERROR_BADFIELD;30.191 + else30.192 + return CDROM_ERROR_OK;30.193 + default:30.194 + return CDROM_ERROR_BADFIELD;30.195 + }30.196 +}30.197 +30.198 +static sector_mode_t identify_sector( sector_mode_t raw_mode, unsigned char *buf )30.199 +{30.200 + struct cdrom_sector_header *header = (struct cdrom_sector_header *)buf;30.201 +30.202 + switch( raw_mode ) {30.203 + case SECTOR_SEMIRAW_MODE2: /* XA sectors */30.204 + case SECTOR_RAW_XA:30.205 + switch( header->mode ) {30.206 + case 1: return SECTOR_MODE1;30.207 + case 2: return ((header->subhead[2] & 0x20) == 0 ) ? SECTOR_MODE2_FORM1 : SECTOR_MODE2_FORM2;30.208 + default: return SECTOR_UNKNOWN;30.209 + }30.210 + case SECTOR_RAW_NONXA:30.211 + switch( header->mode ) {30.212 + case 1: return SECTOR_MODE1;30.213 + case 2: return SECTOR_MODE2_FORMLESS;30.214 + default: return SECTOR_UNKNOWN;30.215 + }30.216 + default:30.217 + return raw_mode;30.218 + }30.219 +}30.220 +30.221 +/**30.222 + * Read a single raw sector from the device. Generate sync, ECC/EDC data etc where30.223 + * necessary.30.224 + */30.225 +static cdrom_error_t read_raw_sector( sector_source_t device, cdrom_lba_t lba, unsigned char *buf )30.226 +{30.227 + cdrom_error_t err;30.228 +30.229 + switch( device->mode ) {30.230 + case SECTOR_RAW_XA:30.231 + case SECTOR_RAW_NONXA:30.232 + return device->read_blocks(device, lba, 1, buf);30.233 + case SECTOR_SEMIRAW_MODE2:30.234 + memcpy( buf, cdrom_sync_data, 12 );30.235 + cd_build_address(buf, SECTOR_MODE2_FORMLESS, lba);30.236 + return device->read_blocks(device, lba, 1, &buf[16]);30.237 + case SECTOR_MODE1:30.238 + case SECTOR_MODE2_FORMLESS:30.239 + err = device->read_blocks(device, lba, 1, &buf[16]);30.240 + if( err == CDROM_ERROR_OK ) {30.241 + do_encode_L2( buf, device->mode, lba );30.242 + }30.243 + return err;30.244 + case SECTOR_MODE2_FORM1:30.245 + *((uint32_t *)(buf+16)) = *((uint32_t *)(buf+20)) = 0;30.246 + err = device->read_blocks(device, lba, 1, &buf[24]);30.247 + if( err == CDROM_ERROR_OK ) {30.248 + do_encode_L2( buf, device->mode, lba );30.249 + }30.250 + return err;30.251 + case SECTOR_MODE2_FORM2:30.252 + *((uint32_t *)(buf+16)) = *((uint32_t *)(buf+20)) = 0x00200000;30.253 + err = device->read_blocks(device, lba, 1, &buf[24]);30.254 + if( err == CDROM_ERROR_OK ) {30.255 + do_encode_L2( buf, device->mode, lba );30.256 + }30.257 + return err;30.258 + default:30.259 + abort();30.260 + }30.261 +}30.262 +30.263 +static cdrom_error_t extract_sector_fields( unsigned char *raw_sector, sector_mode_t mode, int fields, unsigned char *buf, size_t *length )30.264 +{30.265 + int start=-1,end=0;30.266 + int i;30.267 +30.268 + for( i=0; i<5; i++ ) {30.269 + if( fields & (0x8000>>i) ) {30.270 + if( start == -1 )30.271 + start = sector_field_positions[mode][i];30.272 + else if( end != sector_field_positions[mode][i] )30.273 + return CDROM_ERROR_BADFIELD;30.274 + end = sector_field_positions[mode][i+1];30.275 + }30.276 + }30.277 + if( start == -1 ) {30.278 + *length = 0;30.279 + } else {30.280 + memcpy( buf, &raw_sector[start], end-start );30.281 + *length = end-start;30.282 + }30.283 + return CDROM_ERROR_OK;30.284 +}30.285 +30.286 +cdrom_error_t sector_extract_from_raw( unsigned char *raw_sector, cdrom_read_mode_t mode, unsigned char *buf, size_t *length )30.287 +{30.288 + sector_mode_t sector_mode = identify_sector( SECTOR_RAW_XA, raw_sector );30.289 + if( sector_mode == SECTOR_UNKNOWN )30.290 + return CDROM_ERROR_BADREAD;30.291 + cdrom_error_t status = is_legal_read( sector_mode, mode );30.292 + if( status != CDROM_ERROR_OK )30.293 + return status;30.294 + return extract_sector_fields( raw_sector, sector_mode, CDROM_READ_FIELDS(mode), buf, length );30.295 +}30.296 +30.297 +/**30.298 + * This is horribly complicated by the need to handle mapping between all possible30.299 + * sector modes + read modes, but fortunately most sources can just supply30.300 + * a single block type and not care about the details here.30.301 + */30.302 +cdrom_error_t default_sector_source_read_sectors( sector_source_t device,30.303 + cdrom_lba_t lba, cdrom_count_t block_count, cdrom_read_mode_t mode,30.304 + unsigned char *buf, size_t *length )30.305 +{30.306 + unsigned char tmp[CDROM_MAX_SECTOR_SIZE];30.307 + int read_sector_type = CDROM_READ_TYPE(mode);30.308 + int read_sector_fields = CDROM_READ_FIELDS(mode);30.309 + int i;30.310 + size_t len = 0;30.311 + cdrom_error_t err;30.312 +30.313 + CHECK_READ(device, lba, count);30.314 +30.315 + switch(device->mode) {30.316 + case SECTOR_CDDA:30.317 + if( read_sector_type != CDROM_READ_ANY && read_sector_type != CDROM_READ_CDDA )30.318 + return CDROM_ERROR_BADREADMODE;30.319 + if( read_sector_fields != 0 ) {30.320 + len = block_count * CDROM_MAX_SECTOR_SIZE;30.321 + device->read_blocks( device, lba, block_count, buf );30.322 + }30.323 + break;30.324 + case SECTOR_RAW_XA:30.325 + case SECTOR_RAW_NONXA:30.326 + case SECTOR_SEMIRAW_MODE2:30.327 + /* We (may) have to break the raw sector up into requested fields.30.328 + * Process sectors one at a time30.329 + */30.330 + for( i=0; i<block_count; i++ ) {30.331 + size_t tmplen;30.332 + err = read_raw_sector( device, lba+i, tmp );30.333 + if( err != CDROM_ERROR_OK )30.334 + return err;30.335 + err = sector_extract_from_raw( tmp, mode, &buf[len], &tmplen );30.336 + if( err != CDROM_ERROR_OK )30.337 + return err;30.338 + len += tmplen;30.339 + }30.340 + break;30.341 + default: /* Data-only blocks */30.342 + err = is_legal_read( device->mode, mode );30.343 + if( err != CDROM_ERROR_OK )30.344 + return err;30.345 + if( read_sector_fields == 0 ) { /* Read nothing */30.346 + *length = 0;30.347 + return CDROM_ERROR_OK;30.348 + } else if( read_sector_fields == CDROM_READ_DATA ) {30.349 + /* Data-only */30.350 + *length = block_count * CDROM_SECTOR_SIZE(device->mode);30.351 + return device->read_blocks( device, lba, block_count, buf );30.352 + } else if( read_sector_fields == CDROM_READ_RAW ) {30.353 + for( i=0; i<block_count; i++ ) {30.354 + err = read_raw_sector( device, lba+i, &buf[2352*i] );30.355 + if( err != CDROM_ERROR_OK )30.356 + return err;30.357 + }30.358 + len = block_count * CDROM_MAX_SECTOR_SIZE;30.359 + } else {30.360 + for( i=0; i<block_count; i++ ) {30.361 + size_t tmplen;30.362 + err = read_raw_sector( device, lba+i, tmp );30.363 + if( err != CDROM_ERROR_OK )30.364 + return err;30.365 + err = extract_sector_fields( tmp, device->mode, read_sector_fields, &buf[len], &tmplen );30.366 + if( err != CDROM_ERROR_OK )30.367 + return err;30.368 + len += tmplen;30.369 + }30.370 + }30.371 + }30.372 + *length = len;30.373 + return CDROM_ERROR_OK;30.374 +30.375 +}30.376 +30.377 +/************************ Base implementation *************************/30.378 +30.379 +/**30.380 + * Default destroy implementation - clears the tag and frees memory.30.381 + */30.382 +void default_sector_source_destroy( sector_source_t device )30.383 +{30.384 + assert( device != NULL && device->ref_count == 0 );30.385 + device->tag = 0;30.386 + g_free( device );30.387 +}30.388 +30.389 +sector_source_t sector_source_init( sector_source_t device, sector_source_type_t type, sector_mode_t mode, cdrom_count_t size,30.390 + sector_source_read_fn_t readfn, sector_source_destroy_fn_t destroyfn )30.391 +{30.392 + device->tag = SECTOR_SOURCE_TAG;30.393 + device->ref_count = 0;30.394 + device->type = type;30.395 + device->mode = mode;30.396 + device->size = size;30.397 + device->read_blocks = readfn;30.398 + device->read_sectors = default_sector_source_read_sectors;30.399 + if( destroyfn == NULL )30.400 + device->destroy = default_sector_source_destroy;30.401 + else30.402 + device->destroy = destroyfn;30.403 + return device;30.404 +}30.405 +30.406 +/************************ Null device implementation *************************/30.407 +cdrom_error_t null_sector_source_read( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf )30.408 +{30.409 + memset( buf, 0, block_count*CDROM_SECTOR_SIZE(device->mode) );30.410 + return CDROM_ERROR_OK;30.411 +}30.412 +30.413 +sector_source_t null_sector_source_new( sector_mode_t mode, cdrom_count_t size )30.414 +{30.415 + return sector_source_init( g_malloc(sizeof(struct sector_source)), NULL_SECTOR_SOURCE, mode, size,30.416 + null_sector_source_read, default_sector_source_destroy );30.417 +}30.418 +30.419 +/************************ File device implementation *************************/30.420 +typedef struct file_sector_source {30.421 + struct sector_source dev;30.422 + FILE *file;30.423 + uint32_t offset; /* offset in file where source begins */30.424 + sector_source_t ref; /* Parent source reference */30.425 + gboolean closeOnDestroy;30.426 +} *file_sector_source_t;30.427 +30.428 +void file_sector_source_destroy( sector_source_t dev )30.429 +{30.430 + assert( IS_SECTOR_SOURCE_TYPE(dev,FILE_SECTOR_SOURCE) );30.431 + file_sector_source_t fdev = (file_sector_source_t)dev;30.432 +30.433 + if( fdev->closeOnDestroy && fdev->file != NULL ) {30.434 + fclose( fdev->file );30.435 + }30.436 + sector_source_unref( fdev->ref );30.437 + fdev->file = NULL;30.438 + default_sector_source_destroy(dev);30.439 +}30.440 +30.441 +cdrom_error_t file_sector_source_read( sector_source_t dev, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf )30.442 +{30.443 + assert( IS_SECTOR_SOURCE_TYPE(dev,FILE_SECTOR_SOURCE) );30.444 + file_sector_source_t fdev = (file_sector_source_t)dev;30.445 +30.446 + uint32_t off = fdev->offset + lba * CDROM_SECTOR_SIZE(dev->mode);30.447 + uint32_t size = block_count * CDROM_SECTOR_SIZE(dev->mode);30.448 + fseek( fdev->file, off, SEEK_SET );30.449 +30.450 + size_t len = fread( buf, 1, size, fdev->file );30.451 + if( len == -1 ) {30.452 + return CDROM_ERROR_READERROR;30.453 + } else if( len < size ) {30.454 + /* zero-fill */30.455 + memset( buf + len, 0, size-len );30.456 + }30.457 + return CDROM_ERROR_OK;30.458 +}30.459 +30.460 +sector_source_t file_sector_source_new( FILE *f, sector_mode_t mode, uint32_t offset,30.461 + cdrom_count_t sector_count, gboolean closeOnDestroy )30.462 +{30.463 + if( sector_count == FILE_SECTOR_FULL_FILE ) {30.464 + unsigned int sector_size = CDROM_SECTOR_SIZE(mode);30.465 + if( sector_size == 0 )30.466 + sector_size = 2048;30.467 + struct stat st;30.468 +30.469 + if( f == NULL || fstat( fileno(f), &st ) != 0 ) {30.470 + /* can't stat file? */30.471 + return NULL;30.472 + }30.473 +30.474 + sector_count = (st.st_size + sector_size-1) / sector_size;30.475 + }30.476 +30.477 + file_sector_source_t dev = g_malloc(sizeof(struct file_sector_source));30.478 + dev->file = f;30.479 + dev->offset = offset;30.480 + dev->closeOnDestroy = closeOnDestroy;30.481 + dev->ref = NULL;30.482 + return sector_source_init( &dev->dev, FILE_SECTOR_SOURCE, mode, sector_count, file_sector_source_read, file_sector_source_destroy );30.483 +}30.484 +30.485 +sector_source_t file_sector_source_new_full( FILE *f, sector_mode_t mode, gboolean closeOnDestroy )30.486 +{30.487 + return file_sector_source_new( f, mode, 0, FILE_SECTOR_FULL_FILE, closeOnDestroy );30.488 +}30.489 +30.490 +sector_source_t file_sector_source_new_filename( const gchar *filename, sector_mode_t mode, uint32_t offset,30.491 + cdrom_count_t sector_count )30.492 +{30.493 + int fd = open( filename, O_RDONLY|O_NONBLOCK );30.494 + if( fd == -1 ) {30.495 + return NULL;30.496 + }30.497 + FILE *f = fdopen( fd , "ro" );30.498 + if( f == NULL ) {30.499 + close(fd);30.500 + return NULL;30.501 + } else {30.502 + return file_sector_source_new( f, mode, offset, sector_count, TRUE );30.503 + }30.504 +}30.505 +30.506 +sector_source_t file_sector_source_new_source( sector_source_t ref, sector_mode_t mode, uint32_t offset,30.507 + cdrom_count_t sector_count )30.508 +{30.509 + assert( IS_SECTOR_SOURCE_TYPE(ref,FILE_SECTOR_SOURCE) );30.510 + file_sector_source_t fref = (file_sector_source_t)ref;30.511 +30.512 + sector_source_t source = file_sector_source_new( fref->file, mode, offset, sector_count, FALSE );30.513 + ((file_sector_source_t)source)->ref = ref;30.514 + sector_source_ref(ref);30.515 + return source;30.516 +}30.517 +30.518 +FILE *file_sector_source_get_file( sector_source_t ref )30.519 +{30.520 + assert( IS_SECTOR_SOURCE_TYPE(ref,FILE_SECTOR_SOURCE) );30.521 + file_sector_source_t fref = (file_sector_source_t)ref;30.522 + return fref->file;30.523 +}30.524 +30.525 +int file_sector_source_get_fd( sector_source_t ref )30.526 +{30.527 + return fileno(file_sector_source_get_file(ref));30.528 +}30.529 +30.530 +void file_sector_source_set_close_on_destroy( sector_source_t ref, gboolean closeOnDestroy )30.531 +{30.532 + assert( IS_SECTOR_SOURCE_TYPE(ref,FILE_SECTOR_SOURCE) );30.533 + file_sector_source_t fref = (file_sector_source_t)ref;30.534 + fref->closeOnDestroy = closeOnDestroy;30.535 +}30.536 +30.537 +/************************ Track device implementation *************************/30.538 +typedef struct track_sector_source {30.539 + struct sector_source dev;30.540 + cdrom_disc_t disc;30.541 + uint32_t start_lba;30.542 +} *track_sector_source_t;30.543 +30.544 +cdrom_error_t track_sector_source_read_blocks( sector_source_t dev, cdrom_lba_t lba, cdrom_count_t count,30.545 + unsigned char *out )30.546 +{30.547 + size_t length;30.548 + assert( IS_SECTOR_SOURCE_TYPE(dev,TRACK_SECTOR_SOURCE) );30.549 + assert( dev->mode != SECTOR_UNKNOWN );30.550 + track_sector_source_t tdev = (track_sector_source_t)dev;30.551 + return cdrom_disc_read_sectors( tdev->disc, lba + tdev->start_lba, count, CDROM_SECTOR_READ_MODE(dev->mode), out, &length );30.552 +}30.553 +30.554 +cdrom_error_t track_sector_source_read_sectors( sector_source_t dev, cdrom_lba_t lba, cdrom_count_t count,30.555 + cdrom_read_mode_t mode, unsigned char *out, size_t *length )30.556 +{30.557 + assert( IS_SECTOR_SOURCE_TYPE(dev,TRACK_SECTOR_SOURCE) );30.558 + track_sector_source_t tdev = (track_sector_source_t)dev;30.559 +30.560 + return cdrom_disc_read_sectors( tdev->disc, lba + tdev->start_lba, count, mode, out, length );30.561 +}30.562 +30.563 +void track_sector_source_destroy( sector_source_t dev )30.564 +{30.565 + assert( IS_SECTOR_SOURCE_TYPE(dev,TRACK_SECTOR_SOURCE) );30.566 + track_sector_source_t tdev = (track_sector_source_t)dev;30.567 + sector_source_unref( &tdev->disc->source );30.568 + default_sector_source_destroy(dev);30.569 +}30.570 +30.571 +sector_source_t track_sector_source_new( cdrom_disc_t disc, sector_mode_t mode, cdrom_lba_t lba, cdrom_count_t count )30.572 +{30.573 + if( disc == NULL ) {30.574 + return NULL;30.575 + }30.576 + track_sector_source_t dev = g_malloc(sizeof(struct track_sector_source));30.577 + dev->disc = disc;30.578 + dev->start_lba = lba;30.579 + sector_source_init( &dev->dev, TRACK_SECTOR_SOURCE, mode, count,30.580 + track_sector_source_read_blocks, track_sector_source_destroy );30.581 + dev->dev.read_sectors = track_sector_source_read_sectors;30.582 + sector_source_ref( &disc->source );30.583 + return &dev->dev;30.584 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +000031.2 +++ b/src/drivers/cdrom/sector.h Sun Jan 31 18:35:06 2010 +100031.3 @@ -0,0 +1,184 @@31.4 +/**31.5 + * $Id$31.6 + *31.7 + * low-level 'block device' for input to cdrom discs.31.8 + *31.9 + * Copyright (c) 2009 Nathan Keynes.31.10 + *31.11 + * This program is free software; you can redistribute it and/or modify31.12 + * it under the terms of the GNU General Public License as published by31.13 + * the Free Software Foundation; either version 2 of the License, or31.14 + * (at your option) any later version.31.15 + *31.16 + * This program is distributed in the hope that it will be useful,31.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of31.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the31.19 + * GNU General Public License for more details.31.20 + */31.21 +31.22 +#ifndef cdrom_sector_H31.23 +#define cdrom_sector_H 131.24 +31.25 +#include <stdio.h>31.26 +#include <glib/gtypes.h>31.27 +#include "drivers/cdrom/defs.h"31.28 +31.29 +#ifdef __cplusplus31.30 +extern "C" {31.31 +#endif31.32 +31.33 +/******************************** Sector Source ******************************/31.34 +#define SECTOR_SOURCE_TAG 0x4244455631.35 +typedef struct sector_source *sector_source_t;31.36 +typedef enum {31.37 + NULL_SECTOR_SOURCE,31.38 + FILE_SECTOR_SOURCE,31.39 + DISC_SECTOR_SOURCE,31.40 + TRACK_SECTOR_SOURCE31.41 +} sector_source_type_t;31.42 +31.43 +typedef cdrom_error_t (*sector_source_read_fn_t)(sector_source_t, cdrom_lba_t, cdrom_count_t, unsigned char *outbuf);31.44 +typedef cdrom_error_t (*sector_source_read_sectors_fn_t)(sector_source_t, cdrom_lba_t, cdrom_count_t, cdrom_read_mode_t mode,31.45 + unsigned char *outbuf, size_t *length);31.46 +typedef void (*sector_source_destroy_fn_t)(sector_source_t);31.47 +31.48 +/**31.49 + * A 'sector source' is a read-only random-access data source that supports31.50 + * reads of arbitrary blocks within their capacity. A block device has a31.51 + * defined mode, block size, and block count.31.52 + *31.53 + * Source are ref-counted, and automatically destroyed when the reference31.54 + * count reaches 0.31.55 + */31.56 +struct sector_source {31.57 + uint32_t tag; /* sector source tag */31.58 + uint32_t ref_count; /* Reference count. Initialized to 0 */31.59 + sector_source_type_t type;31.60 +31.61 + sector_mode_t mode; /* Implies sector size. */31.62 + uint32_t size; /* Block count */31.63 +31.64 + /**31.65 + * Read blocks from the device using the native block size.31.66 + * @param buf Buffer to receive the blocks31.67 + * @param block First block to transfer (numbered from 0)31.68 + * @param block_count number of blocks to transfer.31.69 + * @return 0 on success, otherwise an error code.31.70 + */31.71 + sector_source_read_fn_t read_blocks;31.72 +31.73 + /**31.74 + * Read sectors from the device using the specified read mode, performing any31.75 + * necessary conversions.31.76 + */31.77 + sector_source_read_sectors_fn_t read_sectors;31.78 +31.79 + /**31.80 + * Release all resources and memory used by the device (note should never31.81 + * be called directly31.82 + */31.83 + sector_source_destroy_fn_t destroy;31.84 +31.85 +};31.86 +31.87 +/**31.88 + * Block device that always returns zeros.31.89 + */31.90 +sector_source_t null_sector_source_new( sector_mode_t mode, cdrom_count_t size );31.91 +31.92 +#define FILE_SECTOR_FULL_FILE ((cdrom_count_t)-1)31.93 +31.94 +/**31.95 + * File reader. Last block is 0-padded.31.96 + */31.97 +sector_source_t file_sector_source_new_filename( const gchar *filename, sector_mode_t mode,31.98 + uint32_t offset, cdrom_count_t sector_count );31.99 +sector_source_t file_sector_source_new( FILE *f, sector_mode_t mode, uint32_t offset, cdrom_count_t sector_count,31.100 + gboolean closeOnDestroy );31.101 +sector_source_t file_sector_source_new_full( FILE *f, sector_mode_t mode, gboolean closeOnDestroy );31.102 +31.103 +/**31.104 + * Construct a file source that shares its file descriptor with another31.105 + * file source.31.106 + */31.107 +sector_source_t file_sector_source_new_source( sector_source_t ref, sector_mode_t mode, uint32_t offset,31.108 + cdrom_count_t sector_count );31.109 +31.110 +/**31.111 + * Change the value of the source's closeOnDestroy flag31.112 + */31.113 +void file_sector_source_set_close_on_destroy( sector_source_t ref, gboolean closeOnDestroy );31.114 +31.115 +/**31.116 + * Retrieve the source's underlying FILE31.117 + */31.118 +FILE *file_sector_source_get_file( sector_source_t ref );31.119 +31.120 +/**31.121 + * Retrieve the source's underlying file descriptor31.122 + */31.123 +int file_sector_source_get_fd( sector_source_t ref );31.124 +31.125 +/**31.126 + * Increment the reference count for a block device.31.127 + */31.128 +void sector_source_ref( sector_source_t device );31.129 +31.130 +/**31.131 + * Unreference a block device. If decremented to 0, the device will be31.132 + * destroyed.31.133 + */31.134 +void sector_source_unref( sector_source_t device );31.135 +31.136 +/**31.137 + * Release an unbound block device. If the ref count is 0, the device is31.138 + * destroyed. Otherwise the function has no effect.31.139 + */31.140 +void sector_source_release( sector_source_t device );31.141 +31.142 +cdrom_error_t sector_source_read( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count, unsigned char *buf );31.143 +31.144 +cdrom_error_t sector_source_read_sectors( sector_source_t device, cdrom_lba_t lba, cdrom_count_t block_count,31.145 + cdrom_read_mode_t mode, unsigned char *buf, size_t *length );31.146 +31.147 +/***** Internals for sector source implementations *****/31.148 +31.149 +/**31.150 + * Initialize a new (pre-allocated) sector source31.151 + */31.152 +sector_source_t sector_source_init( sector_source_t device, sector_source_type_t type, sector_mode_t mode, cdrom_count_t size,31.153 + sector_source_read_fn_t readfn, sector_source_destroy_fn_t destroyfn );31.154 +31.155 +/**31.156 + * Default sector source destructor method31.157 + */31.158 +void default_sector_source_destroy( sector_source_t device );31.159 +31.160 +31.161 +/**31.162 + * Extract the necessary fields from a single raw sector for the given read mode.31.163 + * @param raw_sector input raw 2352 byte sector31.164 + * @param mode sector mode and field specification flags31.165 + * @param buf output buffer for sector data31.166 + * @param length output length of sector written to buf31.167 + * @return CDROM_ERROR_OK on success, otherwise an appropriate error code.31.168 + */31.169 +cdrom_error_t sector_extract_from_raw( unsigned char *raw_sector, cdrom_read_mode_t mode, unsigned char *buf, size_t *length );31.170 +31.171 +/**31.172 + * Test if the given pointer is a valid sector source31.173 + */31.174 +#define IS_SECTOR_SOURCE(dev) ((dev) != NULL && ((sector_source_t)(dev))->tag == SECTOR_SOURCE_TAG)31.175 +31.176 + /**31.177 + * Test if the given pointer is a valid sector source of the given type31.178 + */31.179 +#define IS_SECTOR_SOURCE_TYPE(dev,id) (IS_SECTOR_SOURCE(dev) && ((sector_source_t)(dev))->type == id)31.180 +31.181 +31.182 +31.183 +#ifdef __cplusplus31.184 +}31.185 +#endif31.186 +31.187 +#endif /* !cdrom_sector_H */
32.1 --- a/src/gdlist.c Sun Jan 31 18:30:13 2010 +100032.2 +++ b/src/gdlist.c Sun Jan 31 18:35:06 2010 +100032.3 @@ -23,6 +23,7 @@32.4 #include <libgen.h>32.5 #include "gettext.h"32.6 #include "gdrom/gdrom.h"32.7 +#include "drivers/cdrom/drive.h"32.8 #include "gdlist.h"32.9 #include "lxdream.h"32.10 #include "config.h"32.11 @@ -43,7 +44,7 @@32.12 GList *ptr;32.14 for( ptr = gdrom_device_list; ptr != NULL; ptr = g_list_next(ptr) ) {32.15 - gdrom_device_t device = (gdrom_device_t)ptr->data;32.16 + cdrom_drive_t device = (cdrom_drive_t)ptr->data;32.17 posn++;32.18 if( strcmp(device->name, name) == 0 ) {32.19 return posn;32.20 @@ -99,7 +100,7 @@32.21 /**32.22 * Disc-changed callback from the GD-Rom driver. Updates the list accordingly.32.23 */32.24 -gboolean gdrom_list_disc_changed( gdrom_disc_t disc, const gchar *disc_name, void *user_data )32.25 +gboolean gdrom_list_disc_changed( cdrom_disc_t disc, const gchar *disc_name, void *user_data )32.26 {32.27 gboolean list_changed = FALSE;32.28 int posn = 0;32.29 @@ -137,7 +138,8 @@32.30 {32.31 gdrom_recent_list = lxdream_get_global_config_list_value( CONFIG_RECENT );32.32 register_gdrom_disc_change_hook( gdrom_list_disc_changed, NULL );32.33 - gdrom_device_list = cdrom_get_native_devices();32.34 + cdrom_drive_scan();32.35 + gdrom_device_list = cdrom_drive_get_list();32.36 gdrom_device_count = g_list_length(gdrom_device_list);32.37 gdrom_recent_count = g_list_length(gdrom_recent_list);32.39 @@ -153,7 +155,7 @@32.40 }32.42 if( posn <= gdrom_device_count ) {32.43 - gdrom_device_t device = g_list_nth_data(gdrom_device_list, posn-1);32.44 + cdrom_drive_t device = g_list_nth_data(gdrom_device_list, posn-1);32.45 return gdrom_mount_image(device->name);32.46 }32.48 @@ -188,8 +190,8 @@32.49 }32.51 if( posn <= gdrom_device_count ) {32.52 - gdrom_device_t device = g_list_nth_data(gdrom_device_list, posn-1);32.53 - return device->device_name;32.54 + cdrom_drive_t device = g_list_nth_data(gdrom_device_list, posn-1);32.55 + return device->display_name;32.56 }32.58 if( posn == gdrom_device_count + 1) {32.59 @@ -211,7 +213,7 @@32.60 }32.62 if( posn <= gdrom_device_count ) {32.63 - gdrom_device_t device = g_list_nth_data(gdrom_device_list, posn-1);32.64 + cdrom_drive_t device = g_list_nth_data(gdrom_device_list, posn-1);32.65 return device->name;32.66 }
33.1 --- a/src/gdrom/README.LIBEDC Sun Jan 31 18:30:13 2010 +100033.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000033.3 @@ -1,123 +0,0 @@33.4 -This describes the program as shipped with cdrkit, a spinoff from the33.5 -cdrtools project. However, the cdrtools developers are no longer33.6 -involved in the development of this spinoff and therefore shall not33.7 -be made responsible for any problem caused by it. Do not try to get33.8 -support for this program by contacting the original authors.33.9 -33.10 -This is a small description for the Reed-Solomon library intended for33.11 -CD sector formatting.33.12 -33.13 -Basics:33.14 -It is assumed that you have a basic knowledge of cd sector formats.33.15 -33.16 -The library can handle three types of sector data:33.17 - data sectors,33.18 - audio sectors, and33.19 - sub channel r-w sectors33.20 -33.21 -Currently only encoding is implemented. Decoding and optionally33.22 -error correction is planned for later.33.23 -33.24 -Stages:33.25 -33.26 -The process of sector formatting has several stages. Beginning with33.27 -a data sector (2048, 2324, or 2336 bytes) a sector of 2352 bytes is33.28 -built. This format can be read raw by SCSI MMC-2 and ATAPI drives and33.29 -is accepted by cd burners. The additions are an optionally 32 bit CRC33.30 -checksum and two layers of Reed-Solomon codes (called Reed-Solomon33.31 -Product Code RSPC).33.32 -This sector is then scrambled (exor'ed with a bitstream).33.33 -The result is called F1 frames. Afterwards even and odd bytes are33.34 -swapped, this is called F2 frames. The result is equivalent to an33.35 -audio sector and is treated as such by the cd burner.33.36 -So, if we wrote a series of sectors (F2 frames) into a CDR file and33.37 -later burned them as 'audio', they would turn up as perfect data sectors.33.38 -33.39 -So, now we are at the level of audio sectors. Audio sectors get their33.40 -own error correction data (called CIRC). Sector size goes up to33.41 -3136 bytes (that is 4/3 times 2352 bytes). Furthermore different33.42 -words get delayed differently and swap positions. The result is ready33.43 -to be fed into the so-called EightFourteenModulator (when subchannels33.44 -have been added).33.45 -33.46 -Now, only sub channels are missing. While the p and q sub33.47 -channels have to be generated elsewhere, any supplied r-w subchannel33.48 -user data is protected by two levels of error correction33.49 -codes. This format is read by cd burners when burning cd+graphics.33.50 -The cdimage is a sequence of sectors, each containing audio data and33.51 -after that subchannel data.33.52 -Similar to audio sectors delaying and permutation of words33.53 -takes place. After that the cd burner would mix sub channel data with33.54 -the formatted audio sectors to feed the EFModulator.33.55 -33.56 -NOTE: Most of the described stages need not to be done in order to33.57 -prepare sectors for burning, since all cd burners do at least CIRC,33.58 -delaying and swaps. For data sectors they also do scrambling and f233.59 -frame generation.33.60 -33.61 -Encoding routines:33.62 -33.63 -For data sectors33.64 - int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);33.65 -33.66 - encodes data sectors. The returned data is __unscrambled__ and not in33.67 - F2-frame format.33.68 -33.69 -Parameters are:33.70 - inout pointer to an array of at least 2352 bytes.33.71 - sectortype One of the MODE_* constants from ecc.h. This defines33.72 - how to format the sector.33.73 - address The logical address to be used in the header33.74 - (150 = 0:2.0 MSF).33.75 -33.76 -NOTE: the data portion has be to aligned properly for performance33.77 -reasons (see ecc.h for details). So, no moves are necessary here.33.78 -33.79 -Generating f2 frames to be used like audio sectors33.80 - int scramble_L2(unsigned char *inout)33.81 -33.82 - generates f2 frames in place from sectors generated by do_encode_L2().33.83 -33.84 -Parameters are:33.85 - inout pointer to an array of at least 2352 bytes.33.86 -33.87 -33.88 -33.89 -For sub channels33.90 - int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],33.91 - unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*33.92 - PACKETS_PER_SUBCHANNELFRAME],33.93 - int delay1, int permute);33.94 -33.95 - repack user data and add error correction data. P and q subchannels33.96 -should be added later, since all bytes are in place then.33.97 -33.98 -Parameters are:33.99 - in pointer to an array of at least 72 bytes. It contains33.100 - the user data for one frame.33.101 - out pointer to an array of at least 96 bytes. Here is33.102 - output frame is placed.33.103 - delay1 do low level delaying, when set to 1.33.104 - permute do low level permutations, when set to 1.33.105 -33.106 -NOTE: Probably both options need either to be set on (1) or off (0) together.33.107 -33.108 -There is more, but that is seldomly used.33.109 -33.110 -Tests:33.111 -The library is accompanied by small verify programs, that compare real33.112 -raw sectors with the formatted results. They are also intended as demo33.113 -applications (how to use the library). In order to be able to feed33.114 -real raw sectors into them, the package read2448 is recommended/needed.33.115 -You can only verify sector streams of one sector type, currently no mix.33.116 -33.117 -For more information have a look into ecc.h33.118 -33.119 -recommended Documents:33.120 -Yellow Book or ISO 1014933.121 -Appendix Red Book33.122 -Red Book or IEC 90833.123 -33.124 -Source: libedc/README from cdrtools package33.125 -Edited for cdrkit by Christian Fromme <kaner@strace.org>33.126 -
34.1 --- a/src/gdrom/cdi.c Sun Jan 31 18:30:13 2010 +100034.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000034.3 @@ -1,208 +0,0 @@34.4 -/**34.5 - * $Id$34.6 - *34.7 - * CDI CD-image file support34.8 - *34.9 - * Copyright (c) 2005 Nathan Keynes.34.10 - *34.11 - * This program is free software; you can redistribute it and/or modify34.12 - * it under the terms of the GNU General Public License as published by34.13 - * the Free Software Foundation; either version 2 of the License, or34.14 - * (at your option) any later version.34.15 - *34.16 - * This program is distributed in the hope that it will be useful,34.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of34.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the34.19 - * GNU General Public License for more details.34.20 - */34.21 -34.22 -#include <stdlib.h>34.23 -#include <stdio.h>34.24 -#include <stdint.h>34.25 -#include <string.h>34.26 -#include <fcntl.h>34.27 -#include <errno.h>34.28 -#include <sys/stat.h>34.29 -#include "gdrom/gddriver.h"34.30 -34.31 -#define CDI_V2_ID 0x8000000434.32 -#define CDI_V3_ID 0x8000000534.33 -#define CDI_V35_ID 0x8000000634.34 -34.35 -34.36 -static gboolean cdi_image_is_valid( FILE *f );34.37 -static gdrom_disc_t cdi_image_open( const gchar *filename, FILE *f );34.38 -34.39 -struct gdrom_image_class cdi_image_class = { "DiscJuggler", "cdi",34.40 - cdi_image_is_valid, cdi_image_open };34.41 -34.42 -static const char TRACK_START_MARKER[20] = { 0,0,1,0,0,0,255,255,255,255,34.43 - 0,0,1,0,0,0,255,255,255,255 };34.44 -static const char EXT_MARKER[9] = {0,255,255,255,255,255,255,255,255 };34.45 -34.46 -struct cdi_trailer {34.47 - uint32_t cdi_version;34.48 - uint32_t header_offset;34.49 -};34.50 -34.51 -struct cdi_track_data {34.52 - uint32_t pregap_length;34.53 - uint32_t length;34.54 - char unknown2[6];34.55 - uint32_t mode;34.56 - char unknown3[0x0c];34.57 - uint32_t start_lba;34.58 - uint32_t total_length;34.59 - char unknown4[0x10];34.60 - uint32_t sector_size;34.61 - char unknown5[0x1D];34.62 -} __attribute__((packed));34.63 -34.64 -gboolean cdi_image_is_valid( FILE *f )34.65 -{34.66 - int len;34.67 - struct cdi_trailer trail;34.68 -34.69 - fseek( f, -8, SEEK_END );34.70 - len = ftell(f)+8;34.71 - fread( &trail, sizeof(trail), 1, f );34.72 - if( trail.header_offset >= len ||34.73 - trail.header_offset == 0 )34.74 - return FALSE;34.75 - return trail.cdi_version == CDI_V2_ID || trail.cdi_version == CDI_V3_ID ||34.76 - trail.cdi_version == CDI_V35_ID;34.77 -}34.78 -34.79 -gdrom_disc_t cdi_image_open( const gchar *filename, FILE *f )34.80 -{34.81 - gdrom_disc_t disc = NULL;34.82 - int i,j;34.83 - uint16_t session_count;34.84 - uint16_t track_count;34.85 - int total_tracks = 0;34.86 - int posn = 0;34.87 - long len;34.88 - struct cdi_trailer trail;34.89 - char marker[20];34.90 -34.91 - fseek( f, -8, SEEK_END );34.92 - len = ftell(f)+8;34.93 - fread( &trail, sizeof(trail), 1, f );34.94 - if( trail.header_offset >= len ||34.95 - trail.header_offset == 0 )34.96 - return NULL;34.97 -34.98 - if( trail.cdi_version != CDI_V2_ID && trail.cdi_version != CDI_V3_ID &&34.99 - trail.cdi_version != CDI_V35_ID ) {34.100 - return NULL;34.101 - }34.102 -34.103 - if( trail.cdi_version == CDI_V35_ID ) {34.104 - fseek( f, -(long)trail.header_offset, SEEK_END );34.105 - } else {34.106 - fseek( f, trail.header_offset, SEEK_SET );34.107 - }34.108 - fread( &session_count, sizeof(session_count), 1, f );34.109 -34.110 - disc = gdrom_image_new(filename, f);34.111 - if( disc == NULL ) {34.112 - ERROR("Unable to allocate memory!");34.113 - return NULL;34.114 - }34.115 -34.116 - for( i=0; i< session_count; i++ ) {34.117 - fread( &track_count, sizeof(track_count), 1, f );34.118 - if( track_count + total_tracks > 99 ) {34.119 - ERROR( "Invalid number of tracks, bad cdi image\n" );34.120 - disc->destroy(disc,FALSE);34.121 - return NULL;34.122 - }34.123 - for( j=0; j<track_count; j++ ) {34.124 - struct cdi_track_data trk;34.125 - uint32_t new_fmt = 0;34.126 - uint8_t fnamelen = 0;34.127 - fread( &new_fmt, sizeof(new_fmt), 1, f );34.128 - if( new_fmt != 0 ) { /* Additional data 3.00.780+ ?? */34.129 - fseek( f, 8, SEEK_CUR ); /* Skip */34.130 - }34.131 - fread( marker, 20, 1, f );34.132 - if( memcmp( marker, TRACK_START_MARKER, 20) != 0 ) {34.133 - ERROR( "Track start marker not found, error reading cdi image\n" );34.134 - disc->destroy(disc,FALSE);34.135 - return NULL;34.136 - }34.137 - fseek( f, 4, SEEK_CUR );34.138 - fread( &fnamelen, 1, 1, f );34.139 - fseek( f, (int)fnamelen, SEEK_CUR ); /* skip over the filename */34.140 - fseek( f, 19, SEEK_CUR );34.141 - fread( &new_fmt, sizeof(new_fmt), 1, f );34.142 - if( new_fmt == 0x80000000 ) {34.143 - fseek( f, 10, SEEK_CUR );34.144 - } else {34.145 - fseek( f, 2, SEEK_CUR );34.146 - }34.147 - fread( &trk, sizeof(trk), 1, f );34.148 - disc->track[total_tracks].session = i;34.149 - disc->track[total_tracks].lba = trk.start_lba + 150;34.150 - disc->track[total_tracks].sector_count = trk.length;34.151 - switch( trk.mode ) {34.152 - case 0:34.153 - disc->track[total_tracks].mode = GDROM_CDDA;34.154 - disc->track[total_tracks].sector_size = 2352;34.155 - disc->track[total_tracks].flags = 0x01;34.156 - if( trk.sector_size != 2 ) {34.157 - ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );34.158 - disc->destroy(disc,FALSE);34.159 - return NULL;34.160 - }34.161 - break;34.162 - case 1:34.163 - disc->track[total_tracks].mode = GDROM_MODE1;34.164 - disc->track[total_tracks].sector_size = 2048;34.165 - disc->track[total_tracks].flags = 0x41;34.166 - if( trk.sector_size != 0 ) {34.167 - ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );34.168 - disc->destroy(disc,FALSE);34.169 - return NULL;34.170 - }34.171 - break;34.172 - case 2:34.173 - disc->track[total_tracks].flags = 0x41;34.174 - switch( trk.sector_size ) {34.175 - case 0:34.176 - disc->track[total_tracks].mode = GDROM_MODE2_FORM1;34.177 - disc->track[total_tracks].sector_size = 2048;34.178 - break;34.179 - case 1:34.180 - disc->track[total_tracks].mode = GDROM_SEMIRAW_MODE2;34.181 - disc->track[total_tracks].sector_size = 2336;34.182 - break;34.183 - case 2:34.184 - default:34.185 - ERROR( "Invalid combination of mode %d with size %d", trk.mode, trk.sector_size );34.186 - disc->destroy(disc,FALSE);34.187 - return NULL;34.188 - }34.189 - break;34.190 - default:34.191 - ERROR( "Unsupported track mode %d", trk.mode );34.192 - disc->destroy(disc,FALSE);34.193 - return NULL;34.194 - }34.195 - disc->track[total_tracks].offset = posn +34.196 - trk.pregap_length * disc->track[total_tracks].sector_size ;34.197 - posn += trk.total_length * disc->track[total_tracks].sector_size;34.198 - total_tracks++;34.199 - fread( marker, 1, 9, f );34.200 - if( memcmp( marker, EXT_MARKER, 9 ) == 0 ) {34.201 - fseek( f, 79, SEEK_CUR );34.202 - } else {34.203 - fseek( f, -9, SEEK_CUR );34.204 - }34.205 - }34.206 - fseek( f, 12, SEEK_CUR );34.207 - }34.208 - disc->track_count = total_tracks;34.209 - gdrom_set_disc_type(disc);34.210 - return disc;34.211 -}
35.1 --- a/src/gdrom/ecc.h Sun Jan 31 18:30:13 2010 +100035.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000035.3 @@ -1,136 +0,0 @@35.4 -/*35.5 - * This file has been modified for the cdrkit suite.35.6 - *35.7 - * The behaviour and appearence of the program code below can differ to a major35.8 - * extent from the version distributed by the original author(s).35.9 - *35.10 - * For details, see Changelog file distributed with the cdrkit package. If you35.11 - * received this file from another source then ask the distributing person for35.12 - * a log of modifications.35.13 - *35.14 - */35.15 -35.16 -/* @(#)ecc.h 1.4 02/10/19 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */35.17 -35.18 -/*35.19 - * compact disc reed-solomon routines35.20 - *35.21 - * (c) 1998-2002 by Heiko Eissfeldt, heiko@colossus.escape.de35.22 - * (c) 2002 by Joerg Schilling35.23 - */35.24 -/*35.25 - * This program is free software; you can redistribute it and/or modify35.26 - * it under the terms of the GNU General Public License version 235.27 - * as published by the Free Software Foundation.35.28 - *35.29 - * This program is distributed in the hope that it will be useful,35.30 - * but WITHOUT ANY WARRANTY; without even the implied warranty of35.31 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the35.32 - * GNU General Public License for more details.35.33 - *35.34 - * You should have received a copy of the GNU General Public License along with35.35 - * this program; see the file COPYING. If not, write to the Free Software35.36 - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.35.37 - */35.38 -35.39 -#define RS_L12_BITS 835.40 -35.41 -/* audio sector definitions for CIRC */35.42 -#define FRAMES_PER_SECTOR 9835.43 -/* user data bytes per frame */35.44 -#define L1_RAW 2435.45 -/* parity bytes with 8 bit */35.46 -#define L1_Q 435.47 -#define L1_P 435.48 -35.49 -int cd_build_address(unsigned char inout[], int sectortype, unsigned address);35.50 -35.51 -/* audio sector Cross Interleaved Reed-Solomon Code (CIRC) encoder (layer 1) */35.52 -/* adds P- and Q- parity information to audio (f2) frames. Also35.53 - optionally handles the various delays and permutations. The output with all35.54 - stages enabled can be fed into the Eight-Fourteen-Modulator.35.55 - On input: 2352 bytes of audio data is given.35.56 - On output: 3136 bytes of CIRC enriched audio data are returned.35.57 - */35.58 -int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],35.59 - unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],35.60 - int delay1, int delay2, int delay3, int scramble);35.61 -35.62 -/* data sector definitions for RSPC */35.63 -/* user data bytes per frame */35.64 -#define L2_RAW (1024*2)35.65 -/* parity bytes for 16 bit units */35.66 -#define L2_Q (26*2*2)35.67 -#define L2_P (43*2*2)35.68 -35.69 -/* known sector types */35.70 -#define MODE_0 GDROM_MODE035.71 -#define MODE_1 GDROM_MODE135.72 -#define MODE_2 GDROM_MODE2_FORMLESS35.73 -#define MODE_2_FORM_1 GDROM_MODE2_FORM135.74 -#define MODE_2_FORM_2 GDROM_MODE2_FORM235.75 -35.76 -/* set one of the MODE_* constants for subsequent data sector formatting */35.77 -int set_sector_type(int st);35.78 -/* get the current sector type setting for data sector formatting */35.79 -int get_sector_type(void);35.80 -35.81 -/* data sector layer 2 Reed-Solomon Product Code encoder */35.82 -/* encode the given data portion depending on sector type (see35.83 - get/set_sector_type() functions). Use the given address for the header.35.84 - The returned data is __unscrambled__ and not in F2-frame format (for that35.85 - see function scramble_L2()).35.86 - Supported sector types:35.87 - MODE_0: a 12-byte sync field, a header and 2336 zeros are returned.35.88 - MODE_1: the user data portion (2048 bytes) has to be given35.89 - at offset 16 in the inout array.35.90 - Sync-, header-, edc-, spare-, p- and q- fields will be added.35.91 - MODE_2: the user data portion (2336 bytes) has to be given35.92 - at offset 16 in the inout array.35.93 - Sync- and header- fields will be added.35.94 - MODE_2_FORM_1: the user data portion (8 bytes subheader followed35.95 - by 2048 bytes data) has to be given at offset 1635.96 - in the inout array.35.97 - Sync-, header-, edc-, p- and q- fields will be added.35.98 - MODE_2_FORM_2: the user data portion (8 bytes subheader followed35.99 - by 2324 bytes data) has to be given at offset 1635.100 - in the inout array.35.101 - Sync-, header- and edc- fields will be added.35.102 -*/35.103 -int do_encode_L2(unsigned char *inout, int sectortype, unsigned address);35.104 -int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);35.105 -int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);35.106 -unsigned int build_edc(unsigned char inout[], int from, int upto);35.107 -35.108 -/* generates f2 frames from otherwise fully formatted sectors (generated by35.109 - do_encode_L2()). */35.110 -#define EDC_SCRAMBLE_NOSWAP 1 /* Do not swap bytes while scrambling */35.111 -int scramble_L2(unsigned char *inout);35.112 -35.113 -/* r-w sub channel definitions */35.114 -#define RS_SUB_RW_BITS 635.115 -35.116 -#define PACKETS_PER_SUBCHANNELFRAME 435.117 -#define LSUB_RAW 1835.118 -#define LSUB_QRAW 235.119 -/* 6 bit */35.120 -#define LSUB_Q 235.121 -#define LSUB_P 435.122 -35.123 -/* R-W subchannel encoder */35.124 -/* On input: 72 bytes packed user data, four frames with each 18 bytes.35.125 - On output: per frame: 2 bytes user data, 2 bytes Q parity,35.126 - 16 bytes user data, 4 bytes P parity.35.127 - Options:35.128 - delay1: use low level delay line35.129 - scramble: perform low level permutations35.130 - */35.131 -int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],35.132 - unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],35.133 - int delay1, int scramble);35.134 -int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],35.135 - unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],35.136 - int delay1, int scramble);35.137 -35.138 -int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);35.139 -int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);
36.1 --- a/src/gdrom/edc_crctable.h Sun Jan 31 18:30:13 2010 +100036.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000036.3 @@ -1,171 +0,0 @@36.4 -/* @(#)crctable.out 1.2 02/10/17 joerg */36.5 -36.6 -/*****************************************************************/36.7 -/* */36.8 -/* CRC LOOKUP TABLE */36.9 -/* ================ */36.10 -/* The following CRC lookup table was generated automagically */36.11 -/* by the Rocksoft^tm Model CRC Algorithm Table Generation */36.12 -/* Program V1.0 using the following model parameters: */36.13 -/* */36.14 -/* Width : 4 bytes. */36.15 -/* Poly : 0x8001801BL */36.16 -/* Reverse : TRUE. */36.17 -/* */36.18 -/* For more information on the Rocksoft^tm Model CRC Algorithm, */36.19 -/* see the document titled "A Painless Guide to CRC Error */36.20 -/* Detection Algorithms" by Ross Williams */36.21 -/* (ross@guest.adelaide.edu.au.). This document is likely to be */36.22 -/* in the FTP archive "ftp.adelaide.edu.au/pub/rocksoft". */36.23 -/* */36.24 -/*****************************************************************/36.25 -36.26 -#ifdef PROTOTYPES36.27 -36.28 -static unsigned int EDC_crctable[256] =36.29 -{36.30 - 0x00000000U, 0x90910101U, 0x91210201U, 0x01B00300U,36.31 - 0x92410401U, 0x02D00500U, 0x03600600U, 0x93F10701U,36.32 - 0x94810801U, 0x04100900U, 0x05A00A00U, 0x95310B01U,36.33 - 0x06C00C00U, 0x96510D01U, 0x97E10E01U, 0x07700F00U,36.34 - 0x99011001U, 0x09901100U, 0x08201200U, 0x98B11301U,36.35 - 0x0B401400U, 0x9BD11501U, 0x9A611601U, 0x0AF01700U,36.36 - 0x0D801800U, 0x9D111901U, 0x9CA11A01U, 0x0C301B00U,36.37 - 0x9FC11C01U, 0x0F501D00U, 0x0EE01E00U, 0x9E711F01U,36.38 - 0x82012001U, 0x12902100U, 0x13202200U, 0x83B12301U,36.39 - 0x10402400U, 0x80D12501U, 0x81612601U, 0x11F02700U,36.40 - 0x16802800U, 0x86112901U, 0x87A12A01U, 0x17302B00U,36.41 - 0x84C12C01U, 0x14502D00U, 0x15E02E00U, 0x85712F01U,36.42 - 0x1B003000U, 0x8B913101U, 0x8A213201U, 0x1AB03300U,36.43 - 0x89413401U, 0x19D03500U, 0x18603600U, 0x88F13701U,36.44 - 0x8F813801U, 0x1F103900U, 0x1EA03A00U, 0x8E313B01U,36.45 - 0x1DC03C00U, 0x8D513D01U, 0x8CE13E01U, 0x1C703F00U,36.46 - 0xB4014001U, 0x24904100U, 0x25204200U, 0xB5B14301U,36.47 - 0x26404400U, 0xB6D14501U, 0xB7614601U, 0x27F04700U,36.48 - 0x20804800U, 0xB0114901U, 0xB1A14A01U, 0x21304B00U,36.49 - 0xB2C14C01U, 0x22504D00U, 0x23E04E00U, 0xB3714F01U,36.50 - 0x2D005000U, 0xBD915101U, 0xBC215201U, 0x2CB05300U,36.51 - 0xBF415401U, 0x2FD05500U, 0x2E605600U, 0xBEF15701U,36.52 - 0xB9815801U, 0x29105900U, 0x28A05A00U, 0xB8315B01U,36.53 - 0x2BC05C00U, 0xBB515D01U, 0xBAE15E01U, 0x2A705F00U,36.54 - 0x36006000U, 0xA6916101U, 0xA7216201U, 0x37B06300U,36.55 - 0xA4416401U, 0x34D06500U, 0x35606600U, 0xA5F16701U,36.56 - 0xA2816801U, 0x32106900U, 0x33A06A00U, 0xA3316B01U,36.57 - 0x30C06C00U, 0xA0516D01U, 0xA1E16E01U, 0x31706F00U,36.58 - 0xAF017001U, 0x3F907100U, 0x3E207200U, 0xAEB17301U,36.59 - 0x3D407400U, 0xADD17501U, 0xAC617601U, 0x3CF07700U,36.60 - 0x3B807800U, 0xAB117901U, 0xAAA17A01U, 0x3A307B00U,36.61 - 0xA9C17C01U, 0x39507D00U, 0x38E07E00U, 0xA8717F01U,36.62 - 0xD8018001U, 0x48908100U, 0x49208200U, 0xD9B18301U,36.63 - 0x4A408400U, 0xDAD18501U, 0xDB618601U, 0x4BF08700U,36.64 - 0x4C808800U, 0xDC118901U, 0xDDA18A01U, 0x4D308B00U,36.65 - 0xDEC18C01U, 0x4E508D00U, 0x4FE08E00U, 0xDF718F01U,36.66 - 0x41009000U, 0xD1919101U, 0xD0219201U, 0x40B09300U,36.67 - 0xD3419401U, 0x43D09500U, 0x42609600U, 0xD2F19701U,36.68 - 0xD5819801U, 0x45109900U, 0x44A09A00U, 0xD4319B01U,36.69 - 0x47C09C00U, 0xD7519D01U, 0xD6E19E01U, 0x46709F00U,36.70 - 0x5A00A000U, 0xCA91A101U, 0xCB21A201U, 0x5BB0A300U,36.71 - 0xC841A401U, 0x58D0A500U, 0x5960A600U, 0xC9F1A701U,36.72 - 0xCE81A801U, 0x5E10A900U, 0x5FA0AA00U, 0xCF31AB01U,36.73 - 0x5CC0AC00U, 0xCC51AD01U, 0xCDE1AE01U, 0x5D70AF00U,36.74 - 0xC301B001U, 0x5390B100U, 0x5220B200U, 0xC2B1B301U,36.75 - 0x5140B400U, 0xC1D1B501U, 0xC061B601U, 0x50F0B700U,36.76 - 0x5780B800U, 0xC711B901U, 0xC6A1BA01U, 0x5630BB00U,36.77 - 0xC5C1BC01U, 0x5550BD00U, 0x54E0BE00U, 0xC471BF01U,36.78 - 0x6C00C000U, 0xFC91C101U, 0xFD21C201U, 0x6DB0C300U,36.79 - 0xFE41C401U, 0x6ED0C500U, 0x6F60C600U, 0xFFF1C701U,36.80 - 0xF881C801U, 0x6810C900U, 0x69A0CA00U, 0xF931CB01U,36.81 - 0x6AC0CC00U, 0xFA51CD01U, 0xFBE1CE01U, 0x6B70CF00U,36.82 - 0xF501D001U, 0x6590D100U, 0x6420D200U, 0xF4B1D301U,36.83 - 0x6740D400U, 0xF7D1D501U, 0xF661D601U, 0x66F0D700U,36.84 - 0x6180D800U, 0xF111D901U, 0xF0A1DA01U, 0x6030DB00U,36.85 - 0xF3C1DC01U, 0x6350DD00U, 0x62E0DE00U, 0xF271DF01U,36.86 - 0xEE01E001U, 0x7E90E100U, 0x7F20E200U, 0xEFB1E301U,36.87 - 0x7C40E400U, 0xECD1E501U, 0xED61E601U, 0x7DF0E700U,36.88 - 0x7A80E800U, 0xEA11E901U, 0xEBA1EA01U, 0x7B30EB00U,36.89 - 0xE8C1EC01U, 0x7850ED00U, 0x79E0EE00U, 0xE971EF01U,36.90 - 0x7700F000U, 0xE791F101U, 0xE621F201U, 0x76B0F300U,36.91 - 0xE541F401U, 0x75D0F500U, 0x7460F600U, 0xE4F1F701U,36.92 - 0xE381F801U, 0x7310F900U, 0x72A0FA00U, 0xE231FB01U,36.93 - 0x71C0FC00U, 0xE151FD01U, 0xE0E1FE01U, 0x7070FF00U,36.94 -};36.95 -36.96 -/*****************************************************************/36.97 -/* End of CRC Lookup Table */36.98 -/*****************************************************************/36.99 -36.100 -#else /* PROTOTYPES */36.101 -36.102 -static unsigned int EDC_crctable[256] =36.103 -{36.104 - 0x00000000, 0x90910101, 0x91210201, 0x01B00300,36.105 - 0x92410401, 0x02D00500, 0x03600600, 0x93F10701,36.106 - 0x94810801, 0x04100900, 0x05A00A00, 0x95310B01,36.107 - 0x06C00C00, 0x96510D01, 0x97E10E01, 0x07700F00,36.108 - 0x99011001, 0x09901100, 0x08201200, 0x98B11301,36.109 - 0x0B401400, 0x9BD11501, 0x9A611601, 0x0AF01700,36.110 - 0x0D801800, 0x9D111901, 0x9CA11A01, 0x0C301B00,36.111 - 0x9FC11C01, 0x0F501D00, 0x0EE01E00, 0x9E711F01,36.112 - 0x82012001, 0x12902100, 0x13202200, 0x83B12301,36.113 - 0x10402400, 0x80D12501, 0x81612601, 0x11F02700,36.114 - 0x16802800, 0x86112901, 0x87A12A01, 0x17302B00,36.115 - 0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01,36.116 - 0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300,36.117 - 0x89413401, 0x19D03500, 0x18603600, 0x88F13701,36.118 - 0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01,36.119 - 0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00,36.120 - 0xB4014001, 0x24904100, 0x25204200, 0xB5B14301,36.121 - 0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700,36.122 - 0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00,36.123 - 0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01,36.124 - 0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300,36.125 - 0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701,36.126 - 0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01,36.127 - 0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00,36.128 - 0x36006000, 0xA6916101, 0xA7216201, 0x37B06300,36.129 - 0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701,36.130 - 0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01,36.131 - 0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00,36.132 - 0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301,36.133 - 0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700,36.134 - 0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00,36.135 - 0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01,36.136 - 0xD8018001, 0x48908100, 0x49208200, 0xD9B18301,36.137 - 0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700,36.138 - 0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00,36.139 - 0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01,36.140 - 0x41009000, 0xD1919101, 0xD0219201, 0x40B09300,36.141 - 0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701,36.142 - 0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01,36.143 - 0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00,36.144 - 0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300,36.145 - 0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701,36.146 - 0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01,36.147 - 0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00,36.148 - 0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301,36.149 - 0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700,36.150 - 0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00,36.151 - 0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01,36.152 - 0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300,36.153 - 0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701,36.154 - 0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01,36.155 - 0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00,36.156 - 0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301,36.157 - 0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700,36.158 - 0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00,36.159 - 0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01,36.160 - 0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301,36.161 - 0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700,36.162 - 0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00,36.163 - 0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01,36.164 - 0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300,36.165 - 0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701,36.166 - 0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01,36.167 - 0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00,36.168 -};36.169 -36.170 -#endif /* PROTOTYPES */36.171 -36.172 -/*****************************************************************/36.173 -/* End of CRC Lookup Table */36.174 -/*****************************************************************/
37.1 --- a/src/gdrom/edc_ecc.c Sun Jan 31 18:30:13 2010 +100037.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000037.3 @@ -1,801 +0,0 @@37.4 -/*37.5 - * Note: This file has been extracted from crkit 1.1.6 and modified to work within37.6 - * lxdream.37.7 - */37.8 -/*37.9 - * This file has been modified for the cdrkit suite.37.10 - *37.11 - * The behaviour and appearence of the program code below can differ to a major37.12 - * extent from the version distributed by the original author(s).37.13 - *37.14 - * For details, see Changelog file distributed with the cdrkit package. If you37.15 - * received this file from another source then ask the distributing person for37.16 - * a log of modifications.37.17 - *37.18 - */37.19 -37.20 -/* @(#)edc_ecc.c 1.21 03/04/04 Copyright 1998-2002 Heiko Eissfeldt, Joerg Schilling */37.21 -37.22 -/*37.23 - * Copyright 1998-2002 by Heiko Eissfeldt37.24 - * Copyright 2002 by Joerg Schilling37.25 - *37.26 - * This file contains protected intellectual property.37.27 - *37.28 - * reed-solomon encoder / decoder for compact discs.37.29 - *37.30 - */37.31 -/*37.32 - * This program is free software; you can redistribute it and/or modify37.33 - * it under the terms of the GNU General Public License version 237.34 - * as published by the Free Software Foundation.37.35 - *37.36 - * This program is distributed in the hope that it will be useful,37.37 - * but WITHOUT ANY WARRANTY; without even the implied warranty of37.38 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the37.39 - * GNU General Public License for more details.37.40 - *37.41 - * You should have received a copy of the GNU General Public License along with37.42 - * this program; see the file COPYING. If not, write to the Free Software37.43 - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.37.44 - */37.45 -37.46 -#include <stdint.h>37.47 -#include <stdio.h>37.48 -#include <string.h>37.49 -#include "gdrom/gddriver.h"37.50 -#include "ecc.h"37.51 -37.52 -#define xaligned(a, s) ((((uintptr_t)(a)) & (s)) == 0 )37.53 -37.54 -int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)],37.55 - int sectortype, unsigned address);37.56 -37.57 -int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],37.58 - unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],37.59 - int delay1, int delay2, int delay3, int permute);37.60 -37.61 -int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],37.62 - unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],37.63 - int delay1, int permute);37.64 -37.65 -int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],37.66 - unsigned char out[L2_RAW]);37.67 -37.68 -int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],37.69 - unsigned char out[L1_RAW*FRAMES_PER_SECTOR],37.70 - int delay1, int delay2, int delay3, int permute);37.71 -37.72 -int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],37.73 - unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],37.74 - int delay1, int permute);37.75 -37.76 -37.77 -37.78 -/* ------------- tables generated by gen_encodes --------------*/37.79 -37.80 -#include "edc_scramble.h"37.81 -37.82 -#define DO4(a) a;a;a;a;37.83 -#define DO13(a) a;a;a;a;a;a;a;a;a;a;a;a;a;37.84 -37.85 -/*37.86 - * Scrambles 2352 - 12 = 2340 bytes37.87 - */37.88 -int scramble_L2(unsigned char *inout);37.89 -37.90 -int scramble_L2(unsigned char *inout)37.91 -{37.92 -#ifndef EDC_SCRAMBLE_NOSWAP37.93 - unsigned int *f = (unsigned int *)inout;37.94 -#endif37.95 -37.96 - if (!xaligned(inout + 12, sizeof(uint32_t)-1)) {37.97 -37.98 - uint8_t *r = inout + 12;37.99 - const uint8_t *s = yellowbook_scrambler;37.100 - register int i;37.101 -37.102 - for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(unsigned char)/4; --i >= 0;) {37.103 - DO4(*r++ ^= *s++);37.104 - }37.105 -37.106 - } else {37.107 - uint32_t *r = (uint32_t *) (inout + 12);37.108 - const uint32_t *s = yellowbook_scrambler_uint32;37.109 - register int i;37.110 -37.111 - for (i = (L2_RAW + L2_Q + L2_P +16)/sizeof(uint32_t)/13; --i >= 0;) {37.112 - DO13(*r++ ^= *s++);37.113 - }37.114 - }37.115 -37.116 -#ifndef EDC_SCRAMBLE_NOSWAP37.117 -37.118 - /* generate F1 frames */37.119 - for (i = 2352/sizeof(unsigned int); i; i--) {37.120 - *f++ = ((*f & 0xff00ff00UL) >> 8) | ((*f & 0x00ff00ffUL) << 8);37.121 - }37.122 -#endif37.123 -37.124 - return (0);37.125 -}37.126 -37.127 -#include "edc_l2sq.h"37.128 -37.129 -static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q]);37.130 -37.131 -static int encode_L2_Q(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P + L2_Q])37.132 -{37.133 - unsigned char *dps;37.134 - unsigned char *dp;37.135 - unsigned char *Q;37.136 - register int i;37.137 - int j;37.138 -37.139 - Q = inout + 4 + L2_RAW + 4 + 8 + L2_P;37.140 -37.141 - dps = inout;37.142 - for (j = 0; j < 26; j++) {37.143 - register unsigned short a;37.144 - register unsigned short b;37.145 - a = b = 0;37.146 -37.147 - dp = dps;37.148 - for (i = 0; i < 43; i++) {37.149 -37.150 - /* LSB */37.151 - a ^= L2sq[i][*dp++];37.152 -37.153 - /* MSB */37.154 - b ^= L2sq[i][*dp];37.155 -37.156 - dp += 2*44-1;37.157 - if (dp >= &inout[(4 + L2_RAW + 4 + 8 + L2_P)]) {37.158 - dp -= (4 + L2_RAW + 4 + 8 + L2_P);37.159 - }37.160 - }37.161 - Q[0] = a >> 8;37.162 - Q[26*2] = a;37.163 - Q[1] = b >> 8;37.164 - Q[26*2+1] = b;37.165 -37.166 - Q += 2;37.167 - dps += 2*43;37.168 - }37.169 - return (0);37.170 -}37.171 -37.172 -static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P]);37.173 -37.174 -static int encode_L2_P(unsigned char inout[4 + L2_RAW + 4 + 8 + L2_P])37.175 -{37.176 - unsigned char *dp;37.177 - unsigned char *P;37.178 - register int i;37.179 - int j;37.180 -37.181 - P = inout + 4 + L2_RAW + 4 + 8;37.182 -37.183 - for (j = 0; j < 43; j++) {37.184 - register unsigned short a;37.185 - register unsigned short b;37.186 -37.187 - a = b = 0;37.188 - dp = inout;37.189 - for (i = 19; i < 43; i++) {37.190 -37.191 - /* LSB */37.192 - a ^= L2sq[i][*dp++];37.193 -37.194 - /* MSB */37.195 - b ^= L2sq[i][*dp];37.196 -37.197 - dp += 2*43 -1;37.198 - }37.199 - P[0] = a >> 8;37.200 - P[43*2] = a;37.201 - P[1] = b >> 8;37.202 - P[43*2+1] = b;37.203 -37.204 - P += 2;37.205 - inout += 2;37.206 - }37.207 - return (0);37.208 -}37.209 -37.210 -static unsigned char bin2bcd(unsigned p);37.211 -37.212 -static unsigned char bin2bcd(unsigned p)37.213 -{37.214 - return ((p/10)<<4)|(p%10);37.215 -}37.216 -37.217 -int cd_build_address(unsigned char inout[], int sectortype, unsigned address)37.218 -{37.219 - inout[12] = bin2bcd(address / (60*75));37.220 - inout[13] = bin2bcd((address / 75) % 60);37.221 - inout[14] = bin2bcd(address % 75);37.222 - if (sectortype == MODE_0)37.223 - inout[15] = 0;37.224 - else if (sectortype == MODE_1)37.225 - inout[15] = 1;37.226 - else if (sectortype == MODE_2)37.227 - inout[15] = 2;37.228 - else if (sectortype == MODE_2_FORM_1)37.229 - inout[15] = 2;37.230 - else if (sectortype == MODE_2_FORM_2)37.231 - inout[15] = 2;37.232 - else37.233 - return (-1);37.234 - return (0);37.235 -}37.236 -37.237 -#include "edc_crctable.h"37.238 -37.239 -/*37.240 - * Called with 2064, 2056 or 2332 byte difference - all dividable by 4.37.241 - */37.242 -unsigned int build_edc(unsigned char inout[], int from, int upto);37.243 -37.244 -unsigned int build_edc(unsigned char inout[], int from, int upto)37.245 -{37.246 - unsigned char *p = inout+from;37.247 - unsigned int result = 0;37.248 -37.249 - upto -= from-1;37.250 - upto /= 4;37.251 - while (--upto >= 0) {37.252 - result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);37.253 - result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);37.254 - result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);37.255 - result = EDC_crctable[(result ^ *p++) & 0xffL] ^ (result >> 8);37.256 - }37.257 - return (result);37.258 -}37.259 -37.260 -/* Layer 2 Product code en/decoder */37.261 -37.262 -int do_encode_L2(unsigned char inout[(12 + 4 + L2_RAW+4+8+L2_Q+L2_P)],37.263 - int sectortype, unsigned address)37.264 -{37.265 - unsigned int result;37.266 -37.267 -/* SYNCPATTERN "\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff" */37.268 -#define SYNCPATTERN "\000\377\377\377\377\377\377\377\377\377\377"37.269 -37.270 - /* supply initial sync pattern */37.271 - memcpy(inout, SYNCPATTERN, sizeof(SYNCPATTERN));37.272 -37.273 - if (sectortype == MODE_0) {37.274 - memset(inout + sizeof(SYNCPATTERN), 0, 4 + L2_RAW + 12 + L2_P + L2_Q);37.275 - cd_build_address(inout, sectortype, address);37.276 - return (0);37.277 - }37.278 -37.279 - switch (sectortype) {37.280 -37.281 - case MODE_1:37.282 - cd_build_address(inout, sectortype, address);37.283 - result = build_edc(inout, 0, 16+2048-1);37.284 - inout[2064+0] = result >> 0L;37.285 - inout[2064+1] = result >> 8L;37.286 - inout[2064+2] = result >> 16L;37.287 - inout[2064+3] = result >> 24L;37.288 - memset(inout+2064+4, 0, 8);37.289 - encode_L2_P(inout+12);37.290 - encode_L2_Q(inout+12);37.291 - break;37.292 - case MODE_2:37.293 - cd_build_address(inout, sectortype, address);37.294 - break;37.295 - case MODE_2_FORM_1:37.296 - result = build_edc(inout, 16, 16+8+2048-1);37.297 - inout[2072+0] = result >> 0L;37.298 - inout[2072+1] = result >> 8L;37.299 - inout[2072+2] = result >> 16L;37.300 - inout[2072+3] = result >> 24L;37.301 -37.302 - /* clear header for P/Q parity calculation */37.303 - inout[12] = 0;37.304 - inout[12+1] = 0;37.305 - inout[12+2] = 0;37.306 - inout[12+3] = 0;37.307 - encode_L2_P(inout+12);37.308 - encode_L2_Q(inout+12);37.309 - cd_build_address(inout, sectortype, address);37.310 - break;37.311 - case MODE_2_FORM_2:37.312 - cd_build_address(inout, sectortype, address);37.313 - result = build_edc(inout, 16, 16+8+2324-1);37.314 - inout[2348+0] = result >> 0L;37.315 - inout[2348+1] = result >> 8L;37.316 - inout[2348+2] = result >> 16L;37.317 - inout[2348+3] = result >> 24L;37.318 - break;37.319 - default:37.320 - return (-1);37.321 - }37.322 -37.323 - return (0);37.324 -}37.325 -37.326 -37.327 -/*--------------------------------------------------------------------------*/37.328 -#include "edc_encoder.h"37.329 -37.330 -static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);37.331 -37.332 -static int encode_L1_Q(unsigned char inout[L1_RAW + L1_Q])37.333 -{37.334 - unsigned char *Q;37.335 - int i;37.336 -37.337 - memmove(inout+L1_RAW/2+L1_Q, inout+L1_RAW/2, L1_RAW/2);37.338 - Q = inout + L1_RAW/2;37.339 -37.340 - memset(Q, 0, L1_Q);37.341 - for (i = 0; i < L1_RAW + L1_Q; i++) {37.342 - unsigned char data;37.343 -37.344 - if (i == L1_RAW/2) i += L1_Q;37.345 - data = inout[i];37.346 - if (data != 0) {37.347 - unsigned char base = rs_l12_log[data];37.348 -37.349 - Q[0] ^= rs_l12_alog[(base+AQ[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.350 - Q[1] ^= rs_l12_alog[(base+AQ[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.351 - Q[2] ^= rs_l12_alog[(base+AQ[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.352 - Q[3] ^= rs_l12_alog[(base+AQ[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.353 - }37.354 - }37.355 - return (0);37.356 -}37.357 -37.358 -static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P]);37.359 -37.360 -static int encode_L1_P(unsigned char inout[L1_RAW + L1_Q + L1_P])37.361 -{37.362 - unsigned char *P;37.363 - int i;37.364 -37.365 - P = inout + L1_RAW + L1_Q;37.366 -37.367 - memset(P, 0, L1_P);37.368 - for (i = 0; i < L2_RAW + L2_Q + L2_P; i++) {37.369 - unsigned char data;37.370 -37.371 - data = inout[i];37.372 - if (data != 0) {37.373 - unsigned char base = rs_l12_log[data];37.374 -37.375 - P[0] ^= rs_l12_alog[(base+AP[0][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.376 - P[1] ^= rs_l12_alog[(base+AP[1][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.377 - P[2] ^= rs_l12_alog[(base+AP[2][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.378 - P[3] ^= rs_l12_alog[(base+AP[3][i]) % (unsigned)((1 << RS_L12_BITS)-1)];37.379 - }37.380 - }37.381 - return (0);37.382 -}37.383 -37.384 -static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q]);37.385 -37.386 -static int decode_L1_Q(unsigned char inout[L1_RAW + L1_Q])37.387 -{37.388 - return (0);37.389 -}37.390 -37.391 -static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P]);37.392 -37.393 -static int decode_L1_P(unsigned char in[L1_RAW + L1_Q + L1_P])37.394 -{37.395 - return (0);37.396 -}37.397 -37.398 -int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q]);37.399 -37.400 -int decode_L2_Q(unsigned char inout[4 + L2_RAW + 12 + L2_Q])37.401 -{37.402 - return (0);37.403 -}37.404 -37.405 -int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P]);37.406 -37.407 -int decode_L2_P(unsigned char inout[4 + L2_RAW + 12 + L2_Q + L2_P])37.408 -{37.409 - return (0);37.410 -}37.411 -37.412 -static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q]);37.413 -37.414 -static int encode_LSUB_Q(unsigned char inout[LSUB_RAW + LSUB_Q])37.415 -{37.416 - unsigned char *Q;37.417 - int i;37.418 -37.419 - memmove(inout+LSUB_QRAW+LSUB_Q, inout+LSUB_QRAW, LSUB_RAW-LSUB_QRAW);37.420 - Q = inout + LSUB_QRAW;37.421 -37.422 - memset(Q, 0, LSUB_Q);37.423 -37.424 - for (i = 0; i < LSUB_QRAW; i++) {37.425 - unsigned char data;37.426 -37.427 - data = inout[i] & 0x3f;37.428 - if (data != 0) {37.429 - unsigned char base = rs_sub_rw_log[data];37.430 -37.431 - Q[0] ^= rs_sub_rw_alog[(base+SQ[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.432 - Q[1] ^= rs_sub_rw_alog[(base+SQ[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.433 - }37.434 - }37.435 - return (0);37.436 -}37.437 -37.438 -37.439 -static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);37.440 -37.441 -static int encode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])37.442 -{37.443 - unsigned char *P;37.444 - int i;37.445 -37.446 - P = inout + LSUB_RAW + LSUB_Q;37.447 -37.448 - memset(P, 0, LSUB_P);37.449 - for (i = 0; i < LSUB_RAW + LSUB_Q; i++) {37.450 - unsigned char data;37.451 -37.452 - data = inout[i] & 0x3f;37.453 - if (data != 0) {37.454 - unsigned char base = rs_sub_rw_log[data];37.455 -37.456 - P[0] ^= rs_sub_rw_alog[(base+SP[0][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.457 - P[1] ^= rs_sub_rw_alog[(base+SP[1][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.458 - P[2] ^= rs_sub_rw_alog[(base+SP[2][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.459 - P[3] ^= rs_sub_rw_alog[(base+SP[3][i]) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.460 - }37.461 - }37.462 - return (0);37.463 -}37.464 -37.465 -int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q]);37.466 -37.467 -int decode_LSUB_Q(unsigned char inout[LSUB_QRAW + LSUB_Q])37.468 -{37.469 - unsigned char Q[LSUB_Q];37.470 - int i;37.471 -37.472 - memset(Q, 0, LSUB_Q);37.473 - for (i = LSUB_QRAW + LSUB_Q -1; i>=0; i--) {37.474 - unsigned char data;37.475 -37.476 - data = inout[LSUB_QRAW + LSUB_Q -1 -i] & 0x3f;37.477 - if (data != 0) {37.478 - unsigned char base = rs_sub_rw_log[data];37.479 -37.480 - Q[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.481 - Q[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.482 - }37.483 - }37.484 - return (Q[0] != 0 || Q[1] != 0);37.485 -}37.486 -37.487 -int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P]);37.488 -37.489 -int decode_LSUB_P(unsigned char inout[LSUB_RAW + LSUB_Q + LSUB_P])37.490 -{37.491 - unsigned char P[LSUB_P];37.492 - int i;37.493 -37.494 - memset(P, 0, LSUB_P);37.495 - for (i = LSUB_RAW + LSUB_Q + LSUB_P-1; i>=0; i--) {37.496 - unsigned char data;37.497 -37.498 - data = inout[LSUB_RAW + LSUB_Q + LSUB_P -1 -i] & 0x3f;37.499 - if (data != 0) {37.500 - unsigned char base = rs_sub_rw_log[data];37.501 -37.502 - P[0] ^= rs_sub_rw_alog[(base+0*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.503 - P[1] ^= rs_sub_rw_alog[(base+1*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.504 - P[2] ^= rs_sub_rw_alog[(base+2*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.505 - P[3] ^= rs_sub_rw_alog[(base+3*i) % (unsigned)((1 << RS_SUB_RW_BITS)-1)];37.506 - }37.507 - }37.508 - return (P[0] != 0 || P[1] != 0 || P[2] != 0 || P[3] != 0);37.509 -}37.510 -37.511 -/* Layer 1 CIRC en/decoder */37.512 -#define MAX_L1_DEL1 237.513 -static unsigned char l1_delay_line1[MAX_L1_DEL1][L1_RAW];37.514 -#define MAX_L1_DEL2 10837.515 -static unsigned char l1_delay_line2[MAX_L1_DEL2][L1_RAW+L1_Q];37.516 -#define MAX_L1_DEL3 137.517 -static unsigned char l1_delay_line3[MAX_L1_DEL3][L1_RAW+L1_Q+L1_P];37.518 -static unsigned l1_del_index;37.519 -37.520 -int do_encode_L1(unsigned char in[L1_RAW*FRAMES_PER_SECTOR],37.521 - unsigned char out[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],37.522 - int delay1, int delay2, int delay3, int permute)37.523 -{37.524 - int i;37.525 -37.526 - for (i = 0; i < FRAMES_PER_SECTOR; i++) {37.527 - int j;37.528 - unsigned char t;37.529 -37.530 - if (in != out)37.531 - memcpy(out, in, L1_RAW);37.532 -37.533 - if (delay1) {37.534 - /* shift through delay line 1 */37.535 - for (j = 0; j < L1_RAW; j++) {37.536 - if (((j/4) % MAX_L1_DEL1) == 0) {37.537 - t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];37.538 - l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = out[j];37.539 - out[j] = t;37.540 - }37.541 - }37.542 - }37.543 -37.544 - if (permute) {37.545 - /* permute */37.546 - t = out[2]; out[2] = out[8]; out[8] = out[10]; out[10] = out[18];37.547 - out[18] = out[6]; out [6] = t;37.548 - t = out[3]; out[3] = out[9]; out[9] = out[11]; out[11] = out[19];37.549 - out[19] = out[7]; out [7] = t;37.550 - t = out[4]; out[4] = out[16]; out[16] = out[20]; out[20] = out[14];37.551 - out[14] = out[12]; out [12] = t;37.552 - t = out[5]; out[5] = out[17]; out[17] = out[21]; out[21] = out[15];37.553 - out[15] = out[13]; out [13] = t;37.554 - }37.555 -37.556 - /* build Q parity */37.557 - encode_L1_Q(out);37.558 -37.559 - if (delay2) {37.560 - /* shift through delay line 2 */37.561 - for (j = 0; j < L1_RAW+L1_Q; j++) {37.562 - if (j != 0) {37.563 - t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];37.564 - l1_delay_line2[(l1_del_index + j*4) % MAX_L1_DEL2][j] = out[j];37.565 - out[j] = t;37.566 - }37.567 - }37.568 - }37.569 -37.570 - /* build P parity */37.571 - encode_L1_P(out);37.572 -37.573 - if (delay3) {37.574 - /* shift through delay line 3 */37.575 - for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {37.576 - if (((j) & MAX_L1_DEL3) == 0) {37.577 - t = l1_delay_line3[0][j];37.578 - l1_delay_line3[0][j] = out[j];37.579 - out[j] = t;37.580 - }37.581 - }37.582 - }37.583 -37.584 - /* invert Q and P parity */37.585 - for (j = 0; j < L1_Q; j++)37.586 - out[j+12] = ~out[j+12];37.587 - for (j = 0; j < L1_P; j++)37.588 - out[j+28] = ~out[j+28];37.589 -37.590 - l1_del_index++;37.591 - out += L1_RAW+L1_Q+L1_P;37.592 - in += L1_RAW;37.593 - }37.594 - return (0);37.595 -}37.596 -37.597 -int do_decode_L1(unsigned char in[(L1_RAW+L1_Q+L1_P)*FRAMES_PER_SECTOR],37.598 - unsigned char out[L1_RAW*FRAMES_PER_SECTOR],37.599 - int delay1, int delay2, int delay3, int permute)37.600 -{37.601 - int i;37.602 -37.603 - for (i = 0; i < FRAMES_PER_SECTOR; i++) {37.604 - int j;37.605 - unsigned char t;37.606 -37.607 - if (delay3) {37.608 - /* shift through delay line 3 */37.609 - for (j = 0; j < L1_RAW+L1_Q+L1_P; j++) {37.610 - if (((j) & MAX_L1_DEL3) != 0) {37.611 - t = l1_delay_line3[0][j];37.612 - l1_delay_line3[0][j] = in[j];37.613 - in[j] = t;37.614 - }37.615 - }37.616 - }37.617 -37.618 - /* invert Q and P parity */37.619 - for (j = 0; j < L1_Q; j++)37.620 - in[j+12] = ~in[j+12];37.621 - for (j = 0; j < L1_P; j++)37.622 - in[j+28] = ~in[j+28];37.623 -37.624 - /* build P parity */37.625 - decode_L1_P(in);37.626 -37.627 - if (delay2) {37.628 - /* shift through delay line 2 */37.629 - for (j = 0; j < L1_RAW+L1_Q; j++) {37.630 - if (j != L1_RAW+L1_Q-1) {37.631 - t = l1_delay_line2[(l1_del_index) % MAX_L1_DEL2][j];37.632 - l1_delay_line2[(l1_del_index + (MAX_L1_DEL2 - j*4)) % MAX_L1_DEL2][j] = in[j];37.633 - in[j] = t;37.634 - }37.635 - }37.636 - }37.637 -37.638 - /* build Q parity */37.639 - decode_L1_Q(in);37.640 -37.641 - if (permute) {37.642 - /* permute */37.643 - t = in[2]; in[2] = in[6]; in[6] = in[18]; in[18] = in[10];37.644 - in[10] = in[8]; in [8] = t;37.645 - t = in[3]; in[3] = in[7]; in[7] = in[19]; in[19] = in[11];37.646 - in[11] = in[9]; in [9] = t;37.647 - t = in[4]; in[4] = in[12]; in[12] = in[14]; in[14] = in[20];37.648 - in[20] = in[16]; in [16] = t;37.649 - t = in[5]; in[5] = in[13]; in[13] = in[15]; in[15] = in[21];37.650 - in[21] = in[17]; in [17] = t;37.651 - }37.652 -37.653 - if (delay1) {37.654 - /* shift through delay line 1 */37.655 - for (j = 0; j < L1_RAW; j++) {37.656 - if (((j/4) % MAX_L1_DEL1) != 0) {37.657 - t = l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j];37.658 - l1_delay_line1[l1_del_index % (MAX_L1_DEL1)][j] = in[j];37.659 - in[j] = t;37.660 - }37.661 - }37.662 - }37.663 -37.664 - if (in != out)37.665 - memcpy(out, in, (L1_RAW));37.666 -37.667 - l1_del_index++;37.668 - in += L1_RAW+L1_Q+L1_P;37.669 - out += L1_RAW;37.670 - }37.671 - return (0);37.672 -}37.673 -37.674 -int do_decode_L2(unsigned char in[(L2_RAW+L2_Q+L2_P)],37.675 - unsigned char out[L2_RAW])37.676 -{37.677 - return (0);37.678 -}37.679 -37.680 -37.681 -37.682 -#define MAX_SUB_DEL 837.683 -static unsigned char sub_delay_line[MAX_SUB_DEL][LSUB_RAW+LSUB_Q+LSUB_P];37.684 -static unsigned sub_del_index;37.685 -37.686 -/* R-W Subchannel en/decoder */37.687 -37.688 -int do_encode_sub(unsigned char in[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],37.689 - unsigned char out[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],37.690 - int delay1, int permute)37.691 -{37.692 - int i;37.693 -37.694 - if (in == out) return -1;37.695 -37.696 - for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {37.697 - int j;37.698 - unsigned char t;37.699 -37.700 - memcpy(out, in, (LSUB_RAW));37.701 -37.702 - /* build Q parity */37.703 - encode_LSUB_Q(out);37.704 -37.705 - /* build P parity */37.706 - encode_LSUB_P(out);37.707 -37.708 - if (permute) {37.709 - /* permute */37.710 - t = out[1]; out[1] = out[18]; out[18] = t;37.711 - t = out[2]; out[2] = out[ 5]; out[ 5] = t;37.712 - t = out[3]; out[3] = out[23]; out[23] = t;37.713 - }37.714 -37.715 - if (delay1) {37.716 - /* shift through delay_line */37.717 - for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {37.718 - if ((j % MAX_SUB_DEL) != 0) {37.719 - t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];37.720 - sub_delay_line[(sub_del_index + j) % MAX_SUB_DEL][j] = out[j];37.721 - out[j] = t;37.722 - }37.723 - }37.724 - }37.725 - sub_del_index++;37.726 - out += LSUB_RAW+LSUB_Q+LSUB_P;37.727 - in += LSUB_RAW;37.728 - }37.729 - return (0);37.730 -}37.731 -37.732 -int do_decode_sub(unsigned char in[(LSUB_RAW+LSUB_Q+LSUB_P)*PACKETS_PER_SUBCHANNELFRAME],37.733 - unsigned char out[LSUB_RAW*PACKETS_PER_SUBCHANNELFRAME],37.734 - int delay1, int permute)37.735 -{37.736 - int i;37.737 -37.738 - if (in == out) return -1;37.739 -37.740 - for (i = 0; i < PACKETS_PER_SUBCHANNELFRAME; i++) {37.741 - int j;37.742 - unsigned char t;37.743 -37.744 - if (delay1) {37.745 - /* shift through delay_line */37.746 - for (j = 0; j < LSUB_RAW+LSUB_Q+LSUB_P; j++) {37.747 - if ((j % MAX_SUB_DEL) != MAX_SUB_DEL-1) {37.748 - t = sub_delay_line[(sub_del_index) % MAX_SUB_DEL][j];37.749 - sub_delay_line[(sub_del_index + (MAX_SUB_DEL - j)) % MAX_SUB_DEL][j] = in[j];37.750 - in[j] = t;37.751 - }37.752 - }37.753 - }37.754 -37.755 - if (permute) {37.756 - /* permute */37.757 - t = in[1]; in[1] = in[18]; in[18] = t;37.758 - t = in[2]; in[2] = in[ 5]; in[ 5] = t;37.759 - t = in[3]; in[3] = in[23]; in[23] = t;37.760 - }37.761 -37.762 - /* build P parity */37.763 - decode_LSUB_P(in);37.764 -37.765 - /* build Q parity */37.766 - decode_LSUB_Q(in);37.767 -37.768 - memcpy(out, in, LSUB_QRAW);37.769 - memcpy(out+LSUB_QRAW, in+LSUB_QRAW+LSUB_Q, LSUB_RAW-LSUB_QRAW);37.770 -37.771 - sub_del_index++;37.772 - in += LSUB_RAW+LSUB_Q+LSUB_P;37.773 - out += LSUB_RAW;37.774 - }37.775 - return (0);37.776 -}37.777 -37.778 -static int sectortype = MODE_0;37.779 -37.780 -int get_sector_type(void);37.781 -37.782 -int get_sector_type()37.783 -{37.784 - return (sectortype);37.785 -}37.786 -37.787 -int set_sector_type(int st);37.788 -37.789 -int set_sector_type(int st)37.790 -{37.791 - switch(st) {37.792 -37.793 - case MODE_0:37.794 - case MODE_1:37.795 - case MODE_2:37.796 - case MODE_2_FORM_1:37.797 - case MODE_2_FORM_2:37.798 - sectortype = st;37.799 - return 0;37.800 - default:37.801 - return -1;37.802 - }37.803 -}37.804 -
38.1 --- a/src/gdrom/edc_encoder.h Sun Jan 31 18:30:13 2010 +100038.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000038.3 @@ -1,47 +0,0 @@38.4 -/* @(#)encoder_tables 1.4 02/10/19 */38.5 -38.6 -/*38.7 - * This program is free software; you can redistribute it and/or modify38.8 - * it under the terms of the GNU General Public License version 238.9 - * as published by the Free Software Foundation.38.10 - *38.11 - * This program is distributed in the hope that it will be useful,38.12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of38.13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the38.14 - * GNU General Public License for more details.38.15 - *38.16 - * You should have received a copy of the GNU General Public License along with38.17 - * this program; see the file COPYING. If not, write to the Free Software38.18 - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.38.19 - */38.20 -38.21 -static const unsigned char rs_l12_alog[255] = {38.22 - 1, 2, 4, 8,16,32,64,128,29,58,116,232,205,135,19,38,76,152,45,90,180,117,234,201,143, 3, 6,12,24,48,96,192,157,39,78,156,37,74,148,53,106,212,181,119,238,193,159,35,70,140, 5,10,20,40,80,160,93,186,105,210,185,111,222,161,95,190,97,194,153,47,94,188,101,202,137,15,30,60,120,240,253,231,211,187,107,214,177,127,254,225,223,163,91,182,113,226,217,175,67,134,17,34,68,136,13,26,52,104,208,189,103,206,129,31,62,124,248,237,199,147,59,118,236,197,151,51,102,204,133,23,46,92,184,109,218,169,79,158,33,66,132,21,42,84,168,77,154,41,82,164,85,170,73,146,57,114,228,213,183,115,230,209,191,99,198,145,63,126,252,229,215,179,123,246,241,255,227,219,171,75,150,49,98,196,149,55,110,220,165,87,174,65,130,25,50,100,200,141, 7,14,28,56,112,224,221,167,83,166,81,162,89,178,121,242,249,239,195,155,43,86,172,69,138, 9,18,36,72,144,61,122,244,245,247,243,251,235,203,139,11,22,44,88,176,125,250,233,207,131,27,54,108,216,173,71,142,};38.23 -static const unsigned char rs_l12_log[256] = {38.24 - 0, 0, 1,25, 2,50,26,198, 3,223,51,238,27,104,199,75, 4,100,224,14,52,141,239,129,28,193,105,248,200, 8,76,113, 5,138,101,47,225,36,15,33,53,147,142,218,240,18,130,69,29,181,194,125,106,39,249,185,201,154, 9,120,77,228,114,166, 6,191,139,98,102,221,48,253,226,152,37,179,16,145,34,136,54,208,148,206,143,150,219,189,241,210,19,92,131,56,70,64,30,66,182,163,195,72,126,110,107,58,40,84,250,133,186,61,202,94,155,159,10,21,121,43,78,212,229,172,115,243,167,87, 7,112,192,247,140,128,99,13,103,74,222,237,49,197,254,24,227,165,153,119,38,184,180,124,17,68,146,217,35,32,137,46,55,63,209,91,149,188,207,205,144,135,151,178,220,252,190,97,242,86,211,171,20,42,93,158,132,60,57,83,71,109,65,162,31,45,67,216,183,123,164,118,196,23,73,236,127,12,111,246,108,161,59,82,41,157,85,170,251,96,134,177,187,204,62,90,203,89,95,176,156,169,160,81,11,245,22,235,122,117,44,215,79,174,213,233,230,231,173,232,116,214,244,234,168,80,88,175,};38.25 -static const unsigned char rs_sub_rw_alog[63] = {38.26 - 1, 2, 4, 8,16,32, 3, 6,12,24,48,35, 5,10,20,40,19,38,15,30,60,59,53,41,17,34, 7,14,28,56,51,37, 9,18,36,11,22,44,27,54,47,29,58,55,45,25,50,39,13,26,52,43,21,42,23,46,31,62,63,61,57,49,33,};38.27 -static const unsigned char rs_sub_rw_log[63] = {38.28 - 0, 0, 1, 6, 2,12, 7,26, 3,32,13,35, 8,48,27,18, 4,24,33,16,14,52,36,54, 9,45,49,38,28,41,19,56, 5,62,25,11,34,31,17,47,15,23,53,51,37,44,55,40,10,61,46,30,50,22,39,43,29,60,42,21,20,59,57,};38.29 -static const unsigned char SQ[2][2] = {38.30 -{26,6,},38.31 -{7,1,},38.32 -};38.33 -static const unsigned char SP[4][20] = {38.34 -{57,38,44,29,17,57,53,58,60,39,12,38,18,41,6,25,39,37,5,18,},38.35 -{38,62,42,13,30,11,46,5,54,26,12,49,48,46,8,50,28,9,12,39,},38.36 -{32,18,41,49,52,62,38,36,39,58,37,24,34,51,51,27,28,36,22,21,},38.37 -{44,50,35,23,0,59,1,3,45,18,44,24,47,12,31,45,43,11,24,6,},38.38 -};38.39 -static const unsigned char AQ[4][24] = {38.40 -{58,152,173,95,88,43,134,205,143,131,163,75,37,109,194,159,168,227,153,59,101,},38.41 -{30,214,148,138,112,154,157,96,49,198,189,249,83,23,70,237,70,41,47,52,125,247,},38.42 -{162,244,13,171,213,236,71,177,253,162,59,78,46,68,238,112,147,197,115,200,117,15,236,},38.43 -{158,179,101,94,49,140,211,149,137,169,81,6,33,30,27,24,21,18,15,12,9,6,3,0,},38.44 -};38.45 -static const unsigned char AP[4][32] = {38.46 -{140,143,52,103,249,142,180,197,5,155,153,132,143,244,101,76,102,155,203,104,58,152,173,95,88,43,134,205,143,131,163,75,},38.47 -{104,97,17,162,205,252,218,199,202,41,136,106,119,238,193,103,123,242,83,178,30,214,148,138,112,154,157,96,49,198,189,249,},38.48 -{240,119,29,185,67,11,131,40,7,41,80,147,151,17,245,253,208,66,228,116,162,244,13,171,213,236,71,177,253,162,59,78,},38.49 -{149,58,109,0,148,186,203,11,161,159,138,149,250,107,82,108,161,209,110,64,158,179,101,94,49,140,211,149,137,169,81,6,},38.50 -};
39.1 --- a/src/gdrom/edc_l2sq.h Sun Jan 31 18:30:13 2010 +100039.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000039.3 @@ -1,1180 +0,0 @@39.4 -/* @(#)l2sq_table 1.2 02/10/19 Copyright 2002 J. Schilling */39.5 -39.6 -/*39.7 - * This program is free software; you can redistribute it and/or modify39.8 - * it under the terms of the GNU General Public License version 239.9 - * as published by the Free Software Foundation.39.10 - *39.11 - * This program is distributed in the hope that it will be useful,39.12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of39.13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the39.14 - * GNU General Public License for more details.39.15 - *39.16 - * You should have received a copy of the GNU General Public License along with39.17 - * this program; see the file COPYING. If not, write to the Free Software39.18 - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.39.19 - */39.20 -39.21 -static const unsigned short L2sq[43][256] = {39.22 -{0,44719,16707,61420,33414,11305,50117,28010,6417,47038,39.23 - 22610,63229,39831,13624,56020,29819,12834,40077,29537,56782,39.24 - 45220,7691,61927,24392,11059,34204,27248,50399,43445,1818,39.25 - 59638,18009,25668,51947,9479,35752,59074,18541,42881,2350,39.26 - 32085,54266,15382,37561,65491,20860,48784,4159,22118,63689,39.27 - 5925,47498,54496,31311,38307,15116,20343,57816,3636,41115,39.28 - 52721,25438,36018,8733,51336,26151,35275,10084,18958,58529,39.29 - 2893,42466,53657,32566,37082,15989,21279,64944,4700,48371,39.30 - 64170,21509,48105,5446,30764,54915,14703,38848,58299,19732,39.31 - 41720,3159,24893,53138,8318,36561,44236,611,60815,17184,39.32 - 11850,32997,28425,49574,46557,7026,62622,23089,14171,39412,39.33 - 30232,55479,40686,12353,57261,28930,7272,45767,23851,62340,39.34 - 34815,10576,50876,26643,1401,43990,17466,60053,36109,9122,39.35 - 52302,25313,3979,41252,20168,57447,37916,15027,54623,31728,39.36 - 5786,47157,22489,63862,48943,4480,65132,20675,15785,37638,39.37 - 31978,53829,42558,2193,59261,18898,9400,35351,26107,52052,39.38 - 59721,18406,43018,1701,27599,50528,10892,33827,61528,24311,39.39 - 45339,8116,29406,56433,13213,40242,56171,30148,39464,13447,39.40 - 23021,63298,6318,46593,49786,27861,33593,11670,16636,61011,39.41 - 447,44816,17797,60202,1222,43625,50947,27052,34368,10479,39.42 - 23700,62011,7639,45944,56850,28861,40785,12798,30631,55560,39.43 - 14052,38987,62753,23438,46178,6861,28342,49177,12277,33114,39.44 - 60464,17055,44403,988,8641,36718,24706,52781,41799,3560,39.45 - 57860,19627,14544,38527,31123,55100,47702,5369,64277,21946,39.46 - 5091,48460,21152,64527,37221,16330,53286,32393,2802,42077,39.47 - 19377,58654,34932,9947,51511,26520,39.48 -},39.49 -{0,55768,44973,30325,17223,39583,60650,13618,34446,24406,39.50 - 10531,61691,50633,7185,27236,46012,4353,51417,48812,26484,39.51 - 21062,35742,65003,9267,38799,20055,14370,57850,54472,3344,39.52 - 31589,41661,8706,64474,36271,21623,24901,47261,52968,5936,39.53 - 42124,32084,2849,54009,59339,15891,18534,37310,13059,60123,39.54 - 40110,17782,28740,43420,57321,1585,46477,27733,6688,50168,39.55 - 63178,12050,22887,32959,17412,40412,60329,12913,1859,56987,39.56 - 43246,28982,49802,6994,27943,46335,33229,22549,11872,63416,39.57 - 21765,36061,64168,9072,5698,53146,47599,24631,54155,2643,39.58 - 31782,42494,37068,18708,16225,59065,26118,49118,51627,4211,39.59 - 9537,64665,35564,21300,57480,14672,20261,38653,41935,31255,39.60 - 3170,54714,30471,44767,55466,370,13376,60824,39917,16949,39.61 - 61833,10321,24100,34812,45774,27414,7523,50363,34824,20944,39.62 - 10149,65149,52047,4759,25826,48442,3718,55134,41259,30963,39.63 - 19905,37913,57964,15284,39177,16593,13988,61308,55886,918,39.64 - 30179,44091,8071,50783,45098,27122,23744,34072,62317,10933,39.65 - 43530,29650,1447,56447,59725,12437,18144,40760,11396,62812,39.66 - 33577,23281,28611,46619,49262,6582,47883,25299,5286,52606,39.67 - 63564,8596,22497,36409,15749,58461,37416,19440,32450,42778,39.68 - 53615,2231,52236,5588,25505,47737,36683,22163,8422,63806,39.69 - 19074,37722,58671,15607,2501,53277,42600,32688,56589,1237,39.70 - 29344,43896,40522,18322,12775,59455,23427,33371,62510,11766,39.71 - 6340,49436,46953,28337,60942,14294,16803,39035,44361,29841,39.72 - 740,56124,26752,45400,50989,7925,11207,61983,33898,23986,39.73 - 65295,9943,20642,35194,48200,26000,5093,51773,31105,41049,39.74 - 54828,4084,15046,58142,38251,19635,39.75 -},39.76 -{0,27757,55514,46263,44457,49604,30067,6430,18255,11042,39.77 - 40853,62456,60134,34443,12860,24145,36510,58099,22084,14889,39.78 - 9015,20314,64493,38784,51665,42428,4363,32102,25720,2069,39.79 - 48290,53455,289,27980,55803,46486,44168,49381,29778,6207,39.80 - 18030,10755,40628,62169,60359,34730,13085,24432,36799,58322,39.81 - 22373,15112,8726,20091,64204,38561,51440,42141,4138,31815,39.82 - 25945,2356,48515,53742,578,28207,55960,46837,45035,50054,39.83 - 30513,7004,17677,10592,40407,61882,59556,33993,12414,23571,39.84 - 36060,57521,21510,14443,8565,19736,63919,38338,52115,43006,39.85 - 4937,32548,26170,2647,48864,53901,867,28430,56249,47060,39.86 - 44746,49831,30224,6781,17452,10305,40182,61595,59781,34280,39.87 - 12639,23858,36349,57744,21799,14666,8276,19513,63630,38115,39.88 - 51890,42719,4712,32261,26395,2934,49089,54188,1156,26857,39.89 - 56414,45107,43309,50496,29175,7578,17355,12198,39697,63356,39.90 - 61026,33295,14008,23253,35354,58999,21184,16045,10163,19422,39.91 - 65385,37636,52565,41272,5519,31202,24828,3217,47142,54347,39.92 - 1445,27080,56703,45330,43020,50273,28886,7355,17130,11911,39.93 - 39472,63069,61251,33582,14233,23540,35643,59222,21473,16268,39.94 - 9874,19199,65096,37413,52340,40985,5294,30915,25053,3504,39.95 - 47367,54634,1734,27307,56860,45681,43887,50946,29621,8152,39.96 - 16777,11748,39251,62782,60448,32845,13562,22679,34904,58421,39.97 - 20610,15599,9713,18844,64811,37190,53015,41850,6093,31648,39.98 - 25278,3795,47716,54793,2023,27530,57149,45904,43598,50723,39.99 - 29332,7929,16552,11461,39026,62495,60673,33132,13787,22966,39.100 - 35193,58644,20899,15822,9424,18621,64522,36967,52790,41563,39.101 - 5868,31361,25503,4082,47941,55080,39.102 -},39.103 -{0,47289,28015,54742,56030,25191,47025,3848,43425,4376,39.104 - 50382,31863,29567,52166,7696,42665,20319,63462,8752,39561,39.105 - 38273,11576,63726,16471,59134,24135,35729,13096,15392,33945,39.106 - 20815,59894,40638,9735,62417,19304,17504,64729,10511,37302,39.107 - 14111,36774,23152,58057,60865,21880,32942,14359,53729,26968,39.108 - 48270,1079,2879,45958,26192,57065,30784,49401,5423,44438,39.109 - 41630,6695,53233,30536,8545,39384,19470,62647,64447,17158,39.110 - 38608,11881,35008,12409,58799,23830,21022,60071,16241,34760,39.111 - 28222,54919,849,48104,46304,3161,55695,24886,51103,32550,39.112 - 43760,4681,7489,42488,28718,51351,49119,1894,53936,27145,39.113 - 25857,56760,2158,45271,5758,44743,31505,50088,52384,29721,39.114 - 41423,6518,61568,18489,40431,9558,10846,37607,18225,65416,39.115 - 22817,57752,13390,36087,33791,15174,61072,22057,17090,64123,39.116 - 12205,38676,38940,8357,62835,19914,60259,21466,34316,16053,39.117 - 12733,35076,23762,58475,3485,46372,24818,55371,55107,28666,39.118 - 47660,661,42044,7301,51539,29162,32482,50779,5005,43828,39.119 - 56444,25797,45331,2474,1698,48667,27597,54132,30173,52580,39.120 - 6322,40971,44803,6074,49772,31445,37667,11162,65100,18165,39.121 - 18941,61764,9362,39979,14978,33339,22509,61268,57436,22757,39.122 - 36147,13706,25507,56090,3788,46709,47485,452,54290,27819,39.123 - 51714,29371,42861,8148,4316,43109,32179,50442,11516,37957,39.124 - 16787,63786,63010,20123,39757,9204,34141,15844,59442,20619,39.125 - 24451,59194,13036,35413,64797,17828,36978,10443,10179,40826,39.126 - 19116,61973,21692,60421,14803,33130,36450,14043,58125,23476,39.127 - 45634,2811,57133,26516,26780,53285,1523,48458,7139,41818,39.128 - 30348,52789,49469,31108,44114,5355,39.129 -},39.130 -{0,53971,47547,27496,28523,48568,54992,1027,57046,3077,39.131 - 26477,46526,45501,25454,2054,56021,41393,29538,6154,51929,39.132 - 52954,7177,30561,42418,32615,44468,50908,5135,4108,49887,39.133 - 43447,31588,24447,36268,59076,13335,12308,58055,35247,23420,39.134 - 33193,21370,14354,60097,61122,15377,22393,34218,65230,11293,39.135 - 18293,38310,37285,17270,10270,64205,8216,62155,39331,19312,39.136 - 20339,40352,63176,9243,48894,27693,1861,54678,53653,838,39.137 - 26670,47869,24616,45819,55699,2880,3907,56720,46840,25643,39.138 - 8015,52636,42740,29735,28708,41719,51615,6988,49561,4938,39.139 - 30754,43761,44786,31777,5961,50586,57729,13138,22586,35561,39.140 - 36586,23609,14161,58754,16215,60804,34540,21567,20540,33519,39.141 - 59783,15188,16432,37603,63883,11096,12123,64904,38624,17459,39.142 - 40678,19509,10077,62862,61837,9054,18486,39653,25057,45874,39.143 - 55386,2697,3722,56409,46897,26082,48951,28132,1676,54367,39.144 - 53340,655,27111,47924,49232,4739,31211,43832,44859,32232,39.145 - 5760,50259,7814,52309,42813,30190,29165,41790,51286,6789,39.146 - 16030,60493,34597,22006,20981,33574,59470,15005,57416,12955,39.147 - 23027,35616,36643,24048,13976,58443,40751,19964,9876,62535,39.148 - 61508,8855,18943,39724,16889,37674,63554,10897,11922,64577,39.149 - 38697,17914,57119,3532,26276,46199,45172,25255,2511,56092,39.150 - 457,54042,47218,27297,28322,48241,55065,1482,32430,44157,39.151 - 50965,5574,4549,49942,43134,31405,41080,29355,6595,51984,39.152 - 53011,7616,30376,42107,32864,21171,14811,60168,61195,15832,39.153 - 22192,33891,24246,35941,59149,13790,12765,58126,34918,23221,39.154 - 8657,62210,39018,19129,20154,40041,63233,9682,65287,11732,39.155 - 18108,37999,36972,17087,10711,64260,39.156 -},39.157 -{0,59366,54225,13367,48063,23641,26734,36744,27491,35973,39.158 - 47282,24404,53468,14138,781,58603,54982,12576,1303,58097,39.159 - 28025,35487,48808,22862,48549,23107,28276,35218,1562,57852,39.160 - 54731,12845,45457,22135,25152,34214,2606,60872,55807,15897,39.161 - 56050,15636,2339,61125,24909,34475,45724,21882,26455,32945,39.162 - 46214,21344,56552,15118,3897,59615,3124,60370,57317,14339,39.163 - 46987,20589,25690,33724,32575,39129,44270,19208,50304,9062,39.164 - 5969,61623,5212,62394,51085,8299,45027,18437,31794,39892,39.165 - 43513,19999,31272,40398,4678,62880,49559,9841,49818,9596,39.166 - 4427,63149,31013,40643,43764,19730,52910,10568,7551,64153,39.167 - 29969,37623,42688,16678,42445,16939,30236,37370,7794,63892,39.168 - 52643,10821,6248,65422,52153,11359,41943,17457,28678,38880,39.169 - 29451,38125,41178,18236,51380,12114,7013,64643,65150,6552,39.170 - 11695,51785,17857,41511,38416,29174,38173,29435,18124,41258,39.171 - 11938,51524,64883,6805,10424,53086,64361,7311,37639,29921,39.172 - 16598,42800,17371,42045,36874,30700,63588,8066,11189,52307,39.173 - 20463,43017,39998,31704,62544,5046,10113,49255,9356,50026,39.174 - 63325,4283,40755,30933,19682,43780,39209,32463,19192,44318,39.175 - 8854,50544,61767,5793,62026,5548,8603,50813,18933,44563,39.176 - 39460,32194,33089,26279,21136,46454,15102,56600,59695,3785,39.177 - 59938,3524,14835,56853,20893,46715,33356,26026,22407,45153,39.178 - 33878,25520,60472,3038,16361,55311,15588,56066,61237,2259,39.179 - 34651,24765,21642,45932,12496,55094,58113,1255,35695,27785,39.180 - 22718,48984,23475,48213,34914,28548,57356,2026,13277,54331,39.181 - 58902,496,13767,53793,23977,47695,36472,27038,36213,27283,39.182 - 24228,47426,14026,53548,58651,765,39.183 -},39.184 -{0,29554,59108,38294,53717,41639,14129,17475,49079,52421,39.185 - 22867,10785,28258,7440,34950,64500,25459,4097,34199,63205,39.186 - 45734,49620,21570,10032,56516,44982,14880,18770,3345,32355,39.187 - 60405,39047,50918,46484,8194,21360,5939,25665,61911,33445,39.188 - 31057,2595,40885,60615,43140,56310,20064,15634,42389,55015,39.189 - 17265,12291,29760,1842,37540,57814,6690,26960,64710,36788,39.190 - 52215,47237,11539,24161,37329,58019,30517,1095,16388,13174,39.191 - 42720,54674,11878,23828,51330,48112,65459,36033,6487,27173,39.192 - 62114,33232,5190,26420,9079,20485,50579,46817,19733,15975,39.193 - 44017,55427,40128,61362,31268,2390,22327,9285,45523,49825,39.194 - 34530,62864,24582,4980,59520,39922,3684,32022,14677,18983,39.195 - 57265,44227,13380,18230,53920,41426,58769,38627,885,28679,39.196 - 35827,63617,27927,7781,23078,10580,48322,53168,16319,19661,39.197 - 55643,43561,61034,40216,2190,31740,32776,62330,26348,5534,39.198 - 20957,8879,46905,50251,23756,12222,47656,51546,36121,65131,39.199 - 27645,6287,58235,36873,1439,30445,12974,16860,54346,42808,39.200 - 63833,35371,8125,27855,10380,23550,52840,48410,18158,13724,39.201 - 40970,54136,38715,58441,29151,685,39466,59736,31950,4028,39.202 - 19455,14477,44315,56937,9629,22255,50041,45067,62536,34618,39.203 - 4780,25054,44654,56604,18570,15352,32699,3273,39263,59949,39.204 - 4569,25259,63293,33871,49164,45950,9960,21914,52509,48751,39.205 - 11257,22667,7368,28602,64044,35166,29354,472,37966,59196,39.206 - 41855,53261,17819,14057,26760,7162,36460,64798,47453,51759,39.207 - 24505,11467,55103,42061,12763,17065,1770,30104,57358,37756,39.208 - 3067,30857,60703,40557,55854,43356,15562,20408,46156,51006,39.209 - 21160,8666,26009,5867,33661,61455,39.210 -},39.211 -{0,14648,29296,19272,58592,56792,38544,44968,54749,60645,39.212 - 42925,40597,12605,2053,17229,31349,47015,36511,50647,64751,39.213 - 21319,27263,8503,6159,25210,23362,4106,10546,34458,49058,39.214 - 62698,52690,29523,19051,291,14363,38835,44683,58819,56571,39.215 - 42638,40886,54526,60870,17006,31574,12318,2342,50420,64972,39.216 - 46724,36796,8212,6444,21092,27484,4393,10257,25433,23137,39.217 - 62921,52465,34745,48769,59046,57246,38102,44526,582,15230,39.218 - 28726,18702,13179,2627,16651,30771,55195,61091,42475,40147,39.219 - 20737,26681,9073,6729,46561,36057,51089,65193,34012,48612,39.220 - 63148,53140,24636,22788,4684,11124,38389,44237,59269,57021,39.221 - 28949,18477,869,14941,16424,30992,12888,2912,42184,40432,39.222 - 54968,61312,8786,7018,20514,26906,50866,65418,46274,36346,39.223 - 63375,52919,34303,48327,4975,10839,24863,22567,53585,59497,39.224 - 41761,39449,13745,3209,18369,32505,1164,15796,30460,20420,39.225 - 57452,55636,37404,43812,26358,24526,5254,11710,33302,47918,39.226 - 61542,51550,45867,35347,49499,63587,22475,28403,9659,7299,39.227 - 41474,39738,53362,59722,18146,32730,13458,3498,30687,20199,39.228 - 1455,15511,37695,43527,57679,55415,5541,11421,26581,24301,39.229 - 61765,51325,33589,47629,49272,63808,45576,35632,9368,7584,39.230 - 22248,28624,14327,3791,17799,31935,54039,59951,41319,39007,39.231 - 57898,56082,36954,43362,1738,16370,29882,19842,32848,47464,39.232 - 61984,51992,25776,23944,5824,12280,21901,27829,10237,7877,39.233 - 45421,34901,49949,64037,17572,32156,14036,4076,41028,39292,39.234 - 53812,60172,37241,43073,58121,55857,30105,19617,2025,16081,39.235 - 62211,51771,33139,47179,6115,11995,26003,23723,9950,8166,39.236 - 21678,28054,49726,64262,45134,35190,39.237 -},39.238 -{0,7197,14394,9255,28788,27753,18510,21587,57576,64757,39.239 - 55506,50383,37020,35969,43174,46267,56781,49616,58871,63978,39.240 - 44473,45476,38275,35230,15653,8504,1311,6402,19793,20812,39.241 - 30059,26998,42887,48026,40893,33696,55283,52206,61385,62420,39.242 - 18287,23410,32597,25416,14107,11014,3873,4924,31306,26199,39.243 - 17008,24173,2622,5667,12804,11801,39586,34495,41624,48773,39.244 - 60118,63179,53996,52977,21267,20238,27433,30516,9063,16250,39.245 - 7005,1856,46075,45030,35777,38876,50063,57234,64437,59304,39.246 - 36574,37571,46820,43769,65194,58039,50832,55949,28214,29227,39.247 - 22028,18961,7746,607,9848,14949,62612,59529,52398,53427,39.248 - 34016,39165,48346,41159,5244,2145,11334,12379,25608,30741,39.249 - 23602,16431,10585,13636,4451,3454,22829,17712,24855,32010,39.250 - 51633,54700,61835,60822,47557,42456,33279,40418,42534,47675,39.251 - 40476,33281,54866,51791,61032,62069,18126,23251,32500,25321,39.252 - 14010,10919,3712,4765,31723,26614,17361,24524,2975,6018,39.253 - 13221,12216,39683,34590,41785,48932,60279,63338,54093,53072,39.254 - 417,7612,14747,9606,29141,28104,18927,22002,57673,64852,39.255 - 55667,50542,37181,36128,43271,46362,56428,49265,58454,63563,39.256 - 44056,45061,37922,34879,15492,8345,1214,6307,19696,20717,39.257 - 29898,26839,62773,59688,52495,53522,34113,39260,48507,41318,39.258 - 5597,2496,11751,12794,26025,31156,23955,16782,10488,13541,39.259 - 4290,3295,22668,17553,24758,31915,51216,54285,61482,60471,39.260 - 47204,42105,32862,40003,21170,20143,27272,30357,8902,16091,39.261 - 6908,1761,45658,44615,35424,38525,49710,56883,64020,58889,39.262 - 36735,37730,46917,43864,65291,58134,50993,56108,28567,29578,39.263 - 22445,19376,8163,1022,10201,15300,39.264 -},39.265 -{0,32897,7455,40350,14910,47807,10017,42912,29820,62717,39.266 - 26979,59874,20034,52931,21341,54236,59640,26745,62951,30054,39.267 - 53958,21063,53209,20312,40068,7173,33179,282,42682,9787,39.268 - 48037,15140,52717,19820,53490,20595,63443,30546,60108,27213,39.269 - 47505,14608,42126,9231,33711,814,40624,7729,9493,42388,39.270 - 14346,47243,7979,40874,564,33461,20841,53736,19574,52471,39.271 - 27479,60374,30280,63177,34759,1862,39640,6745,48633,15736,39.272 - 41190,8295,62395,29498,61092,28197,51589,18692,54426,21531,39.273 - 28479,61374,29216,62113,21761,54656,18462,51359,6979,39874,39.274 - 1628,34525,8573,41468,15458,48355,18986,51883,22325,55220,39.275 - 28692,61589,27915,60810,15958,48855,9033,41928,1128,34025,39.276 - 6519,39414,41682,8787,49101,16204,39148,6253,34291,1394,39.277 - 54958,22063,52145,19248,60560,27665,61839,28942,5011,37650,39.278 - 3724,36365,10669,43308,13490,46131,26607,59246,31472,64113,39.279 - 24017,56656,16590,49231,64363,31722,58996,26357,49493,16852,39.280 - 56394,23755,36631,3990,37384,4745,46377,13736,43062,10423,39.281 - 56958,24319,50017,17376,58432,25793,63839,31198,43522,10883,39.282 - 46877,14236,36924,4285,36131,3490,13958,46599,11161,43800,39.283 - 3256,35897,4519,37158,17146,49787,24549,57188,30916,63557,39.284 - 26075,58714,37972,5333,35147,2506,44650,12011,45941,13300,39.285 - 57384,24745,64823,32182,55830,23191,50953,18312,31916,64557,39.286 - 25011,57650,18066,50707,23437,56076,2256,34897,5583,38222,39.287 - 13038,45679,12273,44912,22969,55608,17574,50215,25479,58118,39.288 - 32408,65049,11717,44356,12506,45147,6139,38778,2788,35429,39.289 - 45377,12736,44126,11487,35711,3070,38496,5857,50493,17852,39.290 - 55330,22691,65283,32642,57884,25245,39.291 -},39.292 -{0,52943,33155,20300,7963,53716,40600,20567,15926,61689,39.293 - 49077,29050,8493,61410,41134,28257,31852,45731,65007,13088,39.294 - 25463,44472,58100,11323,16986,35989,50137,3350,23873,37774,39.295 - 56514,4621,63704,13847,31067,46996,59331,10508,26176,43151,39.296 - 50926,2081,18285,35234,55797,5946,22646,38585,33972,19067,39.297 - 1335,52216,39855,21856,6700,54499,47746,29773,15105,62926,39.298 - 42393,27478,9242,60117,60845,9058,27694,41697,62134,15481,39.299 - 29493,48634,54171,7508,21016,40151,52352,591,19715,33740,39.300 - 37313,24334,4162,56973,36570,16405,3929,49558,45047,24888,39.301 - 11892,57531,45292,32291,12655,65440,5493,56250,38134,23097,39.302 - 2670,50337,35821,17698,11075,58764,43712,25615,13400,64151,39.303 - 46555,31508,26905,42966,59546,9813,30210,47309,63361,14670,39.304 - 22319,39392,54956,6243,18484,34555,51639,1912,51015,2440,39.305 - 18116,34827,55388,5779,23007,38672,63857,14270,30962,46653,39.306 - 58986,10405,26601,43302,47915,30180,15016,62567,42032,27391,39.307 - 9651,60284,34077,19410,1182,51793,39430,21705,7045,54602,39.308 - 16287,61776,48668,28883,8324,61003,41223,28616,425,53094,39.309 - 32810,20197,7858,53373,40753,20990,17395,36156,49776,3263,39.310 - 23784,37415,56683,5028,32197,45834,64582,12937,25310,44049,39.311 - 58205,11666,10986,58405,43881,26022,13809,64318,46194,31421,39.312 - 5340,55827,38239,23440,3015,50440,35396,17547,22150,38985,39.313 - 55045,6602,18845,34642,51230,1745,26800,42623,59699,10236,39.314 - 30635,47460,63016,14567,53810,7421,21425,40318,52521,998,39.315 - 19626,33381,60420,8907,28039,41800,62239,15824,29340,48211,39.316 - 44638,24721,12253,57618,45381,32650,12486,65033,36968,24231,39.317 - 4587,57124,36723,16828,3824,49215,39.318 -},39.319 -{0,59880,53197,9765,33671,27247,19530,42402,6931,62203,39.320 - 54494,15670,39060,29052,22361,48817,13862,57294,63979,4099,39.321 - 46497,23625,31340,37764,11573,50397,58104,2832,44722,18266,39.322 - 24959,34967,27724,34212,41857,19049,61387,1571,8198,51694,39.323 - 30559,40631,47250,20858,62680,7472,15125,54013,23146,45954,39.324 - 38311,31823,55789,12293,5664,65480,16761,43153,36532,26460,39.325 - 49918,11030,3379,58587,55448,12656,5973,65213,23327,45815,39.326 - 38098,32058,50059,10851,3142,58798,16396,43492,36801,26153,39.327 - 61118,1878,8563,51355,27961,34001,41716,19228,62893,7237,39.328 - 14944,54152,30250,40898,47591,20495,46292,23868,31513,37617,39.329 - 14163,57019,63646,4470,44999,17967,24586,35298,11328,50600,39.330 - 58253,2661,33522,27418,19775,42199,373,59549,52920,10064,39.331 - 39393,28681,22060,49092,6758,62350,54699,15427,44333,17605,39.332 - 25312,35592,11946,51010,57703,2191,46654,24534,31219,36891,39.333 - 13753,56401,64116,5020,39691,29411,21702,48430,6284,61796,39.334 - 55105,16041,32792,27120,20437,42557,927,60023,52306,9658,39.335 - 49505,10377,3756,59204,17126,43790,36139,25795,55922,13210,39.336 - 5567,64599,23029,45085,38456,32720,63303,7855,14474,53602,39.337 - 29888,40232,47885,21221,60500,1468,9113,51825,28627,34363,39.338 - 40990,18934,30133,40029,47736,21392,63026,8154,14847,53271,39.339 - 28326,34638,41323,18563,60705,1225,8940,51972,17299,43643,39.340 - 35934,26038,49172,10748,4057,58929,22656,45416,38733,32421,39.341 - 56071,13039,5322,64802,6649,61457,54836,16348,39550,29590,39.342 - 21939,48219,746,60162,52519,9423,33133,26757,20128,42824,39.343 - 12255,50743,57362,2554,44120,17840,25493,35453,13516,56612,39.344 - 64257,4841,46923,24227,30854,37230,39.345 -},39.346 -{0,29813,59626,40095,52681,47548,9507,20822,34703,62458,39.347 - 28517,6928,19014,15923,41644,55001,4867,26486,64489,36764,39.348 - 57034,43711,13856,16981,38028,57593,31846,2067,22853,11568,39.349 - 45487,50650,9734,21107,52972,47769,60367,40890,805,30544,39.350 - 41353,54780,18787,15638,27712,6197,33962,61663,13573,16752,39.351 - 56815,43418,63692,36025,4134,25683,45706,50943,23136,11797,39.352 - 32579,2870,38825,58332,19468,14457,42214,53395,33221,62896,39.353 - 26927,7514,52099,49142,9065,22300,1610,29247,61088,39637,39.354 - 24335,11130,47077,50064,37574,59059,31276,3673,55424,44277,39.355 - 12394,17439,5449,24892,64931,35286,27146,7807,33504,63125,39.356 - 42947,54198,20265,15196,60805,39408,1391,28954,8268,21561,39.357 - 51366,48339,30985,3452,37347,58774,46272,49333,23594,10335,39.358 - 65158,35571,5740,25113,13135,18234,56229,45008,38936,60525,39.359 - 28914,1159,21969,8612,48443,51534,8087,27618,63357,33544,39.360 - 53854,42539,15028,20161,35611,65390,25585,6020,18130,12967,39.361 - 44600,55885,3220,30945,58494,36875,49501,46376,10679,24002,39.362 - 48670,51819,22260,8833,29655,1954,39741,61256,14737,19940,39.363 - 53627,42254,62552,32813,7346,26823,44317,55656,17911,12674,39.364 - 24788,5281,34878,64587,10898,24295,49784,46605,59227,37678,39.365 - 4017,31684,54292,41057,15614,18571,6621,28072,61751,34114,39.366 - 21403,10222,47985,52996,40530,59943,30392,717,50967,45922,39.367 - 12285,23432,2782,32427,57908,38465,16536,13549,43122,56327,39.368 - 36177,63780,26043,4558,61970,34407,6904,28301,16347,19374,39.369 - 55089,41796,30109,488,40311,59650,47188,52257,20670,9419,39.370 - 57617,38244,2555,32142,11480,22701,50226,45127,26270,4843,39.371 - 36468,64001,43863,57122,17341,14280,39.372 -},39.373 -{0,46261,30071,49602,60142,24155,40857,11052,51649,32116,39.374 - 48310,2051,9007,38810,22104,58093,36767,15146,64232,20061,39.375 - 25969,53700,4102,42163,18014,62187,13097,34716,44208,6149,39.376 - 55751,28018,803,46998,30292,49889,59853,23928,40122,10255,39.377 - 51938,32343,49045,2848,8204,38073,21883,57806,36028,14345,39.378 - 63947,19838,26194,53991,4901,42896,17789,61896,12298,33983,39.379 - 44947,6950,56036,28241,1606,45811,29489,51076,60584,22557,39.380 - 39391,11626,53127,31538,47856,3653,9577,37340,20510,58539,39.381 - 35289,15724,64686,18459,25399,55170,5696,41717,16408,62637,39.382 - 13679,33242,43766,7747,57217,27444,1381,45520,28690,50343,39.383 - 61323,23358,39676,11849,52388,30737,47571,3430,9802,37631,39.384 - 21309,59272,35578,15951,65421,19256,24596,54433,5475,41430,39.385 - 17211,63374,13900,33529,43477,7520,56482,26647,3212,47161,39.386 - 31227,52558,58978,21207,37653,10144,50509,29176,45114,1167,39.387 - 12195,39702,23252,61025,33555,14246,63076,17105,27133,56648,39.388 - 7306,43071,19154,65127,16293,35600,41020,5257,54603,25086,39.389 - 4015,47898,31448,52845,58689,20980,36918,9347,50798,29403,39.390 - 45849,1964,11392,38965,23031,60738,32816,13445,62791,16882,39.391 - 27358,56939,8105,43804,18929,64836,15494,34867,41759,6058,39.392 - 54888,25309,2762,48767,32701,51976,57380,21649,38227,8678,39.393 - 49931,30654,46716,713,10725,40272,23698,59431,34133,12768,39.394 - 61474,17559,28603,56078,6860,44665,19604,63521,14819,36182,39.395 - 42618,4815,54029,26552,2537,48476,31902,51243,58119,22450,39.396 - 38512,8901,49192,29853,46431,490,10950,40563,24497,60164,39.397 - 34422,12995,62209,18356,27800,55341,6639,44378,20407,64258,39.398 - 15040,36469,42329,4588,53294,25755,39.399 -},39.400 -{0,54485,46519,24930,30579,41894,49860,5649,61158,14899,39.401 - 23377,36740,39317,19776,11298,63735,49617,5380,29798,41139,39.402 - 46754,25207,789,55232,12087,64482,39552,20053,22596,35985,39.403 - 60915,14630,40895,19306,10760,65245,59596,15385,23931,35246,39.404 - 29017,42380,50414,4155,1578,54015,45981,26440,24174,35515,39.405 - 60377,16140,10525,64968,40106,18559,45192,25693,1343,53738,39.406 - 51195,4910,29260,42649,9059,63414,38612,16897,21520,32965,39.407 - 57767,13682,52613,6480,30770,44263,47862,28195,3905,56212,39.408 - 58034,13927,22277,33744,38337,16660,8310,62627,3156,55425,39.409 - 47587,27958,31527,45042,52880,6725,48348,26633,2411,56766,39.410 - 52143,8058,32280,43725,21050,34543,59277,13144,9545,61852,39.411 - 37118,17451,32013,43480,51386,7279,2686,57003,49097,27420,39.412 - 37867,18238,9820,62089,58520,12365,20783,34298,18118,37395,39.413 - 62321,10148,12725,58720,33794,20695,43040,31989,7575,51522,39.414 - 57171,2950,27364,48689,34583,21442,12960,58997,61540,9393,39.415 - 17875,37126,27121,48420,56390,2195,7810,51799,43829,32736,39.416 - 55673,3500,27854,47131,44554,31455,7101,53096,14239,58186,39.417 - 33320,22269,16620,37945,62811,8590,6312,52349,44319,31178,39.418 - 28635,47886,55916,3769,63054,8859,17401,38700,33085,21992,39.419 - 13450,57439,26021,45424,53266,1223,4822,50691,42849,29620,39.420 - 35651,24470,16116,59937,64560,10469,18823,40274,42100,28833,39.421 - 4547,50454,54023,2002,26288,45669,19090,40519,65317,11248,39.422 - 15841,59700,34902,23683,64026,11983,20397,39800,36201,22972,39.423 - 14558,60427,5372,49193,41291,30110,25487,46938,54840,749,39.424 - 15307,61214,36476,23209,19640,39021,63759,11738,54573,504,39.425 - 24730,46159,41566,30347,6121,49980,39.426 -},39.427 -{0,58597,54743,12594,47027,21334,25188,34433,29563,38814,39.428 - 42668,16969,50376,8237,4383,62970,59126,531,13089,55236,39.429 - 20805,46496,33938,24695,38285,29032,16474,42175,8766,50907,39.430 - 63465,4876,53745,13588,1062,57539,26178,33447,45973,22384,39.431 - 41610,18031,30557,37816,5433,61916,49390,9227,14087,54242,39.432 - 58064,1589,32948,25681,21859,45446,17532,41113,37291,30030,39.433 - 62415,5930,9752,49917,49151,23322,27176,36557,2124,60585,39.434 - 56731,14718,52356,10337,6483,64950,31543,40914,44768,18949,39.435 - 22793,48620,36062,26683,61114,2655,15213,57224,10866,52887,39.436 - 65445,6976,40385,31012,18454,44275,28174,35563,48089,24380,39.437 - 55741,15704,3178,59535,7541,63888,51362,11335,43718,20003,39.438 - 32529,39924,35064,27677,23855,47562,16203,56238,60060,3705,39.439 - 64387,8038,11860,51889,19504,43221,39399,32002,25571,34566,39.440 - 46644,21201,54352,12469,391,58722,4248,62589,50511,8618,39.441 - 42795,17358,29436,38425,34069,25072,20674,46119,12966,54851,39.442 - 59249,916,63086,4747,9145,51036,16861,42296,37898,28911,39.443 - 45586,22263,26565,33568,1441,57668,53366,13459,49513,9612,39.444 - 5310,61531,30426,37439,41741,18408,21732,45057,33075,26070,39.445 - 58199,1970,13952,53861,10143,50042,62024,5805,36908,29897,39.446 - 17915,41246,56348,14585,2507,60718,27567,36682,48760,23197,39.447 - 44903,19330,31408,40533,6356,64561,52483,10726,15082,56847,39.448 - 61245,3032,36185,27068,22670,48235,18833,44404,40006,30883,39.449 - 65058,6855,11253,53008,3565,59656,55354,15583,47710,24251,39.450 - 28553,35692,32406,39539,43841,20388,51493,11712,7410,63511,39.451 - 60187,4094,16076,55849,23720,47181,35199,28058,39008,31877,39.452 - 19895,43346,12243,52022,64004,7905,39.453 -},39.454 -{0,64765,58855,6426,55251,11054,12852,52937,46011,20294,39.455 - 22108,43681,25704,39061,33167,32114,31595,34710,40588,25201,39.456 - 44216,20549,18783,46498,51408,13357,11575,53706,7939,58366,39.457 - 64228,1561,63190,2603,4913,61388,8453,56824,50402,14367,39.458 - 17773,47504,41098,23671,37566,28227,30553,35748,36285,28992,39.459 - 26714,38055,23150,42643,49033,17268,15878,49915,56289,10012,39.460 - 59861,5416,3122,61647,61873,3404,5206,59563,9826,55967,39.461 - 50053,16248,16906,48887,42989,23312,38361,26916,28734,36035,39.462 - 35546,30247,28477,37824,23817,41460,47342,17427,14689,50588,39.463 - 56454,8315,61106,4687,2901,63400,1895,64410,57984,7805,39.464 - 53428,11337,13651,51630,46300,18465,20795,44486,25359,40946,39.465 - 34536,31253,31756,33009,39403,25878,43999,22306,20024,45765,39.466 - 53175,13130,10832,54957,6244,58521,64899,382,65407,898,39.467 - 6808,58981,10412,54353,52555,12726,19652,45113,43299,21982,39.468 - 39703,26602,32496,33293,33812,30953,25075,40206,21447,44858,39.469 - 46624,19165,14255,52050,53832,11957,57468,7297,1435,63846,39.470 - 2473,62804,60494,4275,56954,8839,15261,51040,47634,18159,39.471 - 24565,41736,28097,37180,34854,29915,29378,36415,38693,27608,39.472 - 42257,23020,16630,48139,49529,15748,9374,55395,5802,59991,39.473 - 62285,4016,3790,62003,60201,6100,55581,9696,15610,49159,39.474 - 48501,16776,22674,42095,27302,38491,36673,29628,30117,35160,39.475 - 36930,27839,41590,24203,18321,47980,50718,15075,9209,57092,39.476 - 4557,60720,62506,2263,63512,1253,7679,57602,12235,54070,39.477 - 51756,14033,19363,46942,44612,21177,40048,24717,31127,34154,39.478 - 33651,32654,26260,39529,21664,43101,45383,19898,12488,52277,39.479 - 54575,10706,59163,7142,764,65025,39.480 -},39.481 -{0,61681,65023,3342,59363,5906,6684,60141,54235,9002,39.482 - 11812,57045,13368,50377,51655,14646,48043,19290,18004,46757,39.483 - 23624,44217,41399,20806,26736,39041,38287,25982,36755,32610,39.484 - 29292,33437,27467,39866,38580,26181,36008,31833,29015,33190,39.485 - 47248,18529,17775,46494,24435,44930,41612,21117,53472,8209,39.486 - 11551,56814,14083,51186,51964,14861,827,62410,65220,3637,39.487 - 58584,5161,6439,59862,54934,9831,11113,56216,12661,49540,39.488 - 52362,15483,1357,62908,63666,2115,58030,4703,8017,61344,39.489 - 27965,40396,37058,24627,35550,31279,30497,34768,48870,19991,39.490 - 17177,46056,22789,43508,42234,21515,48605,19756,16418,45267,39.491 - 23102,43727,42945,22320,28166,40695,37881,25352,35301,30996,39.492 - 29722,34027,1654,63111,64393,2936,57749,4452,7274,60571,39.493 - 54701,9564,10322,55459,12878,49855,53169,16192,45361,16832,39.494 - 19662,48191,22226,42531,43821,23516,25322,37403,40725,28644,39.495 - 34057,30200,30966,34823,2714,64107,63333,1940,60793,7560,39.496 - 4230,57463,55617,10672,9406,54351,16034,52819,50013,13228,39.497 - 55930,10891,10117,55156,15769,52584,49254,12439,2465,63824,39.498 - 62558,1199,60994,7859,5053,58188,25041,37152,39982,27871,39.499 - 34354,30403,31693,35644,45578,17147,20469,48900,21993,42264,39.500 - 43030,22759,26535,38742,39512,27305,32836,28853,32187,36170,39.501 - 46204,17549,18819,47474,21407,41838,44640,24209,56332,11517,39.502 - 8691,53506,15343,51998,50704,14049,4055,65318,61992,729,39.503 - 59444,6341,5579,58682,3308,64541,61715,482,60175,7166,39.504 - 5872,58881,57143,12230,8904,53817,14548,51237,50475,13786,39.505 - 46919,18358,19128,47689,20644,41045,44379,23978,25756,37997,39.506 - 39267,27026,33663,29582,32384,36465,39.507 -},39.508 -{0,63223,61939,1796,65531,2316,3592,63743,58347,5404,39.509 - 4632,58607,7184,60135,60899,6932,56267,11580,10808,56527,39.510 - 9264,53959,54723,9012,14368,52951,51667,16164,51163,12588,39.511 - 13864,49375,43915,23932,23160,44175,21616,41607,42371,21364,39.512 - 18528,48791,47507,20324,47003,16748,18024,45215,28736,34487,39.513 - 33203,30532,36795,31052,32328,35007,37803,25948,25176,38063,39.514 - 27728,39591,40355,27476,19211,48636,47864,19471,46320,16903,39.515 - 17667,46068,43232,24087,22803,45028,22299,41452,42728,20511,39.516 - 37056,26167,24883,38852,28475,39372,40648,26687,29483,34268,39.517 - 33496,29743,36048,31271,32035,35796,57472,5751,4467,59268,39.518 - 8059,59788,61064,6271,875,62876,62104,1135,64656,2663,39.519 - 3427,64404,15179,52668,51896,15439,50352,12871,13635,50100,39.520 - 55456,11863,10579,57252,10075,53676,54952,8287,38422,24801,39.521 - 26597,37138,27117,40730,38942,28393,30205,33546,33806,29433,39.522 - 35334,31985,31733,36098,19933,47914,48174,19161,45606,17617,39.523 - 17365,46370,44598,22721,24517,43314,20941,42810,41022,22217,39.524 - 15773,52074,52334,15001,49766,13457,13205,50530,56950,10369,39.525 - 12165,55666,8589,55162,53374,9865,58966,4257,6053,57682,39.526 - 6573,61274,59486,7849,1469,62282,62542,697,64070,3249,39.527 - 2997,64834,56605,11242,11502,55833,8934,54289,54037,9698,39.528 - 16118,51201,52997,14834,49421,14330,12542,50697,1750,61473,39.529 - 63269,466,63789,4058,2270,65065,58685,5066,5326,57913,39.530 - 6854,60465,60213,7618,30358,32865,34661,29074,35181,32666,39.531 - 30878,36457,38269,25482,25742,37497,27270,40049,39797,28034,39.532 - 44381,23466,23726,43609,21158,42065,41813,21922,20150,47169,39.533 - 48965,18866,45389,18362,16574,46665,39.534 -},39.535 -{0,62964,63477,513,62455,1539,1026,61942,64499,3591,39.536 - 3078,63986,2052,65008,65521,2565,60411,7695,7182,59898,39.537 - 6156,60920,61433,6669,4104,58876,59389,4617,58367,5643,39.538 - 5130,57854,52203,15903,15390,51690,14364,52712,53225,14877,39.539 - 12312,50668,51181,12825,50159,13851,13338,49646,8208,54756,39.540 - 55269,8721,54247,9747,9234,53734,56291,11799,11286,55778,39.541 - 10260,56800,57313,10773,35787,32319,31806,35274,30780,36296,39.542 - 36809,31293,28728,34252,34765,29241,33743,30267,29754,33230,39.543 - 24624,38340,38853,25137,37831,26163,25650,37318,39875,28215,39.544 - 27702,39362,26676,40384,40897,27189,16416,46548,47061,16929,39.545 - 46039,17955,17442,45526,48083,20007,19494,47570,18468,48592,39.546 - 49105,18981,43995,24111,23598,43482,22572,44504,45017,23085,39.547 - 20520,42460,42973,21033,41951,22059,21546,41438,2955,65151,39.548 - 64638,2442,63612,3464,3977,64125,61560,1420,1933,62073,39.549 - 911,63099,62586,398,57456,5508,6021,57969,4999,58995,39.550 - 58482,4486,7043,61047,60534,6530,59508,7552,8065,60021,39.551 - 49248,13716,14229,49761,13207,50787,50274,12694,15251,52839,39.552 - 52326,14738,51300,15760,16273,51813,11163,56943,56430,10650,39.553 - 55404,11672,12185,55917,53352,9628,10141,53865,9119,54891,39.554 - 54378,8606,32832,30132,30645,33345,29623,34371,33858,29110,39.555 - 31667,36423,35910,31154,34884,32176,32689,35397,27579,40527,39.556 - 40014,27066,38988,28088,28601,39501,36936,26044,26557,37449,39.557 - 25535,38475,37962,25022,19371,48735,48222,18858,47196,19880,39.558 - 20393,47709,45144,17836,18349,45657,17327,46683,46170,16814,39.559 - 41040,21924,22437,41553,21415,42579,42066,20902,23459,44631,39.560 - 44118,22946,43092,23968,24481,43605,39.561 -},39.562 -{0,31355,62710,36493,62961,36746,263,31612,63487,36228,39.563 - 777,31090,526,30837,63224,35971,62435,35224,1813,32110,39.564 - 1554,31849,62180,34975,1052,32359,61674,35473,61933,35734,39.565 - 1307,32608,64475,33184,3885,30038,3626,29777,64220,32935,39.566 - 3108,30303,63698,33449,63957,33710,3363,30552,2104,29251,39.567 - 64718,34485,64969,34738,2367,29508,65479,34236,2865,29002,39.568 - 2614,28749,65216,33979,60331,37328,8029,25894,7770,25633,39.569 - 60076,37079,7252,26159,59554,37593,59813,37854,7507,26408,39.570 - 6216,25139,60606,38597,60857,38850,6479,25396,61367,38348,39.571 - 6977,24890,6726,24637,61104,38091,4208,27147,58502,40701,39.572 - 58753,40954,4471,27404,59279,40436,4985,26882,4734,26629,39.573 - 59016,40179,58259,39400,5989,27934,5730,27673,58004,39151,39.574 - 5228,28183,57498,39649,57757,39910,5483,28432,52043,45360,39.575 - 16317,17862,16058,17601,51788,45111,15540,18127,51266,45625,39.576 - 51525,45886,15795,18376,14504,17107,52318,46629,52569,46882,39.577 - 14767,17364,53079,46380,15265,16858,15014,16605,52816,46123,39.578 - 12432,19179,50278,48669,50529,48922,12695,19436,51055,48404,39.579 - 13209,18914,12958,18661,50792,48147,50035,47368,14213,19966,39.580 - 13954,19705,49780,47119,13452,20215,49274,47617,49533,47878,39.581 - 13707,20464,8416,23195,54294,44653,54545,44906,8679,23452,39.582 - 55071,44388,9193,22930,8942,22677,54808,44131,54019,43384,39.583 - 10229,23950,9970,23689,53764,43135,9468,24199,53258,43633,39.584 - 53517,43894,9723,24448,56123,41280,12237,21942,11978,21681,39.585 - 55868,41031,11460,22207,55346,41545,55605,41806,11715,22456,39.586 - 10456,21155,56366,42581,56617,42834,10719,21412,57127,42332,39.587 - 11217,20906,10966,20653,56864,42075,39.588 -},39.589 -{0,46002,31609,51403,63218,17728,36235,15929,61945,16971,39.590 - 35456,14642,1803,46265,31858,53184,65519,19549,33942,14116,39.591 - 2333,47791,29284,49622,3606,48548,30063,50909,63716,19286,39.592 - 33693,12335,58307,20593,39098,11016,5425,42627,28232,56826,39.593 - 4666,41352,26947,56049,58568,22394,40881,11267,7212,44958,39.594 - 26453,54503,60126,22892,37287,8725,60885,24167,38572,9502,39.595 - 6951,43157,24670,54252,56219,26665,41186,4944,11625,40667,39.596 - 22032,58786,10850,39376,20763,58025,56464,28450,42985,5211,39.597 - 9332,38854,24333,60607,53894,24884,43519,6733,54669,26175,39.598 - 44788,7494,9087,37069,22534,60340,14424,35818,17185,61587,39.599 - 52906,32024,46547,1633,51617,31251,45784,362,16211,36065,39.600 - 17450,63384,51127,29701,48334,3964,12613,33527,19004,63886,39.601 - 13902,34300,19767,65157,49340,29454,48069,2167,43819,6297,39.602 - 53330,25568,24025,61035,9888,38162,23250,59744,8619,37401,39.603 - 44064,8082,55129,25835,21700,59254,12221,39951,41526,4484,39.604 - 55631,27389,42301,5775,56900,28150,21455,57469,10422,39684,39.605 - 18664,64346,13201,32803,48666,3496,50531,30417,47377,2723,39.606 - 49768,29146,20451,64593,13466,34600,46855,1205,52350,32716,39.607 - 16885,62023,14988,35134,18174,62796,15751,36405,45068,958,39.608 - 52085,30919,28848,49922,3017,47227,34370,13808,64827,20105,39.609 - 33097,13051,64048,18818,30651,50185,3266,49008,36703,15597,39.610 - 62502,18324,31149,51743,724,45414,32422,52500,1503,46701,39.611 - 34900,15334,62253,16543,37747,8385,59402,23480,25985,54835,39.612 - 7928,44362,25226,53560,6643,43585,38008,10186,61185,23731,39.613 - 27804,57134,6117,42071,39534,10716,57623,21157,40293,11991,39.614 - 58908,21934,27543,55333,4334,41820,39.615 -},39.616 -{0,22872,45744,60392,31101,8229,52173,37525,62202,43938,39.617 - 16458,6418,35719,53983,14647,24687,63977,41137,19289,4609,39.618 - 32916,55756,12836,27516,2835,21067,47523,57595,29294,11062,39.619 - 49374,39302,61391,46743,23935,1063,38578,53226,9218,32090,39.620 - 7477,17517,44933,63197,25672,15632,55032,36768,5670,20350,39.621 - 42134,64974,28507,13827,56811,33971,58588,48516,22124,3892,39.622 - 40353,50425,12049,30281,50051,39643,28979,10347,47870,58278,39.623 - 2126,20758,12665,26657,33737,55953,18436,4444,64180,41964,39.624 - 14954,25394,35034,53634,17175,6735,61863,43263,51344,37320,39.625 - 31264,9080,45549,59573,861,23045,11340,29972,40700,51108,39.626 - 21809,3177,59265,48857,57014,34798,27654,13662,42955,65171,39.627 - 5499,19491,54693,36093,26389,15949,44248,62848,7784,18224,39.628 - 10079,32263,38383,52407,24098,1914,60562,46538,39707,49731,39.629 - 10667,28915,57958,47934,20694,2446,27105,12473,56145,33289,39.630 - 4252,18884,41516,64372,25330,15274,53314,35098,7055,17111,39.631 - 43327,61543,36872,51536,8888,31712,59765,45101,23493,669,39.632 - 29908,11660,50788,40764,3497,21745,48921,58945,34350,57206,39.633 - 13470,28102,65363,42507,19939,5307,36157,54373,16269,26325,39.634 - 62528,44312,18160,8104,32711,9887,52599,37935,1722,24546,39.635 - 46090,60754,22680,448,59944,45936,8677,30909,37717,51725,39.636 - 43618,62266,6354,16778,54047,35399,25007,14583,41329,63529,39.637 - 5057,19097,55308,33108,27324,13284,21387,2771,57659,47203,39.638 - 10998,29614,38982,49438,46935,60943,1511,23743,52778,38770,39.639 - 31898,9666,17837,7413,63261,44613,15568,25992,36448,55096,39.640 - 20158,6118,64526,42326,14275,28315,34163,56363,48196,58652,39.641 - 3828,22444,50489,40033,30601,11985,39.642 -},39.643 -{0,11309,22618,29815,45236,40089,59630,50371,32117,20824,39.644 - 9519,2306,52673,57836,38299,47542,64234,54983,41648,36509,39.645 - 19038,26227,4612,15913,34719,43954,57285,62440,14123,6918,39.646 - 28529,17244,59849,50660,45459,40382,22909,30032,295,11530,39.647 - 38076,47249,52454,57547,9224,2085,31826,20607,4899,16142,39.648 - 19321,26452,41879,36794,64461,55264,28246,17019,13836,6689,39.649 - 57058,62159,34488,43669,53135,58274,38869,48120,32571,21270,39.650 - 10081,2892,45818,40663,60064,50829,590,11875,23060,30265,39.651 - 13669,6472,27967,16658,34257,43516,56715,61862,18448,25661,39.652 - 4170,15463,63652,54409,41214,36051,9798,2667,32284,21041,39.653 - 38642,47839,52904,57989,23347,30494,873,12100,60295,51114,39.654 - 46045,40944,56492,61569,34038,43227,27672,16437,13378,6255,39.655 - 41433,36340,63875,54702,4461,15680,18743,25882,33539,44846,39.656 - 56153,63348,13239,8090,27629,18368,65142,53851,42540,35329,39.657 - 20162,25327,5784,15029,31209,21956,8627,3486,51549,58736,39.658 - 37127,48426,1180,10417,23750,28907,46120,38917,60530,49247,39.659 - 27338,18151,12944,7869,55934,63059,33316,44553,6079,15250,39.660 - 20453,25544,42763,35622,65361,54140,36896,48141,51322,58455,39.661 - 8340,3257,30926,21731,60757,49528,46351,39202,24033,29132,39.662 - 1467,10646,19596,24737,5334,14587,64568,53269,42082,34895,39.663 - 12793,7636,27043,17806,33101,44384,55575,62778,46694,39499,39.664 - 60988,49681,1746,11007,24200,29349,51987,59198,37705,48996,39.665 - 31655,22410,9213,4048,42309,35176,64799,53554,5617,14812,39.666 - 19883,24966,55344,62493,32874,44103,26756,17577,12510,7411,39.667 - 24495,29570,2037,11224,61211,49974,46913,39788,8922,3831,39.668 - 31360,22189,37486,48707,51764,58905,39.669 -},39.670 -{0,39065,11567,46518,23134,49863,30577,61416,46268,11301,39.671 - 39315,266,61154,30331,50125,23380,30053,60924,22602,49363,39.672 - 12091,47010,532,39565,49625,22848,60662,29807,39815,798,39.673 - 46760,11825,60106,29267,51173,24444,45204,10253,40379,1314,39.674 - 24182,50927,29529,60352,1064,40113,10503,45470,40879,1846,39.675 - 45696,10777,50673,23912,59614,28743,11027,45962,1596,40613,39.676 - 29005,59860,23650,50427,51593,20752,58534,31807,37847,2894,39.677 - 48888,9825,32053,58796,20506,51331,10091,49138,2628,37597,39.678 - 48364,9333,37315,2394,59058,32299,52125,21252,2128,37065,39.679 - 9599,48614,21006,51863,32545,59320,9027,48090,3692,38645,39.680 - 31005,57732,21554,52395,38911,3942,47824,8777,52641,21816,39.681 - 57486,30743,22054,52927,31497,58256,3192,38113,8535,47566,39.682 - 58010,31235,53173,22316,47300,8285,38379,3442,36623,6038,39.683 - 41504,15033,54609,19912,63614,24807,15283,41770,5788,36357,39.684 - 25069,63860,19650,54363,64106,25331,55109,20444,41012,14509,39.685 - 36123,5506,20182,54863,25593,64352,5256,35857,14759,41278,39.686 - 26053,64860,18666,53363,16283,42754,4788,35373,53625,18912,39.687 - 64598,25807,35623,5054,42504,16017,4256,34873,15759,42262,39.688 - 19198,53863,26577,65352,42012,15493,35123,4522,65090,26331,39.689 - 54125,19444,18054,56863,27561,62256,7384,33857,12791,43374,39.690 - 62010,27299,57109,18316,43108,12541,34123,7634,13283,43898,39.691 - 7884,34389,27069,61732,17554,56331,34655,8134,43632,13033,39.692 - 56577,17816,61486,26807,44108,13525,33123,6650,62994,28299,39.693 - 56125,17316,6384,32873,13791,44358,17070,55863,28545,63256,39.694 - 55593,16816,62470,27807,33655,7150,44632,14017,28053,62732,39.695 - 16570,55331,14283,44882,6884,33405,39.696 -},39.697 -{0,49859,39323,23384,12075,60904,46768,29811,24150,40085,39.698 - 51149,1294,29053,46014,59622,10789,48300,32367,9527,59380,39.699 - 37767,20804,2588,51423,58106,8249,31585,47522,52689,3858,39.700 - 21578,38537,25925,42886,64734,15901,19054,34989,54261,4406,39.701 - 15123,63952,41608,24651,5176,55035,36259,20320,55785,6954,39.702 - 16498,33457,63170,13313,28505,44442,34751,17788,7716,56551,39.703 - 43156,27223,12559,62412,51850,2121,21265,37330,58785,10082,39.704 - 31802,48889,38108,22047,3399,53124,48119,31028,8812,57519,39.705 - 30246,46309,61373,11646,22797,39886,49302,597,10352,60083,39.706 - 45547,29480,1883,50584,40640,23555,45007,27916,13908,62615,39.707 - 32996,16935,6527,56252,61849,13146,26626,43713,57010,7281,39.708 - 18217,34282,4963,53664,35576,18491,15432,65163,42451,26384,39.709 - 19765,36854,54446,5741,25118,41181,64389,14662,35081,19402,39.710 - 4242,53841,42530,25825,16313,64890,55135,5532,20164,35847,39.711 - 63604,15031,25071,41772,13733,63334,44094,28413,6798,55373,39.712 - 33557,16854,27635,43312,62056,12459,17624,34331,56643,8064,39.713 - 60492,11919,30167,46868,50023,420,23292,38975,45594,28889,39.714 - 11137,59714,40241,24562,1194,50793,20704,37411,51579,3000,39.715 - 32715,48392,58960,9363,3766,52341,38701,21998,8605,58206,39.716 - 47110,31429,17283,33088,55832,6363,27816,44651,62771,14320,39.717 - 7637,57110,33870,18061,13054,61501,43877,27046,65327,15852,39.718 - 26292,42103,53252,4807,18847,35676,41337,25530,14562,64033,39.719 - 36434,19601,6089,54538,9926,58373,48989,32158,2541,52014,39.720 - 36982,21173,30864,47699,57611,9160,22459,38264,52768,3299,39.721 - 39530,22697,1009,49458,46401,30594,11482,60953,50236,1791,39.722 - 23975,40804,60183,10708,29324,45135,39.723 -},39.724 -{0,61422,50113,11311,39839,29809,22622,47024,11043,50381,39.725 - 59618,1804,45244,24402,29565,40083,22086,47528,38279,31337,39.726 - 52697,8759,3608,57846,32101,37515,48804,20810,59130,2324,39.727 - 9531,51925,44172,17250,28493,32931,14099,55549,62674,6972,39.728 - 34735,26689,17518,43904,7216,62430,57329,12319,64202,5412,39.729 - 14603,55013,24917,36539,41620,19834,53737,15879,4648,64966,39.730 - 19062,42392,35255,26201,17669,43755,34500,26922,56986,12660,39.731 - 7515,62133,28198,33224,44519,16905,62905,6743,13944,55702,39.732 - 4931,64685,53378,16236,35036,26418,19229,42227,14432,55182,39.733 - 64417,5199,41983,19473,24638,36816,59785,1639,10824,50598,39.734 - 29206,40440,45527,24121,49834,11588,363,61061,22837,46811,39.735 - 39668,29978,49103,20513,31758,37856,9296,52158,59281,2175,39.736 - 38124,31490,22317,47299,3955,57501,52402,9052,35338,26084,39.737 - 18891,42533,4501,65147,53844,15802,41257,20167,25320,36102,39.738 - 15030,54616,63863,5785,56396,13218,8077,61539,18387,43069,39.739 - 33810,27644,63343,6273,13486,56128,27888,33566,44849,16607,39.740 - 9862,51560,58695,2729,48409,21239,32472,37174,3493,57931,39.741 - 52836,8586,38458,31188,22011,47637,28864,40750,45825,23791,39.742 - 60255,1201,10398,51056,23523,46093,38946,30668,49276,12178,39.743 - 957,60499,53007,8417,3278,58144,21648,47998,38737,30911,39.744 - 58412,3010,10221,51203,32691,36957,48242,21404,39241,30375,39.745 - 23176,46438,726,60728,49431,12025,45674,23940,29099,40517,39.746 - 10741,50715,59956,1498,25475,35949,41026,20396,63516,6130,39.747 - 15325,54323,18592,42830,35681,25743,54079,15569,4350,65296,39.748 - 13765,55851,62980,6634,44634,16820,28059,33397,7910,61704,39.749 - 56615,13001,34169,27287,18104,43350,39.750 -},39.751 -{0,30582,61164,39322,49605,46771,12073,22623,40855,59617,39.752 - 29051,1549,24146,10532,45246,51144,9011,21573,52703,47785,39.753 - 58102,38272,3098,31596,48292,52178,21064,9534,32097,2583,39.754 - 37773,58619,18022,12560,43146,57340,34723,61653,26959,7737,39.755 - 55793,44679,14109,16491,6196,28482,63192,33198,25941,4643,39.756 - 35769,64719,42128,54246,19068,15626,64194,36276,5166,25432,39.757 - 15111,19569,54763,41629,36044,64442,25120,5462,19721,14975,39.758 - 41957,54419,4955,25645,64951,35521,53918,42472,15474,19204,39.759 - 45055,55433,16659,13925,28218,6476,32982,63392,12392,18206,39.760 - 56964,43506,61869,34523,8001,26679,51882,48604,9286,21296,39.761 - 2927,31769,58755,37621,21821,8779,48081,52391,38136,58254,39.762 - 31252,3426,59801,40687,1909,28675,10332,24362,50864,45510,39.763 - 30222,376,39138,61332,47051,49341,22823,11857,1413,29427,39.764 - 60265,39967,50240,45878,10924,24026,39442,60772,29950,904,39.765 - 23511,11425,46395,49741,9910,20928,51290,48940,59251,36869,39.766 - 2463,32489,47393,52823,22477,8379,30948,3986,38408,57726,39.767 - 17379,13461,44303,55929,33318,62800,27850,7100,56436,43778,39.768 - 12952,17902,7601,27335,62301,33835,24784,6054,36412,63818,39.769 - 41237,54883,20473,14479,65351,34865,4523,26333,16002,18932,39.770 - 53358,42776,35145,65087,26533,4307,18572,16378,42592,53526,39.771 - 5854,25000,63538,36676,55067,41069,14839,20097,43642,56588,39.772 - 17558,13280,27583,7369,34131,61989,13805,17051,56065,44151,39.773 - 62504,33630,6852,28082,53039,47193,8643,22197,3818,31132,39.774 - 57350,38768,20664,10190,48724,51490,37245,58891,32657,2279,39.775 - 60444,39786,752,30086,11737,23215,49973,46147,29579,1277,39.776 - 40295,59921,45646,50488,23714,11220,39.777 -},39.778 -{0,15162,30324,19790,60648,55250,39580,41382,50637,65271,39.779 - 46009,34947,10533,4639,24401,25707,38791,44221,57843,56009,39.780 - 31599,16469,3355,13857,21066,26992,9278,7940,48802,34200,39.781 - 51414,62444,13075,2089,17767,32349,57339,58561,43407,37557,39.782 - 63198,52708,32938,48016,6710,8460,27714,22392,42132,40878,39.783 - 53984,59866,18556,29510,15880,1330,24921,23139,5933,11287,39.784 - 36273,46731,64453,49407,26150,23836,4178,11112,35534,45556,39.785 - 64698,51072,41963,39121,54687,61093,20227,29753,14711,589,39.786 - 61857,51867,34773,48367,7497,9843,27453,20487,13420,3926,39.787 - 16920,31010,55428,58302,44784,38346,21813,28175,9025,6267,39.788 - 47581,33511,53161,62611,37112,43970,59020,56758,31760,18218,39.789 - 2660,12638,49842,63880,46278,36860,11866,5472,22574,25364,39.790 - 1919,15429,28939,18993,60311,53421,40419,42713,52300,63350,39.791 - 47672,33026,8356,7070,22224,28138,2433,12987,32757,17615,39.792 - 58729,56915,37661,43047,23499,24817,11711,5765,46883,35865,39.793 - 49495,64109,40454,42300,59506,54088,29422,18900,1178,16288,39.794 - 65375,50277,35115,45585,5047,10381,26051,24313,14994,424,39.795 - 19686,30684,54906,60736,40974,39732,26840,21474,7852,9622,39.796 - 33840,48906,62020,51582,44309,38447,56161,57435,16893,31431,39.797 - 14217,3251,43626,37200,56350,59172,18050,32184,12534,3020,39.798 - 28583,21661,6611,8937,33615,47221,62779,52737,15853,1751,39.799 - 19353,28835,53509,59967,42865,40011,63520,49946,36436,46446,39.800 - 5320,12274,25276,22918,39289,41539,61197,54327,30097,20139,39.801 - 997,14559,23732,26510,10944,4602,45148,35686,50728,64786,39.802 - 3838,13764,30858,17328,57878,55596,37986,44888,52019,61449,39.803 - 48455,34429,10203,7393,20911,27285,39.804 -},39.805 -{0,7452,14904,10020,29808,26988,20040,21332,59616,62972,39.806 - 53976,53188,40080,33164,42664,48052,52701,53441,63461,60153,39.807 - 47533,42161,33685,40585,9533,14369,7941,537,20813,19537,39.808 - 27509,30313,34727,39611,48543,41091,62423,61131,51695,54515,39.809 - 28487,29275,21887,18531,6967,1579,8463,15379,19066,22374,39.810 - 28738,27998,15882,8982,1074,6446,41626,49030,39074,34238,39.811 - 55018,52214,60626,61902,4947,3663,10603,13431,26403,31295,39.812 - 23835,16391,64435,59055,49547,56471,36803,37599,46587,43239,39.813 - 56974,50066,58550,63914,43774,47074,37062,36314,13934,11122,39.814 - 3158,4426,16926,24322,30758,25914,38132,35304,44748,46032,39.815 - 57476,64920,55996,51104,31764,24840,17964,23344,2148,5496,39.816 - 12892,12096,22825,17461,25361,32269,11609,12357,5985,2685,39.817 - 45513,44245,35825,38637,50617,55461,65409,58013,9894,15290,39.818 - 7326,386,21206,20426,26862,30194,52806,54106,62590,59746,39.819 - 47670,42794,32782,40210,60283,63079,53571,52319,40715,33303,39.820 - 42291,47151,923,7815,14755,9407,30699,27383,19923,20687,39.821 - 41217,48157,39737,34341,54641,51309,61257,62037,18913,21757,39.822 - 29657,28357,15761,8333,1961,6837,27868,29120,22244,19448,39.823 - 6316,1456,8852,16264,33852,39200,48644,41752,61516,60752,39.824 - 51828,55144,13813,10473,4045,4817,16773,23705,31677,26273,39.825 - 56597,49161,59181,64049,43365,46201,37725,36417,63528,58676,39.826 - 49680,57100,35928,37188,46688,43900,4296,3540,10992,14316,39.827 - 25784,31140,24192,17308,45650,44878,34922,38262,50722,56126,39.828 - 64538,57606,23218,18350,24714,32150,11970,13278,5370,2534,39.829 - 32655,25235,17847,22699,3071,5859,12743,11483,38767,35443,39.830 - 44375,45131,58143,65027,55591,50235,39.831 -},39.832 -{0,3599,7198,4625,14396,13875,9250,10797,28792,32375,39.833 - 27750,25193,18500,17995,21594,23125,57584,61183,64750,62177,39.834 - 55500,54979,50386,51933,37000,40583,35990,33433,43188,42683,39.835 - 46250,47781,56829,54258,49635,53228,58817,60366,63967,63440,39.836 - 44421,41866,45467,49044,38329,39862,35239,34728,15629,13058,39.837 - 8467,12060,1329,2878,6447,5920,19829,17274,20843,24420,39.838 - 30025,31558,26967,26456,42983,43496,48121,46582,40923,37332,39.839 - 33733,36298,55199,55696,52097,50574,61347,57772,62397,64946,39.840 - 18199,18712,23305,21766,32555,28964,25397,27962,14191,14688,39.841 - 11121,9598,3923,348,4941,7490,31258,29717,26116,26635,39.842 - 16934,19497,24120,20535,2658,1133,5756,6259,12894,15441,39.843 - 11840,8271,39658,38117,34548,35067,41686,44249,48840,45255,39.844 - 60050,58525,63116,63619,53934,56481,52912,49343,21459,24028,39.845 - 20429,16834,27631,26080,30705,31230,9131,11684,16309,12730,39.846 - 7063,5528,1929,2438,45859,48428,44861,41266,35615,34064,39.847 - 38657,39182,50011,52564,57157,53578,64359,62824,59257,59766,39.848 - 36398,32801,37424,39999,46610,47133,43532,41987,65110,61529,39.849 - 57928,60487,50794,51301,55924,54395,28382,24785,29376,31951,39.850 - 22242,22765,19196,17651,7846,4265,696,3255,9882,10389,39.851 - 14980,13451,62516,64059,59434,58917,52232,49671,53270,56857,39.852 - 33868,35395,38994,38493,48240,45695,41070,44641,5316,6859,39.853 - 2266,1749,11512,8951,12518,16105,25788,27315,30882,30381,39.854 - 23680,21135,16542,20113,10697,10182,13783,15320,4597,8186,39.855 - 3563,996,22961,22462,17839,19360,24973,28546,32147,29596,39.856 - 51513,50998,54567,56104,61701,65290,60699,58132,47425,46926,39.857 - 42335,43856,33149,36722,40291,37740,39.858 -},39.859 -{0,35208,3853,34437,7706,38802,4375,39071,15412,46524,39.860 - 13113,47793,8750,43942,11555,42155,30824,61920,30565,65261,39.861 - 26226,61434,27007,57591,17500,52692,19281,49881,23110,54222,39.862 - 21835,56515,61648,31064,65501,30293,61130,26434,57799,26703,39.863 - 52452,17772,50153,19041,54014,23414,56819,21627,35000,304,39.864 - 34741,3645,38562,7978,39343,4135,46220,15620,48001,12809,39.865 - 43670,8990,42395,11283,64957,29749,62128,31544,58279,27183,39.866 - 60586,25890,49545,18433,52868,18188,57235,22043,53406,22806,39.867 - 34261,3165,35544,848,39887,4679,38082,7498,47585,12393,39.868 - 46828,16228,43003,11891,43254,8574,3437,34021,608,35816,39.869 - 4983,39679,7290,38386,12633,47313,15956,47068,12099,42699,39.870 - 8270,43462,29957,64653,31240,62336,27423,58007,25618,60826,39.871 - 18737,49337,17980,53172,22315,56995,22566,53678,59239,28399,39.872 - 59498,25058,63869,28917,63088,32760,56147,21211,54366,24022,39.873 - 50505,19649,51780,17356,40719,5767,36866,6538,33045,2205,39.874 - 36376,1936,41787,10931,44086,9662,48417,13481,45612,15268,39.875 - 6071,40511,6330,37170,2477,32805,1696,36648,11139,41483,39.876 - 9358,44294,13721,48145,14996,45852,28639,58967,24786,59738,39.877 - 29125,63565,32456,63296,21483,55907,23782,54638,19953,50297,39.878 - 17148,52084,6874,37714,5591,40031,1216,36168,3021,33349,39.879 - 9966,44902,10723,41067,14580,45436,14329,48753,25266,60218,39.880 - 28095,58423,31912,62752,29605,64045,24198,55054,20875,55299,39.881 - 16540,51476,20369,50713,59914,25474,58631,27791,62480,32152,39.882 - 64285,29333,54846,24502,55603,20667,51236,16812,50985,20129,39.883 - 37474,7146,40303,5351,35960,1520,33653,2813,44630,10206,39.884 - 41307,10451,45132,14788,48961,14025,39.885 -},39.886 -{0,17477,34954,52431,3337,18764,34179,49606,6674,24151,39.887 - 37528,55005,5915,21342,40849,56276,13348,28769,48302,63723,39.888 - 14637,32104,45479,62946,11830,27251,42684,58105,9023,26490,39.889 - 43957,61424,26696,11277,57538,42119,25921,8452,60875,43406,39.890 - 29274,13855,64208,48789,32595,15126,63449,45980,23660,6185,39.891 - 54502,37027,20837,5408,55791,40362,18046,571,52980,35505,39.892 - 19319,3890,50173,34744,53392,38101,22554,7263,56729,39388,39.893 - 21779,4438,51842,36551,16904,1613,51083,33742,20225,2884,39.894 - 58548,41201,27710,10363,59837,44536,24887,9586,65190,47843,39.895 - 30252,12905,62383,47082,31525,16224,47320,64669,12370,29719,39.896 - 46545,61844,15707,31006,41674,59023,10816,28165,44995,60294,39.897 - 10057,25356,36092,51385,1142,16435,33269,50608,2431,19770,39.898 - 38638,53931,7780,23073,39911,57250,4973,22312,48445,63864,39.899 - 13751,29170,45108,62577,14526,31995,42799,58218,12197,27616,39.900 - 43558,61027,8876,26345,35097,52572,403,17878,33808,49237,39.901 - 3226,18655,37643,55118,7041,24516,40450,55879,5768,21197,39.902 - 54645,37168,24063,6586,55420,39993,20726,5299,53095,35618,39.903 - 18413,936,49774,34347,19172,3745,57681,42260,27099,11678,39.904 - 60504,43037,25810,8343,64323,48902,29641,14220,63050,45583,39.905 - 32448,14981,28077,10728,58663,41314,24740,9441,59438,44139,39.906 - 30655,13306,65333,47984,31414,16115,62012,46713,22921,7628,39.907 - 53507,38214,21632,4293,56330,38991,17307,2014,51985,36692,39.908 - 20114,2775,50712,33373,1509,16800,36207,51498,2284,19625,39.909 - 32870,50211,8183,23474,38781,54072,4862,22203,39540,56881,39.910 - 12737,30084,47435,64782,15560,30861,46146,61447,11219,28566,39.911 - 41817,59164,9946,25247,44624,59925,39.912 -},39.913 -{0,44205,17735,59882,35470,9763,53193,25444,2305,42412,39.914 - 19526,57579,33679,12066,50888,27237,4610,48815,22341,64488,39.915 - 39052,13345,56779,29030,6915,47022,24132,62185,37261,15648,39.916 - 54474,30823,9220,34985,24899,52718,44682,551,60365,18272,39.917 - 11525,33192,26690,50415,42891,2854,58060,20065,13830,39595,39.918 - 29505,57324,48264,4133,63951,21858,16135,37802,31296,55021,39.919 - 46473,6436,61646,23651,18440,58533,3407,41442,49798,28203,39.920 - 34753,11116,16649,60836,1102,43235,52103,26410,36544,8813,39.921 - 23050,63143,8013,46048,53380,31785,38339,14702,21259,65446,39.922 - 5708,47841,55685,29992,40130,12399,27660,49313,10571,34278,39.923 - 59010,18991,41925,3944,25869,51616,8266,36071,61315,17198,39.924 - 43716,1641,32270,53923,15177,38884,62592,22573,45511,7530,39.925 - 30479,56226,12872,40677,64897,20780,47302,5227,36880,15549,39.926 - 54615,31226,6814,46643,24537,62324,39185,13756,56406,28923,39.927 - 5023,48946,22232,64117,33298,11967,51029,27640,2204,42033,39.928 - 19931,57718,35603,10174,52820,25337,413,44336,17626,59511,39.929 - 46100,6329,61779,24062,16026,37431,31709,55152,48405,4536,39.930 - 63570,21759,14235,39734,29404,56945,42518,2747,58193,20476,39.931 - 11416,32821,27103,50546,44823,954,59984,18173,9625,35124,39.932 - 24798,52339,55320,29877,40287,12786,21142,65083,6097,47996,39.933 - 53529,32180,37982,14579,23447,63290,7888,45693,51738,26295,39.934 - 36701,9200,16532,60473,1491,43390,49947,28598,34396,10993,39.935 - 18837,58680,3282,41087,64540,20657,47451,5622,30354,55871,39.936 - 13269,40824,62749,22960,45146,7415,32659,54078,15060,38521,39.937 - 60958,17075,43865,2036,25744,51261,8663,36218,59167,19378,39.938 - 41560,3829,28049,49468,10454,33915,39.939 -},39.940 -{0,55513,44463,30070,18243,40858,60140,12853,36486,22111,39.941 - 9001,64496,51653,4380,25706,48307,273,55752,44222,29799,39.942 - 18002,40587,60413,13092,36759,22350,8760,64225,51412,4109,39.943 - 25979,48546,546,56059,44941,30548,17761,40376,59598,12311,39.944 - 36004,21629,8459,63954,52199,4926,26184,48785,819,56298,39.945 - 44700,30277,17520,40105,59871,12550,36277,21868,8218,63683,39.946 - 51958,4655,26457,49024,1092,56477,43499,28978,17159,39902,39.947 - 61096,13937,35522,21019,10093,65460,52609,5464,24622,47351,39.948 - 1365,56716,43258,28707,16918,39631,61369,14176,35795,21258,39.949 - 9852,65189,52368,5193,24895,47590,1638,57023,43977,29456,39.950 - 16677,39420,60554,13395,35040,20537,9551,64918,53155,6010,39.951 - 25100,47829,1911,57262,43736,29185,16436,39149,60827,13634,39.952 - 35313,20776,9310,64647,52914,5739,25373,48068,2184,53329,39.953 - 42279,32254,20427,38674,57956,15037,34318,24279,11169,62328,39.954 - 49485,6548,27874,46139,2457,53568,42038,31983,20186,38403,39.955 - 58229,15276,34591,24518,10928,62057,49244,6277,28147,46378,39.956 - 2730,53875,42757,32732,19945,38192,57414,14495,33836,23797,39.957 - 10627,61786,50031,7094,28352,46617,3003,54114,42516,32461,39.958 - 19704,37921,57687,14734,34109,24036,10386,61515,49790,6823,39.959 - 28625,46856,3276,54293,41315,31162,19343,37718,58912,16121,39.960 - 33354,23187,12261,63292,50441,7632,26790,45183,3549,54532,39.961 - 41074,30891,19102,37447,59185,16360,33627,23426,12020,63021,39.962 - 50200,7361,27063,45422,3822,54839,41793,31640,18861,37236,39.963 - 58370,15579,32872,22705,11719,62750,50987,8178,27268,45661,39.964 - 4095,55078,41552,31369,18620,36965,58643,15818,33145,22944,39.965 - 11478,62479,50746,7907,27541,45900,39.966 -},39.967 -{0,58083,55771,15160,44971,19784,30320,38035,17227,41384,39.968 - 39568,30835,60640,3587,13627,55256,34454,25717,24397,48558,39.969 - 10557,52190,61670,4613,50653,10046,7174,65253,27254,34965,39.970 - 45997,20814,4401,62418,51434,10761,48794,23673,26433,34210,39.971 - 21114,45209,35745,26946,64977,7986,9226,50921,38823,30020,39.972 - 20092,44191,14348,56047,57815,820,54508,13839,3383,61396,39.973 - 31559,39332,41628,16511,8802,49281,64441,6490,36297,28458,39.974 - 21522,46833,24873,33738,47346,23057,52866,11361,5977,62906,39.975 - 42228,17943,32047,40908,2911,59836,53892,12391,59327,1372,39.976 - 15972,56455,18452,43767,37327,29484,13139,53680,60040,2155,39.977 - 40184,32283,17699,42944,28696,37627,43459,19232,57267,15696,39.978 - 1640,58507,46533,22310,27678,36605,6766,63629,50101,8534,39.979 - 63118,5229,12117,52662,22821,48070,33022,25117,17604,42535,39.980 - 40223,32764,60271,2444,12980,53335,1935,58732,56916,15543,39.981 - 43044,19143,29183,37660,49746,8369,7049,63850,28153,36634,39.982 - 46114,22209,33049,25594,22722,47649,11954,52305,63337,5514,39.983 - 22005,46870,35886,28365,64094,6333,9093,49510,5822,62557,39.984 - 53093,11654,47381,23542,24782,33325,54115,12672,2744,59483,39.985 - 31944,40491,42259,18416,36904,29387,18931,43792,16259,56672,39.986 - 58968,1211,26278,33861,49021,23966,51469,11246,4310,62005,39.987 - 9709,50958,64566,7893,35398,26789,21405,45438,57392,723,39.988 - 14827,56072,20379,44408,38464,29859,41851,16792,31392,38979,39.989 - 3280,60979,54539,14312,30615,38260,44620,19631,55356,15071,39.990 - 487,58116,13532,54847,60679,4068,39799,31124,17068,41039,39.991 - 61697,5090,10458,51769,24234,48201,34673,26002,45642,20649,39.992 - 27537,35186,7649,65282,50234,9945,39.993 -},39.994 -{0,65534,58337,7199,56287,9249,14398,51136,43939,21597,39.995 - 18498,47036,28796,36738,37789,27747,19291,46245,43194,22340,39.996 - 36996,28538,29541,35995,57592,7942,793,64743,15143,50393,39.997 - 55494,10040,38582,26952,30039,35497,19817,45719,44680,20854,39.998 - 15637,49899,57076,8458,59082,6452,1323,64213,56813,8723,39.999 - 15884,49650,1586,63948,58835,6701,30286,35248,38319,27217,39.1000 - 44433,21103,20080,45454,12657,52879,53904,11630,60078,5456,39.1001 - 2383,63153,39634,25900,31027,34509,16653,48883,41708,23826,39.1002 - 31274,34260,39371,26165,41461,24075,16916,48618,53641,11895,39.1003 - 12904,52630,2646,62888,59831,5705,42951,22585,17446,48088,39.1004 - 31768,33766,40953,24583,3172,62362,61317,4219,55227,10309,39.1005 - 13402,52132,60572,4962,3965,61571,14147,51389,54434,11100,39.1006 - 18239,47297,42206,23328,40160,25374,32513,33023,25314,40220,39.1007 - 33027,32509,47421,18115,23260,42274,51521,14015,10912,54622,39.1008 - 4766,60768,61823,3713,10681,54855,51800,13734,62054,3480,39.1009 - 4487,61049,33306,32228,25083,40453,22981,42555,47652,17882,39.1010 - 62548,2986,6069,59467,12171,53365,52330,13204,24567,40969,39.1011 - 48150,17384,33832,31702,26569,38967,48911,16625,23790,41744,39.1012 - 25808,39726,34609,30927,5292,60242,63309,2227,53107,12429,39.1013 - 11410,54124,21395,44141,45170,20364,34892,30642,27565,37971,39.1014 - 63536,1998,7121,58415,9199,56337,49166,16368,6344,59190,39.1015 - 64297,1239,49943,15593,8438,57096,45931,19605,20618,44916,39.1016 - 26804,38730,35669,29867,50469,15067,9924,55610,7930,57604,39.1017 - 64795,741,28294,37240,36199,29337,46425,19111,22200,43334,39.1018 - 36478,29056,28063,37473,21921,43615,46656,18878,9693,55843,39.1019 - 50748,14786,65026,508,7651,57885,39.1020 -},39.1021 -{0,32638,65276,33154,57829,40603,7961,24679,57303,41129,39.1022 - 8491,24149,15922,16716,49358,49072,41907,56525,23887,8753,39.1023 - 16982,15656,48298,50132,31844,794,33432,64998,40321,58111,39.1024 - 25469,7171,23419,9221,42375,56057,47774,50656,17506,15132,39.1025 - 33964,64466,31312,1326,25929,6711,39861,58571,63688,34742,39.1026 - 1588,31050,6445,26195,59345,39087,10015,22625,55779,42653,39.1027 - 50938,47492,14342,18296,46838,51592,18442,14196,22291,10349,39.1028 - 43503,54929,26913,5727,38877,59555,35012,63418,30264,2374,39.1029 - 5445,27195,60345,38087,62624,35806,2652,29986,51858,46572,39.1030 - 13422,19216,11127,21513,54667,43765,60813,37619,4977,27663,39.1031 - 3176,29462,62100,36330,12890,19748,52390,46040,54207,44225,39.1032 - 11587,21053,20030,12608,45250,53180,45019,53413,20775,11865,39.1033 - 37353,61079,28437,4203,28684,3954,36592,61838,29169,3727,39.1034 - 36621,61555,36884,61290,28392,4502,44582,53592,20698,12196,39.1035 - 20419,12477,45375,52801,53826,44348,11454,21440,13223,19673,39.1036 - 52571,45605,3477,29419,62313,35863,60528,37646,4748,28146,39.1037 - 10890,22004,54390,43784,52079,46097,13715,19181,62813,35363,39.1038 - 2977,29919,5304,27590,59972,38202,35129,63047,30661,2235,39.1039 - 26844,6050,38432,59742,22254,10640,43026,55148,46859,51317,39.1040 - 18935,13961,50951,47225,14843,18053,9954,22940,55326,42848,39.1041 - 6352,26542,58924,39250,63797,34379,1993,30903,25780,7114,39.1042 - 39496,58678,34129,64047,31661,1235,47971,50205,17823,15073,39.1043 - 23174,9720,42106,56068,40060,58114,25216,7678,32153,743,39.1044 - 33637,64539,17323,15573,48471,49705,41550,56624,23730,9164,39.1045 - 16335,16561,49459,48717,56874,41300,8406,24488,57368,40806,39.1046 - 7908,24986,509,32387,65281,32895,39.1047 -},39.1048 -{0,16190,32380,16706,64760,50118,33412,48570,58861,56019,39.1049 - 39825,42159,6421,9771,26473,22615,55239,59641,43451,38533,39.1050 - 11071,5121,21827,27261,12842,3348,19542,29544,52946,61932,39.1051 - 45230,36752,45971,36013,52719,62161,20331,28757,12567,3625,39.1052 - 22142,26944,10242,5948,43654,38328,54522,60356,25684,23402,39.1053 - 6696,9494,39084,42898,59088,55790,33209,48775,65477,49403,39.1054 - 32065,17023,829,15363,31547,17413,1351,14969,34755,47357,39.1055 - 63935,50817,40662,41448,57514,57236,25134,23824,7250,9068,39.1056 - 44284,37826,53888,60862,20484,28474,11896,4422,18705,30255,39.1057 - 14189,2131,46569,35543,52117,62635,51368,63382,46804,35306,39.1058 - 13392,2926,18988,29970,11589,4731,21305,27655,53693,61059,39.1059 - 44993,37119,8047,8273,24851,24109,58263,56489,40427,41685,39.1060 - 64130,50620,34046,48064,1658,14660,30726,18232,63094,51528,39.1061 - 34826,46900,2702,13744,29938,19404,5019,11429,28135,21209,39.1062 - 61283,53341,37151,44577,8625,7823,24525,24819,56649,57975,39.1063 - 41781,39947,50268,64354,47648,34078,14500,1946,18136,31206,39.1064 - 17893,31451,15257,1191,47389,34339,51041,63583,40968,40758,39.1065 - 56948,57674,23792,25550,8844,7602,37410,44316,60510,54112,39.1066 - 28378,20964,4262,12184,30671,18673,2483,13965,35639,46089,39.1067 - 62795,51829,36173,45683,62257,52239,29109,20107,4041,12535,39.1068 - 26784,22430,5852,10722,37976,43878,59940,54554,23178,26036,39.1069 - 9462,7112,42610,39244,55310,59184,48999,32857,49435,65061,39.1070 - 17311,31905,15843,733,16094,480,16546,32668,49702,64792,39.1071 - 48218,33636,56115,58381,42319,39537,10187,6389,22967,26249,39.1072 - 59673,54823,38757,43099,5601,10975,27549,21667,3316,13258,39.1073 - 29320,19894,61452,53042,36464,45390,39.1074 -},39.1075 -{0,7966,15932,8482,31864,25446,16964,23898,63728,59374,39.1076 - 50892,55762,33928,39830,47796,42410,60925,62179,54209,52447,39.1077 - 37253,36507,44985,45223,5389,2579,11057,13359,26997,30315,39.1078 - 22345,18519,51175,55545,63963,59077,48031,42113,34211,39613,39.1079 - 16151,8201,299,7733,17263,23665,32083,25165,10778,13572,39.1080 - 5158,2872,22114,18812,26718,30528,53994,52724,60630,62408,39.1081 - 44690,45452,37038,36784,37843,36045,44527,45809,61355,61621,39.1082 - 53655,52873,27427,29757,21791,18945,5979,2117,10599,13945,39.1083 - 32302,24880,16402,24332,598,7496,15466,9076,34526,39360,39.1084 - 47330,43004,64166,58808,50330,56196,21556,19242,27144,29974,39.1085 - 10316,14162,5744,2414,44228,46042,37624,36326,53436,53154,39.1086 - 61056,61854,47561,42711,34805,39147,50609,55983,64397,58515,39.1087 - 16697,24103,32517,24603,15681,8799,893,7267,15291,9381,39.1088 - 1415,6809,18371,22749,31231,26337,49995,56405,64887,57961,39.1089 - 48947,41005,33039,40465,54854,51544,59514,63332,43582,46368,39.1090 - 37890,35612,11958,12712,4234,3988,21198,19920,27890,29676,39.1091 - 64604,58178,49760,56702,32804,40762,48664,41222,1196,7090,39.1092 - 14992,9614,30932,26570,18152,23030,4513,3775,12189,12419,39.1093 - 28121,29383,21477,19707,59729,63055,55149,51315,38185,35383,39.1094 - 43797,46091,43112,46966,38484,35146,54288,51982,59948,62770,39.1095 - 20632,20358,28324,29114,11488,13310,4828,3522,17813,23179,39.1096 - 31657,25783,14829,9971,2001,6351,48485,41595,33625,40007,39.1097 - 49437,56835,65313,57407,28559,28817,20915,20141,5111,3305,39.1098 - 11723,13013,38783,34913,43331,46685,60167,62489,54587,51749,39.1099 - 33394,40300,48206,41808,65034,57620,49206,57128,31362,26012,39.1100 - 17598,23456,1786,6628,14534,10200,39.1101 -},39.1102 -{0,3854,7708,4370,15416,13110,8740,11562,30832,30590,39.1103 - 26220,26978,17480,19270,23124,21850,61664,65518,61180,57842,39.1104 - 52440,50134,53956,56778,34960,34718,38540,39298,46248,48038,39.1105 - 43700,42426,64989,62163,58305,60623,49637,52971,57337,53495,39.1106 - 34221,35491,39857,38079,47509,46747,42889,43143,3389,563,39.1107 - 4897,7215,12549,15883,12057,8215,30029,31299,27473,25695,39.1108 - 18805,18043,22377,22631,59303,59561,63931,63157,56223,54417,39.1109 - 50563,51853,40919,37081,33227,36549,41967,44257,48627,45821,39.1110 - 5959,6217,2395,1621,11135,9329,13667,14957,28471,24633,39.1111 - 28971,32293,21263,23553,19731,16925,6778,5492,1126,2920,39.1112 - 9794,10572,14430,14160,25098,27908,31766,29464,24114,20796,39.1113 - 16430,20256,60058,58772,62598,64392,54946,55724,51390,51120,39.1114 - 37610,40420,36086,33784,44754,41436,45262,49088,54099,56413,39.1115 - 52559,49729,61291,57445,61815,65145,43811,42029,46399,47665,39.1116 - 38683,38933,35079,34313,9139,11453,15791,12961,8075,4229,39.1117 - 407,3737,23491,21709,17887,19153,26619,26869,31207,30441,39.1118 - 11918,8576,12434,16284,4790,7608,3242,932,22270,23024,39.1119 - 18658,18412,27334,26056,29914,31700,56942,53600,49266,53116,39.1120 - 57942,60760,64586,62276,42526,43280,47106,46860,39462,38184,39.1121 - 33850,35636,13556,15354,10984,9702,2252,1986,5840,6622,39.1122 - 19588,17290,21144,23958,28860,32690,28320,25006,50196,51994,39.1123 - 55816,54534,63532,63266,58928,59710,48228,45930,41592,44406,39.1124 - 32860,36690,40512,37198,51497,50727,55093,55355,62737,64031,39.1125 - 60173,58371,45401,48727,44869,41035,36193,33391,37757,40051,39.1126 - 14793,14023,10197,10459,1521,2815,7149,5347,16825,20151,39.1127 - 24485,20651,32129,29327,25501,27795,39.1128 -},39.1129 -{0,1798,3596,2314,7192,6942,4628,5394,14384,16182,39.1130 - 13884,12602,9256,9006,10788,11554,28768,30566,32364,31082,39.1131 - 27768,27518,25204,25970,18512,20310,18012,16730,21576,21326,39.1132 - 23108,23874,57536,59334,61132,59850,64728,64478,62164,62930,39.1133 - 55536,57334,55036,53754,50408,50158,51940,52706,37024,38822,39.1134 - 40620,39338,36024,35774,33460,34226,43152,44950,42652,41370,39.1135 - 46216,45966,47748,48514,56733,55963,54161,54423,49541,50819,39.1136 - 53129,51343,58797,58027,60321,60583,63925,65203,63417,61631,39.1137 - 44541,43771,41969,42231,45541,46819,49129,47343,38349,37579,39.1138 - 39873,40135,35285,36563,34777,32991,15709,14939,13137,13399,39.1139 - 8517,9795,12105,10319,1389,619,2913,3175,6517,7795,39.1140 - 6009,4223,19773,19003,17201,17463,20773,22051,24361,22575,39.1141 - 29965,29195,31489,31751,26901,28179,26393,24607,42791,40993,39.1142 - 43307,44589,47935,48185,46387,45621,40727,38929,37147,38429,39.1143 - 33551,33801,36099,35333,55111,53313,55627,56909,52063,52313,39.1144 - 50515,49749,61303,59505,57723,59005,62319,62569,64867,64101,39.1145 - 18407,16609,18923,20205,23551,23801,22003,21237,32727,30929,39.1146 - 29147,30429,25551,25801,28099,27333,14215,12417,14731,16013,39.1147 - 11167,11417,9619,8853,4023,2225,443,1725,5039,5289,39.1148 - 7587,6821,31418,32188,29878,29616,26274,24996,26798,28584,39.1149 - 17034,17804,19590,19328,24210,22932,20638,22424,2778,3548,39.1150 - 1238,976,5826,4548,6350,8136,13034,13804,15590,15328,39.1151 - 12018,10740,8446,10232,39546,40316,38006,37744,34402,33124,39.1152 - 34926,36712,41546,42316,44102,43840,48722,47444,45150,46936,39.1153 - 59930,60700,58390,58128,62978,61700,63502,65288,53802,54572,39.1154 - 56358,56096,52786,51508,49214,51000,39.1155 -},39.1156 -{0,770,1540,1286,3080,3850,2572,2318,6160,6930,39.1157 - 7700,7446,5144,5914,4636,4382,12320,13090,13860,13606,39.1158 - 15400,16170,14892,14638,10288,11058,11828,11574,9272,10042,39.1159 - 8764,8510,24640,25410,26180,25926,27720,28490,27212,26958,39.1160 - 30800,31570,32340,32086,29784,30554,29276,29022,20576,21346,39.1161 - 22116,21862,23656,24426,23148,22894,18544,19314,20084,19830,39.1162 - 17528,18298,17020,16766,49280,50050,50820,50566,52360,53130,39.1163 - 51852,51598,55440,56210,56980,56726,54424,55194,53916,53662,39.1164 - 61600,62370,63140,62886,64680,65450,64172,63918,59568,60338,39.1165 - 61108,60854,58552,59322,58044,57790,41152,41922,42692,42438,39.1166 - 44232,45002,43724,43470,47312,48082,48852,48598,46296,47066,39.1167 - 45788,45534,37088,37858,38628,38374,40168,40938,39660,39406,39.1168 - 35056,35826,36596,36342,34040,34810,33532,33278,40221,40479,39.1169 - 39705,38939,37141,37399,38673,37907,34061,34319,33545,32779,39.1170 - 35077,35335,36609,35843,44349,44607,43833,43067,41269,41527,39.1171 - 42801,42035,46381,46639,45865,45099,47397,47655,48929,48163,39.1172 - 64861,65119,64345,63579,61781,62039,63313,62547,58701,58959,39.1173 - 58185,57419,59717,59975,61249,60483,52605,52863,52089,51323,39.1174 - 49525,49783,51057,50291,54637,54895,54121,53355,55653,55911,39.1175 - 57185,56419,23965,24223,23449,22683,20885,21143,22417,21651,39.1176 - 17805,18063,17289,16523,18821,19079,20353,19587,28093,28351,39.1177 - 27577,26811,25013,25271,26545,25779,30125,30383,29609,28843,39.1178 - 31141,31399,32673,31907,15837,16095,15321,14555,12757,13015,39.1179 - 14289,13523,9677,9935,9161,8395,10693,10951,12225,11459,39.1180 - 3581,3839,3065,2299,501,759,2033,1267,5613,5871,39.1181 - 5097,4331,6629,6887,8161,7395,39.1182 -},39.1183 -};
40.1 --- a/src/gdrom/edc_scramble.h Sun Jan 31 18:30:13 2010 +100040.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000040.3 @@ -1,621 +0,0 @@40.4 -/* @(#)scramble_table 1.2 02/10/19 */40.5 -40.6 -/*40.7 - * This program is free software; you can redistribute it and/or modify40.8 - * it under the terms of the GNU General Public License version 240.9 - * as published by the Free Software Foundation.40.10 - *40.11 - * This program is distributed in the hope that it will be useful,40.12 - * but WITHOUT ANY WARRANTY; without even the implied warranty of40.13 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the40.14 - * GNU General Public License for more details.40.15 - *40.16 - * You should have received a copy of the GNU General Public License along with40.17 - * this program; see the file COPYING. If not, write to the Free Software40.18 - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.40.19 - */40.20 -40.21 -static const unsigned char yellowbook_scrambler[2340] = {40.22 - 1,128,0,96,0,40,0,30,128,8,96,6,168,2,254,129,128,96,96,40,40,30,158,40.23 - 136,104,102,174,170,252,127,1,224,0,72,0,54,128,22,224,14,200,4,86,131,126,225,40.24 - 224,72,72,54,182,150,246,238,198,204,82,213,253,159,1,168,0,126,128,32,96,24,40,40.25 - 10,158,135,40,98,158,169,168,126,254,160,64,120,48,34,148,25,175,74,252,55,1,214,40.26 - 128,94,224,56,72,18,182,141,182,229,182,203,54,215,86,222,190,216,112,90,164,59,59,40.27 - 83,83,125,253,225,129,136,96,102,168,42,254,159,0,104,0,46,128,28,96,9,232,6,40.28 - 206,130,212,97,159,104,104,46,174,156,124,105,225,238,200,76,86,181,254,247,0,70,128,40.29 - 50,224,21,136,15,38,132,26,227,75,9,247,70,198,178,210,245,157,135,41,162,158,249,40.30 - 168,66,254,177,128,116,96,39,104,26,174,139,60,103,81,234,188,79,49,244,20,71,79,40.31 - 114,180,37,183,91,54,187,86,243,126,197,224,83,8,61,198,145,146,236,109,141,237,165,40.32 - 141,187,37,179,91,53,251,87,3,126,129,224,96,72,40,54,158,150,232,110,206,172,84,40.33 - 125,255,97,128,40,96,30,168,8,126,134,160,98,248,41,130,158,225,168,72,126,182,160,40.34 - 118,248,38,194,154,209,171,28,127,73,224,54,200,22,214,142,222,228,88,75,122,183,99,40.35 - 54,169,214,254,222,192,88,80,58,188,19,49,205,212,85,159,127,40,32,30,152,8,106,40.36 - 134,175,34,252,25,129,202,224,87,8,62,134,144,98,236,41,141,222,229,152,75,42,183,40.37 - 95,54,184,22,242,142,197,164,83,59,125,211,97,157,232,105,142,174,228,124,75,97,247,40.38 - 104,70,174,178,252,117,129,231,32,74,152,55,42,150,159,46,232,28,78,137,244,102,199,40.39 - 106,210,175,29,188,9,177,198,244,82,199,125,146,161,173,184,125,178,161,181,184,119,50,40.40 - 166,149,186,239,51,12,21,197,207,19,20,13,207,69,148,51,47,85,220,63,25,208,10,40.41 - 220,7,25,194,138,209,167,28,122,137,227,38,201,218,214,219,30,219,72,91,118,187,102,40.42 - 243,106,197,239,19,12,13,197,197,147,19,45,205,221,149,153,175,42,252,31,1,200,0,40.43 - 86,128,62,224,16,72,12,54,133,214,227,30,201,200,86,214,190,222,240,88,68,58,179,40.44 - 83,53,253,215,1,158,128,104,96,46,168,28,126,137,224,102,200,42,214,159,30,232,8,40.45 - 78,134,180,98,247,105,134,174,226,252,73,129,246,224,70,200,50,214,149,158,239,40,76,40.46 - 30,181,200,119,22,166,142,250,228,67,11,113,199,100,82,171,125,191,97,176,40,116,30,40.47 - 167,72,122,182,163,54,249,214,194,222,209,152,92,106,185,239,50,204,21,149,207,47,20,40.48 - 28,15,73,196,54,211,86,221,254,217,128,90,224,59,8,19,70,141,242,229,133,139,35,40.49 - 39,89,218,186,219,51,27,85,203,127,23,96,14,168,4,126,131,96,97,232,40,78,158,40.50 - 180,104,119,110,166,172,122,253,227,1,137,192,102,208,42,220,31,25,200,10,214,135,30,40.51 - 226,136,73,166,182,250,246,195,6,209,194,220,81,153,252,106,193,239,16,76,12,53,197,40.52 - 215,19,30,141,200,101,150,171,46,255,92,64,57,240,18,196,13,147,69,173,243,61,133,40.53 - 209,163,28,121,201,226,214,201,158,214,232,94,206,184,84,114,191,101,176,43,52,31,87,40.54 - 72,62,182,144,118,236,38,205,218,213,155,31,43,72,31,118,136,38,230,154,202,235,23,40.55 - 15,78,132,52,99,87,105,254,174,192,124,80,33,252,24,65,202,176,87,52,62,151,80,40.56 - 110,188,44,113,221,228,89,139,122,231,99,10,169,199,62,210,144,93,172,57,189,210,241,40.57 - 157,132,105,163,110,249,236,66,205,241,149,132,111,35,108,25,237,202,205,151,21,174,143,40.58 - 60,100,17,235,76,79,117,244,39,7,90,130,187,33,179,88,117,250,167,3,58,129,211,40.59 - 32,93,216,57,154,146,235,45,143,93,164,57,187,82,243,125,133,225,163,8,121,198,162,40.60 - 210,249,157,130,233,161,142,248,100,66,171,113,191,100,112,43,100,31,107,72,47,118,156,40.61 - 38,233,218,206,219,20,91,79,123,116,35,103,89,234,186,207,51,20,21,207,79,20,52,40.62 - 15,87,68,62,179,80,117,252,39,1,218,128,91,32,59,88,19,122,141,227,37,137,219,40.63 - 38,219,90,219,123,27,99,75,105,247,110,198,172,82,253,253,129,129,160,96,120,40,34,40.64 - 158,153,168,106,254,175,0,124,0,33,192,24,80,10,188,7,49,194,148,81,175,124,124,40.65 - 33,225,216,72,90,182,187,54,243,86,197,254,211,0,93,192,57,144,18,236,13,141,197,40.66 - 165,147,59,45,211,93,157,249,169,130,254,225,128,72,96,54,168,22,254,142,192,100,80,40.67 - 43,124,31,97,200,40,86,158,190,232,112,78,164,52,123,87,99,126,169,224,126,200,32,40.68 - 86,152,62,234,144,79,44,52,29,215,73,158,182,232,118,206,166,212,122,223,99,24,41,40.69 - 202,158,215,40,94,158,184,104,114,174,165,188,123,49,227,84,73,255,118,192,38,208,26,40.70 - 220,11,25,199,74,210,183,29,182,137,182,230,246,202,198,215,18,222,141,152,101,170,171,40.71 - 63,63,80,16,60,12,17,197,204,83,21,253,207,1,148,0,111,64,44,48,29,212,9,40.72 - 159,70,232,50,206,149,148,111,47,108,28,45,201,221,150,217,174,218,252,91,1,251,64,40.73 - 67,112,49,228,20,75,79,119,116,38,167,90,250,187,3,51,65,213,240,95,4,56,3,40.74 - 82,129,253,160,65,184,48,114,148,37,175,91,60,59,81,211,124,93,225,249,136,66,230,40.75 - 177,138,244,103,7,106,130,175,33,188,24,113,202,164,87,59,126,147,96,109,232,45,142,40.76 - 157,164,105,187,110,243,108,69,237,243,13,133,197,163,19,57,205,210,213,157,159,41,168,40.77 - 30,254,136,64,102,176,42,244,31,7,72,2,182,129,182,224,118,200,38,214,154,222,235,40.78 - 24,79,74,180,55,55,86,150,190,238,240,76,68,53,243,87,5,254,131,0,97,192,40,40.79 - 80,30,188,8,113,198,164,82,251,125,131,97,161,232,120,78,162,180,121,183,98,246,169,40.80 - 134,254,226,192,73,144,54,236,22,205,206,213,148,95,47,120,28,34,137,217,166,218,250,40.81 - 219,3,27,65,203,112,87,100,62,171,80,127,124,32,33,216,24,90,138,187,39,51,90,40.82 - 149,251,47,3,92,1,249,192,66,208,49,156,20,105,207,110,212,44,95,93,248,57,130,40.83 - 146,225,173,136,125,166,161,186,248,115,2,165,193,187,16,115,76,37,245,219,7,27,66,40.84 - 139,113,167,100,122,171,99,63,105,208,46,220,28,89,201,250,214,195,30,209,200,92,86,40.85 - 185,254,242,192,69,144,51,44,21,221,207,25,148,10,239,71,12,50,133,213,163,31,57,40.86 - 200,18,214,141,158,229,168,75,62,183,80,118,188,38,241,218,196,91,19,123,77,227,117,40.87 - 137,231,38,202,154,215,43,30,159,72,104,54,174,150,252,110,193,236,80,77,252,53,129,40.88 - 215,32,94,152,56,106,146,175,45,188,29,177,201,180,86,247,126,198,160,82,248,61,130,40.89 - 145,161,172,120,125,226,161,137,184,102,242,170,197,191,19,48,13,212,5,159,67,40,49,40.90 - 222,148,88,111,122,172,35,61,217,209,154,220,107,25,239,74,204,55,21,214,143,30,228,40.91 - 8,75,70,183,114,246,165,134,251,34,195,89,145,250,236,67,13,241,197,132,83,35,125,40.92 - 217,225,154,200,107,22,175,78,252,52,65,215,112,94,164,56,123,82,163,125,185,225,178,40.93 - 200,117,150,167,46,250,156,67,41,241,222,196,88,83,122,189,227,49,137,212,102,223,106,40.94 - 216,47,26,156,11,41,199,94,210,184,93,178,185,181,178,247,53,134,151,34,238,153,140,40.95 - 106,229,239,11,12,7,69,194,179,17,181,204,119,21,230,143,10,228,7,11,66,135,113,40.96 - 162,164,121,187,98,243,105,133,238,227,12,73,197,246,211,6,221,194,217,145,154,236,107,40.97 - 13,239,69,140,51,37,213,219,31,27,72,11,118,135,102,226,170,201,191,22,240,14,196,40.98 - 4,83,67,125,241,225,132,72,99,118,169,230,254,202,192,87,16,62,140,16,101,204,43,40.99 - 21,223,79,24,52,10,151,71,46,178,156,117,169,231,62,202,144,87,44,62,157,208,105,40.100 - 156,46,233,220,78,217,244,90,199,123,18,163,77,185,245,178,199,53,146,151,45,174,157,40.101 - 188,105,177,238,244,76,71,117,242,167,5,186,131,51,33,213,216,95,26,184,11,50,135,40.102 - 85,162,191,57,176,18,244,13,135,69,162,179,57,181,210,247,29,134,137,162,230,249,138,40.103 - 194,231,17,138,140,103,37,234,155,15,43,68,31,115,72,37,246,155,6,235,66,207,113,40.104 - 148,36,111,91,108,59,109,211,109,157,237,169,141,190,229,176,75,52,55,87,86,190,190,40.105 - 240,112,68,36,51,91,85,251,127,3,96,1,232,0,78,128,52,96,23,104,14,174,132,40.106 - 124,99,97,233,232,78,206,180,84,119,127,102,160,42,248,31,2,136,1,166,128,122,224,40.107 - 35,8,25,198,138,210,231,29,138,137,167,38,250,154,195,43,17,223,76,88,53,250,151,40.108 - 3,46,129,220,96,89,232,58,206,147,20,109,207,109,148,45,175,93,188,57,177,210,244,40.109 - 93,135,121,162,162,249,185,130,242,225,133,136,99,38,169,218,254,219,0,91,64,59,112,40.110 - 19,100,13,235,69,143,115,36,37,219,91,27,123,75,99,119,105,230,174,202,252,87,1,40.111 - 254,128,64,96,48,40,20,30,143,72,100,54,171,86,255,126,192,32,80,24,60,10,145,40.112 - 199,44,82,157,253,169,129,190,224,112,72,36,54,155,86,235,126,207,96,84,40,63,94,40.113 - 144,56,108,18,173,205,189,149,177,175,52,124,23,97,206,168,84,126,191,96,112,40,36,40.114 - 30,155,72,107,118,175,102,252,42,193,223,16,88,12,58,133,211,35,29,217,201,154,214,40.115 - 235,30,207,72,84,54,191,86,240,62,196,16,83,76,61,245,209,135,28,98,137,233,166,40.116 - 206,250,212,67,31,113,200,36,86,155,126,235,96,79,104,52,46,151,92,110,185,236,114,40.117 - 205,229,149,139,47,39,92,26,185,203,50,215,85,158,191,40,112,30,164,8,123,70,163,40.118 - 114,249,229,130,203,33,151,88,110,186,172,115,61,229,209,139,28,103,73,234,182,207,54,40.119 - 212,22,223,78,216,52,90,151,123,46,163,92,121,249,226,194,201,145,150,236,110,205,236,40.120 - 85,141,255,37,128,27,32,11,88,7,122,130,163,33,185,216,114,218,165,155,59,43,83,40.121 - 95,125,248,33,130,152,97,170,168,127,62,160,16,120,12,34,133,217,163,26,249,203,2,40.122 - 215,65,158,176,104,116,46,167,92,122,185,227,50,201,213,150,223,46,216,28,90,137,251,40.123 - 38,195,90,209,251,28,67,73,241,246,196,70,211,114,221,229,153,40.124 -};40.125 -40.126 -#ifdef PROTOTYPES40.127 -40.128 -# if !defined WORDS_BIGENDIAN40.129 -/* little endian */40.130 -static const uint32_t yellowbook_scrambler_uint32[2340/4] = {40.131 - 0x60008001UL,0x1E002800UL,0x06600880UL,0x81FE02A8UL,0x28606080UL,40.132 - 0x889E1E28UL,0xAAAE6668UL,0xE0017FFCUL,0x36004800UL,0x0EE01680UL,40.133 - 0x835604C8UL,0x48E0E17EUL,0x96B63648UL,0xCCC6EEF6UL,0x9FFDD552UL,40.134 - 0x7E00A801UL,0x18602080UL,0x879E0A28UL,0xA99E6228UL,0xA0FE7EA8UL,40.135 - 0x22307840UL,0x4AAF1994UL,0xD60137FCUL,0x38E05E80UL,0x8DB61248UL,40.136 - 0xCBB6E5B6UL,0xDE56D736UL,0x5A70D8BEUL,0x533B3BA4UL,0xE1FD7D53UL,40.137 - 0x66608881UL,0x9FFE2AA8UL,0x2E006800UL,0x09601C80UL,0x82CE06E8UL,40.138 - 0x689F61D4UL,0x9CAE2E68UL,0xEEE1697CUL,0xB5564CC8UL,0x4600F7FEUL,40.139 - 0x15E03280UL,0x84260F88UL,0x094BE31AUL,0xB2C646F7UL,0x879DF5D2UL,40.140 - 0xF99EA229UL,0xB1FE42A8UL,0x27607480UL,0x8BAE1A68UL,0xEA51673CUL,40.141 - 0xF4314FBCUL,0x724F4714UL,0x5BB725B4UL,0xF356BB36UL,0x53E0C57EUL,40.142 - 0x91C63D08UL,0x8D6DEC92UL,0xBB8DA5EDUL,0x355BB325UL,0x7E0357FBUL,40.143 - 0x4860E081UL,0x969E3628UL,0xACCE6EE8UL,0x61FF7D54UL,0x1E602880UL,40.144 - 0x867E08A8UL,0x29F862A0UL,0xA8E19E82UL,0xA0B67E48UL,0xC226F876UL,40.145 - 0x1CABD19AUL,0x36E0497FUL,0x8ED616C8UL,0x4B58E4DEUL,0x3663B77AUL,40.146 - 0xDEFED6A9UL,0x3A5058C0UL,0xCD3113BCUL,0x7F9F55D4UL,0x981E2028UL,40.147 - 0xAF866A08UL,0x8119FC22UL,0x0857E0CAUL,0x6290863EUL,0xDE8D29ECUL,40.148 - 0x2A4B98E5UL,0xB8365FB7UL,0xC58EF216UL,0x7D3B53A4UL,0xE89D61D3UL,40.149 - 0xE4AE8E69UL,0xF7614B7CUL,0xB2AE4668UL,0xE78175FCUL,0x37984A20UL,40.150 - 0x2E9F962AUL,0x894E1CE8UL,0x6AC766F4UL,0xBC1DAFD2UL,0xF4C6B109UL,40.151 - 0x927DC752UL,0x7DB8ADA1UL,0xB8B5A1B2UL,0x95A63277UL,0x0C33EFBAUL,40.152 - 0x13CFC515UL,0x45CF0D14UL,0x552F3394UL,0xD0193FDCUL,0x1907DC0AUL,40.153 - 0xA7D18AC2UL,0xE3897A1CUL,0xD6DAC926UL,0x48DB1EDBUL,0x66BB765BUL,40.154 - 0xEFC56AF3UL,0xC50D0C13UL,0x2D1393C5UL,0x9995DDCDUL,0x1FFC2AAFUL,40.155 - 0x5600C801UL,0x10E03E80UL,0x85360C48UL,0xC91EE3D6UL,0xBED656C8UL,40.156 - 0x4458F0DEUL,0x3553B33AUL,0x9E01D7FDUL,0x2E606880UL,0x897E1CA8UL,40.157 - 0x2AC866E0UL,0xE81E9FD6UL,0xB4864E08UL,0x8669F762UL,0x49FCE2AEUL,40.158 - 0x46E0F681UL,0x95D632C8UL,0x4C28EF9EUL,0x77C8B51EUL,0xFA8EA616UL,40.159 - 0x710B43E4UL,0xAB5264C7UL,0xB061BF7DUL,0xA71E7428UL,0xA3B67A48UL,40.160 - 0xC2D6F936UL,0x5C98D1DEUL,0x32EFB96AUL,0xCF9515CCUL,0x0F1C142FUL,40.161 - 0xD336C449UL,0xD9FEDD56UL,0x3BE05A80UL,0x8D461308UL,0x8B85E5F2UL,40.162 - 0xDA592723UL,0x1B33DBBAUL,0x177FCB55UL,0x04A80E60UL,0x6160837EUL,40.163 - 0x9E4E28E8UL,0x6E7768B4UL,0xFD7AACA6UL,0xC08901E3UL,0xDC2AD066UL,40.164 - 0x0AC8191FUL,0xE21E87D6UL,0xB6A64988UL,0x06C3F6FAUL,0x51DCC2D1UL,40.165 - 0xC16AFC99UL,0x0C4C10EFUL,0x13D7C535UL,0x65C88D1EUL,0xFF2EAB96UL,40.166 - 0xF039405CUL,0x930DC412UL,0x3DF3AD45UL,0x1CA3D185UL,0xD6E2C979UL,40.167 - 0xE8D69EC9UL,0x54B8CE5EUL,0xB065BF72UL,0x571F342BUL,0x90B63E48UL,40.168 - 0xCD26EC76UL,0x1F9BD5DAUL,0x761F482BUL,0x9AE62688UL,0x0F17EBCAUL,40.169 - 0x6334844EUL,0xAEFE6957UL,0x21507CC0UL,0xCA4118FCUL,0x3E3457B0UL,40.170 - 0xBC6E5097UL,0xE4DD712CUL,0xE77A8B59UL,0xC7A90A63UL,0x5D90D23EUL,40.171 - 0xD2BD39ACUL,0x69849DF1UL,0xECF96EA3UL,0x95F1CD42UL,0x6C236F84UL,40.172 - 0xCDCAED19UL,0x8FAE1597UL,0xEB11643CUL,0xF4754F4CUL,0x825A0727UL,40.173 - 0x58B321BBUL,0x03A7FA75UL,0x20D3813AUL,0x9A39D85DUL,0x8F2DEB92UL,40.174 - 0xBB39A45DUL,0x857DF352UL,0x7908A3E1UL,0xF9D2A2C6UL,0xA1E9829DUL,40.175 - 0x4264F88EUL,0x64BF71ABUL,0x1F642B70UL,0x762F486BUL,0xDAE9269CUL,40.176 - 0x5B14DBCEUL,0x23747B4FUL,0xBAEA5967UL,0x151433CFUL,0x34144FCFUL,40.177 - 0x3E44570FUL,0xFC7550B3UL,0x80DA0127UL,0x583B205BUL,0xE38D7A13UL,40.178 - 0x26DB8925UL,0x7BDB5ADBUL,0x694B631BUL,0xACC66EF7UL,0x81FDFD52UL,40.179 - 0x7860A081UL,0x999E2228UL,0xAFFE6AA8UL,0x21007C00UL,0x0A5018C0UL,40.180 - 0xC23107BCUL,0x7CAF5194UL,0xD8E1217CUL,0xBBB65A48UL,0xC556F336UL,40.181 - 0x5D00D3FEUL,0x129039C0UL,0xC58D0DECUL,0x2D3B93A5UL,0xF99D5DD3UL,40.182 - 0xE1FE82A9UL,0x36604880UL,0x8EFE16A8UL,0x2B5064C0UL,0xC8611F7CUL,40.183 - 0xBE9E5628UL,0xA44E70E8UL,0x63577B34UL,0x7EE0A97EUL,0x985620C8UL,40.184 - 0x4F90EA3EUL,0xD71D342CUL,0xE8B69E49UL,0xD4A6CE76UL,0x1863DF7AUL,40.185 - 0xD79ECA29UL,0xB89E5E28UL,0xA5AE7268UL,0xE3317BBCUL,0x76FF4954UL,40.186 - 0x1AD026C0UL,0xC7190BDCUL,0x1DB7D24AUL,0xE6B689B6UL,0xD7C6CAF6UL,40.187 - 0x988DDE12UL,0x3FABAA65UL,0x3C10503FUL,0xCCC5110CUL,0xCFFD1553UL,40.188 - 0x6F009401UL,0x1D302C40UL,0x469F09D4UL,0x95CE32E8UL,0x6C2F6F94UL,40.189 - 0xDDC92D1CUL,0xDAAED996UL,0xFB015BFCUL,0x31704340UL,0x4F4B14E4UL,40.190 - 0xA7267477UL,0x03BBFA5AUL,0xF0D54133UL,0x0338045FUL,0xA0FD8152UL,40.191 - 0x7230B841UL,0x5BAF2594UL,0xD3513B3CUL,0xF9E15D7CUL,0xB1E64288UL,40.192 - 0x0767F48AUL,0x21AF826AUL,0xCA7118BCUL,0x7E3B57A4UL,0xE86D6093UL,40.193 - 0xA49D8E2DUL,0xF36EBB69UL,0xF3ED456CUL,0xA3C5850DUL,0xD2CD3913UL,40.194 - 0x299F9DD5UL,0x88FE1EA8UL,0x2AB06640UL,0x48071FF4UL,0xB681B602UL,40.195 - 0x26C876E0UL,0xEBDE9AD6UL,0xB44A4F18UL,0x96563737UL,0x4CF0EEBEUL,40.196 - 0x57F33544UL,0x0083FE05UL,0x5028C061UL,0x7108BC1EUL,0xFB52A4C6UL,40.197 - 0xA161837DUL,0xA24E78E8UL,0x62B779B4UL,0xFE86A9F6UL,0x9049C0E2UL,40.198 - 0xCD16EC36UL,0x5F94D5CEUL,0x221C782FUL,0xDAA6D989UL,0x1B03DBFAUL,40.199 - 0x5770CB41UL,0x50AB3E64UL,0x21207C7FUL,0x8A5A18D8UL,0x5A3327BBUL,40.200 - 0x032FFB95UL,0xC0F9015CUL,0x9C31D042UL,0x6ECF6914UL,0x5D5F2CD4UL,40.201 - 0x928239F8UL,0x7D88ADE1UL,0xF8BAA1A6UL,0xC1A50273UL,0x4C7310BBUL,40.202 - 0x07DBF525UL,0x718B421BUL,0xAB7A64A7UL,0xD0693F63UL,0x591CDC2EUL,40.203 - 0xC3D6FAC9UL,0x5CC8D11EUL,0xF2FEB956UL,0x339045C0UL,0xCFDD152CUL,40.204 - 0xEF0A9419UL,0x85320C47UL,0x391FA3D5UL,0x8DD612C8UL,0x4BA8E59EUL,40.205 - 0x7650B73EUL,0xDAF126BCUL,0x7B135BC4UL,0x8975E34DUL,0x9ACA26E7UL,40.206 - 0x9F1E2BD7UL,0xAE366848UL,0xC16EFC96UL,0xFC4D50ECUL,0x20D78135UL,40.207 - 0x6A38985EUL,0xBC2DAF92UL,0xB4C9B11DUL,0xC67EF756UL,0x3DF852A0UL,40.208 - 0xACA19182UL,0xA1E27D78UL,0xF266B889UL,0x13BFC5AAUL,0x05D40D30UL,40.209 - 0x3128439FUL,0x6F5894DEUL,0x3D23AC7AUL,0xDC9AD1D9UL,0x4AEF196BUL,40.210 - 0xD61537CCUL,0x08E41E8FUL,0x72B7464BUL,0xFB86A5F6UL,0x9159C322UL,40.211 - 0x0D43ECFAUL,0x5384C5F1UL,0xE1D97D23UL,0x166BC89AUL,0x34FC4EAFUL,40.212 - 0x5E70D741UL,0x527B38A4UL,0xE1B97DA3UL,0x9675C8B2UL,0x9CFA2EA7UL,40.213 - 0xDEF12943UL,0x7A5358C4UL,0x8931E3BDUL,0x6ADF66D4UL,0x9C1A2FD8UL,40.214 - 0x5EC7290BUL,0xB25DB8D2UL,0xF7B2B5B9UL,0x22978635UL,0x6A8C99EEUL,40.215 - 0x0C0BEFE5UL,0xB3C24507UL,0x77CCB511UL,0x0A8FE615UL,0x420B07E4UL,40.216 - 0xA4A27187UL,0xF362BB79UL,0xE3EE8569UL,0xF6C5490CUL,0xC2DD06D3UL,40.217 - 0xEC9A91D9UL,0x45EF0D6BUL,0xD525338CUL,0x481B1FDBUL,0x6687760BUL,40.218 - 0xBFC9AAE2UL,0xC40EF016UL,0x7D435304UL,0x4884E1F1UL,0xE6A97663UL,40.219 - 0x57C0CAFEUL,0x108C3E10UL,0x152BCC65UL,0x34184FDFUL,0x2E47970AUL,40.220 - 0xA9759CB2UL,0x90CA3EE7UL,0x9D3E2C57UL,0x2E9C69D0UL,0xD94EDCE9UL,40.221 - 0x7BC75AF4UL,0xB94DA312UL,0x35C7B2F5UL,0xAE2D9792UL,0xB169BC9DUL,40.222 - 0x474CF4EEUL,0x05A7F275UL,0x213383BAUL,0x1A5FD8D5UL,0x87320BB8UL,40.223 - 0x39BFA255UL,0x0DF412B0UL,0xB3A24587UL,0xF7D2B539UL,0xA289861DUL,40.224 - 0xC28AF9E6UL,0x8C8A11E7UL,0x9BEA2567UL,0x1F442B0FUL,0xF6254873UL,40.225 - 0x42EB069BUL,0x249471CFUL,0x3B6C5B6FUL,0x9D6DD36DUL,0xBE8DA9EDUL,40.226 - 0x344BB0E5UL,0xBE565737UL,0x4470F0BEUL,0x555B3324UL,0x60037FFBUL,40.227 - 0x4E00E801UL,0x17603480UL,0x84AE0E68UL,0xE961637CUL,0xB4CE4EE8UL,40.228 - 0x667F7754UL,0x1FF82AA0UL,0xA6018802UL,0x23E07A80UL,0x8AC61908UL,40.229 - 0x8A1DE7D2UL,0xFA26A789UL,0x112BC39AUL,0x35584CDFUL,0x2E0397FAUL,40.230 - 0x5960DC81UL,0x93CE3AE8UL,0x6DCF6D14UL,0x5DAF2D94UL,0xD2B139BCUL,40.231 - 0x79875DF4UL,0xB9F9A2A2UL,0x85E1F282UL,0xA9266388UL,0x00DBFEDAUL,40.232 - 0x703B405BUL,0xEB0D6413UL,0x24738F45UL,0x1B5BDB25UL,0x77634B7BUL,40.233 - 0xCAAEE669UL,0xFE0157FCUL,0x30604080UL,0x8F1E1428UL,0xAB366448UL,40.234 - 0xC07EFF56UL,0x3C185020UL,0x2CC7910AUL,0xA9FD9D52UL,0x70E0BE81UL,40.235 - 0x9B362448UL,0xCF7EEB56UL,0x3F285460UL,0x6C38905EUL,0xBDCDAD12UL,40.236 - 0x34AFB195UL,0xCE61177CUL,0xBF7E54A8UL,0x24287060UL,0x6B489B1EUL,40.237 - 0xFC66AF76UL,0x10DFC12AUL,0x853A0C58UL,0xD91D23D3UL,0xEBD69AC9UL,40.238 - 0x5448CF1EUL,0xF056BF36UL,0x5310C43EUL,0xD1F53D4CUL,0x89621C87UL,40.239 - 0xFACEA6E9UL,0x711F43D4UL,0x9B5624C8UL,0x4F60EB7EUL,0x972E3468UL,40.240 - 0xECB96E5CUL,0x95E5CD72UL,0x5C272F8BUL,0x32CBB91AUL,0xBF9E55D7UL,40.241 - 0xA41E7028UL,0xA3467B08UL,0x82E5F972UL,0x589721CBUL,0x73ACBA6EUL,40.242 - 0x8BD1E53DUL,0xEA49671CUL,0xD436CFB6UL,0xD84EDF16UL,0x7B975A34UL,40.243 - 0x795CA32EUL,0xC9C2E2F9UL,0x6EEC9691UL,0x8D55ECCDUL,0x1B8025FFUL,40.244 - 0x07580B20UL,0x21A3827AUL,0xDA72D8B9UL,0x2B3B9BA5UL,0xF87D5F53UL,40.245 - 0x61988221UL,0x3E7FA8AAUL,0x0C7810A0UL,0xA3D98522UL,0x02CBF91AUL,40.246 - 0xB09E41D7UL,0xA72E7468UL,0xE3B97A5CUL,0x96D5C932UL,0x1CD82EDFUL,40.247 - 0x26FB895AUL,0xFBD15AC3UL,0xF149431CUL,0xD346C4F6UL,0x99E5DD72UL,40.248 -40.249 -};40.250 -# endif40.251 -# if defined WORDS_BIGENDIAN40.252 -/* big endian */40.253 -static const uint32_t yellowbook_scrambler_uint32[2340/4] = {40.254 - 0x01800060UL,0x0028001EUL,0x80086006UL,0xA802FE81UL,0x80606028UL,40.255 - 0x281E9E88UL,0x6866AEAAUL,0xFC7F01E0UL,0x00480036UL,0x8016E00EUL,40.256 - 0xC8045683UL,0x7EE1E048UL,0x4836B696UL,0xF6EEC6CCUL,0x52D5FD9FUL,40.257 - 0x01A8007EUL,0x80206018UL,0x280A9E87UL,0x28629EA9UL,0xA87EFEA0UL,40.258 - 0x40783022UL,0x9419AF4AUL,0xFC3701D6UL,0x805EE038UL,0x4812B68DUL,40.259 - 0xB6E5B6CBUL,0x36D756DEUL,0xBED8705AUL,0xA43B3B53UL,0x537DFDE1UL,40.260 - 0x81886066UL,0xA82AFE9FUL,0x0068002EUL,0x801C6009UL,0xE806CE82UL,40.261 - 0xD4619F68UL,0x682EAE9CUL,0x7C69E1EEUL,0xC84C56B5UL,0xFEF70046UL,40.262 - 0x8032E015UL,0x880F2684UL,0x1AE34B09UL,0xF746C6B2UL,0xD2F59D87UL,40.263 - 0x29A29EF9UL,0xA842FEB1UL,0x80746027UL,0x681AAE8BUL,0x3C6751EAUL,40.264 - 0xBC4F31F4UL,0x14474F72UL,0xB425B75BUL,0x36BB56F3UL,0x7EC5E053UL,40.265 - 0x083DC691UL,0x92EC6D8DUL,0xEDA58DBBUL,0x25B35B35UL,0xFB57037EUL,40.266 - 0x81E06048UL,0x28369E96UL,0xE86ECEACUL,0x547DFF61UL,0x8028601EUL,40.267 - 0xA8087E86UL,0xA062F829UL,0x829EE1A8UL,0x487EB6A0UL,0x76F826C2UL,40.268 - 0x9AD1AB1CUL,0x7F49E036UL,0xC816D68EUL,0xDEE4584BUL,0x7AB76336UL,40.269 - 0xA9D6FEDEUL,0xC058503AUL,0xBC1331CDUL,0xD4559F7FUL,0x28201E98UL,40.270 - 0x086A86AFUL,0x22FC1981UL,0xCAE05708UL,0x3E869062UL,0xEC298DDEUL,40.271 - 0xE5984B2AUL,0xB75F36B8UL,0x16F28EC5UL,0xA4533B7DUL,0xD3619DE8UL,40.272 - 0x698EAEE4UL,0x7C4B61F7UL,0x6846AEB2UL,0xFC7581E7UL,0x204A9837UL,40.273 - 0x2A969F2EUL,0xE81C4E89UL,0xF466C76AUL,0xD2AF1DBCUL,0x09B1C6F4UL,40.274 - 0x52C77D92UL,0xA1ADB87DUL,0xB2A1B5B8UL,0x7732A695UL,0xBAEF330CUL,40.275 - 0x15C5CF13UL,0x140DCF45UL,0x94332F55UL,0xDC3F19D0UL,0x0ADC0719UL,40.276 - 0xC28AD1A7UL,0x1C7A89E3UL,0x26C9DAD6UL,0xDB1EDB48UL,0x5B76BB66UL,40.277 - 0xF36AC5EFUL,0x130C0DC5UL,0xC593132DUL,0xCDDD9599UL,0xAF2AFC1FUL,40.278 - 0x01C80056UL,0x803EE010UL,0x480C3685UL,0xD6E31EC9UL,0xC856D6BEUL,40.279 - 0xDEF05844UL,0x3AB35335UL,0xFDD7019EUL,0x8068602EUL,0xA81C7E89UL,40.280 - 0xE066C82AUL,0xD69F1EE8UL,0x084E86B4UL,0x62F76986UL,0xAEE2FC49UL,40.281 - 0x81F6E046UL,0xC832D695UL,0x9EEF284CUL,0x1EB5C877UL,0x16A68EFAUL,40.282 - 0xE4430B71UL,0xC76452ABUL,0x7DBF61B0UL,0x28741EA7UL,0x487AB6A3UL,40.283 - 0x36F9D6C2UL,0xDED1985CUL,0x6AB9EF32UL,0xCC1595CFUL,0x2F141C0FUL,40.284 - 0x49C436D3UL,0x56DDFED9UL,0x805AE03BUL,0x0813468DUL,0xF2E5858BUL,40.285 - 0x232759DAUL,0xBADB331BUL,0x55CB7F17UL,0x600EA804UL,0x7E836061UL,40.286 - 0xE8284E9EUL,0xB468776EUL,0xA6AC7AFDUL,0xE30189C0UL,0x66D02ADCUL,40.287 - 0x1F19C80AUL,0xD6871EE2UL,0x8849A6B6UL,0xFAF6C306UL,0xD1C2DC51UL,40.288 - 0x99FC6AC1UL,0xEF104C0CUL,0x35C5D713UL,0x1E8DC865UL,0x96AB2EFFUL,40.289 - 0x5C4039F0UL,0x12C40D93UL,0x45ADF33DUL,0x85D1A31CUL,0x79C9E2D6UL,40.290 - 0xC99ED6E8UL,0x5ECEB854UL,0x72BF65B0UL,0x2B341F57UL,0x483EB690UL,40.291 - 0x76EC26CDUL,0xDAD59B1FUL,0x2B481F76UL,0x8826E69AUL,0xCAEB170FUL,40.292 - 0x4E843463UL,0x5769FEAEUL,0xC07C5021UL,0xFC1841CAUL,0xB057343EUL,40.293 - 0x97506EBCUL,0x2C71DDE4UL,0x598B7AE7UL,0x630AA9C7UL,0x3ED2905DUL,40.294 - 0xAC39BDD2UL,0xF19D8469UL,0xA36EF9ECUL,0x42CDF195UL,0x846F236CUL,40.295 - 0x19EDCACDUL,0x9715AE8FUL,0x3C6411EBUL,0x4C4F75F4UL,0x27075A82UL,40.296 - 0xBB21B358UL,0x75FAA703UL,0x3A81D320UL,0x5DD8399AUL,0x92EB2D8FUL,40.297 - 0x5DA439BBUL,0x52F37D85UL,0xE1A30879UL,0xC6A2D2F9UL,0x9D82E9A1UL,40.298 - 0x8EF86442UL,0xAB71BF64UL,0x702B641FUL,0x6B482F76UL,0x9C26E9DAUL,40.299 - 0xCEDB145BUL,0x4F7B7423UL,0x6759EABAUL,0xCF331415UL,0xCF4F1434UL,40.300 - 0x0F57443EUL,0xB35075FCUL,0x2701DA80UL,0x5B203B58UL,0x137A8DE3UL,40.301 - 0x2589DB26UL,0xDB5ADB7BUL,0x1B634B69UL,0xF76EC6ACUL,0x52FDFD81UL,40.302 - 0x81A06078UL,0x28229E99UL,0xA86AFEAFUL,0x007C0021UL,0xC018500AUL,40.303 - 0xBC0731C2UL,0x9451AF7CUL,0x7C21E1D8UL,0x485AB6BBUL,0x36F356C5UL,40.304 - 0xFED3005DUL,0xC0399012UL,0xEC0D8DC5UL,0xA5933B2DUL,0xD35D9DF9UL,40.305 - 0xA982FEE1UL,0x80486036UL,0xA816FE8EUL,0xC064502BUL,0x7C1F61C8UL,40.306 - 0x28569EBEUL,0xE8704EA4UL,0x347B5763UL,0x7EA9E07EUL,0xC8205698UL,40.307 - 0x3EEA904FUL,0x2C341DD7UL,0x499EB6E8UL,0x76CEA6D4UL,0x7ADF6318UL,40.308 - 0x29CA9ED7UL,0x285E9EB8UL,0x6872AEA5UL,0xBC7B31E3UL,0x5449FF76UL,40.309 - 0xC026D01AUL,0xDC0B19C7UL,0x4AD2B71DUL,0xB689B6E6UL,0xF6CAC6D7UL,40.310 - 0x12DE8D98UL,0x65AAAB3FUL,0x3F50103CUL,0x0C11C5CCUL,0x5315FDCFUL,40.311 - 0x0194006FUL,0x402C301DUL,0xD4099F46UL,0xE832CE95UL,0x946F2F6CUL,40.312 - 0x1C2DC9DDUL,0x96D9AEDAUL,0xFC5B01FBUL,0x40437031UL,0xE4144B4FUL,40.313 - 0x777426A7UL,0x5AFABB03UL,0x3341D5F0UL,0x5F043803UL,0x5281FDA0UL,40.314 - 0x41B83072UL,0x9425AF5BUL,0x3C3B51D3UL,0x7C5DE1F9UL,0x8842E6B1UL,40.315 - 0x8AF46707UL,0x6A82AF21UL,0xBC1871CAUL,0xA4573B7EUL,0x93606DE8UL,40.316 - 0x2D8E9DA4UL,0x69BB6EF3UL,0x6C45EDF3UL,0x0D85C5A3UL,0x1339CDD2UL,40.317 - 0xD59D9F29UL,0xA81EFE88UL,0x4066B02AUL,0xF41F0748UL,0x02B681B6UL,40.318 - 0xE076C826UL,0xD69ADEEBUL,0x184F4AB4UL,0x37375696UL,0xBEEEF04CUL,40.319 - 0x4435F357UL,0x05FE8300UL,0x61C02850UL,0x1EBC0871UL,0xC6A452FBUL,40.320 - 0x7D8361A1UL,0xE8784EA2UL,0xB479B762UL,0xF6A986FEUL,0xE2C04990UL,40.321 - 0x36EC16CDUL,0xCED5945FUL,0x2F781C22UL,0x89D9A6DAUL,0xFADB031BUL,40.322 - 0x41CB7057UL,0x643EAB50UL,0x7F7C2021UL,0xD8185A8AUL,0xBB27335AUL,40.323 - 0x95FB2F03UL,0x5C01F9C0UL,0x42D0319CUL,0x1469CF6EUL,0xD42C5F5DUL,40.324 - 0xF8398292UL,0xE1AD887DUL,0xA6A1BAF8UL,0x7302A5C1UL,0xBB10734CUL,40.325 - 0x25F5DB07UL,0x1B428B71UL,0xA7647AABUL,0x633F69D0UL,0x2EDC1C59UL,40.326 - 0xC9FAD6C3UL,0x1ED1C85CUL,0x56B9FEF2UL,0xC0459033UL,0x2C15DDCFUL,40.327 - 0x19940AEFUL,0x470C3285UL,0xD5A31F39UL,0xC812D68DUL,0x9EE5A84BUL,40.328 - 0x3EB75076UL,0xBC26F1DAUL,0xC45B137BUL,0x4DE37589UL,0xE726CA9AUL,40.329 - 0xD72B1E9FUL,0x486836AEUL,0x96FC6EC1UL,0xEC504DFCUL,0x3581D720UL,40.330 - 0x5E98386AUL,0x92AF2DBCUL,0x1DB1C9B4UL,0x56F77EC6UL,0xA052F83DUL,40.331 - 0x8291A1ACUL,0x787DE2A1UL,0x89B866F2UL,0xAAC5BF13UL,0x300DD405UL,40.332 - 0x9F432831UL,0xDE94586FUL,0x7AAC233DUL,0xD9D19ADCUL,0x6B19EF4AUL,40.333 - 0xCC3715D6UL,0x8F1EE408UL,0x4B46B772UL,0xF6A586FBUL,0x22C35991UL,40.334 - 0xFAEC430DUL,0xF1C58453UL,0x237DD9E1UL,0x9AC86B16UL,0xAF4EFC34UL,40.335 - 0x41D7705EUL,0xA4387B52UL,0xA37DB9E1UL,0xB2C87596UL,0xA72EFA9CUL,40.336 - 0x4329F1DEUL,0xC458537AUL,0xBDE33189UL,0xD466DF6AUL,0xD82F1A9CUL,40.337 - 0x0B29C75EUL,0xD2B85DB2UL,0xB9B5B2F7UL,0x35869722UL,0xEE998C6AUL,40.338 - 0xE5EF0B0CUL,0x0745C2B3UL,0x11B5CC77UL,0x15E68F0AUL,0xE4070B42UL,40.339 - 0x8771A2A4UL,0x79BB62F3UL,0x6985EEE3UL,0x0C49C5F6UL,0xD306DDC2UL,40.340 - 0xD9919AECUL,0x6B0DEF45UL,0x8C3325D5UL,0xDB1F1B48UL,0x0B768766UL,40.341 - 0xE2AAC9BFUL,0x16F00EC4UL,0x0453437DUL,0xF1E18448UL,0x6376A9E6UL,40.342 - 0xFECAC057UL,0x103E8C10UL,0x65CC2B15UL,0xDF4F1834UL,0x0A97472EUL,40.343 - 0xB29C75A9UL,0xE73ECA90UL,0x572C3E9DUL,0xD0699C2EUL,0xE9DC4ED9UL,40.344 - 0xF45AC77BUL,0x12A34DB9UL,0xF5B2C735UL,0x92972DAEUL,0x9DBC69B1UL,40.345 - 0xEEF44C47UL,0x75F2A705UL,0xBA833321UL,0xD5D85F1AUL,0xB80B3287UL,40.346 - 0x55A2BF39UL,0xB012F40DUL,0x8745A2B3UL,0x39B5D2F7UL,0x1D8689A2UL,40.347 - 0xE6F98AC2UL,0xE7118A8CUL,0x6725EA9BUL,0x0F2B441FUL,0x734825F6UL,40.348 - 0x9B06EB42UL,0xCF719424UL,0x6F5B6C3BUL,0x6DD36D9DUL,0xEDA98DBEUL,40.349 - 0xE5B04B34UL,0x375756BEUL,0xBEF07044UL,0x24335B55UL,0xFB7F0360UL,40.350 - 0x01E8004EUL,0x80346017UL,0x680EAE84UL,0x7C6361E9UL,0xE84ECEB4UL,40.351 - 0x54777F66UL,0xA02AF81FUL,0x028801A6UL,0x807AE023UL,0x0819C68AUL,40.352 - 0xD2E71D8AUL,0x89A726FAUL,0x9AC32B11UL,0xDF4C5835UL,0xFA97032EUL,40.353 - 0x81DC6059UL,0xE83ACE93UL,0x146DCF6DUL,0x942DAF5DUL,0xBC39B1D2UL,40.354 - 0xF45D8779UL,0xA2A2F9B9UL,0x82F2E185UL,0x886326A9UL,0xDAFEDB00UL,40.355 - 0x5B403B70UL,0x13640DEBUL,0x458F7324UL,0x25DB5B1BUL,0x7B4B6377UL,40.356 - 0x69E6AECAUL,0xFC5701FEUL,0x80406030UL,0x28141E8FUL,0x486436ABUL,40.357 - 0x56FF7EC0UL,0x2050183CUL,0x0A91C72CUL,0x529DFDA9UL,0x81BEE070UL,40.358 - 0x4824369BUL,0x56EB7ECFUL,0x6054283FUL,0x5E90386CUL,0x12ADCDBDUL,40.359 - 0x95B1AF34UL,0x7C1761CEUL,0xA8547EBFUL,0x60702824UL,0x1E9B486BUL,40.360 - 0x76AF66FCUL,0x2AC1DF10UL,0x580C3A85UL,0xD3231DD9UL,0xC99AD6EBUL,40.361 - 0x1ECF4854UL,0x36BF56F0UL,0x3EC41053UL,0x4C3DF5D1UL,0x871C6289UL,40.362 - 0xE9A6CEFAUL,0xD4431F71UL,0xC824569BUL,0x7EEB604FUL,0x68342E97UL,40.363 - 0x5C6EB9ECUL,0x72CDE595UL,0x8B2F275CUL,0x1AB9CB32UL,0xD7559EBFUL,40.364 - 0x28701EA4UL,0x087B46A3UL,0x72F9E582UL,0xCB219758UL,0x6EBAAC73UL,40.365 - 0x3DE5D18BUL,0x1C6749EAUL,0xB6CF36D4UL,0x16DF4ED8UL,0x345A977BUL,40.366 - 0x2EA35C79UL,0xF9E2C2C9UL,0x9196EC6EUL,0xCDEC558DUL,0xFF25801BUL,40.367 - 0x200B5807UL,0x7A82A321UL,0xB9D872DAUL,0xA59B3B2BUL,0x535F7DF8UL,40.368 - 0x21829861UL,0xAAA87F3EUL,0xA010780CUL,0x2285D9A3UL,0x1AF9CB02UL,40.369 - 0xD7419EB0UL,0x68742EA7UL,0x5C7AB9E3UL,0x32C9D596UL,0xDF2ED81CUL,40.370 - 0x5A89FB26UL,0xC35AD1FBUL,0x1C4349F1UL,0xF6C446D3UL,0x72DDE599UL,40.371 -40.372 -};40.373 -# endif40.374 -40.375 -#else /* PROTOTYPES */40.376 -40.377 -# if !defined WORDS_BIGENDIAN40.378 -/* little endian */40.379 -static const uint32_t yellowbook_scrambler_uint32[2340/4] = {40.380 - 0x60008001,0x1E002800,0x06600880,0x81FE02A8,0x28606080,40.381 - 0x889E1E28,0xAAAE6668,0xE0017FFC,0x36004800,0x0EE01680,40.382 - 0x835604C8,0x48E0E17E,0x96B63648,0xCCC6EEF6,0x9FFDD552,40.383 - 0x7E00A801,0x18602080,0x879E0A28,0xA99E6228,0xA0FE7EA8,40.384 - 0x22307840,0x4AAF1994,0xD60137FC,0x38E05E80,0x8DB61248,40.385 - 0xCBB6E5B6,0xDE56D736,0x5A70D8BE,0x533B3BA4,0xE1FD7D53,40.386 - 0x66608881,0x9FFE2AA8,0x2E006800,0x09601C80,0x82CE06E8,40.387 - 0x689F61D4,0x9CAE2E68,0xEEE1697C,0xB5564CC8,0x4600F7FE,40.388 - 0x15E03280,0x84260F88,0x094BE31A,0xB2C646F7,0x879DF5D2,40.389 - 0xF99EA229,0xB1FE42A8,0x27607480,0x8BAE1A68,0xEA51673C,40.390 - 0xF4314FBC,0x724F4714,0x5BB725B4,0xF356BB36,0x53E0C57E,40.391 - 0x91C63D08,0x8D6DEC92,0xBB8DA5ED,0x355BB325,0x7E0357FB,40.392 - 0x4860E081,0x969E3628,0xACCE6EE8,0x61FF7D54,0x1E602880,40.393 - 0x867E08A8,0x29F862A0,0xA8E19E82,0xA0B67E48,0xC226F876,40.394 - 0x1CABD19A,0x36E0497F,0x8ED616C8,0x4B58E4DE,0x3663B77A,40.395 - 0xDEFED6A9,0x3A5058C0,0xCD3113BC,0x7F9F55D4,0x981E2028,40.396 - 0xAF866A08,0x8119FC22,0x0857E0CA,0x6290863E,0xDE8D29EC,40.397 - 0x2A4B98E5,0xB8365FB7,0xC58EF216,0x7D3B53A4,0xE89D61D3,40.398 - 0xE4AE8E69,0xF7614B7C,0xB2AE4668,0xE78175FC,0x37984A20,40.399 - 0x2E9F962A,0x894E1CE8,0x6AC766F4,0xBC1DAFD2,0xF4C6B109,40.400 - 0x927DC752,0x7DB8ADA1,0xB8B5A1B2,0x95A63277,0x0C33EFBA,40.401 - 0x13CFC515,0x45CF0D14,0x552F3394,0xD0193FDC,0x1907DC0A,40.402 - 0xA7D18AC2,0xE3897A1C,0xD6DAC926,0x48DB1EDB,0x66BB765B,40.403 - 0xEFC56AF3,0xC50D0C13,0x2D1393C5,0x9995DDCD,0x1FFC2AAF,40.404 - 0x5600C801,0x10E03E80,0x85360C48,0xC91EE3D6,0xBED656C8,40.405 - 0x4458F0DE,0x3553B33A,0x9E01D7FD,0x2E606880,0x897E1CA8,40.406 - 0x2AC866E0,0xE81E9FD6,0xB4864E08,0x8669F762,0x49FCE2AE,40.407 - 0x46E0F681,0x95D632C8,0x4C28EF9E,0x77C8B51E,0xFA8EA616,40.408 - 0x710B43E4,0xAB5264C7,0xB061BF7D,0xA71E7428,0xA3B67A48,40.409 - 0xC2D6F936,0x5C98D1DE,0x32EFB96A,0xCF9515CC,0x0F1C142F,40.410 - 0xD336C449,0xD9FEDD56,0x3BE05A80,0x8D461308,0x8B85E5F2,40.411 - 0xDA592723,0x1B33DBBA,0x177FCB55,0x04A80E60,0x6160837E,40.412 - 0x9E4E28E8,0x6E7768B4,0xFD7AACA6,0xC08901E3,0xDC2AD066,40.413 - 0x0AC8191F,0xE21E87D6,0xB6A64988,0x06C3F6FA,0x51DCC2D1,40.414 - 0xC16AFC99,0x0C4C10EF,0x13D7C535,0x65C88D1E,0xFF2EAB96,40.415 - 0xF039405C,0x930DC412,0x3DF3AD45,0x1CA3D185,0xD6E2C979,40.416 - 0xE8D69EC9,0x54B8CE5E,0xB065BF72,0x571F342B,0x90B63E48,40.417 - 0xCD26EC76,0x1F9BD5DA,0x761F482B,0x9AE62688,0x0F17EBCA,40.418 - 0x6334844E,0xAEFE6957,0x21507CC0,0xCA4118FC,0x3E3457B0,40.419 - 0xBC6E5097,0xE4DD712C,0xE77A8B59,0xC7A90A63,0x5D90D23E,40.420 - 0xD2BD39AC,0x69849DF1,0xECF96EA3,0x95F1CD42,0x6C236F84,40.421 - 0xCDCAED19,0x8FAE1597,0xEB11643C,0xF4754F4C,0x825A0727,40.422 - 0x58B321BB,0x03A7FA75,0x20D3813A,0x9A39D85D,0x8F2DEB92,40.423 - 0xBB39A45D,0x857DF352,0x7908A3E1,0xF9D2A2C6,0xA1E9829D,40.424 - 0x4264F88E,0x64BF71AB,0x1F642B70,0x762F486B,0xDAE9269C,40.425 - 0x5B14DBCE,0x23747B4F,0xBAEA5967,0x151433CF,0x34144FCF,40.426 - 0x3E44570F,0xFC7550B3,0x80DA0127,0x583B205B,0xE38D7A13,40.427 - 0x26DB8925,0x7BDB5ADB,0x694B631B,0xACC66EF7,0x81FDFD52,40.428 - 0x7860A081,0x999E2228,0xAFFE6AA8,0x21007C00,0x0A5018C0,40.429 - 0xC23107BC,0x7CAF5194,0xD8E1217C,0xBBB65A48,0xC556F336,40.430 - 0x5D00D3FE,0x129039C0,0xC58D0DEC,0x2D3B93A5,0xF99D5DD3,40.431 - 0xE1FE82A9,0x36604880,0x8EFE16A8,0x2B5064C0,0xC8611F7C,40.432 - 0xBE9E5628,0xA44E70E8,0x63577B34,0x7EE0A97E,0x985620C8,40.433 - 0x4F90EA3E,0xD71D342C,0xE8B69E49,0xD4A6CE76,0x1863DF7A,40.434 - 0xD79ECA29,0xB89E5E28,0xA5AE7268,0xE3317BBC,0x76FF4954,40.435 - 0x1AD026C0,0xC7190BDC,0x1DB7D24A,0xE6B689B6,0xD7C6CAF6,40.436 - 0x988DDE12,0x3FABAA65,0x3C10503F,0xCCC5110C,0xCFFD1553,40.437 - 0x6F009401,0x1D302C40,0x469F09D4,0x95CE32E8,0x6C2F6F94,40.438 - 0xDDC92D1C,0xDAAED996,0xFB015BFC,0x31704340,0x4F4B14E4,40.439 - 0xA7267477,0x03BBFA5A,0xF0D54133,0x0338045F,0xA0FD8152,40.440 - 0x7230B841,0x5BAF2594,0xD3513B3C,0xF9E15D7C,0xB1E64288,40.441 - 0x0767F48A,0x21AF826A,0xCA7118BC,0x7E3B57A4,0xE86D6093,40.442 - 0xA49D8E2D,0xF36EBB69,0xF3ED456C,0xA3C5850D,0xD2CD3913,40.443 - 0x299F9DD5,0x88FE1EA8,0x2AB06640,0x48071FF4,0xB681B602,40.444 - 0x26C876E0,0xEBDE9AD6,0xB44A4F18,0x96563737,0x4CF0EEBE,40.445 - 0x57F33544,0x0083FE05,0x5028C061,0x7108BC1E,0xFB52A4C6,40.446 - 0xA161837D,0xA24E78E8,0x62B779B4,0xFE86A9F6,0x9049C0E2,40.447 - 0xCD16EC36,0x5F94D5CE,0x221C782F,0xDAA6D989,0x1B03DBFA,40.448 - 0x5770CB41,0x50AB3E64,0x21207C7F,0x8A5A18D8,0x5A3327BB,40.449 - 0x032FFB95,0xC0F9015C,0x9C31D042,0x6ECF6914,0x5D5F2CD4,40.450 - 0x928239F8,0x7D88ADE1,0xF8BAA1A6,0xC1A50273,0x4C7310BB,40.451 - 0x07DBF525,0x718B421B,0xAB7A64A7,0xD0693F63,0x591CDC2E,40.452 - 0xC3D6FAC9,0x5CC8D11E,0xF2FEB956,0x339045C0,0xCFDD152C,40.453 - 0xEF0A9419,0x85320C47,0x391FA3D5,0x8DD612C8,0x4BA8E59E,40.454 - 0x7650B73E,0xDAF126BC,0x7B135BC4,0x8975E34D,0x9ACA26E7,40.455 - 0x9F1E2BD7,0xAE366848,0xC16EFC96,0xFC4D50EC,0x20D78135,40.456 - 0x6A38985E,0xBC2DAF92,0xB4C9B11D,0xC67EF756,0x3DF852A0,40.457 - 0xACA19182,0xA1E27D78,0xF266B889,0x13BFC5AA,0x05D40D30,40.458 - 0x3128439F,0x6F5894DE,0x3D23AC7A,0xDC9AD1D9,0x4AEF196B,40.459 - 0xD61537CC,0x08E41E8F,0x72B7464B,0xFB86A5F6,0x9159C322,40.460 - 0x0D43ECFA,0x5384C5F1,0xE1D97D23,0x166BC89A,0x34FC4EAF,40.461 - 0x5E70D741,0x527B38A4,0xE1B97DA3,0x9675C8B2,0x9CFA2EA7,40.462 - 0xDEF12943,0x7A5358C4,0x8931E3BD,0x6ADF66D4,0x9C1A2FD8,40.463 - 0x5EC7290B,0xB25DB8D2,0xF7B2B5B9,0x22978635,0x6A8C99EE,40.464 - 0x0C0BEFE5,0xB3C24507,0x77CCB511,0x0A8FE615,0x420B07E4,40.465 - 0xA4A27187,0xF362BB79,0xE3EE8569,0xF6C5490C,0xC2DD06D3,40.466 - 0xEC9A91D9,0x45EF0D6B,0xD525338C,0x481B1FDB,0x6687760B,40.467 - 0xBFC9AAE2,0xC40EF016,0x7D435304,0x4884E1F1,0xE6A97663,40.468 - 0x57C0CAFE,0x108C3E10,0x152BCC65,0x34184FDF,0x2E47970A,40.469 - 0xA9759CB2,0x90CA3EE7,0x9D3E2C57,0x2E9C69D0,0xD94EDCE9,40.470 - 0x7BC75AF4,0xB94DA312,0x35C7B2F5,0xAE2D9792,0xB169BC9D,40.471 - 0x474CF4EE,0x05A7F275,0x213383BA,0x1A5FD8D5,0x87320BB8,40.472 - 0x39BFA255,0x0DF412B0,0xB3A24587,0xF7D2B539,0xA289861D,40.473 - 0xC28AF9E6,0x8C8A11E7,0x9BEA2567,0x1F442B0F,0xF6254873,40.474 - 0x42EB069B,0x249471CF,0x3B6C5B6F,0x9D6DD36D,0xBE8DA9ED,40.475 - 0x344BB0E5,0xBE565737,0x4470F0BE,0x555B3324,0x60037FFB,40.476 - 0x4E00E801,0x17603480,0x84AE0E68,0xE961637C,0xB4CE4EE8,40.477 - 0x667F7754,0x1FF82AA0,0xA6018802,0x23E07A80,0x8AC61908,40.478 - 0x8A1DE7D2,0xFA26A789,0x112BC39A,0x35584CDF,0x2E0397FA,40.479 - 0x5960DC81,0x93CE3AE8,0x6DCF6D14,0x5DAF2D94,0xD2B139BC,40.480 - 0x79875DF4,0xB9F9A2A2,0x85E1F282,0xA9266388,0x00DBFEDA,40.481 - 0x703B405B,0xEB0D6413,0x24738F45,0x1B5BDB25,0x77634B7B,40.482 - 0xCAAEE669,0xFE0157FC,0x30604080,0x8F1E1428,0xAB366448,40.483 - 0xC07EFF56,0x3C185020,0x2CC7910A,0xA9FD9D52,0x70E0BE81,40.484 - 0x9B362448,0xCF7EEB56,0x3F285460,0x6C38905E,0xBDCDAD12,40.485 - 0x34AFB195,0xCE61177C,0xBF7E54A8,0x24287060,0x6B489B1E,40.486 - 0xFC66AF76,0x10DFC12A,0x853A0C58,0xD91D23D3,0xEBD69AC9,40.487 - 0x5448CF1E,0xF056BF36,0x5310C43E,0xD1F53D4C,0x89621C87,40.488 - 0xFACEA6E9,0x711F43D4,0x9B5624C8,0x4F60EB7E,0x972E3468,40.489 - 0xECB96E5C,0x95E5CD72,0x5C272F8B,0x32CBB91A,0xBF9E55D7,40.490 - 0xA41E7028,0xA3467B08,0x82E5F972,0x589721CB,0x73ACBA6E,40.491 - 0x8BD1E53D,0xEA49671C,0xD436CFB6,0xD84EDF16,0x7B975A34,40.492 - 0x795CA32E,0xC9C2E2F9,0x6EEC9691,0x8D55ECCD,0x1B8025FF,40.493 - 0x07580B20,0x21A3827A,0xDA72D8B9,0x2B3B9BA5,0xF87D5F53,40.494 - 0x61988221,0x3E7FA8AA,0x0C7810A0,0xA3D98522,0x02CBF91A,40.495 - 0xB09E41D7,0xA72E7468,0xE3B97A5C,0x96D5C932,0x1CD82EDF,40.496 - 0x26FB895A,0xFBD15AC3,0xF149431C,0xD346C4F6,0x99E5DD72,40.497 -40.498 -};40.499 -# endif40.500 -# if defined WORDS_BIGENDIAN40.501 -/* big endian */40.502 -static const uint32_t yellowbook_scrambler_uint32[2340/4] = {40.503 - 0x01800060,0x0028001E,0x80086006,0xA802FE81,0x80606028,40.504 - 0x281E9E88,0x6866AEAA,0xFC7F01E0,0x00480036,0x8016E00E,40.505 - 0xC8045683,0x7EE1E048,0x4836B696,0xF6EEC6CC,0x52D5FD9F,40.506 - 0x01A8007E,0x80206018,0x280A9E87,0x28629EA9,0xA87EFEA0,40.507 - 0x40783022,0x9419AF4A,0xFC3701D6,0x805EE038,0x4812B68D,40.508 - 0xB6E5B6CB,0x36D756DE,0xBED8705A,0xA43B3B53,0x537DFDE1,40.509 - 0x81886066,0xA82AFE9F,0x0068002E,0x801C6009,0xE806CE82,40.510 - 0xD4619F68,0x682EAE9C,0x7C69E1EE,0xC84C56B5,0xFEF70046,40.511 - 0x8032E015,0x880F2684,0x1AE34B09,0xF746C6B2,0xD2F59D87,40.512 - 0x29A29EF9,0xA842FEB1,0x80746027,0x681AAE8B,0x3C6751EA,40.513 - 0xBC4F31F4,0x14474F72,0xB425B75B,0x36BB56F3,0x7EC5E053,40.514 - 0x083DC691,0x92EC6D8D,0xEDA58DBB,0x25B35B35,0xFB57037E,40.515 - 0x81E06048,0x28369E96,0xE86ECEAC,0x547DFF61,0x8028601E,40.516 - 0xA8087E86,0xA062F829,0x829EE1A8,0x487EB6A0,0x76F826C2,40.517 - 0x9AD1AB1C,0x7F49E036,0xC816D68E,0xDEE4584B,0x7AB76336,40.518 - 0xA9D6FEDE,0xC058503A,0xBC1331CD,0xD4559F7F,0x28201E98,40.519 - 0x086A86AF,0x22FC1981,0xCAE05708,0x3E869062,0xEC298DDE,40.520 - 0xE5984B2A,0xB75F36B8,0x16F28EC5,0xA4533B7D,0xD3619DE8,40.521 - 0x698EAEE4,0x7C4B61F7,0x6846AEB2,0xFC7581E7,0x204A9837,40.522 - 0x2A969F2E,0xE81C4E89,0xF466C76A,0xD2AF1DBC,0x09B1C6F4,40.523 - 0x52C77D92,0xA1ADB87D,0xB2A1B5B8,0x7732A695,0xBAEF330C,40.524 - 0x15C5CF13,0x140DCF45,0x94332F55,0xDC3F19D0,0x0ADC0719,40.525 - 0xC28AD1A7,0x1C7A89E3,0x26C9DAD6,0xDB1EDB48,0x5B76BB66,40.526 - 0xF36AC5EF,0x130C0DC5,0xC593132D,0xCDDD9599,0xAF2AFC1F,40.527 - 0x01C80056,0x803EE010,0x480C3685,0xD6E31EC9,0xC856D6BE,40.528 - 0xDEF05844,0x3AB35335,0xFDD7019E,0x8068602E,0xA81C7E89,40.529 - 0xE066C82A,0xD69F1EE8,0x084E86B4,0x62F76986,0xAEE2FC49,40.530 - 0x81F6E046,0xC832D695,0x9EEF284C,0x1EB5C877,0x16A68EFA,40.531 - 0xE4430B71,0xC76452AB,0x7DBF61B0,0x28741EA7,0x487AB6A3,40.532 - 0x36F9D6C2,0xDED1985C,0x6AB9EF32,0xCC1595CF,0x2F141C0F,40.533 - 0x49C436D3,0x56DDFED9,0x805AE03B,0x0813468D,0xF2E5858B,40.534 - 0x232759DA,0xBADB331B,0x55CB7F17,0x600EA804,0x7E836061,40.535 - 0xE8284E9E,0xB468776E,0xA6AC7AFD,0xE30189C0,0x66D02ADC,40.536 - 0x1F19C80A,0xD6871EE2,0x8849A6B6,0xFAF6C306,0xD1C2DC51,40.537 - 0x99FC6AC1,0xEF104C0C,0x35C5D713,0x1E8DC865,0x96AB2EFF,40.538 - 0x5C4039F0,0x12C40D93,0x45ADF33D,0x85D1A31C,0x79C9E2D6,40.539 - 0xC99ED6E8,0x5ECEB854,0x72BF65B0,0x2B341F57,0x483EB690,40.540 - 0x76EC26CD,0xDAD59B1F,0x2B481F76,0x8826E69A,0xCAEB170F,40.541 - 0x4E843463,0x5769FEAE,0xC07C5021,0xFC1841CA,0xB057343E,40.542 - 0x97506EBC,0x2C71DDE4,0x598B7AE7,0x630AA9C7,0x3ED2905D,40.543 - 0xAC39BDD2,0xF19D8469,0xA36EF9EC,0x42CDF195,0x846F236C,40.544 - 0x19EDCACD,0x9715AE8F,0x3C6411EB,0x4C4F75F4,0x27075A82,40.545 - 0xBB21B358,0x75FAA703,0x3A81D320,0x5DD8399A,0x92EB2D8F,40.546 - 0x5DA439BB,0x52F37D85,0xE1A30879,0xC6A2D2F9,0x9D82E9A1,40.547 - 0x8EF86442,0xAB71BF64,0x702B641F,0x6B482F76,0x9C26E9DA,40.548 - 0xCEDB145B,0x4F7B7423,0x6759EABA,0xCF331415,0xCF4F1434,40.549 - 0x0F57443E,0xB35075FC,0x2701DA80,0x5B203B58,0x137A8DE3,40.550 - 0x2589DB26,0xDB5ADB7B,0x1B634B69,0xF76EC6AC,0x52FDFD81,40.551 - 0x81A06078,0x28229E99,0xA86AFEAF,0x007C0021,0xC018500A,40.552 - 0xBC0731C2,0x9451AF7C,0x7C21E1D8,0x485AB6BB,0x36F356C5,40.553 - 0xFED3005D,0xC0399012,0xEC0D8DC5,0xA5933B2D,0xD35D9DF9,40.554 - 0xA982FEE1,0x80486036,0xA816FE8E,0xC064502B,0x7C1F61C8,40.555 - 0x28569EBE,0xE8704EA4,0x347B5763,0x7EA9E07E,0xC8205698,40.556 - 0x3EEA904F,0x2C341DD7,0x499EB6E8,0x76CEA6D4,0x7ADF6318,40.557 - 0x29CA9ED7,0x285E9EB8,0x6872AEA5,0xBC7B31E3,0x5449FF76,40.558 - 0xC026D01A,0xDC0B19C7,0x4AD2B71D,0xB689B6E6,0xF6CAC6D7,40.559 - 0x12DE8D98,0x65AAAB3F,0x3F50103C,0x0C11C5CC,0x5315FDCF,40.560 - 0x0194006F,0x402C301D,0xD4099F46,0xE832CE95,0x946F2F6C,40.561 - 0x1C2DC9DD,0x96D9AEDA,0xFC5B01FB,0x40437031,0xE4144B4F,40.562 - 0x777426A7,0x5AFABB03,0x3341D5F0,0x5F043803,0x5281FDA0,40.563 - 0x41B83072,0x9425AF5B,0x3C3B51D3,0x7C5DE1F9,0x8842E6B1,40.564 - 0x8AF46707,0x6A82AF21,0xBC1871CA,0xA4573B7E,0x93606DE8,40.565 - 0x2D8E9DA4,0x69BB6EF3,0x6C45EDF3,0x0D85C5A3,0x1339CDD2,40.566 - 0xD59D9F29,0xA81EFE88,0x4066B02A,0xF41F0748,0x02B681B6,40.567 - 0xE076C826,0xD69ADEEB,0x184F4AB4,0x37375696,0xBEEEF04C,40.568 - 0x4435F357,0x05FE8300,0x61C02850,0x1EBC0871,0xC6A452FB,40.569 - 0x7D8361A1,0xE8784EA2,0xB479B762,0xF6A986FE,0xE2C04990,40.570 - 0x36EC16CD,0xCED5945F,0x2F781C22,0x89D9A6DA,0xFADB031B,40.571 - 0x41CB7057,0x643EAB50,0x7F7C2021,0xD8185A8A,0xBB27335A,40.572 - 0x95FB2F03,0x5C01F9C0,0x42D0319C,0x1469CF6E,0xD42C5F5D,40.573 - 0xF8398292,0xE1AD887D,0xA6A1BAF8,0x7302A5C1,0xBB10734C,40.574 - 0x25F5DB07,0x1B428B71,0xA7647AAB,0x633F69D0,0x2EDC1C59,40.575 - 0xC9FAD6C3,0x1ED1C85C,0x56B9FEF2,0xC0459033,0x2C15DDCF,40.576 - 0x19940AEF,0x470C3285,0xD5A31F39,0xC812D68D,0x9EE5A84B,40.577 - 0x3EB75076,0xBC26F1DA,0xC45B137B,0x4DE37589,0xE726CA9A,40.578 - 0xD72B1E9F,0x486836AE,0x96FC6EC1,0xEC504DFC,0x3581D720,40.579 - 0x5E98386A,0x92AF2DBC,0x1DB1C9B4,0x56F77EC6,0xA052F83D,40.580 - 0x8291A1AC,0x787DE2A1,0x89B866F2,0xAAC5BF13,0x300DD405,40.581 - 0x9F432831,0xDE94586F,0x7AAC233D,0xD9D19ADC,0x6B19EF4A,40.582 - 0xCC3715D6,0x8F1EE408,0x4B46B772,0xF6A586FB,0x22C35991,40.583 - 0xFAEC430D,0xF1C58453,0x237DD9E1,0x9AC86B16,0xAF4EFC34,40.584 - 0x41D7705E,0xA4387B52,0xA37DB9E1,0xB2C87596,0xA72EFA9C,40.585 - 0x4329F1DE,0xC458537A,0xBDE33189,0xD466DF6A,0xD82F1A9C,40.586 - 0x0B29C75E,0xD2B85DB2,0xB9B5B2F7,0x35869722,0xEE998C6A,40.587 - 0xE5EF0B0C,0x0745C2B3,0x11B5CC77,0x15E68F0A,0xE4070B42,40.588 - 0x8771A2A4,0x79BB62F3,0x6985EEE3,0x0C49C5F6,0xD306DDC2,40.589 - 0xD9919AEC,0x6B0DEF45,0x8C3325D5,0xDB1F1B48,0x0B768766,40.590 - 0xE2AAC9BF,0x16F00EC4,0x0453437D,0xF1E18448,0x6376A9E6,40.591 - 0xFECAC057,0x103E8C10,0x65CC2B15,0xDF4F1834,0x0A97472E,40.592 - 0xB29C75A9,0xE73ECA90,0x572C3E9D,0xD0699C2E,0xE9DC4ED9,40.593 - 0xF45AC77B,0x12A34DB9,0xF5B2C735,0x92972DAE,0x9DBC69B1,40.594 - 0xEEF44C47,0x75F2A705,0xBA833321,0xD5D85F1A,0xB80B3287,40.595 - 0x55A2BF39,0xB012F40D,0x8745A2B3,0x39B5D2F7,0x1D8689A2,40.596 - 0xE6F98AC2,0xE7118A8C,0x6725EA9B,0x0F2B441F,0x734825F6,40.597 - 0x9B06EB42,0xCF719424,0x6F5B6C3B,0x6DD36D9D,0xEDA98DBE,40.598 - 0xE5B04B34,0x375756BE,0xBEF07044,0x24335B55,0xFB7F0360,40.599 - 0x01E8004E,0x80346017,0x680EAE84,0x7C6361E9,0xE84ECEB4,40.600 - 0x54777F66,0xA02AF81F,0x028801A6,0x807AE023,0x0819C68A,40.601 - 0xD2E71D8A,0x89A726FA,0x9AC32B11,0xDF4C5835,0xFA97032E,40.602 - 0x81DC6059,0xE83ACE93,0x146DCF6D,0x942DAF5D,0xBC39B1D2,40.603 - 0xF45D8779,0xA2A2F9B9,0x82F2E185,0x886326A9,0xDAFEDB00,40.604 - 0x5B403B70,0x13640DEB,0x458F7324,0x25DB5B1B,0x7B4B6377,40.605 - 0x69E6AECA,0xFC5701FE,0x80406030,0x28141E8F,0x486436AB,40.606 - 0x56FF7EC0,0x2050183C,0x0A91C72C,0x529DFDA9,0x81BEE070,40.607 - 0x4824369B,0x56EB7ECF,0x6054283F,0x5E90386C,0x12ADCDBD,40.608 - 0x95B1AF34,0x7C1761CE,0xA8547EBF,0x60702824,0x1E9B486B,40.609 - 0x76AF66FC,0x2AC1DF10,0x580C3A85,0xD3231DD9,0xC99AD6EB,40.610 - 0x1ECF4854,0x36BF56F0,0x3EC41053,0x4C3DF5D1,0x871C6289,40.611 - 0xE9A6CEFA,0xD4431F71,0xC824569B,0x7EEB604F,0x68342E97,40.612 - 0x5C6EB9EC,0x72CDE595,0x8B2F275C,0x1AB9CB32,0xD7559EBF,40.613 - 0x28701EA4,0x087B46A3,0x72F9E582,0xCB219758,0x6EBAAC73,40.614 - 0x3DE5D18B,0x1C6749EA,0xB6CF36D4,0x16DF4ED8,0x345A977B,40.615 - 0x2EA35C79,0xF9E2C2C9,0x9196EC6E,0xCDEC558D,0xFF25801B,40.616 - 0x200B5807,0x7A82A321,0xB9D872DA,0xA59B3B2B,0x535F7DF8,40.617 - 0x21829861,0xAAA87F3E,0xA010780C,0x2285D9A3,0x1AF9CB02,40.618 - 0xD7419EB0,0x68742EA7,0x5C7AB9E3,0x32C9D596,0xDF2ED81C,40.619 - 0x5A89FB26,0xC35AD1FB,0x1C4349F1,0xF6C446D3,0x72DDE599,40.620 -40.621 -};40.622 -# endif40.623 -40.624 -#endif /* PROTOTYPES */
41.1 --- a/src/gdrom/gddriver.h Sun Jan 31 18:30:13 2010 +100041.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000041.3 @@ -1,266 +0,0 @@41.4 -/**41.5 - * $Id$41.6 - *41.7 - * This file defines the structures and functions used by the GD-Rom41.8 - * disc drivers. (ie, the modules that supply a CD image to be used by the41.9 - * system).41.10 - *41.11 - * Copyright (c) 2005 Nathan Keynes.41.12 - *41.13 - * This program is free software; you can redistribute it and/or modify41.14 - * it under the terms of the GNU General Public License as published by41.15 - * the Free Software Foundation; either version 2 of the License, or41.16 - * (at your option) any later version.41.17 - *41.18 - * This program is distributed in the hope that it will be useful,41.19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of41.20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the41.21 - * GNU General Public License for more details.41.22 - */41.23 -41.24 -#ifndef lxdream_gddriver_H41.25 -#define lxdream_gddriver_H 141.26 -41.27 -#include <stdio.h>41.28 -#include "lxdream.h"41.29 -#include "gdrom/gdrom.h"41.30 -#include <glib/gstrfuncs.h>41.31 -41.32 -#ifdef __cplusplus41.33 -extern "C" {41.34 -#endif41.35 -41.36 -#define MAX_SECTOR_SIZE 235241.37 -41.38 -#define CD_MSF_START 150 /* MSF numbering starts after the initial pregap */41.39 -#define CD_FRAMES_PER_SECOND 7541.40 -#define CD_SECONDS_PER_MINUTE 6041.41 -#define CD_FRAMES_PER_MINUTE (CD_FRAMES_PER_SECOND*CD_SECONDS_PER_MINUTE)41.42 -41.43 -#define GDROM_PREGAP 150 /* Sectors */41.44 -41.45 -extern uint32_t gdrom_sector_size[];41.46 -#define GDROM_SECTOR_SIZE(x) gdrom_sector_size[x]41.47 -/**41.48 - * Track data type enumeration for cd images and devices. This somewhat41.49 - * conflates the real track mode with the format of the image file, but41.50 - * it manages to make sense so far.41.51 - */41.52 -typedef enum {41.53 - GDROM_MODE0, // Mode 0 - should never actually see this41.54 - /* Data-only modes (image file contains only the user data) */41.55 - GDROM_MODE1, // Standard CD-Rom Mode 1 data track41.56 - GDROM_MODE2_FORMLESS, // Mode 2 data track with no sub-structure (rare)41.57 - GDROM_MODE2_FORM1, // Mode 2/Form 1 data track (standard for multisession)41.58 - GDROM_MODE2_FORM2, // Mode 2/Form 2 data track (also fairly uncommon).41.59 - GDROM_CDDA, // Standard audio track41.60 -41.61 - /* This one is somewhat special - the image file contains the 2336 bytes of41.62 - * "extended user data", which in turn contains either a form 1 or form 241.63 - * sector. In other words it's a raw mode2 XA sector without the 16-byte header.41.64 - */41.65 - GDROM_SEMIRAW_MODE2,41.66 - /* Raw modes (image contains the full 2352-byte sector). Split into XA/Non-XA41.67 - * here for convenience, although it's really a session level flag. */41.68 - GDROM_RAW_XA,41.69 - GDROM_RAW_NONXA,41.70 -} gdrom_track_mode_t;41.71 -41.72 -/* The disc register indicates the current contents of the drive. When open41.73 - * contains 0x06.41.74 - */41.75 -#define IDE_DISC_READY 0x01 /* ored with above */41.76 -#define IDE_DISC_IDLE 0x02 /* ie spun-down */41.77 -41.78 -#define IDE_DISC_NONE 0x0641.79 -#define IDE_DISC_AUDIO 0x0041.80 -#define IDE_DISC_CDROM 0x1041.81 -#define IDE_DISC_CDROMXA 0x2041.82 -#define IDE_DISC_GDROM 0x8041.83 -41.84 -#define TRACK_PRE_EMPHASIS 0x1041.85 -#define TRACK_COPY_PERMITTED 0x2041.86 -#define TRACK_DATA 0x4041.87 -#define TRACK_FOUR_CHANNEL 0x8041.88 -41.89 -typedef struct gdrom_track {41.90 - gdrom_track_mode_t mode;41.91 - uint8_t flags; /* Track flags */41.92 - int session; /* session # containing this track */41.93 - uint32_t lba; /* start sector address */41.94 - uint32_t sector_size; /* For convenience, determined by mode */41.95 - uint32_t sector_count;41.96 - uint32_t offset; /* File offset of start of track (image files only) */41.97 - FILE *file; /* Per-track file handle (if any) */41.98 -} *gdrom_track_t;41.99 -41.100 -struct gdrom_disc {41.101 - int disc_type; /* One of the IDE_DISC_* flags */41.102 - const gchar *name; /* Device name / Image filename (owned) */41.103 - const gchar *display_name; /* User-friendly device name, if any (owned) */41.104 - gchar mcn[14]; /* Media catalogue number */41.105 - char title[129]; /* Disc title (if any) from bootstrap */41.106 - int track_count;41.107 - struct gdrom_track track[99];41.108 - FILE *file; /* Image file / device handle */41.109 - void *impl_data; /* Implementation private data */41.110 -41.111 - /* Check for media change. If the media cannot change (ie image file)41.112 - * or is notified asynchonously, this should be a no-op. In the event of41.113 - * a change, this function should update the structure according to the41.114 - * new media (including TOC), and return TRUE.41.115 - * @return TRUE if the media has changed since the last check, otherwise41.116 - * FALSE.41.117 - */41.118 - gboolean (*check_status)( struct gdrom_disc *disc );41.119 -41.120 - /**41.121 - * Read a single sector from the disc at the specified logical address.41.122 - * @param disc pointer to the disc structure41.123 - * @param lba logical address to read from41.124 - * @param mode mode field from the read command41.125 - * @param buf buffer to receive data (at least MAX_SECTOR_SIZE bytes)41.126 - * @param length unsigned int to receive the number of bytes actually read.41.127 - * @return PKT_ERR_OK on success, or another PKT_ERR_* code on failure.41.128 - */41.129 - gdrom_error_t (*read_sector)( struct gdrom_disc *disc,41.130 - uint32_t lba, int mode,41.131 - unsigned char *buf, uint32_t *length );41.132 -41.133 - /**41.134 - * Begin playing audio from the given lba address on the disc.41.135 - */41.136 - gdrom_error_t (*play_audio)(struct gdrom_disc *disc, uint32_t lba, uint32_t endlba);41.137 -41.138 - /**41.139 - * Stop audio playback41.140 - */41.141 - gdrom_error_t (*stop_audio)(struct gdrom_disc *disc);41.142 -41.143 - /**41.144 - * Executed once per time slice to perform house-keeping operations41.145 - * (checking disc status, media changed, etc).41.146 - */41.147 - uint32_t (*run_time_slice)( struct gdrom_disc *disc, uint32_t nanosecs );41.148 -41.149 - /**41.150 - * Release all memory and system resources, including the gdrom_disc itself.41.151 - * (implicitly calls close() if not already closed.41.152 - * @param disc The disc to destroy41.153 - * @param close_fh if TRUE, close the main file/device, otherwise leave open.41.154 - * This is mainly used when the handle will be immediately reused.41.155 - */41.156 - void (*destroy)( struct gdrom_disc *disc, gboolean close_fh );41.157 -};41.158 -41.159 -/**41.160 - * Low-level SCSI transport provided to the main SCSI/MMC driver. When used41.161 - * this will be set as the disc->impl_data field.41.162 - * Note: For symmetry there should be a packet_write variant, but we don't41.163 - * currently need it for anything. YAGNI, etc.41.164 - */41.165 -typedef struct gdrom_scsi_transport {41.166 - /* Execute a read command (ie a command that returns a block of data in41.167 - * response, not necessarily a CD read).41.168 - * @param scsi The disc to execute the command41.169 - * @param cmd The 12-byte command packet41.170 - * @param buf The buffer to receive the read results41.171 - * @param length On entry, the size of buf. Modified on exit to the number41.172 - * of bytes actually read.41.173 - * @return PKT_ERR_OK on success, otherwise the host error code.41.174 - */41.175 - gdrom_error_t (*packet_read)( struct gdrom_disc *disc,41.176 - char *cmd, unsigned char *buf,41.177 - unsigned int *length );41.178 -41.179 - /* Execute a generic command that does not write or return any data.41.180 - * (eg play audio).41.181 - * @param scsi The disc to execute the command41.182 - * @param cmd The 12-byte command packet41.183 - * @return PKT_ERR_OK on success, otherwise the host error code.41.184 - */41.185 - gdrom_error_t (*packet_cmd)( struct gdrom_disc *disc,41.186 - char *cmd );41.187 -41.188 - /* Return TRUE if the media has changed since the last call, otherwise41.189 - * FALSE. This method is used to implement the disc-level check_status41.190 - * and should have no side-effects.41.191 - */41.192 - gboolean (*media_changed)( struct gdrom_disc *disc );41.193 -} *gdrom_scsi_transport_t;41.194 -41.195 -/**41.196 - * Allocate a new gdrom_disc_t and initialize the filename and file fields.41.197 - * The disc is otherwise uninitialized - this is an internal method for use41.198 - * by the concrete implementations.41.199 - */41.200 -gdrom_disc_t gdrom_disc_new(const gchar *filename, FILE *f);41.201 -41.202 -/**41.203 - * Construct a new SCSI/MMC disc using the supplied transport implementation.41.204 - */41.205 -gdrom_disc_t gdrom_scsi_disc_new(const gchar *filename, FILE *f, gdrom_scsi_transport_t transport);41.206 -41.207 -/**41.208 - * Construct a new image file using the default methods.41.209 - */41.210 -gdrom_disc_t gdrom_image_new( const gchar *filename, FILE *f );41.211 -41.212 -#define SCSI_TRANSPORT(disc) ((gdrom_scsi_transport_t)disc->impl_data)41.213 -41.214 -/**41.215 - *41.216 - */41.217 -typedef struct gdrom_image_class {41.218 - const gchar *name;41.219 - const gchar *extension;41.220 - gboolean (*is_valid_file)(FILE *f);41.221 - gdrom_disc_t (*open_image_file)(const gchar *filename, FILE *f);41.222 -} *gdrom_image_class_t;41.223 -41.224 -extern struct gdrom_image_class nrg_image_class;41.225 -extern struct gdrom_image_class cdi_image_class;41.226 -extern struct gdrom_image_class gdi_image_class;41.227 -extern struct gdrom_image_class cdrom_device_class;41.228 -41.229 -/**41.230 - * Determine the track number containing the specified sector by lba.41.231 - */41.232 -int gdrom_disc_get_track_by_lba( gdrom_disc_t image, uint32_t lba );41.233 -41.234 -/**41.235 - * Default disc destroy method, for chaining from subclasses41.236 - */41.237 -void gdrom_disc_destroy( gdrom_disc_t disc, gboolean close_fh );41.238 -41.239 -gdrom_device_t gdrom_device_new( const gchar *name, const gchar *dev_name );41.240 -41.241 -void gdrom_device_destroy( gdrom_device_t dev );41.242 -41.243 -/************* Host-native support functions ***************/41.244 -41.245 -/**41.246 - * Given a raw (2352 byte) data sector, extract the requested components into the41.247 - * target buffer. length will also be updated with the length of the copied41.248 - * data41.249 - */41.250 -void gdrom_extract_raw_data_sector( char *sector_data, int mode, unsigned char *buf, uint32_t *length );41.251 -41.252 -/**41.253 - * Check the disc for a useable DC bootstrap, and update the disc41.254 - * with the title accordingly.41.255 - * @return TRUE if we found a bootstrap, otherwise FALSE.41.256 - */41.257 -gboolean gdrom_disc_read_title( gdrom_disc_t disc );41.258 -41.259 -/**41.260 - * Parse a TOC mode-2 result buffer into the gdrom_disc_t data structure41.261 - */41.262 -void mmc_parse_toc2( gdrom_disc_t disc, unsigned char *buf );41.263 -41.264 -/**41.265 - * Set the disc type flag based on the track contents41.266 - */41.267 -void gdrom_set_disc_type( gdrom_disc_t disc );41.268 -41.269 -#endif /* !lxdream_gddriver_H */
42.1 --- a/src/gdrom/gdi.c Sun Jan 31 18:30:13 2010 +100042.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000042.3 @@ -1,137 +0,0 @@42.4 -/**42.5 - * $Id$42.6 - *42.7 - * NullDC GDI image format42.8 - *42.9 - * Copyright (c) 2005 Nathan Keynes.42.10 - *42.11 - * This program is free software; you can redistribute it and/or modify42.12 - * it under the terms of the GNU General Public License as published by42.13 - * the Free Software Foundation; either version 2 of the License, or42.14 - * (at your option) any later version.42.15 - *42.16 - * This program is distributed in the hope that it will be useful,42.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of42.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the42.19 - * GNU General Public License for more details.42.20 - */42.21 -42.22 -#include <stdlib.h>42.23 -#include <stdio.h>42.24 -#include <stdint.h>42.25 -#include <string.h>42.26 -#include <fcntl.h>42.27 -#include <errno.h>42.28 -#include <sys/stat.h>42.29 -#include <glib/gutils.h>42.30 -#include "gdrom/gddriver.h"42.31 -42.32 -42.33 -static gboolean gdi_image_is_valid( FILE *f );42.34 -static gdrom_disc_t gdi_image_open( const gchar *filename, FILE *f );42.35 -42.36 -struct gdrom_image_class gdi_image_class = { "NullDC GD-Rom Image", "gdi",42.37 - gdi_image_is_valid, gdi_image_open };42.38 -42.39 -static gboolean gdi_image_is_valid( FILE *f )42.40 -{42.41 - char line[512];42.42 - uint32_t track_count;42.43 -42.44 - fseek(f, 0, SEEK_SET);42.45 - if( fgets( line, sizeof(line), f ) == NULL ) {42.46 - return FALSE;42.47 - }42.48 - track_count = strtoul(line, NULL, 0);42.49 - if( track_count == 0 || track_count > 99 ) {42.50 - return FALSE;42.51 - }42.52 - return TRUE;42.53 -}42.54 -42.55 -static gdrom_disc_t gdi_image_open( const gchar *filename, FILE *f )42.56 -{42.57 - int i;42.58 - uint32_t track_count;42.59 - gdrom_disc_t disc;42.60 - struct stat st;42.61 - char line[512];42.62 - int session = 0;42.63 - gchar *dirname;42.64 -42.65 - fseek(f, 0, SEEK_SET);42.66 -42.67 - if( fgets( line, sizeof(line), f ) == NULL ) {42.68 - return FALSE;42.69 - }42.70 - track_count = strtoul(line, NULL, 0);42.71 - if( track_count == 0 || track_count > 99 ) {42.72 - return NULL;42.73 - }42.74 -42.75 - disc = gdrom_image_new(filename, f);42.76 - if( disc == NULL ) {42.77 - ERROR("Unable to allocate memory!");42.78 - return NULL;42.79 - }42.80 - dirname = g_path_get_dirname(filename);42.81 - disc->disc_type = IDE_DISC_GDROM;42.82 - disc->track_count = track_count;42.83 - for( i=0; i<track_count; i++ ) {42.84 - int track_no, start_lba, flags, size, offset;42.85 - char filename[256];42.86 -42.87 - if( fgets( line, sizeof(line), f ) == NULL ) {42.88 - disc->destroy(disc,FALSE);42.89 - return NULL;42.90 - }42.91 - sscanf( line, "%d %d %d %d %s %d", &track_no, &start_lba, &flags, &size,42.92 - filename, &offset );42.93 - if( start_lba >= 45000 ) {42.94 - session = 1;42.95 - }42.96 - disc->track[i].session = session;42.97 - disc->track[i].lba = start_lba + 150; // 2-second offset42.98 - disc->track[i].flags = (flags & 0x0F)<<4;42.99 - disc->track[i].sector_size = size;42.100 - if( strcasecmp( filename, "none" ) == 0 ) {42.101 - disc->track[i].file = NULL;42.102 - disc->track[i].sector_count = 0;42.103 - disc->track[i].mode = GDROM_MODE1;42.104 - } else {42.105 - gchar *pathname = g_strdup_printf( "%s%c%s", dirname, G_DIR_SEPARATOR, filename );42.106 - disc->track[i].file = fopen( pathname, "ro" );42.107 - g_free(pathname);42.108 - if( disc->track[i].file == NULL ) {42.109 - disc->destroy(disc,FALSE);42.110 - g_free(dirname);42.111 - return NULL;42.112 - }42.113 - fstat( fileno(disc->track[i].file), &st );42.114 - disc->track[i].sector_count = st.st_size / size;42.115 - if( disc->track[i].flags & TRACK_DATA ) {42.116 - /* Data track */42.117 - switch(size) {42.118 - case 2048: disc->track[i].mode = GDROM_MODE1; break;42.119 - case 2336: disc->track[i].mode = GDROM_SEMIRAW_MODE2; break;42.120 - case 2352: disc->track[i].mode = GDROM_RAW_XA; break;42.121 - default:42.122 - disc->destroy(disc,FALSE);42.123 - g_free(dirname);42.124 - return NULL;42.125 - }42.126 - } else {42.127 - /* Audio track */42.128 - disc->track[i].mode = GDROM_CDDA;42.129 - if( size != 2352 ) {42.130 - disc->destroy(disc,FALSE);42.131 - g_free(dirname);42.132 - return NULL;42.133 - }42.134 - }42.135 - }42.136 - disc->track[i].offset = offset;42.137 - }42.138 - g_free(dirname);42.139 - return disc;42.140 -}
43.1 --- a/src/gdrom/gdimage.c Sun Jan 31 18:30:13 2010 +100043.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000043.3 @@ -1,460 +0,0 @@43.4 -/**43.5 - * $Id$43.6 - *43.7 - * GD-Rom image-file common functions.43.8 - *43.9 - * Copyright (c) 2005 Nathan Keynes.43.10 - *43.11 - * This program is free software; you can redistribute it and/or modify43.12 - * it under the terms of the GNU General Public License as published by43.13 - * the Free Software Foundation; either version 2 of the License, or43.14 - * (at your option) any later version.43.15 - *43.16 - * This program is distributed in the hope that it will be useful,43.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of43.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the43.19 - * GNU General Public License for more details.43.20 - */43.21 -43.22 -#include <assert.h>43.23 -#include <stdlib.h>43.24 -#include <string.h>43.25 -#include <ctype.h>43.26 -#include <sys/types.h>43.27 -#include <sys/stat.h>43.28 -#include <fcntl.h>43.29 -#include <netinet/in.h>43.30 -43.31 -#include "gdrom/gddriver.h"43.32 -#include "gdrom/packet.h"43.33 -#include "ecc.h"43.34 -43.35 -static gboolean gdrom_null_check_status( gdrom_disc_t disc );43.36 -static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba, int mode,43.37 - unsigned char *buf, uint32_t *readlength );43.38 -43.39 -static uint8_t gdrom_default_sync[12] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0 };43.40 -43.41 -#define SECTOR_HEADER_SIZE 1643.42 -#define SECTOR_SUBHEADER_SIZE 843.43 -43.44 -/* Data offset (from start of raw sector) by sector mode */43.45 -static int gdrom_data_offset[] = { 16, 16, 16, 24, 24, 0, 8, 0, 0 };43.46 -43.47 -gdrom_image_class_t gdrom_image_classes[] = { &cdrom_device_class,43.48 - &nrg_image_class,43.49 - &cdi_image_class,43.50 - &gdi_image_class,43.51 - NULL };43.52 -43.53 -struct cdrom_sector_header {43.54 - uint8_t sync[12];43.55 - uint8_t msf[3];43.56 - uint8_t mode;43.57 - uint8_t subhead[8]; // Mode-2 XA sectors only43.58 -};43.59 -43.60 -gdrom_disc_t gdrom_disc_new( const gchar *filename, FILE *f )43.61 -{43.62 - gdrom_disc_t disc = (gdrom_disc_t)g_malloc0(sizeof(struct gdrom_disc));43.63 - if( disc == NULL ) {43.64 - return NULL;43.65 - }43.66 - disc->disc_type = IDE_DISC_NONE;43.67 - disc->file = f;43.68 - if( filename == NULL ) {43.69 - disc->name = NULL;43.70 - } else {43.71 - disc->name = g_strdup(filename);43.72 - }43.73 -43.74 - disc->check_status = gdrom_null_check_status;43.75 - disc->destroy = gdrom_disc_destroy;43.76 - return disc;43.77 -}43.78 -43.79 -void gdrom_disc_destroy( gdrom_disc_t disc, gboolean close_fh )43.80 -{43.81 - int i;43.82 - FILE *lastfile = NULL;43.83 - if( disc->file != NULL ) {43.84 - if( close_fh ) {43.85 - fclose(disc->file);43.86 - }43.87 - disc->file = NULL;43.88 - }43.89 - for( i=0; i<disc->track_count; i++ ) {43.90 - if( disc->track[i].file != NULL && disc->track[i].file != lastfile ) {43.91 - lastfile = disc->track[i].file;43.92 - /* Track files (if any) are closed regardless of the value of close_fh */43.93 - fclose(lastfile);43.94 - disc->track[i].file = NULL;43.95 - }43.96 - }43.97 - if( disc->name != NULL ) {43.98 - g_free( (gpointer)disc->name );43.99 - disc->name = NULL;43.100 - }43.101 - if( disc->display_name != NULL ) {43.102 - g_free( (gpointer)disc->name );43.103 - disc->display_name = NULL;43.104 - }43.105 - free( disc );43.106 -}43.107 -43.108 -/**43.109 - * Construct a new gdrom_disc_t and initalize the vtable to the gdrom image43.110 - * default functions.43.111 - */43.112 -gdrom_disc_t gdrom_image_new( const gchar *filename, FILE *f )43.113 -{43.114 - gdrom_disc_t disc = gdrom_disc_new( filename, f );43.115 - if( disc != NULL ) {43.116 - disc->read_sector = gdrom_image_read_sector;43.117 - disc->play_audio = NULL; /* not supported yet */43.118 - disc->run_time_slice = NULL; /* not needed */43.119 - }43.120 - return disc;43.121 -}43.122 -43.123 -43.124 -gdrom_disc_t gdrom_image_open( const gchar *inFilename )43.125 -{43.126 - const gchar *filename = inFilename;43.127 - const gchar *ext = strrchr(filename, '.');43.128 - gdrom_disc_t disc = NULL;43.129 - int fd;43.130 - FILE *f;43.131 - int i;43.132 - gdrom_image_class_t extclz = NULL;43.133 -43.134 - // Check for a url-style filename.43.135 - char *lizard_lips = strstr( filename, "://" );43.136 - if( lizard_lips != NULL ) {43.137 - gchar *path = lizard_lips + 3;43.138 - int method_len = (lizard_lips-filename);43.139 - gchar method[method_len + 1];43.140 - memcpy( method, filename, method_len );43.141 - method[method_len] = '\0';43.142 -43.143 - if( strcasecmp( method, "file" ) == 0 ) {43.144 - filename = path;43.145 - } else if( strcasecmp( method, "dvd" ) == 0 ||43.146 - strcasecmp( method, "cd" ) == 0 ||43.147 - strcasecmp( method, "cdrom" ) ) {43.148 - return cdrom_open_device( method, path );43.149 - } else {43.150 - ERROR( "Unrecognized URL method '%s' in filename '%s'", method, filename );43.151 - return NULL;43.152 - }43.153 - }43.154 -43.155 - fd = open( filename, O_RDONLY | O_NONBLOCK );43.156 - if( fd == -1 ) {43.157 - return NULL;43.158 - }43.159 -43.160 - f = fdopen(fd, "ro");43.161 -43.162 -43.163 - /* try extensions */43.164 - if( ext != NULL ) {43.165 - ext++; /* Skip the '.' */43.166 - for( i=0; gdrom_image_classes[i] != NULL; i++ ) {43.167 - if( gdrom_image_classes[i]->extension != NULL &&43.168 - strcasecmp( gdrom_image_classes[i]->extension, ext ) == 0 ) {43.169 - extclz = gdrom_image_classes[i];43.170 - if( extclz->is_valid_file(f) ) {43.171 - disc = extclz->open_image_file(filename, f);43.172 - if( disc != NULL )43.173 - return disc;43.174 - }43.175 - break;43.176 - }43.177 - }43.178 - }43.179 -43.180 - /* Okay, fall back to magic */43.181 - gboolean recognized = FALSE;43.182 - for( i=0; gdrom_image_classes[i] != NULL; i++ ) {43.183 - if( gdrom_image_classes[i] != extclz &&43.184 - gdrom_image_classes[i]->is_valid_file(f) ) {43.185 - recognized = TRUE;43.186 - disc = gdrom_image_classes[i]->open_image_file(filename, f);43.187 - if( disc != NULL )43.188 - return disc;43.189 - }43.190 - }43.191 -43.192 - fclose(f);43.193 - return NULL;43.194 -}43.195 -43.196 -/**43.197 - * Read a block from an image file, handling negative file offsets43.198 - * with 0-fill.43.199 - */43.200 -static gboolean gdrom_read_block( unsigned char *buf, int file_offset, int length, FILE *f )43.201 -{43.202 - if( file_offset < 0 ) {43.203 - int size = -file_offset;43.204 - if( size >= length ) {43.205 - memset( buf, 0, length );43.206 - return TRUE;43.207 - } else {43.208 - memset( buf, 0, size );43.209 - file_offset = 0;43.210 - length -= size;43.211 - }43.212 - }43.213 - fseek( f, file_offset, SEEK_SET );43.214 - return fread( buf, length, 1, f ) == 1;43.215 -}43.216 -43.217 -static void gdrom_build_sector_header( unsigned char *buf, uint32_t lba,43.218 - gdrom_track_mode_t sector_mode )43.219 -{43.220 - memcpy( buf, gdrom_default_sync, 12 );43.221 - cd_build_address( buf, sector_mode, lba );43.222 -}43.223 -43.224 -/**43.225 - * Return TRUE if the given read mode + track modes are compatible,43.226 - * otherwise FALSE.43.227 - * @param track_mode one of the GDROM_MODE* constants43.228 - * @param read_mode the READ_CD_MODE from the read request43.229 - */43.230 -static gboolean gdrom_is_compatible_read_mode( int track_mode, int read_mode )43.231 -{43.232 - switch( read_mode ) {43.233 - case READ_CD_MODE_ANY:43.234 - return TRUE;43.235 - case READ_CD_MODE_CDDA:43.236 - return track_mode == GDROM_CDDA;43.237 - case READ_CD_MODE_1:43.238 - return track_mode == GDROM_MODE1 || track_mode == GDROM_MODE2_FORM1;43.239 - case READ_CD_MODE_2_FORM_1:43.240 - return track_mode == GDROM_MODE1 || track_mode == GDROM_MODE2_FORM1;43.241 - case READ_CD_MODE_2_FORM_2:43.242 - return track_mode == GDROM_MODE2_FORM2;43.243 - case READ_CD_MODE_2:43.244 - return track_mode == GDROM_MODE2_FORMLESS;43.245 - default:43.246 - return FALSE;43.247 - }43.248 -}43.249 -43.250 -void gdrom_set_disc_type( gdrom_disc_t disc )43.251 -{43.252 - int type = IDE_DISC_NONE, i;43.253 - for( i=0; i<disc->track_count; i++ ) {43.254 - if( disc->track[i].mode == GDROM_CDDA ) {43.255 - if( type == IDE_DISC_NONE )43.256 - type = IDE_DISC_AUDIO;43.257 - } else if( disc->track[i].mode == GDROM_MODE1 || disc->track[i].mode == GDROM_RAW_NONXA ) {43.258 - if( type != IDE_DISC_CDROMXA )43.259 - type = IDE_DISC_CDROM;43.260 - } else {43.261 - type = IDE_DISC_CDROMXA;43.262 - break;43.263 - }43.264 - }43.265 - disc->disc_type = type;43.266 -}43.267 -43.268 -/**43.269 - * Determine the start position in a raw sector, and the amount of data to read43.270 - * in bytes, for a given combination of sector mode and read mode.43.271 - */43.272 -static void gdrom_get_read_bounds( int sector_mode, int read_mode, int *start, int *size )43.273 -{43.274 - if( READ_CD_RAW(read_mode) ) {43.275 - // whole sector43.276 - *start = 0;43.277 - *size = 2352;43.278 - } else {43.279 - *size = 0;43.280 - if( READ_CD_DATA(read_mode) ) {43.281 - *start = gdrom_data_offset[sector_mode];43.282 - *size = gdrom_sector_size[sector_mode];43.283 - }43.284 -43.285 - if( READ_CD_SUBHEAD(read_mode) &&43.286 - (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2) ) {43.287 - *start = SECTOR_HEADER_SIZE;43.288 - *size += SECTOR_SUBHEADER_SIZE;43.289 - }43.290 -43.291 - if( READ_CD_HEADER(read_mode) ) {43.292 - *size += SECTOR_HEADER_SIZE;43.293 - *start = 0;43.294 - }43.295 -43.296 - }43.297 -}43.298 -43.299 -void gdrom_extract_raw_data_sector( char *sector_data, int channels, unsigned char *buf, uint32_t *length )43.300 -{43.301 - int sector_mode;43.302 - int start, size;43.303 - struct cdrom_sector_header *secthead = (struct cdrom_sector_header *)sector_data;43.304 - if( secthead->mode == 1 ) {43.305 - sector_mode = GDROM_MODE1;43.306 - } else {43.307 - sector_mode = ((secthead->subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;43.308 - }43.309 - gdrom_get_read_bounds( sector_mode, channels, &start, &size );43.310 -43.311 - memcpy( buf, sector_data+start, size );43.312 - *length = size;43.313 -}43.314 -43.315 -/**43.316 - * Default check media status that does nothing and always returns43.317 - * false (unchanged).43.318 - */43.319 -static gboolean gdrom_null_check_status( gdrom_disc_t disc )43.320 -{43.321 - return FALSE;43.322 -}43.323 -43.324 -/**43.325 - * Read a single sector from a disc image. If you thought this would be simple,43.326 - * I have just one thing to say to you: Bwahahahahahahahah.43.327 - *43.328 - * Once we've decided that there's a real sector at the requested lba, there's43.329 - * really two things we need to care about:43.330 - * 1. Is the sector mode compatible with the requested read mode43.331 - * 2. Which parts of the sector do we need to return?43.332 - * (header/subhead/data/raw sector)43.333 - *43.334 - * Also note that the disc image may supply us with just the data (most common43.335 - * case), or may have the full raw sector. In the former case we may need to43.336 - * generate the missing data on the fly, for which we use libedc to compute the43.337 - * data correction codes.43.338 - */43.339 -static gdrom_error_t gdrom_image_read_sector( gdrom_disc_t disc, uint32_t lba,43.340 - int mode, unsigned char *buf, uint32_t *length )43.341 -{43.342 - struct cdrom_sector_header secthead;43.343 - int file_offset, read_len, track_no;43.344 -43.345 - FILE *f;43.346 -43.347 - track_no = gdrom_disc_get_track_by_lba( disc, lba );43.348 - if( track_no == -1 ) {43.349 - return PKT_ERR_BADREAD;43.350 - }43.351 - struct gdrom_track *track = &disc->track[track_no-1];43.352 - file_offset = track->offset + track->sector_size * (lba - track->lba);43.353 - read_len = track->sector_size;43.354 - if( track->file != NULL ) {43.355 - f = track->file;43.356 - } else {43.357 - f = disc->file;43.358 - }43.359 -43.360 - /* First figure out what the real sector mode is for raw/semiraw sectors */43.361 - int sector_mode;43.362 - switch( track->mode ) {43.363 - case GDROM_RAW_NONXA:43.364 - gdrom_read_block( (unsigned char *)(§head), file_offset, sizeof(secthead), f );43.365 - sector_mode = (secthead.mode == 1) ? GDROM_MODE1 : GDROM_MODE2_FORMLESS;43.366 - break;43.367 - case GDROM_RAW_XA:43.368 - gdrom_read_block( (unsigned char *)(§head), file_offset, sizeof(secthead), f );43.369 - if( secthead.mode == 1 ) {43.370 - sector_mode = GDROM_MODE1;43.371 - } else {43.372 - sector_mode = ((secthead.subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;43.373 - }43.374 - break;43.375 - case GDROM_SEMIRAW_MODE2:43.376 - gdrom_read_block( secthead.subhead, file_offset, 8, f );43.377 - sector_mode = ((secthead.subhead[2] & 0x20) == 0 ) ? GDROM_MODE2_FORM1 : GDROM_MODE2_FORM2;43.378 - break;43.379 - default:43.380 - /* In the other cases, the track mode completely defines the sector mode */43.381 - sector_mode = track->mode;43.382 - break;43.383 - }43.384 -43.385 - if( !gdrom_is_compatible_read_mode(sector_mode, READ_CD_MODE(mode)) ) {43.386 - return PKT_ERR_BADREADMODE;43.387 - }43.388 -43.389 - /* Ok, we've got a valid sector, check what parts of the sector we need to43.390 - * return - header | subhead | data | everything43.391 - */43.392 - int channels = READ_CD_CHANNELS(mode);43.393 -43.394 - if( channels == 0 ) {43.395 - // legal, if weird43.396 - *length = 0;43.397 - return PKT_ERR_OK;43.398 - } else if( channels == 0xA0 &&43.399 - (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2 )) {43.400 - // caller requested a non-contiguous region43.401 - return PKT_ERR_BADFIELD;43.402 - } else if( READ_CD_RAW(channels) ) {43.403 - channels = 0xF0; // implies everything43.404 - }43.405 -43.406 - read_len = 0;43.407 - int start, size;43.408 - switch( track->mode ) {43.409 - case GDROM_CDDA:43.410 - // audio is nice and simple (assume perfect reads for now)43.411 - *length = 2352;43.412 - gdrom_read_block( buf, file_offset, track->sector_size, f );43.413 - return PKT_ERR_OK;43.414 - case GDROM_RAW_XA:43.415 - case GDROM_RAW_NONXA:43.416 - gdrom_get_read_bounds( sector_mode, channels, &start, &size );43.417 - gdrom_read_block( buf, file_offset+start, size, f );43.418 - read_len = size;43.419 - break;43.420 - case GDROM_SEMIRAW_MODE2:43.421 - gdrom_get_read_bounds( sector_mode, channels, &start, &size );43.422 - if( READ_CD_HEADER(channels) ) {43.423 - gdrom_build_sector_header( buf, lba, sector_mode );43.424 - read_len += SECTOR_HEADER_SIZE;43.425 - size -= SECTOR_HEADER_SIZE;43.426 - } else {43.427 - start -= SECTOR_HEADER_SIZE;43.428 - }43.429 - gdrom_read_block( buf + read_len, file_offset+start, size, f );43.430 - read_len += size;43.431 - break;43.432 - default: // Data track w/ data only in file43.433 - if( READ_CD_RAW(channels) ) {43.434 - gdrom_read_block( buf + gdrom_data_offset[track->mode], file_offset,43.435 - track->sector_size, f );43.436 - do_encode_L2( buf, sector_mode, lba );43.437 - read_len = 2352;43.438 - } else {43.439 - if( READ_CD_HEADER(channels) ) {43.440 - gdrom_build_sector_header( buf, lba, sector_mode );43.441 - read_len += SECTOR_HEADER_SIZE;43.442 - }43.443 - if( READ_CD_SUBHEAD(channels) &&43.444 - (sector_mode == GDROM_MODE2_FORM1 || sector_mode == GDROM_MODE2_FORM2) ) {43.445 - if( sector_mode == GDROM_MODE2_FORM1 ) {43.446 - *((uint32_t *)(buf+read_len)) = 0;43.447 - *((uint32_t *)(buf+read_len+4)) = 0;43.448 - } else {43.449 - *((uint32_t *)(buf+read_len)) = 0x00200000;43.450 - *((uint32_t *)(buf+read_len+4)) = 0x00200000;43.451 - }43.452 - read_len += 8;43.453 - }43.454 - if( READ_CD_DATA(channels) ) {43.455 - gdrom_read_block( buf+read_len, file_offset, track->sector_size, f );43.456 - read_len += track->sector_size;43.457 - }43.458 - }43.459 - }43.460 - *length = read_len;43.461 - return PKT_ERR_OK;43.462 -}43.463 -
44.1 --- a/src/gdrom/gdrom.c Sun Jan 31 18:30:13 2010 +100044.2 +++ b/src/gdrom/gdrom.c Sun Jan 31 18:35:06 2010 +100044.3 @@ -17,6 +17,8 @@44.4 */44.6 #include <stdio.h>44.7 +#include <stdlib.h>44.8 +#include <string.h>44.9 #include <fcntl.h>44.10 #include <errno.h>44.11 #include <ctype.h>44.12 @@ -24,61 +26,41 @@44.13 #include <netinet/in.h>44.14 #include "gdrom/ide.h"44.15 #include "gdrom/gdrom.h"44.16 -#include "gdrom/gddriver.h"44.17 #include "gdrom/packet.h"44.18 -#include "dream.h"44.19 #include "bootstrap.h"44.20 +#include "drivers/cdrom/cdrom.h"44.22 -extern gdrom_disc_t gdrom_disc;44.23 +#define GDROM_LBA_OFFSET 15044.25 DEFINE_HOOK( gdrom_disc_change_hook, gdrom_disc_change_hook_t )44.27 -static void gdrom_fire_disc_changed( gdrom_disc_t disc )44.28 +static void gdrom_fire_disc_changed( cdrom_disc_t disc )44.29 {44.30 CALL_HOOKS( gdrom_disc_change_hook, disc, disc == NULL ? NULL : disc->name );44.31 }44.33 -char *gdrom_mode_names[] = { "Mode 0", "Mode 1", "Mode 2", "Mode 2 Form 1", "Mode 2 Form 2", "Audio",44.34 - "Mode 2 semiraw", "XA Raw", "Non-XA Raw" };44.35 -uint32_t gdrom_sector_size[] = { 0, 2048, 2336, 2048, 2324, 2352, 2336, 2352, 2352 };44.36 +gboolean gdrom_disc_read_title( cdrom_disc_t disc, char *title, size_t titlelen );44.38 +struct gdrom_drive {44.39 + cdrom_disc_t disc;44.40 + int boot_track;44.41 + char title[129];44.42 +} gdrom_drive;44.44 -gdrom_device_t gdrom_device_new( const gchar *name, const gchar *dev_name )44.45 +void gdrom_mount_disc( cdrom_disc_t disc )44.46 {44.47 - struct gdrom_device *dev = g_malloc0( sizeof(struct gdrom_device) );44.48 - dev->name = g_strdup(name);44.49 - dev->device_name = g_strdup(dev_name);44.50 - return dev;44.51 -}44.52 -44.53 -void gdrom_device_destroy( gdrom_device_t dev )44.54 -{44.55 - if( dev->name != NULL ) {44.56 - g_free( dev->name );44.57 - dev->name = NULL;44.58 - }44.59 - if( dev->device_name != NULL ) {44.60 - g_free( dev->device_name );44.61 - dev->device_name = NULL;44.62 - }44.63 - g_free( dev );44.64 -}44.65 -44.66 -void gdrom_mount_disc( gdrom_disc_t disc )44.67 -{44.68 - if( disc != gdrom_disc ) {44.69 - if( gdrom_disc != NULL ) {44.70 - gdrom_disc->destroy(gdrom_disc,TRUE);44.71 - }44.72 - gdrom_disc = disc;44.73 - gdrom_disc_read_title( disc );44.74 + if( disc != gdrom_drive.disc ) {44.75 + cdrom_disc_unref(gdrom_drive.disc);44.76 + gdrom_drive.disc = disc;44.77 + cdrom_disc_ref(disc);44.78 + gdrom_disc_read_title( disc, gdrom_drive.title, sizeof(gdrom_drive.title) );44.79 gdrom_fire_disc_changed( disc );44.80 }44.81 }44.83 gboolean gdrom_mount_image( const gchar *filename )44.84 {44.85 - gdrom_disc_t disc = gdrom_image_open(filename);44.86 + cdrom_disc_t disc = cdrom_disc_open(filename, NULL);44.87 if( disc != NULL ) {44.88 gdrom_mount_disc( disc );44.89 return TRUE;44.90 @@ -88,61 +70,47 @@44.92 void gdrom_unmount_disc( )44.93 {44.94 - if( gdrom_disc != NULL ) {44.95 - gdrom_disc->destroy(gdrom_disc, TRUE);44.96 + if( gdrom_drive.disc != NULL ) {44.97 + cdrom_disc_unref(gdrom_drive.disc);44.98 gdrom_fire_disc_changed(NULL);44.99 - gdrom_disc = NULL;44.100 + gdrom_drive.disc = NULL;44.101 }44.102 }44.104 -gdrom_disc_t gdrom_get_current_disc()44.105 +cdrom_disc_t gdrom_get_current_disc()44.106 {44.107 - return gdrom_disc;44.108 + return gdrom_drive.disc;44.109 }44.111 const gchar *gdrom_get_current_disc_name()44.112 {44.113 - if( gdrom_disc == NULL ) {44.114 + if( gdrom_drive.disc == NULL ) {44.115 return NULL;44.116 } else {44.117 - return gdrom_disc->name;44.118 + return gdrom_drive.disc->name;44.119 }44.120 }44.122 const gchar *gdrom_get_current_disc_title()44.123 {44.124 - if( gdrom_disc == NULL || gdrom_disc->title[0] == '\0' ) {44.125 + if( gdrom_drive.disc == NULL || gdrom_drive.title[0] == '\0' ) {44.126 return NULL;44.127 } else {44.128 - return gdrom_disc->title;44.129 + return gdrom_drive.title;44.130 }44.131 }44.133 -int gdrom_disc_get_track_by_lba( gdrom_disc_t disc, uint32_t lba )44.134 +#define CHECK_DISC() do { \44.135 + if( gdrom_drive.disc == NULL || gdrom_drive.disc->disc_type == CDROM_DISC_NONE ) { return CDROM_ERROR_NODISC; } \44.136 + } while(0)44.137 +44.138 +cdrom_error_t gdrom_check_media( )44.139 {44.140 - int i;44.141 - for( i=0; i<disc->track_count; i++ ) {44.142 - if( disc->track[i].lba <= lba &&44.143 - lba < (disc->track[i].lba + disc->track[i].sector_count) ) {44.144 - return i+1;44.145 - }44.146 - }44.147 - return -1;44.148 + CHECK_DISC();44.149 + return CDROM_ERROR_OK;44.150 }44.152 -#define CHECK_DISC(disc) do { \44.153 - if( disc == NULL ) { return PKT_ERR_NODISC; } \44.154 - disc->check_status(disc); \44.155 - if( disc->disc_type == IDE_DISC_NONE ) { return PKT_ERR_NODISC; } \44.156 - } while(0)44.157 -44.158 -gdrom_error_t gdrom_disc_check_media( gdrom_disc_t disc )44.159 -{44.160 - CHECK_DISC(disc);44.161 - return PKT_ERR_OK;44.162 -}44.163 -44.164 -gdrom_error_t gdrom_disc_get_toc( gdrom_disc_t disc, unsigned char *buf )44.165 +cdrom_error_t gdrom_read_toc( unsigned char *buf )44.166 {44.167 struct gdrom_toc {44.168 uint32_t track[99];44.169 @@ -152,68 +120,66 @@44.170 struct gdrom_toc *toc = (struct gdrom_toc *)buf;44.171 int i;44.173 - CHECK_DISC(disc);44.174 + CHECK_DISC();44.175 + cdrom_disc_t disc = gdrom_drive.disc;44.177 for( i=0; i<disc->track_count; i++ ) {44.178 - toc->track[i] = htonl( disc->track[i].lba ) | disc->track[i].flags;44.179 + toc->track[i] = htonl( disc->track[i].lba+GDROM_LBA_OFFSET ) | disc->track[i].flags;44.180 }44.181 toc->first = 0x0100 | disc->track[0].flags;44.182 toc->last = (disc->track_count<<8) | disc->track[i-1].flags;44.183 - toc->leadout = htonl(disc->track[i-1].lba + disc->track[i-1].sector_count) |44.184 + toc->leadout = htonl(disc->leadout+GDROM_LBA_OFFSET) |44.185 disc->track[i-1].flags;44.186 for( ;i<99; i++ )44.187 toc->track[i] = 0xFFFFFFFF;44.188 return PKT_ERR_OK;44.189 }44.191 -gdrom_error_t gdrom_disc_get_session_info( gdrom_disc_t disc, int session, unsigned char *buf )44.192 +cdrom_error_t gdrom_read_session( int session, unsigned char *buf )44.193 {44.194 - CHECK_DISC(disc);44.195 + cdrom_lba_t lba;44.196 + CHECK_DISC();44.198 - struct gdrom_track *last_track = &disc->track[disc->track_count-1];44.199 - unsigned int end_of_disc = last_track->lba + last_track->sector_count;44.200 - int i;44.201 buf[0] = 0x01; /* Disc status? */44.202 buf[1] = 0;44.204 +44.205 if( session == 0 ) {44.206 - buf[2] = last_track->session+1; /* last session */44.207 - buf[3] = (end_of_disc >> 16) & 0xFF;44.208 - buf[4] = (end_of_disc >> 8) & 0xFF;44.209 - buf[5] = end_of_disc & 0xFF;44.210 - return PKT_ERR_OK;44.211 + buf[2] = gdrom_drive.disc->session_count;44.212 + lba = gdrom_drive.disc->leadout + GDROM_LBA_OFFSET;44.213 } else {44.214 - session--;44.215 - for( i=0; i<disc->track_count; i++ ) {44.216 - if( disc->track[i].session == session ) {44.217 - buf[2] = i+1; /* first track of session */44.218 - buf[3] = (disc->track[i].lba >> 16) & 0xFF;44.219 - buf[4] = (disc->track[i].lba >> 8) & 0xFF;44.220 - buf[5] = disc->track[i].lba & 0xFF;44.221 - return PKT_ERR_OK;44.222 - }44.223 - }44.224 - return PKT_ERR_BADFIELD; /* No such session */44.225 + cdrom_track_t track = cdrom_disc_get_session( gdrom_drive.disc, session );44.226 + if( track == NULL )44.227 + return CDROM_ERROR_BADFIELD;44.228 +44.229 + buf[2] = track->trackno;44.230 + lba = track->lba + GDROM_LBA_OFFSET;44.231 }44.232 + buf[3] = (lba >> 16) & 0xFF;44.233 + buf[4] = (lba >> 8) & 0xFF;44.234 + buf[5] = lba & 0xFF;44.235 + return CDROM_ERROR_OK;44.236 }44.238 -gdrom_error_t gdrom_disc_get_short_status( gdrom_disc_t disc, uint32_t lba, unsigned char *buf )44.239 +cdrom_error_t gdrom_read_short_status( cdrom_lba_t lba, unsigned char *buf )44.240 {44.241 - CHECK_DISC(disc);44.242 + cdrom_lba_t real_lba = lba - GDROM_LBA_OFFSET;44.243 + CHECK_DISC();44.245 - int track_no = gdrom_disc_get_track_by_lba( disc, lba );44.246 - if( track_no == -1 ) {44.247 - track_no = 1;44.248 + cdrom_track_t track = cdrom_disc_get_track_by_lba( gdrom_drive.disc, real_lba );44.249 + if( track == NULL ) {44.250 + track = cdrom_disc_get_track( gdrom_drive.disc, 1 );44.251 + if( track == NULL )44.252 + return CDROM_ERROR_NODISC;44.253 lba = 150;44.254 }44.255 - struct gdrom_track *track = &disc->track[track_no-1];44.256 - uint32_t offset = lba - track->lba;44.257 + uint32_t offset = real_lba - track->lba;44.258 buf[0] = 0x00;44.259 buf[1] = 0x15; /* audio status ? */44.260 buf[2] = 0x00;44.261 buf[3] = 0x0E;44.262 buf[4] = track->flags;44.263 - buf[5] = track_no;44.264 + buf[5] = track->trackno;44.265 buf[6] = 0x01; /* ?? */44.266 buf[7] = (offset >> 16) & 0xFF;44.267 buf[8] = (offset >> 8) & 0xFF;44.268 @@ -225,53 +191,126 @@44.269 return PKT_ERR_OK;44.270 }44.272 -int gdrom_disc_get_drive_status( gdrom_disc_t disc )44.273 +int gdrom_get_drive_status( )44.274 {44.275 - if( disc == NULL ) {44.276 - return IDE_DISC_NONE;44.277 + if( gdrom_drive.disc == NULL ) {44.278 + return CDROM_DISC_NONE;44.279 }44.281 - disc->check_status(disc);44.282 - if( disc->disc_type == IDE_DISC_NONE ) {44.283 - return IDE_DISC_NONE;44.284 + if( cdrom_disc_check_media(gdrom_drive.disc) == CDROM_DISC_NONE ) {44.285 + return CDROM_DISC_NONE;44.286 } else {44.287 - return disc->disc_type | IDE_DISC_READY;44.288 + return gdrom_drive.disc->disc_type | IDE_DISC_READY;44.289 }44.290 }44.292 +cdrom_error_t gdrom_play_audio( cdrom_lba_t lba, cdrom_count_t count )44.293 +{44.294 + CHECK_DISC();44.295 + if( gdrom_drive.disc->play_audio ) {44.296 + return gdrom_drive.disc->play_audio( gdrom_drive.disc, lba - GDROM_LBA_OFFSET, count );44.297 + }44.298 + return CDROM_ERROR_BADFIELD;44.299 +}44.300 +44.301 +/* Parse CD read */44.302 +#define READ_CD_MODE(x) ((x)&0x0E)44.303 +#define READ_CD_MODE_ANY 0x0044.304 +#define READ_CD_MODE_CDDA 0x0244.305 +#define READ_CD_MODE_1 0x0444.306 +#define READ_CD_MODE_2 0x0644.307 +#define READ_CD_MODE_2_FORM_1 0x0844.308 +#define READ_CD_MODE_2_FORM_2 0x0A44.309 +44.310 +#define READ_CD_CHANNELS(x) ((x)&0xF0)44.311 +#define READ_CD_HEADER(x) ((x)&0x80)44.312 +#define READ_CD_SUBHEAD(x) ((x)&0x40)44.313 +#define READ_CD_DATA(x) ((x)&0x20)44.314 +#define READ_CD_RAW(x) ((x)&0x10)44.315 +44.316 +44.317 +cdrom_error_t gdrom_read_cd( cdrom_lba_t lba, cdrom_count_t count,44.318 + unsigned mode, unsigned char *buf, size_t *length )44.319 +{44.320 + cdrom_lba_t real_lba = lba - 150;44.321 + cdrom_read_mode_t real_mode = 0;44.322 +44.323 + CHECK_DISC();44.324 +44.325 + /* Translate GDROM read mode into standard MMC read mode */44.326 + if( READ_CD_RAW(mode) ) {44.327 + real_mode = CDROM_READ_RAW;44.328 + } else {44.329 + if( READ_CD_HEADER(mode) ) {44.330 + real_mode = CDROM_READ_HEADER|CDROM_READ_SYNC;44.331 + }44.332 + if( READ_CD_SUBHEAD(mode) ) {44.333 + real_mode |= CDROM_READ_SUBHEADER;44.334 + }44.335 + if( READ_CD_DATA(mode) ) {44.336 + real_mode |= CDROM_READ_DATA;44.337 + }44.338 + }44.339 +44.340 + if( READ_CD_MODE(mode) == 0x0C )44.341 + real_mode |= CDROM_READ_MODE2;44.342 + else44.343 + real_mode |= (READ_CD_MODE(mode)<<1);44.344 +44.345 + return cdrom_disc_read_sectors( gdrom_drive.disc, real_lba, count, real_mode, buf, length );44.346 +}44.347 +44.348 +void gdrom_run_slice( uint32_t nanosecs )44.349 +{44.350 +44.351 +}44.352 +44.353 +44.354 +cdrom_track_t gdrom_disc_get_boot_track( cdrom_disc_t disc ) {44.355 + int i, boot_track = -1;44.356 + if( disc != NULL && disc->track_count > 0 ) {44.357 + int last_session = disc->track[disc->track_count-1].sessionno;44.358 + if( last_session == 1 )44.359 + return NULL;44.360 + for( i=disc->track_count-1; i>=0 && disc->track[i].sessionno == last_session; i-- ) {44.361 + if( disc->track[i].flags & TRACK_FLAG_DATA ) {44.362 + boot_track = i;44.363 + }44.364 + }44.365 + }44.366 + return &disc->track[boot_track];44.367 +}44.368 +44.369 /**44.370 * Check the disc for a useable DC bootstrap, and update the disc44.371 - * with the title accordingly.44.372 + * with the title accordingly. Otherwise set the title to the empty string.44.373 * @return TRUE if we found a bootstrap, otherwise FALSE.44.374 */44.375 -gboolean gdrom_disc_read_title( gdrom_disc_t disc ) {44.376 - if( disc->track_count > 0 ) {44.377 - /* Find the first data track of the last session */44.378 - int last_session = disc->track[disc->track_count-1].session;44.379 - int i, boot_track = -1;44.380 - for( i=disc->track_count-1; i>=0 && disc->track[i].session == last_session; i-- ) {44.381 - if( disc->track[i].flags & TRACK_DATA ) {44.382 - boot_track = i;44.383 +gboolean gdrom_disc_read_title( cdrom_disc_t disc, char *title, size_t titlelen ) {44.384 + cdrom_track_t boot_track = gdrom_disc_get_boot_track(disc);44.385 + int i;44.386 + if( boot_track != NULL ) {44.387 + unsigned char boot_sector[CDROM_MAX_SECTOR_SIZE];44.388 + size_t length = sizeof(boot_sector);44.389 + if( cdrom_disc_read_sectors( disc, boot_track->lba, 1, CDROM_READ_DATA|CDROM_READ_MODE2_FORM1,44.390 + boot_sector, &length ) == CDROM_ERROR_OK ) {44.391 + if( memcmp( boot_sector, "SEGA SEGAKATANA SEGA ENTERPRISES", 32) == 0 ) {44.392 + /* Got magic */44.393 + dc_bootstrap_head_t bootstrap = (dc_bootstrap_head_t)boot_sector;44.394 + for( i=128; i>0; i-- ) {44.395 + if( !isspace(bootstrap->product_name[i-1]) )44.396 + break;44.397 + }44.398 + if( i >= titlelen )44.399 + i = (titlelen-1);44.400 + memcpy( title, bootstrap->product_name, i );44.401 + title[i] = '\0';44.402 }44.403 - }44.404 - if( boot_track != -1 ) {44.405 - unsigned char boot_sector[MAX_SECTOR_SIZE];44.406 - uint32_t length = sizeof(boot_sector);44.407 - if( disc->read_sector( disc, disc->track[boot_track].lba, 0x28,44.408 - boot_sector, &length ) == PKT_ERR_OK ) {44.409 - if( memcmp( boot_sector, "SEGA SEGAKATANA SEGA ENTERPRISES", 32) == 0 ) {44.410 - /* Got magic */44.411 - memcpy( disc->title, boot_sector+128, 128 );44.412 - for( i=127; i>=0; i-- ) {44.413 - if( !isspace(disc->title[i]) )44.414 - break;44.415 - }44.416 - disc->title[i+1] = '\0';44.417 - }44.418 - bootstrap_dump(boot_sector, FALSE);44.419 - return TRUE;44.420 - }44.421 + bootstrap_dump(boot_sector, FALSE);44.422 + return TRUE;44.423 }44.424 }44.425 + title[0] = '\0';44.426 return FALSE;44.427 }44.428 +
45.1 --- a/src/gdrom/gdrom.h Sun Jan 31 18:30:13 2010 +100045.2 +++ b/src/gdrom/gdrom.h Sun Jan 31 18:35:06 2010 +100045.3 @@ -22,6 +22,7 @@45.5 #include "lxdream.h"45.6 #include "hook.h"45.7 +#include "drivers/cdrom/defs.h"45.8 #include <glib/glist.h>45.10 #ifdef __cplusplus45.11 @@ -32,19 +33,7 @@45.12 #define GDROM_SESSION_INFO_SIZE 6 /* Size of GDROM session info structure */45.13 #define GDROM_SHORT_STATUS_SIZE 14 /* Size of GDROM short status structure */45.15 -typedef uint16_t gdrom_error_t;45.16 -45.17 -45.18 -struct gdrom_device {45.19 - char *name; // internal name45.20 - char *device_name; // Human-readable device name45.21 -};45.22 -45.23 -typedef struct gdrom_device *gdrom_device_t;45.24 -45.25 -typedef struct gdrom_disc *gdrom_disc_t;45.26 -45.27 -typedef gboolean (*gdrom_disc_change_hook_t)( gdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );45.28 +typedef gboolean (*gdrom_disc_change_hook_t)( cdrom_disc_t new_disc, const gchar *new_disc_name, void *user_data );45.29 DECLARE_HOOK(gdrom_disc_change_hook, gdrom_disc_change_hook_t);45.31 typedef gboolean (*gdrom_drive_list_change_hook_t)( GList *drive_list, void *user_data );45.32 @@ -53,13 +42,7 @@45.33 /**45.34 * Open an image file45.35 */45.36 -gdrom_disc_t gdrom_image_open( const gchar *filename );45.37 -45.38 -/**45.39 - * Read image bootstrap info45.40 - */45.41 -gboolean gdrom_image_read_info( gdrom_disc_t d );45.42 -45.43 +cdrom_disc_t gdrom_image_open( const gchar *filename );45.45 /**45.46 * Shortcut to open and mount an image file45.47 @@ -67,51 +50,49 @@45.48 */45.49 gboolean gdrom_mount_image( const gchar *filename );45.51 -void gdrom_mount_disc( gdrom_disc_t disc );45.52 +void gdrom_mount_disc( cdrom_disc_t disc );45.54 void gdrom_unmount_disc( void );45.56 gboolean gdrom_is_mounted( void );45.58 -gdrom_disc_t gdrom_get_current_disc();45.59 +cdrom_disc_t gdrom_get_current_disc();45.61 const gchar *gdrom_get_current_disc_name();45.63 const gchar *gdrom_get_current_disc_title();45.65 -45.66 /**45.67 - * Find the track (numbered from 1) containing the sector specified by LBA.45.68 - * Note: this function does not check for media change.45.69 - * @return The track number, or -1 if no track contains the sector.45.70 + * Find the track which should be checked for the45.71 + * dreamcast bootstrap - this is the first data track on the last45.72 + * session (where there are at least 2 sessions). If a boot track45.73 + * cannot be found, returns NULL.45.74 */45.75 -int gdrom_disc_get_track_by_lba( gdrom_disc_t disc, uint32_t lba );45.76 +cdrom_track_t gdrom_disc_get_boot_track( cdrom_disc_t disc );45.78 /**45.79 * Check if the disc contains valid media.45.80 - * @return PKT_ERR_OK if disc is present, otherwise PKT_ERR_NODISC45.81 + * @return CDROM_ERROR_OK if disc is present, otherwise CDROM_ERROR_NODISC45.82 */45.83 -gdrom_error_t gdrom_disc_check_media( gdrom_disc_t disc );45.84 +cdrom_error_t gdrom_check_media( );45.86 /**45.87 * Retrieve the disc table of contents, and write it into the buffer in the45.88 * format expected by the DC.45.89 - * @param disc The disc to read45.90 * @param buf Buffer to receive the TOC data, which must be at least45.91 * GDROM_TOC_SIZE bytes long.45.92 * @return 0 on success, error code on failure (eg no disc)45.93 */45.94 -gdrom_error_t gdrom_disc_get_toc( gdrom_disc_t disc, unsigned char *buf );45.95 +cdrom_error_t gdrom_read_toc( unsigned char *buf );45.97 /**45.98 * Retrieve the short (6-byte) session info, and write it into the buffer.45.99 - * @param disc The disc to read45.100 * @param session The session to read (numbered from 1), or 045.101 * @param buf Buffer to receive the session data, which must be at least45.102 * GDROM_SESSION_INFO_SIZE bytes long.45.103 * @return 0 on success, error code on failure.45.104 */45.105 -gdrom_error_t gdrom_disc_get_session_info( gdrom_disc_t disc, int session, unsigned char *buf );45.106 +cdrom_error_t gdrom_read_session( int session, unsigned char *buf );45.108 /**45.109 * Generate the position data as returned from a STATUS(1) packet.45.110 @@ -121,33 +102,31 @@45.111 * GDROM_SHORT_STATUS_SIZE bytes long.45.112 * @return 0 on success, error code on failure.45.113 */45.114 -gdrom_error_t gdrom_disc_get_short_status( gdrom_disc_t disc, uint32_t lba, unsigned char *buf );45.115 +cdrom_error_t gdrom_read_short_status( uint32_t lba, unsigned char *buf );45.116 +45.117 +/**45.118 + * Read sectors from the current disc.45.119 + * @param lba Address of first sector to read45.120 + * @param count Number of sectors to read45.121 + * @param read_mode GDROM format read-mode45.122 + * @param buf Buffer to receive read sectors45.123 + * @param length If not null, will be written with the number of bytes read.45.124 + * @return 0 on success, otherwise error code.45.125 + */45.126 +cdrom_error_t gdrom_read_cd( cdrom_lba_t lba, cdrom_count_t count,45.127 + unsigned read_mode, unsigned char *buf, size_t *length );45.128 +45.129 +cdrom_error_t gdrom_play_audio( cdrom_lba_t lba, cdrom_count_t count );45.131 /**45.132 * Return the 1-byte status code for the disc (combination of IDE_DISC_* flags)45.133 */45.134 -int gdrom_disc_get_drive_status( gdrom_disc_t disc );45.135 +int gdrom_get_drive_status( );45.137 /**45.138 - * Native CD-ROM API - provided by drivers/cd_*.c45.139 - *45.140 - * A device name is either a system special file (most unixes) or a url of the45.141 - * form dvd://<identifier> or cd://<identifier>, where <identifier> is a system45.142 - * defined string that uniquely identifies a particular device.45.143 + * Run GDROM time slice (if any)45.144 */45.145 -45.146 -/**45.147 - * Return a list of gdrom_device_t defining all CD/DVD drives in the host system.45.148 - */45.149 -GList *cdrom_get_native_devices();45.150 -45.151 -/**45.152 - * Open a native device given a device name and url method. Eg, for the url dvd://145.153 - * this function will be invoked with method = "dvd" and name = "1"45.154 - *45.155 - * @return NULL on failure, otherwise a valid gdrom_disc_t that can be mounted.45.156 - */45.157 -gdrom_disc_t cdrom_open_device( const gchar *method, const gchar *name );45.158 +void gdrom_run_slice( uint32_t nanosecs );45.160 #ifdef __cplusplus45.161 }
46.1 --- a/src/gdrom/ide.c Sun Jan 31 18:30:13 2010 +100046.2 +++ b/src/gdrom/ide.c Sun Jan 31 18:35:06 2010 +100046.3 @@ -28,7 +28,7 @@46.4 #include "mem.h"46.5 #include "asic.h"46.6 #include "gdrom/ide.h"46.7 -#include "gdrom/gddriver.h"46.8 +#include "gdrom/gdrom.h"46.9 #include "gdrom/packet.h"46.11 #define MAX_WRITE_BUF 409646.12 @@ -49,7 +49,6 @@46.13 NULL, ide_save_state, ide_load_state };46.15 struct ide_registers idereg;46.16 -gdrom_disc_t gdrom_disc = NULL;46.18 unsigned char data_buffer[MAX_SECTOR_SIZE];46.20 @@ -160,9 +159,7 @@46.22 static uint32_t ide_run_slice( uint32_t nanosecs )46.23 {46.24 - if( gdrom_disc != NULL && gdrom_disc->run_time_slice != NULL ) {46.25 - gdrom_disc->run_time_slice(gdrom_disc, nanosecs);46.26 - }46.27 + gdrom_run_slice(nanosecs);46.28 return nanosecs;46.29 }46.31 @@ -443,21 +440,18 @@46.33 uint8_t ide_get_drive_status( void )46.34 {46.35 - return gdrom_disc_get_drive_status(gdrom_disc);46.36 + return gdrom_get_drive_status();46.37 }46.39 -#define REQUIRE_DISC() if( gdrom_disc == NULL || gdrom_disc->disc_type == IDE_DISC_NONE ) { ide_set_packet_result( PKT_ERR_NODISC ); return; }46.40 +#define REQUIRE_DISC() if( gdrom_get_drive_status() == IDE_DISC_NONE ) { ide_set_packet_result( PKT_ERR_NODISC ); return; }46.42 /**46.43 * Read the next sector from the active read, if any46.44 */46.45 static void ide_read_next_sector( void )46.46 {46.47 - uint32_t sector_size;46.48 - REQUIRE_DISC();46.49 - gdrom_error_t status =46.50 - gdrom_disc->read_sector( gdrom_disc, idereg.current_lba, idereg.current_mode,46.51 - data_buffer, §or_size );46.52 + size_t sector_size;46.53 + cdrom_error_t status = gdrom_read_cd( idereg.current_lba, 1, idereg.current_mode, data_buffer, §or_size );46.54 if( status != PKT_ERR_OK ) {46.55 ide_set_packet_result( status );46.56 idereg.gdrom_sense[5] = (idereg.current_lba >> 16) & 0xFF;46.57 @@ -507,7 +501,7 @@46.58 uint8_t status = ide_get_drive_status();46.59 /* FIXME: Refactor read_position to avoid this kind of crud */46.60 unsigned char tmp[16];46.61 - gdrom_disc_get_short_status( gdrom_disc, idereg.current_lba, tmp );46.62 + gdrom_read_short_status( idereg.current_lba, tmp );46.64 length = cmd[4];46.65 if( lba+length > GDROM_DRIVE_STATUS_LENGTH )46.66 @@ -559,12 +553,11 @@46.67 ide_start_packet_read( length, 0 );46.68 break;46.69 case PKT_CMD_READ_TOC:46.70 - REQUIRE_DISC();46.71 length = (cmd[3]<<8) | cmd[4];46.72 if( length > GDROM_TOC_SIZE )46.73 length = GDROM_TOC_SIZE;46.75 - status = gdrom_disc_get_toc( gdrom_disc, data_buffer );46.76 + status = gdrom_read_toc( data_buffer );46.77 if( status != PKT_ERR_OK ) {46.78 ide_set_packet_result( status );46.79 } else {46.80 @@ -572,11 +565,10 @@46.81 }46.82 break;46.83 case PKT_CMD_SESSION_INFO:46.84 - REQUIRE_DISC();46.85 length = cmd[4];46.86 if( length > 6 )46.87 length = 6;46.88 - status = gdrom_disc_get_session_info( gdrom_disc, cmd[2], data_buffer );46.89 + status = gdrom_read_session( cmd[2], data_buffer );46.90 if( status != PKT_ERR_OK ) {46.91 ide_set_packet_result( status );46.92 } else {46.93 @@ -584,8 +576,10 @@46.94 }46.95 break;46.96 case PKT_CMD_PLAY_AUDIO:46.97 - REQUIRE_DISC();46.98 - ide_set_packet_result( 0 );46.99 + lba = (cmd[2] << 16) | (cmd[3]<<8) | cmd[4];46.100 + length = ((cmd[8]<<16) | (cmd[9]<<8) | cmd[10]) - lba;46.101 + status = gdrom_play_audio( lba, length );46.102 + ide_set_packet_result( status );46.103 ide_raise_interrupt();46.104 idereg.status = 0x50;46.105 break;46.106 @@ -617,7 +611,7 @@46.107 if( length > 14 ) {46.108 length = 14;46.109 }46.110 - gdrom_disc_get_short_status( gdrom_disc, idereg.current_lba, data_buffer );46.111 + gdrom_read_short_status( idereg.current_lba, data_buffer );46.112 ide_start_packet_read( length, 0 );46.113 break;46.114 }
47.1 --- a/src/gdrom/ide.h Sun Jan 31 18:30:13 2010 +100047.2 +++ b/src/gdrom/ide.h Sun Jan 31 18:35:06 2010 +100047.3 @@ -33,6 +33,10 @@47.4 #define GDROM_SENSE_LENGTH 1047.5 #define GDROM_MODE_LENGTH 3247.7 +#define IDE_DISC_READY 0x01 /* ored with above */47.8 +#define IDE_DISC_IDLE 0x02 /* ie spun-down */47.9 +#define IDE_DISC_NONE 0x06 /* No media in drive */47.10 +47.11 struct ide_registers {47.12 /* IDE interface registers */47.13 uint8_t status; /* A05F709C + A05F7018 Read-only */
48.1 --- a/src/gdrom/nrg.c Sun Jan 31 18:30:13 2010 +100048.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +000048.3 @@ -1,349 +0,0 @@48.4 -/**48.5 - * $Id$48.6 - *48.7 - * Nero (NRG) CD file format. File information stolen shamelessly from48.8 - * libcdio.48.9 - *48.10 - * Copyright (c) 2005 Nathan Keynes.48.11 - *48.12 - * This program is free software; you can redistribute it and/or modify48.13 - * it under the terms of the GNU General Public License as published by48.14 - * the Free Software Foundation; either version 2 of the License, or48.15 - * (at your option) any later version.48.16 - *48.17 - * This program is distributed in the hope that it will be useful,48.18 - * but WITHOUT ANY WARRANTY; without even the implied warranty of48.19 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the48.20 - * GNU General Public License for more details.48.21 - */48.22 -48.23 -#include <assert.h>48.24 -#include <stdio.h>48.25 -#include <errno.h>48.26 -#include <glib/gtypes.h>48.27 -#include "gdrom/gddriver.h"48.28 -#include "dream.h"48.29 -48.30 -static gboolean nrg_image_is_valid( FILE *f );48.31 -static gdrom_disc_t nrg_image_open( const gchar *filename, FILE *f );48.32 -48.33 -struct gdrom_image_class nrg_image_class = { "Nero", "nrg",48.34 - nrg_image_is_valid, nrg_image_open };48.35 -48.36 -#define NERO_V55_ID 0x4e45523548.37 -#define NERO_V50_ID 0x4e45524f48.38 -48.39 -/* Courtesy of libcdio */48.40 -/* 5.0 or earlier */48.41 -#define NERO_ID 0x4e45524f /* Nero pre 5.5.x */48.42 -#define CUES_ID 0x43554553 /* Nero pre version 5.5.x-6.x */48.43 -#define DAOI_ID 0x44414f4948.44 -#define ETNF_ID 0x45544e4648.45 -#define SINF_ID 0x53494e46 /* Session information */48.46 -#define END_ID 0x454e442148.47 -/* 5.5+ only */48.48 -#define NER5_ID 0x4e455235 /* Nero version 5.5.x */48.49 -#define CDTX_ID 0x43445458 /* CD TEXT */48.50 -#define CUEX_ID 0x43554558 /* Nero version 5.5.x-6.x */48.51 -#define DAOX_ID 0x44414f58 /* Nero version 5.5.x-6.x */48.52 -#define ETN2_ID 0x45544e3248.53 -#define MTYP_ID 0x4d545950 /* Disc Media type? */48.54 -48.55 -48.56 -union nrg_footer {48.57 - struct nrg_footer_v50 {48.58 - uint32_t dummy;48.59 - uint32_t id;48.60 - uint32_t offset;48.61 - } v50;48.62 - struct nrg_footer_v55 {48.63 - uint32_t id;48.64 - uint64_t offset;48.65 - } v55;48.66 -};48.67 -48.68 -struct nrg_chunk {48.69 - uint32_t id;48.70 - uint32_t length;48.71 -};48.72 -48.73 -struct nrg_etnf {48.74 - uint32_t offset;48.75 - uint32_t length;48.76 - uint32_t mode;48.77 - uint32_t lba;48.78 - uint32_t padding;48.79 -};48.80 -48.81 -struct nrg_etn2 {48.82 - uint64_t offset;48.83 - uint64_t length;48.84 - uint32_t mode;48.85 - uint32_t lba;48.86 - uint64_t padding;48.87 -};48.88 -48.89 -struct nrg_cues {48.90 - uint8_t type;48.91 - uint8_t track;48.92 - uint8_t control;48.93 - uint8_t pad;48.94 - uint32_t addr;48.95 -};48.96 -48.97 -struct nrg_daoi {48.98 - uint32_t length;48.99 - char mcn[14];48.100 - uint8_t disc_mode;48.101 - uint8_t unknown[2]; /* always 01 01? */48.102 - uint8_t track_count;48.103 - struct nrg_daoi_track {48.104 - char unknown[10];48.105 - uint32_t sector_size __attribute__((packed)); /* Always 0? */48.106 - uint8_t mode;48.107 - uint8_t unknown2[3]; /* Always 00 00 01? */48.108 - uint32_t pregap __attribute__((packed));48.109 - uint32_t offset __attribute__((packed));48.110 - uint32_t end __attribute__((packed));48.111 - } track[0];48.112 -} __attribute__((packed));48.113 -48.114 -struct nrg_daox {48.115 - uint32_t length;48.116 - char mcn[14];48.117 - uint8_t disc_mode;48.118 - uint8_t unknown[2]; /* always 01 01? */48.119 - uint8_t track_count;48.120 - struct nrg_daox_track {48.121 - char unknown[10];48.122 - uint32_t sector_size __attribute__((packed)); /* Always 0? */48.123 - uint8_t mode;48.124 - uint8_t unknown2[3]; /* Always 00 00 01? */48.125 - uint64_t pregap __attribute__((packed));48.126 - uint64_t offset __attribute__((packed));48.127 - uint64_t end __attribute__((packed));48.128 - } track[0];48.129 -} __attribute__((packed));48.130 -48.131 -/**48.132 - * Convert an 8-bit BCD number to normal integer form.48.133 - * Eg, 0x79 => 7948.134 - */48.135 -uint8_t static bcd_to_uint8( uint8_t bcd )48.136 -{48.137 - return (bcd & 0x0F) + (((bcd & 0xF0)>>4)*10);48.138 -}48.139 -48.140 -48.141 -/**48.142 - * Convert a 32 bit MSF address (BCD coded) to the48.143 - * equivalent LBA form.48.144 - * Eg, 0x48.145 - */48.146 -uint32_t static msf_to_lba( uint32_t msf )48.147 -{48.148 - msf = GUINT32_FROM_BE(msf);48.149 - int f = bcd_to_uint8(msf);48.150 - int s = bcd_to_uint8(msf>>8);48.151 - int m = bcd_to_uint8(msf>>16);48.152 - return (m * 60 + s) * 75 + f;48.153 -48.154 -}48.155 -48.156 -uint32_t static nrg_track_mode( uint8_t mode )48.157 -{48.158 - switch( mode ) {48.159 - case 0: return GDROM_MODE1;48.160 - case 2: return GDROM_MODE2_FORM1;48.161 - case 3: return GDROM_SEMIRAW_MODE2;48.162 - case 7: return GDROM_CDDA;48.163 - default:48.164 - ERROR( "Unrecognized track mode %d in Nero image", mode );48.165 - return -1;48.166 - }48.167 -}48.168 -48.169 -static gboolean nrg_image_is_valid( FILE *f )48.170 -{48.171 - union nrg_footer footer;48.172 -48.173 - fseek( f, -12, SEEK_END );48.174 - fread( &footer, sizeof(footer), 1, f );48.175 - if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ||48.176 - GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {48.177 - return TRUE;48.178 - } else {48.179 - return FALSE;48.180 - }48.181 -}48.182 -48.183 -static gdrom_disc_t nrg_image_open( const gchar *filename, FILE *f )48.184 -{48.185 - union nrg_footer footer;48.186 - struct nrg_chunk chunk;48.187 - struct nrg_daoi *dao;48.188 - struct nrg_daox *daox;48.189 - struct nrg_etnf *etnf;48.190 - struct nrg_etn2 *etn2;48.191 - gdrom_disc_t disc;48.192 - gboolean end = FALSE;48.193 - uint32_t chunk_id;48.194 - int session_id = 0;48.195 - int session_track_id = 0;48.196 - int track_id = 0;48.197 - int cue_track_id = 0, cue_track_count = 0;48.198 - int i, count;48.199 -48.200 - fseek( f, -12, SEEK_END );48.201 - fread( &footer, sizeof(footer), 1, f );48.202 - if( GUINT32_FROM_BE(footer.v50.id) == NERO_V50_ID ) {48.203 - fseek( f, GUINT32_FROM_BE(footer.v50.offset), SEEK_SET );48.204 - } else if( GUINT32_FROM_BE(footer.v55.id) == NERO_V55_ID ) {48.205 - fseek( f, (uint32_t)GUINT64_FROM_BE(footer.v55.offset), SEEK_SET );48.206 - } else {48.207 - /* Not a (recognized) Nero image */48.208 - return NULL;48.209 - }48.210 -48.211 - disc = gdrom_image_new(filename, f);48.212 - if( disc == NULL ) {48.213 - ERROR("Unable to allocate memory!");48.214 - return NULL;48.215 - }48.216 -48.217 - do {48.218 - fread( &chunk, sizeof(chunk), 1, f );48.219 - chunk.length = GUINT32_FROM_BE(chunk.length);48.220 - char data[chunk.length];48.221 - fread( data, chunk.length, 1, f );48.222 - chunk_id = GUINT32_FROM_BE(chunk.id);48.223 - switch( chunk_id ) {48.224 - case CUES_ID:48.225 - case CUEX_ID:48.226 - cue_track_id = track_id;48.227 - cue_track_count = ((chunk.length / sizeof(struct nrg_cues)) >> 1) - 1;48.228 - track_id += cue_track_count;48.229 - for( i=0; i<chunk.length; i+= sizeof(struct nrg_cues) ) {48.230 - struct nrg_cues *cue = (struct nrg_cues *)(data+i);48.231 - int track = 0;48.232 - uint32_t lba;48.233 - if( chunk_id == CUEX_ID ) {48.234 - lba = GUINT32_FROM_BE( cue->addr ) + GDROM_PREGAP;48.235 - } else {48.236 - lba = msf_to_lba( cue->addr );48.237 - }48.238 - if( cue->track == 0 )48.239 - continue; /* Track 0. Leadin? always 0? */48.240 - if( cue->track == 0xAA ) { /* end of disc */48.241 - disc->track[track_id-1].sector_count =48.242 - lba - disc->track[track_id-1].lba;48.243 - } else {48.244 - track = bcd_to_uint8(cue->track) - 1;48.245 - if( (cue->control & 0x01) == 0 ) {48.246 - /* Pre-gap address. */48.247 - if( track != 0 ) {48.248 - disc->track[track-1].sector_count =48.249 - lba - disc->track[track-1].lba;48.250 - }48.251 - } else { /* Track-start address */48.252 - disc->track[track].lba = lba;48.253 - disc->track[track].flags = cue->type;48.254 - }48.255 - }48.256 - }48.257 - break;48.258 - case DAOI_ID:48.259 - dao = (struct nrg_daoi *)data;48.260 - memcpy( disc->mcn, dao->mcn, 13 );48.261 - disc->mcn[13] = '\0';48.262 - assert( (dao->track_count - cue_track_id) * 30 + 22 == chunk.length );48.263 - assert( dao->track_count == track_id );48.264 - for( i=0; i<(dao->track_count-cue_track_id); i++ ) {48.265 - disc->track[cue_track_id].sector_size = GUINT32_FROM_BE(dao->track[i].sector_size);48.266 - disc->track[cue_track_id].offset = GUINT32_FROM_BE(dao->track[i].offset);48.267 - disc->track[cue_track_id].mode = nrg_track_mode( dao->track[i].mode );48.268 - disc->track[cue_track_id].sector_count =48.269 - (GUINT32_FROM_BE(dao->track[i].end) - GUINT32_FROM_BE(dao->track[i].offset))/48.270 - GUINT32_FROM_BE(dao->track[i].sector_size);48.271 - cue_track_id++;48.272 - }48.273 - break;48.274 - case DAOX_ID:48.275 - daox = (struct nrg_daox *)data;48.276 - memcpy( disc->mcn, daox->mcn, 13 );48.277 - disc->mcn[13] = '\0';48.278 - assert( (daox->track_count - cue_track_id) * 42 + 22 == chunk.length );48.279 - assert( daox->track_count == track_id );48.280 - for( i=0; i<(daox->track_count-cue_track_id); i++ ) {48.281 - disc->track[cue_track_id].sector_size = GUINT32_FROM_BE(daox->track[i].sector_size);48.282 - disc->track[cue_track_id].offset = GUINT64_FROM_BE(daox->track[i].offset);48.283 - disc->track[cue_track_id].mode = nrg_track_mode( daox->track[i].mode );48.284 - disc->track[cue_track_id].sector_count =48.285 - (GUINT64_FROM_BE(daox->track[i].end) - GUINT64_FROM_BE(daox->track[i].offset))/48.286 - GUINT32_FROM_BE(daox->track[i].sector_size);48.287 - cue_track_id++;48.288 - }48.289 - break;48.290 -48.291 - case SINF_ID:48.292 - /* Data is a single 32-bit number representing number of tracks in session */48.293 - i = GUINT32_FROM_BE( *(uint32_t *)data );48.294 - while( i-- > 0 )48.295 - disc->track[session_track_id++].session = session_id;48.296 - session_id++;48.297 - break;48.298 - case ETNF_ID:48.299 - etnf = (struct nrg_etnf *)data;48.300 - count = chunk.length / sizeof(struct nrg_etnf);48.301 - for( i=0; i < count; i++, etnf++ ) {48.302 - disc->track[track_id].offset = GUINT32_FROM_BE(etnf->offset);48.303 - disc->track[track_id].lba = GUINT32_FROM_BE(etnf->lba) + (i+1)*GDROM_PREGAP;48.304 - disc->track[track_id].mode = nrg_track_mode( GUINT32_FROM_BE(etnf->mode) );48.305 - if( disc->track[track_id].mode == -1 ) {48.306 - disc->destroy(disc,FALSE);48.307 - return NULL;48.308 - }48.309 - if( disc->track[track_id].mode == GDROM_CDDA )48.310 - disc->track[track_id].flags = 0x01;48.311 - else48.312 - disc->track[track_id].flags = 0x01 | TRACK_DATA;48.313 - disc->track[track_id].sector_size = GDROM_SECTOR_SIZE(disc->track[track_id].mode);48.314 - disc->track[track_id].sector_count = GUINT32_FROM_BE(etnf->length) /48.315 - disc->track[track_id].sector_size;48.316 - track_id++;48.317 - }48.318 - break;48.319 - case ETN2_ID:48.320 - etn2 = (struct nrg_etn2 *)data;48.321 - count = chunk.length / sizeof(struct nrg_etn2);48.322 - for( i=0; i < count; i++, etn2++ ) {48.323 - disc->track[track_id].offset = (uint32_t)GUINT64_FROM_BE(etn2->offset);48.324 - disc->track[track_id].lba = GUINT32_FROM_BE(etn2->lba) + (i+1)*GDROM_PREGAP;48.325 - disc->track[track_id].mode = nrg_track_mode( GUINT32_FROM_BE(etn2->mode) );48.326 - if( disc->track[track_id].mode == -1 ) {48.327 - disc->destroy(disc,FALSE);48.328 - return NULL;48.329 - }48.330 - if( disc->track[track_id].mode == GDROM_CDDA )48.331 - disc->track[track_id].flags = 0x01;48.332 - else48.333 - disc->track[track_id].flags = 0x01 | TRACK_DATA;48.334 - disc->track[track_id].sector_size = GDROM_SECTOR_SIZE(disc->track[track_id].mode);48.335 - disc->track[track_id].sector_count = (uint32_t)(GUINT64_FROM_BE(etn2->length) /48.336 - disc->track[track_id].sector_size);48.337 - track_id++;48.338 - }48.339 - break;48.340 -48.341 - case END_ID:48.342 - end = TRUE;48.343 - break;48.344 - }48.345 - } while( !end );48.346 - disc->track_count = track_id;48.347 - gdrom_set_disc_type(disc);48.348 - return disc;48.349 -}48.350 -48.351 -48.352 -
49.1 --- a/src/gdrom/packet.h Sun Jan 31 18:30:13 2010 +100049.2 +++ b/src/gdrom/packet.h Sun Jan 31 18:35:06 2010 +100049.3 @@ -68,6 +68,7 @@49.4 #define PKT_ERR_BADFIELD 0x240549.5 #define PKT_ERR_BADREAD 0x300249.6 #define PKT_ERR_BADREADMODE 0x6405 /* Illegal mode for this track */49.7 +#define PKT_ERR_READERROR 0x1103 /* Read failed due to uncorrectable error */49.8 #define PKT_ERR_RESET 0x290649.10 /* Parse CD read */
.