scd.c (25056) | scd.c (25460) |
---|---|
1/*- 2 * Copyright (c) 1995 Mikael Hybsch 3 * All rights reserved. 4 * 5 * Portions of this file are copied from mcd.c 6 * which has the following copyrights: 7 * 8 * Copyright 1993 by Holger Veit (data part) --- 27 unchanged lines hidden (view full) --- 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 */ 42 43 | 1/*- 2 * Copyright (c) 1995 Mikael Hybsch 3 * All rights reserved. 4 * 5 * Portions of this file are copied from mcd.c 6 * which has the following copyrights: 7 * 8 * Copyright 1993 by Holger Veit (data part) --- 27 unchanged lines hidden (view full) --- 36 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 37 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 38 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 39 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 40 * 41 */ 42 43 |
44/* $Id: scd.c,v 1.28 1997/03/24 11:24:01 bde Exp $ */ | 44/* $Id: scd.c,v 1.29 1997/04/20 17:26:55 bde Exp $ */ |
45 46/* Please send any comments to micke@dynas.se */ 47 48#define SCD_DEBUG 0 49 50#include "scd.h" 51#if NSCD > 0 52#include <sys/types.h> --- 122 unchanged lines hidden (view full) --- 175static int scd_playmsf(int unit, struct ioc_play_msf *msf); 176static int scd_play(int unit, struct ioc_play_msf *msf); 177static int scd_subchan(int unit, struct ioc_read_subchannel *sc); 178static int read_subcode(int unit, struct sony_subchannel_position_data *sc); 179 180/* for xcdplayer */ 181static int scd_toc_header(int unit, struct ioc_toc_header *th); 182static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te); | 45 46/* Please send any comments to micke@dynas.se */ 47 48#define SCD_DEBUG 0 49 50#include "scd.h" 51#if NSCD > 0 52#include <sys/types.h> --- 122 unchanged lines hidden (view full) --- 175static int scd_playmsf(int unit, struct ioc_play_msf *msf); 176static int scd_play(int unit, struct ioc_play_msf *msf); 177static int scd_subchan(int unit, struct ioc_read_subchannel *sc); 178static int read_subcode(int unit, struct sony_subchannel_position_data *sc); 179 180/* for xcdplayer */ 181static int scd_toc_header(int unit, struct ioc_toc_header *th); 182static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te); |
183static int scd_toc_entry(int unit, struct ioc_read_toc_single_entry *te); |
|
183#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */ 184 185static int scd_probe(struct isa_device *dev); 186static int scd_attach(struct isa_device *dev); 187struct isa_driver scddriver = { scd_probe, scd_attach, "scd" }; 188 189static d_open_t scdopen; 190static d_close_t scdclose; --- 260 unchanged lines hidden (view full) --- 451 case CDIOCPLAYMSF: 452 return scd_playmsf(unit, (struct ioc_play_msf *) addr); 453 case CDIOCREADSUBCHANNEL: 454 return scd_subchan(unit, (struct ioc_read_subchannel *) addr); 455 case CDIOREADTOCHEADER: 456 return scd_toc_header (unit, (struct ioc_toc_header *) addr); 457 case CDIOREADTOCENTRYS: 458 return scd_toc_entrys (unit, (struct ioc_read_toc_entry*) addr); | 184#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */ 185 186static int scd_probe(struct isa_device *dev); 187static int scd_attach(struct isa_device *dev); 188struct isa_driver scddriver = { scd_probe, scd_attach, "scd" }; 189 190static d_open_t scdopen; 191static d_close_t scdclose; --- 260 unchanged lines hidden (view full) --- 452 case CDIOCPLAYMSF: 453 return scd_playmsf(unit, (struct ioc_play_msf *) addr); 454 case CDIOCREADSUBCHANNEL: 455 return scd_subchan(unit, (struct ioc_read_subchannel *) addr); 456 case CDIOREADTOCHEADER: 457 return scd_toc_header (unit, (struct ioc_toc_header *) addr); 458 case CDIOREADTOCENTRYS: 459 return scd_toc_entrys (unit, (struct ioc_read_toc_entry*) addr); |
460 case CDIOREADTOCENTRY: 461 return scd_toc_entry (unit, (struct ioc_read_toc_single_entry*) addr); |
|
459 case CDIOCSETPATCH: 460 case CDIOCGETVOL: 461 case CDIOCSETVOL: 462 case CDIOCSETMONO: 463 case CDIOCSETSTERIO: 464 case CDIOCSETMUTE: 465 case CDIOCSETLEFT: 466 case CDIOCSETRIGHT: --- 1045 unchanged lines hidden (view full) --- 1512 /* copy the data back */ 1513 if (copyout(&toc_entry, te->data, sizeof(struct cd_toc_entry)) != 0) 1514 return EFAULT; 1515 1516 return 0; 1517} 1518 1519 | 462 case CDIOCSETPATCH: 463 case CDIOCGETVOL: 464 case CDIOCSETVOL: 465 case CDIOCSETMONO: 466 case CDIOCSETSTERIO: 467 case CDIOCSETMUTE: 468 case CDIOCSETLEFT: 469 case CDIOCSETRIGHT: --- 1045 unchanged lines hidden (view full) --- 1515 /* copy the data back */ 1516 if (copyout(&toc_entry, te->data, sizeof(struct cd_toc_entry)) != 0) 1517 return EFAULT; 1518 1519 return 0; 1520} 1521 1522 |
1523static int 1524scd_toc_entry (int unit, struct ioc_read_toc_single_entry *te) 1525{ 1526 struct scd_data *cd = scd_data + unit; 1527 struct cd_toc_entry toc_entry; 1528 int rc, i; 1529 1530 if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { 1531 print_error(unit, rc); 1532 return EIO; 1533 } 1534 1535 /* find the toc to copy*/ 1536 i = te->track; 1537 if (i == SCD_LASTPLUS1) 1538 i = cd->last_track + 1; 1539 1540 /* verify starting track */ 1541 if (i < cd->first_track || i > cd->last_track+1) 1542 return EINVAL; 1543 1544 /* copy the toc data */ 1545 toc_entry.control = cd->toc[i].ctl; 1546 toc_entry.addr_type = te->address_format; 1547 toc_entry.track = i; 1548 if (te->address_format == CD_MSF_FORMAT) { 1549 toc_entry.addr.msf.unused = 0; 1550 toc_entry.addr.msf.minute = bcd2bin(cd->toc[i].start_msf[0]); 1551 toc_entry.addr.msf.second = bcd2bin(cd->toc[i].start_msf[1]); 1552 toc_entry.addr.msf.frame = bcd2bin(cd->toc[i].start_msf[2]); 1553 } 1554 1555 /* copy the data back */ 1556 bcopy(&toc_entry, &te->entry, sizeof(struct cd_toc_entry)); 1557 1558 return 0; 1559} 1560 1561 |
|
1520static scd_devsw_installed = 0; 1521 1522static void scd_drvinit(void *unused) 1523{ 1524 1525 if( ! scd_devsw_installed ) { 1526 bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_bdevsw); 1527 scd_devsw_installed = 1; 1528 } 1529} 1530 1531SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL) 1532 1533 1534#endif /* NSCD > 0 */ | 1562static scd_devsw_installed = 0; 1563 1564static void scd_drvinit(void *unused) 1565{ 1566 1567 if( ! scd_devsw_installed ) { 1568 bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_bdevsw); 1569 scd_devsw_installed = 1; 1570 } 1571} 1572 1573SYSINIT(scddev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,scd_drvinit,NULL) 1574 1575 1576#endif /* NSCD > 0 */ |