Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x68k/dev Avoid magic numbers and give appropriate n...
details: https://anonhg.NetBSD.org/src/rev/2ff80a935cf9
branches: trunk
changeset: 356499:2ff80a935cf9
user: isaki <isaki%NetBSD.org@localhost>
date: Sat Sep 30 04:07:04 2017 +0000
description:
Avoid magic numbers and give appropriate names.
diffstat:
sys/arch/x68k/dev/vs.c | 16 ++++++++++------
sys/arch/x68k/dev/vsvar.h | 10 +++++++---
2 files changed, 17 insertions(+), 9 deletions(-)
diffs (82 lines):
diff -r a395ca9ba2ea -r 2ff80a935cf9 sys/arch/x68k/dev/vs.c
--- a/sys/arch/x68k/dev/vs.c Sat Sep 30 03:34:04 2017 +0000
+++ b/sys/arch/x68k/dev/vs.c Sat Sep 30 04:07:04 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vs.c,v 1.48 2017/09/02 15:40:31 isaki Exp $ */
+/* $NetBSD: vs.c,v 1.49 2017/09/30 04:07:04 isaki Exp $ */
/*
* Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.48 2017/09/02 15:40:31 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.49 2017/09/30 04:07:04 isaki Exp $");
#include "audio.h"
#include "vs.h"
@@ -510,7 +510,8 @@
(int)block - (int)KVADDR(vd), blksize);
if (sc->sc_active == 0) {
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 2);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+ MSM6258_CMD, MSM6258_CMD_PLAY_START);
sc->sc_active = 1;
}
@@ -555,7 +556,8 @@
(int)block - (int)KVADDR(vd), blksize);
if (sc->sc_active == 0) {
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 4);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+ MSM6258_CMD, MSM6258_CMD_REC_START);
sc->sc_active = 1;
}
@@ -572,7 +574,8 @@
if (sc->sc_active) {
/* stop ADPCM play */
dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+ MSM6258_CMD, MSM6258_CMD_STOP);
sc->sc_active = 0;
}
@@ -589,7 +592,8 @@
if (sc->sc_active) {
/* stop ADPCM recoding */
dmac_abort_xfer(sc->sc_dma_ch->ch_softc, sc->sc_current.xfer);
- bus_space_write_1(sc->sc_iot, sc->sc_ioh, MSM6258_STAT, 1);
+ bus_space_write_1(sc->sc_iot, sc->sc_ioh,
+ MSM6258_CMD, MSM6258_CMD_STOP);
sc->sc_active = 0;
}
diff -r a395ca9ba2ea -r 2ff80a935cf9 sys/arch/x68k/dev/vsvar.h
--- a/sys/arch/x68k/dev/vsvar.h Sat Sep 30 03:34:04 2017 +0000
+++ b/sys/arch/x68k/dev/vsvar.h Sat Sep 30 04:07:04 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vsvar.h,v 1.15 2017/09/02 12:52:55 isaki Exp $ */
+/* $NetBSD: vsvar.h,v 1.16 2017/09/30 04:07:04 isaki Exp $ */
/*
* Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -59,8 +59,12 @@
#define VS_MAX_BUFSIZE (65536*4) /* XXX: enough? */
/* XXX: msm6258vreg.h */
-#define MSM6258_STAT 0
-#define MSM6258_DATA 1
+#define MSM6258_CMD 0 /* W */
+#define MSM6258_CMD_STOP (0x01)
+#define MSM6258_CMD_PLAY_START (0x02)
+#define MSM6258_CMD_REC_START (0x04)
+#define MSM6258_STAT 0 /* R */
+#define MSM6258_DATA 1 /* R/W */
struct vs_dma {
bus_dma_tag_t vd_dmat;
Home |
Main Index |
Thread Index |
Old Index