diff --git a/sys/dev/pci/esa.c b/sys/dev/pci/esa.c index ffc5e8240b45..6e776ecc3db6 100644 --- a/sys/dev/pci/esa.c +++ b/sys/dev/pci/esa.c @@ -1,4 +1,4 @@ -/* $NetBSD: esa.c,v 1.58 2012/01/30 19:41:19 drochner Exp $ */ +/* $NetBSD: esa.c,v 1.59 2013/10/16 17:39:09 christos Exp $ */ /* * Copyright (c) 2001-2008 Jared D. McNeill @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.58 2012/01/30 19:41:19 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esa.c,v 1.59 2013/10/16 17:39:09 christos Exp $"); #include #include @@ -653,7 +653,7 @@ esa_trigger_output(void *hdl, void *start, void *end, int blksize, ESA_DMAC_BLOCKF_SELECTOR); /* Set an armload of static initializers */ - for (i = 0; i < (sizeof(esa_playvals) / sizeof(esa_playvals[0])); i++) + for (i = 0; i < __arraycount(esa_playvals); i++) esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_DATA, dac_data + esa_playvals[i].addr, esa_playvals[i].val); @@ -787,7 +787,7 @@ esa_trigger_input(void *hdl, void *start, void *end, int blksize, ESA_DMAC_PAGE3_SELECTOR + ESA_DMAC_BLOCKF_SELECTOR); /* Set an armload of static initializers */ - for (i = 0; i < (sizeof(esa_recvals) / sizeof(esa_recvals[0])); i++) + for (i = 0; i < __arraycount(esa_recvals); i++) esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_DATA, adc_data + esa_recvals[i].addr, esa_recvals[i].val); @@ -930,7 +930,7 @@ esa_allocmem(struct esa_softc *sc, size_t size, size_t align, p->size = size; error = bus_dmamem_alloc(sc->sc_dmat, p->size, align, 0, - p->segs, sizeof(p->segs) / sizeof(p->segs[0]), + p->segs, __arraycount(p->segs), &p->nsegs, BUS_DMA_WAITOK); if (error) return error; @@ -1090,7 +1090,7 @@ esa_attach(device_t parent, device_t self, void *aux) /* create suspend save area */ sc->savememsz = sizeof(uint16_t) * (ESA_REV_B_CODE_MEMORY_LENGTH + ESA_REV_B_DATA_MEMORY_LENGTH + 1); - sc->savemem = (uint16_t *)kmem_zalloc(sc->savememsz, KM_SLEEP); + sc->savemem = kmem_zalloc(sc->savememsz, KM_SLEEP); if (sc->savemem == NULL) { aprint_error_dev(sc->sc_dev, "unable to allocate suspend buffer\n"); @@ -1385,21 +1385,19 @@ esa_init(struct esa_softc *sc) ESA_KDATA_DMA_XFER0); /* Write kernel code into memory */ - size = sizeof(esa_assp_kernel_image); - for (i = 0; i < size / 2; i++) + for (i = 0; i < __arraycount(esa_assp_kernel_image); i++) esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_CODE, ESA_REV_B_CODE_MEMORY_BEGIN + i, esa_assp_kernel_image[i]); - size = sizeof(esa_assp_minisrc_image); - for (i = 0; i < size / 2; i++) + for (i = 0; i < __arraycount(esa_assp_minisrc_image); i++) esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_CODE, 0x400 + i, esa_assp_minisrc_image[i]); /* Write the coefficients for the low pass filter */ - size = sizeof(esa_minisrc_lpf_image); - for (i = 0; i < size / 2; i++) + for (i = 0; i < __arraycount(esa_minisrc_lpf_image); i++) esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_CODE, - 0x400 + ESA_MINISRC_COEF_LOC + i, esa_minisrc_lpf_image[i]); + 0x400 + ESA_MINISRC_COEF_LOC + i, + esa_minisrc_lpf_image[i]); esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_CODE, 0x400 + ESA_MINISRC_COEF_LOC + size, 0x8000); esa_write_assp(sc, ESA_MEMTYPE_INTERNAL_DATA, ESA_KDATA_TASK0, 0x400); diff --git a/sys/dev/pci/esadsp.h b/sys/dev/pci/esadsp.h index 49c057c68433..9c91438f0d37 100644 --- a/sys/dev/pci/esadsp.h +++ b/sys/dev/pci/esadsp.h @@ -1,4 +1,4 @@ -/* $NetBSD: esadsp.h,v 1.6 2005/12/11 12:22:49 christos Exp $ */ +/* $NetBSD: esadsp.h,v 1.7 2013/10/16 17:39:09 christos Exp $ */ /* * Copyright (c) 2002 Lennart Augustsson @@ -93,7 +93,7 @@ static struct rec_vals { { ESA_SRC3_DIRECTION_OFFSET + 22, 0xff} }; -static uint32_t esa_assp_kernel_image[] = { +static uint16_t esa_assp_kernel_image[] = { 0x7980, 0x0030, 0x7980, 0x03b4, 0x7980, 0x03b4, 0x7980, 0x00fb, 0x7980, 0x00dd, 0x7980, 0x03b4, 0x7980, 0x0332, 0x7980, 0x0287, 0x7980, 0x03b4, 0x7980, 0x03b4, 0x7980, 0x03b4, 0x7980, 0x03b4, @@ -215,7 +215,7 @@ static uint32_t esa_assp_kernel_image[] = { 0x0267, 0x0368, 0x0469, 0x056a, 0xbe3a, }; -static uint32_t esa_assp_minisrc_image[] = { +static uint16_t esa_assp_minisrc_image[] = { 0xbf80, 0x101e, 0x906e, 0x006e, 0x8b88, 0x6980, 0xef88, 0x906f, 0x0d6f, 0x6900, 0xeb08, 0x0412, 0xbc20, 0x696e, 0xb801, 0x906e, 0x7980, 0x0403, 0xb90e,