File indexing completed on 2024-04-21 04:54:24

0001 /*
0002  * This file is part of WorkMan, the civilized CD player library
0003  * Copyright (C) 1991-1997 by Steven Grimm <koreth@midwinter.com>
0004  * Copyright (C) by Dirk Försterling <milliByte@DeathsDoor.com>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Library General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014  * Library General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Library General Public
0017  * License along with this library; if not, write to the Free
0018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0019  *
0020  *
0021  * This file surely contains nonsense. It's the porter's part to fill
0022  * the gaps and assure that the resulting code makes sense.
0023  *
0024  */
0025 
0026 #if [TEMPLATESYSTEM]
0027 
0028 
0029 #include "include/wm_config.h"
0030 #include "include/wm_struct.h"
0031 #include "include/wm_cdtext.h"
0032 
0033 #define WM_MSG_CLASS WM_MSG_CLASS_PLATFORM
0034 
0035 /*
0036  * gen_init();
0037  *
0038  */
0039 int
0040 gen_init(struct wm_drive *d)
0041 {
0042   return (0);
0043 } /* gen_init() */
0044 
0045 /*
0046  * gen_open()
0047  *
0048  */
0049 int
0050 gen_open(struct wm_drive *d)
0051 {
0052   if( ! d )
0053     {
0054       errno = EFAULT;
0055       return -1;
0056     }
0057 
0058   if(d->fd > -1)            /* device already open? */
0059     {
0060       wm_lib_message(WM_MSG_LEVEL_DEBUG|WM_MSG_CLASS, "gen_open(): [device is open (fd=%d)]\n", d->fd);
0061       return 0;
0062     }
0063 
0064 
0065   return (0);
0066 } /* gen_open() */
0067 
0068 /*
0069  * gen_scsi()
0070  *
0071  */
0072 int
0073 gen_scsi(struct wm_drive *d,
0074         uchar_t *cdb, int cdblen,void *retbuf,int retbuflen,int getreply)
0075 {
0076   return -1;
0077 } /* gen_scsi() */
0078 
0079 /*
0080  * close the CD device
0081  */
0082 
0083 int
0084 gen_close(struct wm_drive *d)
0085 {
0086     if(d->fd != -1) {
0087       wm_lib_message(WM_MSG_LEVEL_DEBUG, "closing the device\n");
0088       close(d->fd);
0089       d->fd = -1;
0090     }
0091     return 0;
0092 } /* gen_close() */
0093 
0094 /*
0095  * gen_get_drive_status()
0096  *
0097  */
0098 int
0099 gen_get_drive_status(struct wm_drive *d,
0100              int oldmode,
0101              int *mode,
0102              int *pos,
0103              int *track,
0104              int *index)
0105 {
0106   return (0);
0107 } /* gen_get_drive_status() */
0108 
0109 /*
0110  * gen_get_trackcount()
0111  *
0112  */
0113 int
0114 gen_get_trackcount(struct wm_drive *d,int *tracks)
0115 {
0116   return (0);
0117 } /* gen_get_trackcount() */
0118 
0119 /*
0120  * gen_get_trackinfo()
0121  *
0122  */
0123 int
0124 gen_get_trackinfo(struct wm_drive *d,int track,int *data,int *startframe)
0125 {
0126   return (0);
0127 } /* gen_get_trackinfo() */
0128 
0129 /*
0130  * gen_get_cdlen()
0131  *
0132  */
0133 int
0134 gen_get_cdlen(struct wm_drive *d,int *frames)
0135 {
0136   return (0);
0137 } /* gen_get_cdlen() */
0138 
0139 /*
0140  * gen_play()
0141  *
0142  */
0143 int
0144 gen_play(struct wm_drive *d,int start,int end)
0145 {
0146   return (0);
0147 } /* gen_play() */
0148 
0149 /*
0150  * gen_pause()
0151  *
0152  */
0153 int
0154 gen_pause(struct wm_drive *d)
0155 {
0156   return ioctl( 0 );
0157 } /* gen_pause() */
0158 
0159 /*
0160  * gen_resume
0161  *
0162  */
0163 int
0164 gen_resume(struct wm_drive *d)
0165 {
0166   return (0);
0167 } /* gen_resume() */
0168 
0169 /*
0170  * gen_stop()
0171  *
0172  */
0173 int
0174 gen_stop(struct wm_drive *d)
0175 {
0176   return (0);
0177 } /* gen_stop() */
0178 
0179 /*
0180  * gen_eject()
0181  *
0182  */
0183 int
0184 gen_eject(struct wm_drive *d)
0185 {
0186   return (0);
0187 } /* gen_eject() */
0188 
0189 /*----------------------------------------*
0190  * Close the CD tray
0191  *----------------------------------------*/
0192 int gen_closetray(struct wm_drive *d)
0193 {
0194   return -1;
0195 } /* gen_closetray() */
0196 
0197 int
0198 scale_volume(int vol,int max)
0199 {
0200   return ((vol * (max_volume - min_volume)) / max + min_volume);
0201 } /* scale_volume() */
0202 
0203 int
0204 unscale_volume(int vol,int max)
0205 {
0206   int n;
0207   n = ( vol - min_volume ) * max_volume / (max - min_volume);
0208   return (n <0)?0:n;
0209 } /* unscale_volume() */
0210 
0211 /*
0212  * gen_set_volume()
0213  *
0214  */
0215 int
0216 gen_set_volume(struct wm_drive *d,int left,int right)
0217 {
0218   return (0);
0219 } /* gen_set_volume() */
0220 
0221 /*
0222  * gen_get_volume()
0223  *
0224  */
0225 int
0226 gen_get_volume(struct wm_drive *d,int *left,int *right)
0227 {
0228   return (0);
0229 } /* gen_get_volume() */
0230 
0231 #endif /* TEMPLATESYSTEM */