4 * This file is part of WorkMan, the civilized CD player library
5 * (c) 1991-1997 by Steven Grimm (original author)
6 * (c) by Dirk Försterling (current 'author' = maintainer)
7 * The maintainer can be contacted by his e-mail address:
8 * milliByte@DeathsDoor.com
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Library General Public License for more details.
20 * You should have received a copy of the GNU Library General Public
21 * License along with this library; if not, write to the Free
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 static char plat_template_id
[] = "$Id$"
33 #include "include/wm_config.h"
34 #include "include/wm_struct.h"
36 #define WM_MSG_CLASS WM_MSG_CLASS_PLATFORM
43 int gen_init(struct wm_drive
*d
)
49 * gen_get_trackcount()
53 int gen_get_trackcount(struct wm_drive
*d
,int *tracks
)
64 int gen_get_cdlen(struct wm_drive
*d
,int *frames
)
75 gen_get_trackinfo(struct wm_drive
*d
,int track
,int *data
,int *startframe
)
81 * gen_get_drive_status()
85 int gen_get_drive_status(struct wm_drive
*d
,
86 enum wm_cd_modes oldmode
,
87 enum wm_cd_modes
*mode
,
96 int scale_volume(int vol
,int max
)
98 return ((vol
* (max_volume
- min_volume
)) / max
+ min_volume
);
101 int unscale_volume(int vol
,int max
)
104 n
= ( vol
- min_volume
) * max_volume
/ (max
- min_volume
);
113 int gen_get_volume(struct wm_drive
*d
,int *left
,int *right
)
123 int gen_set_volume(struct wm_drive
*d
,int left
,int right
)
133 int gen_pause(struct wm_drive
*d
)
143 int gen_resume(struct wm_drive
*d
)
153 int gen_stop(struct wm_drive
*d
){
162 int gen_play(struct wm_drive
*d
,int start
,int end
)
172 int gen_eject(struct wm_drive
*d
)
178 /*----------------------------------------*
180 *----------------------------------------*/
181 int gen_closetray(struct wm_drive
*d
)
187 return(wmcd_reopen(d
));
192 /* Always succeed if the drive can't close */
194 #endif /* CAN_CLOSE */
195 } /* gen_closetray() */
202 int wm_scsi(struct wm_drive
*d
,
203 uchar_t
*cdb
, int cdblen
,void *retbuf
,int retbuflen
,int getreply
)
214 int wmcd_open(struct wm_drive
*d
)
216 char vendor
[32] = WM_STR_GENVENDOR
;
217 char model
[32] = WM_STR_GENMODEL
;
218 char rev
[32] = WM_STR_GENREV
;
227 if(d
->fd
> -1) /* device already open? */
230 if( cd_device
== (char *)NULL
)
231 cd_device
= DEFAULT_CD_DEVICE
;
233 /* open() goes here */
235 *d
= *(find_drive_struct(vendor
, model
, rev
));
236 wm_drive_settype(vendor
, model
, rev
);
245 * Re-Open the device if it is open.
248 wmcd_reopen( struct wm_drive
*d
)
253 wm_lib_message(WM_MSG_LEVEL_DEBUG
, "wmcd_reopen ");
254 if (d
->fd
>= 0) /* Device really open? */
256 wm_lib_message(WM_MSG_LEVEL_DEBUG
, "closes the device and ");
257 status
= close( d
->fd
); /* close it! */
258 /* we know, that the file is closed, do we? */
262 wm_lib_message(WM_MSG_LEVEL_DEBUG
, "calls wmcd_open()\n");
263 status
= wmcd_open( d
); /* open it as usual */
265 } while ( status
!= 0 );
267 } /* wmcd_reopen() */
269 #endif /* TEMPLATESYSTEM */