Index: conf/GENERIC =================================================================== RCS file: /cvsroot/src/sys/arch/dreamcast/conf/GENERIC,v retrieving revision 1.36 diff -u -r1.36 GENERIC --- conf/GENERIC 2003/06/14 16:28:32 1.36 +++ conf/GENERIC 2003/08/23 15:02:26 @@ -167,6 +167,9 @@ mbe* at g2bus? # SEGA LAN Adapter +aica* at g2bus? # AICA Sound Processing Unit +audio* at aica? + #pseudo-device cgd 2 # cryptographic disk devices pseudo-device md 1 # memory disk device (ramdisk) pseudo-device vnd 2 # disk-like interface to files Index: conf/files.dreamcast =================================================================== RCS file: /cvsroot/src/sys/arch/dreamcast/conf/files.dreamcast,v retrieving revision 1.24 diff -u -r1.24 files.dreamcast --- conf/files.dreamcast 2003/06/14 16:15:16 1.24 +++ conf/files.dreamcast 2003/08/23 15:02:26 @@ -99,4 +99,8 @@ attach mbe at g2bus with mbe_g2bus file arch/dreamcast/dev/g2/if_mbe_g2.c mbe_g2bus +device aica: audiobus, auconv, mulaw +attach aica at g2bus +file arch/dreamcast/dev/g2/aica.c aica needs-flag + include "arch/dreamcast/conf/majors.dreamcast" Index: dev/g2/g2bus_bus_mem.c =================================================================== RCS file: /cvsroot/src/sys/arch/dreamcast/dev/g2/g2bus_bus_mem.c,v retrieving revision 1.8 diff -u -r1.8 g2bus_bus_mem.c --- dev/g2/g2bus_bus_mem.c 2003/07/15 01:31:38 1.8 +++ dev/g2/g2bus_bus_mem.c 2003/08/23 15:02:26 @@ -74,10 +74,21 @@ void g2bus_bus_mem_read_region_1(void *, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t); +void g2bus_bus_mem_read_region_2(void *, bus_space_handle_t, bus_size_t, + u_int16_t *, bus_size_t); +void g2bus_bus_mem_read_region_4(void *, bus_space_handle_t, bus_size_t, + u_int32_t *, bus_size_t); void g2bus_bus_mem_write_region_1(void *, bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t); +void g2bus_bus_mem_write_region_2(void *, bus_space_handle_t, bus_size_t, + const u_int16_t *, bus_size_t); +void g2bus_bus_mem_write_region_4(void *, bus_space_handle_t, bus_size_t, + const u_int32_t *, bus_size_t); +void g2bus_bus_mem_set_region_4(void *, bus_space_handle_t, bus_size_t, + u_int32_t, bus_size_t); + u_int8_t g2bus_sparse_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t); u_int16_t g2bus_sparse_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t); u_int32_t g2bus_sparse_bus_mem_read_4(void *, bus_space_handle_t, bus_size_t); @@ -120,8 +131,14 @@ t->dbs_w_4 = g2bus_bus_mem_write_4; t->dbs_rr_1 = g2bus_bus_mem_read_region_1; + t->dbs_rr_2 = g2bus_bus_mem_read_region_2; + t->dbs_rr_4 = g2bus_bus_mem_read_region_4; t->dbs_wr_1 = g2bus_bus_mem_write_region_1; + t->dbs_wr_2 = g2bus_bus_mem_write_region_2; + t->dbs_wr_4 = g2bus_bus_mem_write_region_4; + + t->dbs_sr_4 = g2bus_bus_mem_set_region_4; } int @@ -265,6 +282,36 @@ } void +g2bus_bus_mem_read_region_2(void *v, bus_space_handle_t sh, bus_size_t off, + u_int16_t *addr, bus_size_t len) +{ + G2LOCK_DECL; + __volatile const u_int16_t *baddr = (u_int16_t *)(sh + off); + + G2_LOCK(); + + while (len--) + *addr++ = *baddr++; + + G2_UNLOCK(); +} + +void +g2bus_bus_mem_read_region_4(void *v, bus_space_handle_t sh, bus_size_t off, + u_int32_t *addr, bus_size_t len) +{ + G2LOCK_DECL; + __volatile const u_int32_t *baddr = (u_int32_t *)(sh + off); + + G2_LOCK(); + + while (len--) + *addr++ = *baddr++; + + G2_UNLOCK(); +} + +void g2bus_bus_mem_write_region_1(void *v, bus_space_handle_t sh, bus_size_t off, const u_int8_t *addr, bus_size_t len) { @@ -275,6 +322,51 @@ while (len--) *baddr++ = *addr++; + + G2_UNLOCK(); +} + +void +g2bus_bus_mem_write_region_2(void *v, bus_space_handle_t sh, bus_size_t off, + const u_int16_t *addr, bus_size_t len) +{ + G2LOCK_DECL; + __volatile u_int16_t *baddr = (u_int16_t *)(sh + off); + + G2_LOCK(); + + while (len--) + *baddr++ = *addr++; + + G2_UNLOCK(); +} + +void +g2bus_bus_mem_write_region_4(void *v, bus_space_handle_t sh, bus_size_t off, + const u_int32_t *addr, bus_size_t len) +{ + G2LOCK_DECL; + __volatile u_int32_t *baddr = (u_int32_t *)(sh + off); + + G2_LOCK(); + + while (len--) + *baddr++ = *addr++; + + G2_UNLOCK(); +} + +void +g2bus_bus_mem_set_region_4(void *v, bus_space_handle_t sh, bus_size_t off, + u_int32_t val, bus_size_t len) +{ + G2LOCK_DECL; + __volatile u_int32_t *baddr = (u_int32_t *)(sh + off); + + G2_LOCK(); + + while (len--) + *baddr++ = val; G2_UNLOCK(); } --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/g2/aica.c 2003-08-24 00:01:06.000000000 +0900 @@ -0,0 +1,806 @@ +/* $NetBSD$ */ + +/* + * Copyright (c) 2003 SHIMIZU Ryo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__KERNEL_RCSID(0, "$NetBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include + +#define AICA_REG_ADDR 0x00700000 +#define AICA_RAM_START 0x00800000 +#define AICA_RAM_SIZE 0x00200000 +#define AICA_NCHAN 64 +#define AICA_TIMEOUT 0x1800 + +struct aica_softc { + struct device sc_dev; /* base device */ + bus_space_tag_t sc_memt; + bus_space_handle_t sc_aica_regh; + bus_space_handle_t sc_aica_memh; + + /* audio property */ + int sc_open; + int sc_encodings; + int sc_precision; + int sc_channels; + int sc_rate; + void (*sc_intr)(void *); + void *sc_intr_arg; + + int sc_output_master; + int sc_output_gain[2]; +#define AICA_VOLUME_LEFT 0 +#define AICA_VOLUME_RIGHT 1 + + /* work for output */ + void *sc_buffer; + void *sc_buffer_start; + void *sc_buffer_end; + int sc_blksize; + int sc_nextfill; +}; + +struct { + char *name; + int encoding; + int precision; +} aica_encodings[] = { + {AudioEadpcm, AUDIO_ENCODING_ADPCM, 4}, + {AudioEslinear, AUDIO_ENCODING_SLINEAR, 8}, + {AudioEulinear, AUDIO_ENCODING_ULINEAR, 8}, + {AudioEmulaw, AUDIO_ENCODING_ULAW, 8}, + {AudioEslinear_be, AUDIO_ENCODING_SLINEAR_BE, 16}, + {AudioEslinear_le, AUDIO_ENCODING_SLINEAR_LE, 16}, +}; + +int aica_match(struct device *, struct cfdata *, void *); +void aica_attach(struct device *, struct device *, void *); +int aica_print(void *, const char *); + +CFATTACH_DECL(aica, sizeof(struct aica_softc), aica_match, aica_attach, + NULL, NULL); + +struct audio_device aica_device = { + "Dreamcast Sound", + "", + "aica" +}; + +__inline static void aica_g2fifo_wait(void); +void aica_enable(struct aica_softc *); +void aica_disable(struct aica_softc *); +void aica_memwrite(struct aica_softc *, bus_size_t, u_int32_t *, int); +void aica_ch2p16write(struct aica_softc *, bus_size_t, u_int16_t *, int); +void aica_ch2p8write(struct aica_softc *, bus_size_t, u_int8_t *, int); +void aica_command(struct aica_softc *, u_int32_t); +void aica_sendparam(struct aica_softc *, u_int32_t, int, int); +void aica_play(struct aica_softc *, int, int, int, int); +void aica_fillbuffer(struct aica_softc *); + +/* intr */ +int aica_intr(void *); + +/* for audio */ +int aica_open(void *, int); +void aica_close(void *); +int aica_query_encoding(void *, struct audio_encoding *); +int aica_set_params(void *, int, int, struct audio_params *, + struct audio_params *); +int aica_round_blocksize(void *, int); +size_t aica_round_buffersize(void *, int, size_t); +int aica_trigger_output(void *, void *, void *, int, void (*)(void *), void *, + struct audio_params *); +int aica_trigger_input(void *, void *, void *, int, void (*)(void *), void *, + struct audio_params *); +int aica_halt_output(void *); +int aica_halt_input(void *); +int aica_getdev(void *, struct audio_device *); +int aica_set_port(void *, mixer_ctrl_t *); +int aica_get_port(void *, mixer_ctrl_t *); +int aica_query_devinfo(void *, mixer_devinfo_t *); +void aica_encode(int, int, int, int, u_char *, u_short **); +int aica_get_props(void *); + +struct audio_hw_if aica_hw_if = { + aica_open, + aica_close, + NULL, /* aica_drain */ + aica_query_encoding, + aica_set_params, + aica_round_blocksize, + NULL, /* aica_commit_setting */ + NULL, /* aica_init_output */ + NULL, /* aica_init_input */ + NULL, /* aica_start_output */ + NULL, /* aica_start_input */ + aica_halt_output, + aica_halt_input, + NULL, /* aica_speaker_ctl */ + aica_getdev, + NULL, /* aica_setfd */ + aica_set_port, + aica_get_port, + aica_query_devinfo, + NULL, /* aica_allocm */ + NULL, /* aica_freem */ + + aica_round_buffersize, /* aica_round_buffersize */ + + NULL, /* aica_mappage */ + aica_get_props, + aica_trigger_output, + aica_trigger_input, + NULL, /* aica_dev_ioctl */ +}; + +int +aica_match(struct device *parent, struct cfdata *cf, void *aux) +{ + static int aica_matched = 0; + + if (aica_matched) + return 0; + + aica_matched = 1; + return 1; +} + +void +aica_attach(struct device *parent, struct device *self, void *aux) +{ + struct aica_softc *sc = (struct aica_softc *)self; + struct g2bus_attach_args *ga = aux; + int i; + + sc->sc_memt = ga->ga_memt; + + if (bus_space_map(sc->sc_memt, AICA_REG_ADDR, 0x3000, 0, + &sc->sc_aica_regh) != 0) { + printf(": can't map AICA register space\n"); + return; + } + + if (bus_space_map(sc->sc_memt, AICA_RAM_START, AICA_RAM_SIZE, 0, + &sc->sc_aica_memh) != 0) { + printf(": can't map AICA memory space\n"); + return; + } + + printf(": ARM7 Sound Processing Unit\n"); + + aica_disable(sc); + + for (i = 0; i < AICA_NCHAN; i++) + bus_space_write_4(sc->sc_memt,sc->sc_aica_regh, i << 7, + ((bus_space_read_4(sc->sc_memt, sc->sc_aica_regh, i << 7) + & ~0x4000) | 0x8000)); + + /* load microcode, and clear memory */ + bus_space_set_region_4(sc->sc_memt, sc->sc_aica_memh, + 0, 0, AICA_RAM_SIZE); + + aica_memwrite(sc, 0, aica_armcode, sizeof(aica_armcode)); + + aica_enable(sc); + + printf("%s: interrupting at %s\n", sc->sc_dev.dv_xname, + sysasic_intr_string(IPL_BIO)); + sysasic_intr_establish(SYSASIC_EVENT_AICA, IPL_BIO, aica_intr, sc); + + audio_attach_mi(&aica_hw_if, sc, &sc->sc_dev); + + /* init parameters */ + sc->sc_output_master = 255; + sc->sc_output_gain[AICA_VOLUME_LEFT] = 255; + sc->sc_output_gain[AICA_VOLUME_RIGHT] = 255; +} + +void +aica_enable(struct aica_softc *sc) +{ + + bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x28a8, 24); + bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00, + bus_space_read_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00) & ~1); +} + +void +aica_disable(struct aica_softc *sc) +{ + + bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00, + bus_space_read_4(sc->sc_memt, sc->sc_aica_regh, 0x2c00) | 1); +} + +inline static void +aica_g2fifo_wait() +{ + int i; + + i = AICA_TIMEOUT; + while (--i > 0) + if ((*(volatile u_int32_t *)0xa05f688c) & 0x11) + break; +} + +void +aica_memwrite(struct aica_softc *sc, bus_size_t offset, u_int32_t *src, int len) +{ + int n; + + KASSERT((offset & 3) == 0); + n = (len + 3) / 4; /* u_int32_t * n (aligned) */ + + aica_g2fifo_wait(); + bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, + offset, src, n); +} + +void +aica_ch2p16write(struct aica_softc *sc, bus_size_t offset, u_int16_t *src, + int len) +{ + union { + u_int32_t w[8]; + u_int16_t s[16]; + } buf; + u_int16_t *p; + int i; + + KASSERT((offset & 3) == 0); + + while (len >= 32) { + p = buf.s; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + + aica_g2fifo_wait(); + bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, + offset, buf.w , 32 / 4); + + offset += sizeof(u_int16_t) * 16; + len -= 32; + } + + if (len / 2 > 0) { + p = buf.s; + for (i = 0; i < len / 2; i++) { + *p++ = *src++; src++; + } + + aica_g2fifo_wait(); + bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, + offset, buf.w, len / 4); + } +} + +void +aica_ch2p8write(struct aica_softc *sc, bus_size_t offset, u_int8_t *src, + int len) +{ + u_int32_t buf[8]; + u_int8_t *p; + int i; + + KASSERT((offset & 3) == 0); + while (len >= 32) { + p = (u_int8_t *)buf; + + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + *p++ = *src++; src++; + + aica_g2fifo_wait(); + bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, + offset, buf, 32 / 4); + + offset += 32; + len -= 32; + } + + if (len) { + p = (u_int8_t *)buf; + for (i = 0; i < len; i++) + *p++ = *src++; src++; + + aica_g2fifo_wait(); + bus_space_write_region_4(sc->sc_memt, sc->sc_aica_memh, + offset, buf, len / 4); + } +} + +int +aica_open(void *addr, int flags) +{ + struct aica_softc *sc = addr; + + if (sc->sc_open) + return EBUSY; + + sc->sc_intr = NULL; + sc->sc_open = 1; + + return 0; +} + +void +aica_close(void *addr) +{ + struct aica_softc *sc = addr; + + sc->sc_open = 0; + sc->sc_intr = NULL; +} + +int +aica_query_encoding(void *addr, struct audio_encoding *fp) +{ + if (fp->index >= sizeof(aica_encodings) / sizeof(aica_encodings[0])) + return EINVAL; + + strcpy(fp->name, aica_encodings[fp->index].name); + fp->encoding = aica_encodings[fp->index].encoding; + fp->precision = aica_encodings[fp->index].precision; + fp->flags = 0; + + return 0; +} + +int +aica_set_params(void *addr, int setmode, int usemode, + struct audio_params *play, struct audio_params *rec) +{ + struct aica_softc *sc = addr; + + if ((play->channels != 1) && + (play->channels != 2)) + return EINVAL; + + if ((play->precision != 4) && + (play->precision != 8) && + (play->precision != 16)) + return EINVAL; + + play->factor = 1; + play->factor_denom = 1; + + play->hw_precision = play->precision; + play->hw_channels = play->channels; + play->hw_sample_rate = play->sample_rate; + play->hw_encoding = AUDIO_ENCODING_SLINEAR_LE; + + play->sw_code = NULL; + + sc->sc_precision = play->hw_precision; + sc->sc_channels = play->hw_channels; + sc->sc_rate = play->hw_sample_rate; + sc->sc_encodings = play->hw_encoding; + +#if 1 + /* XXX: limit check */ + if ((play->precision == 4) && + (play->channels == 1) && + (play->sample_rate >= 65536)) + return EINVAL; + + if ((play->precision == 8) && + (play->channels == 1) && + (play->sample_rate >= 65536)) + return EINVAL; +#endif + + switch (play->encoding) { + case AUDIO_ENCODING_ADPCM: + if (play->precision != 4) + return EINVAL; + if (play->channels != 1) + return EINVAL; + + play->hw_encoding = AUDIO_ENCODING_ADPCM; + play->hw_precision = 8; /* 4? XXX */ + sc->sc_precision = 4; + break; + + case AUDIO_ENCODING_SLINEAR: + break; + case AUDIO_ENCODING_ULINEAR: + play->sw_code = change_sign8; + break; + + case AUDIO_ENCODING_SLINEAR_BE: + if (play->precision == 16) + play->sw_code = swap_bytes; + break; + case AUDIO_ENCODING_SLINEAR_LE: + break; + case AUDIO_ENCODING_ULINEAR_BE: + if (play->precision == 16) + play->sw_code = swap_bytes_change_sign16_le; + break; + case AUDIO_ENCODING_ULINEAR_LE: + if (play->precision == 16) + play->sw_code = change_sign16_le; + break; + + case AUDIO_ENCODING_ULAW: + play->sw_code = mulaw_to_slinear16_le; + play->hw_precision = 16; + sc->sc_precision = play->hw_precision; + break; + case AUDIO_ENCODING_ALAW: + play->sw_code = alaw_to_slinear16_le; + play->hw_precision = 16; + sc->sc_precision = play->hw_precision; + break; + + default: + return EINVAL; + } + + return 0; +} + +int +aica_round_blocksize(void *addr, int blk) +{ + struct aica_softc *sc = addr; + + switch (sc->sc_precision) { + case 4: + if (sc->sc_channels == 1) + return AICA_DMABUF_SIZE / 4; + else + return AICA_DMABUF_SIZE / 2; + break; + case 8: + if (sc->sc_channels == 1) + return AICA_DMABUF_SIZE / 2; + else + return AICA_DMABUF_SIZE; + break; + case 16: + if (sc->sc_channels == 1) + return AICA_DMABUF_SIZE; + else + return AICA_DMABUF_SIZE * 2; + break; + default: + break; + } + + return AICA_DMABUF_SIZE / 4; +} + +size_t +aica_round_buffersize(void *addr, int dir, size_t bufsize) +{ + + if (dir == AUMODE_PLAY) + return 65536; + + return 512; /* XXX: AUMINBUF */ +} + +void +aica_command(struct aica_softc *sc, u_int32_t command) +{ + + bus_space_write_4(sc->sc_memt, sc->sc_aica_memh, + AICA_ARM_CMD_COMMAND, command); + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, AICA_ARM_CMD_SERIAL, + bus_space_read_4(sc->sc_memt, sc->sc_aica_memh, + AICA_ARM_CMD_SERIAL) + 1); +} + +void +aica_sendparam(struct aica_softc *sc, u_int32_t command, + int32_t lparam, int32_t rparam) +{ + + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, + AICA_ARM_CMD_LPARAM, lparam); + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, + AICA_ARM_CMD_RPARAM, rparam); + + aica_command(sc, command); +} + +void +aica_play(struct aica_softc *sc, int blksize, int channel, int rate, int prec) +{ + + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, + AICA_ARM_CMD_BLOCKSIZE, blksize); + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, + AICA_ARM_CMD_CHANNEL, channel); + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, + AICA_ARM_CMD_RATE, rate); + bus_space_write_4(sc->sc_memt,sc->sc_aica_memh, + AICA_ARM_CMD_PRECISION, prec); + + aica_command(sc, AICA_COMMAND_PLAY); +} + +void +aica_fillbuffer(struct aica_softc *sc) +{ + + if (sc->sc_channels == 2) { + if (sc->sc_precision == 16) { + aica_ch2p16write(sc, + AICA_DMABUF_LEFT + sc->sc_nextfill, + (u_int16_t *)sc->sc_buffer + 0, sc->sc_blksize / 2); + aica_ch2p16write(sc, + AICA_DMABUF_RIGHT + sc->sc_nextfill, + (u_int16_t *)sc->sc_buffer + 1, sc->sc_blksize / 2); + } else if (sc->sc_precision == 8) { + aica_ch2p8write(sc, AICA_DMABUF_LEFT + sc->sc_nextfill, + (u_int8_t *)sc->sc_buffer + 0, sc->sc_blksize / 2); + aica_ch2p8write(sc, AICA_DMABUF_RIGHT + sc->sc_nextfill, + (u_int8_t *)sc->sc_buffer + 1, sc->sc_blksize / 2); + } + } else { + aica_memwrite(sc, AICA_DMABUF_MONO + sc->sc_nextfill, + sc->sc_buffer, sc->sc_blksize); + } + + (int8_t *)sc->sc_buffer += sc->sc_blksize; + if (sc->sc_buffer >= sc->sc_buffer_end) + sc->sc_buffer = sc->sc_buffer_start; + + sc->sc_nextfill ^= sc->sc_blksize / sc->sc_channels; +} + +int +aica_intr(void *arg) +{ + struct aica_softc *sc = arg; + + aica_fillbuffer(sc); + + /* call audio interrupt handler (audio_pint()) */ + if (sc->sc_open && sc->sc_intr != NULL) { + (*(sc->sc_intr))(sc->sc_intr_arg); + } + + /* clear SPU interrupt */ + bus_space_write_4(sc->sc_memt, sc->sc_aica_regh, 0x28bc, 0x20); + return 1; +} + +int +aica_trigger_output(void *addr, void *start, void *end, int blksize, + void (*intr)(void *), void *arg, struct audio_params *param) +{ + struct aica_softc *sc = addr; + + aica_command(sc, AICA_COMMAND_INIT); + tsleep(aica_trigger_output, PWAIT, "aicawait", hz / 20); + + sc->sc_buffer_start = sc->sc_buffer = start; + sc->sc_buffer_end = end; + sc->sc_blksize = blksize; + sc->sc_nextfill = 0; + + sc->sc_intr = intr; + sc->sc_intr_arg = arg; + + /* fill buffers in advance */ + aica_intr(sc); + aica_intr(sc); + + /* ...and start playing */ + aica_play(sc, blksize / sc->sc_channels, sc->sc_channels, sc->sc_rate, + sc->sc_precision); + + return 0; +} + +int +aica_trigger_input(void *addr, void *start, void *end, int blksize, + void (*intr)(void *), void *arg, struct audio_params *param) +{ + + return ENODEV; +} + +int +aica_halt_output(void *addr) +{ + struct aica_softc *sc = addr; + + aica_command(sc, AICA_COMMAND_STOP); + + return 0; +} + +int +aica_halt_input(void *addr) +{ + + return ENODEV; +} + +int +aica_getdev(void *addr, struct audio_device *ret) +{ + + *ret = aica_device; + return 0; +} + +int +aica_set_port(void *addr, mixer_ctrl_t *mc) +{ + struct aica_softc *sc = addr; + + switch (mc->dev) { + case AICA_MASTER_VOL: + sc->sc_output_master = + mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] & 0xff; + aica_sendparam(sc, AICA_COMMAND_MVOL, + sc->sc_output_master, sc->sc_output_master); + break; + case AICA_OUTPUT_GAIN: + sc->sc_output_gain[AICA_VOLUME_LEFT] = + mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] & 0xff; + sc->sc_output_gain[AICA_VOLUME_RIGHT] = + mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] & 0xff; + aica_sendparam(sc, AICA_COMMAND_VOL, + sc->sc_output_gain[AICA_VOLUME_LEFT], + sc->sc_output_gain[AICA_VOLUME_RIGHT]); + break; + default: + return EINVAL; + } + + return 0; +} + +int +aica_get_port(void *addr, mixer_ctrl_t *mc) +{ + struct aica_softc *sc = addr; + + switch (mc->dev) { + case AICA_MASTER_VOL: + if (mc->un.value.num_channels != 1) + return EINVAL; + mc->un.value.level[AUDIO_MIXER_LEVEL_MONO] = + L16TO256(L256TO16(sc->sc_output_master)); + break; + case AICA_OUTPUT_GAIN: + mc->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = + sc->sc_output_gain[AICA_VOLUME_LEFT]; + mc->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = + sc->sc_output_gain[AICA_VOLUME_RIGHT]; + break; + default: + return EINVAL; + } + return 0; +} + +int +aica_query_devinfo(void *addr, mixer_devinfo_t *md) +{ + + switch (md->index) { + case AICA_MASTER_VOL: + md->type = AUDIO_MIXER_VALUE; + md->mixer_class = AICA_OUTPUT_CLASS; + md->prev = md->next = AUDIO_MIXER_LAST; + strcpy(md->label.name, AudioNmaster); + md->un.v.num_channels = 1; + strcpy(md->un.v.units.name, AudioNvolume); + return 0; + case AICA_OUTPUT_GAIN: + md->type = AUDIO_MIXER_VALUE; + md->mixer_class = AICA_OUTPUT_CLASS; + md->prev = md->next = AUDIO_MIXER_LAST; + strcpy(md->label.name, AudioNoutput); + md->un.v.num_channels = 2; + strcpy(md->label.name, AudioNvolume); + return 0; + case AICA_OUTPUT_CLASS: + md->type = AUDIO_MIXER_CLASS; + md->mixer_class = AICA_OUTPUT_CLASS; + md->next = md->prev = AUDIO_MIXER_LAST; + strcpy(md->label.name, AudioCoutputs); + return 0; + } + + return ENXIO; +} + +int +aica_get_props(void *addr) +{ + + return 0; +} --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/g2/aicavar.h 2003-08-24 00:02:07.000000000 +0900 @@ -0,0 +1,94 @@ +/* $NetBSD$ */ + +/* + * Copyright (c) 2003 SHIMIZU Ryo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _AICAVAR_H_ +#define _AICAVAR_H_ + +typedef struct { + u_int32_t serial; + u_int32_t command; + u_int32_t blocksize; + u_int32_t channel; + u_int32_t rate; + u_int32_t precision; + u_int32_t l_param; /* volume,etc... for left */ + u_int32_t r_param; /* volume,etc... for right */ +} aica_cmd_t; + +#define AICA_COMMAND_NOP 0 +#define AICA_COMMAND_PLAY 1 +#define AICA_COMMAND_STOP 2 +#define AICA_COMMAND_INIT 3 +#define AICA_COMMAND_MVOL 4 +#define AICA_COMMAND_VOL 5 + +#define AICA_ARM_CODE 0x00000000 /* text+data+bss+stack + 0x00000000-0x0000ff00 */ +#define AICA_ARM_CMD 0x0000ff00 /* SH4<->ARM work for + communication */ +#define AICA_ARM_CMDADDR(x) (AICA_ARM_CMD + offsetof(aica_cmd_t, x)) +#define AICA_ARM_CMD_SERIAL AICA_ARM_CMDADDR(serial) +#define AICA_ARM_CMD_COMMAND AICA_ARM_CMDADDR(command) +#define AICA_ARM_CMD_BLOCKSIZE AICA_ARM_CMDADDR(blocksize) +#define AICA_ARM_CMD_CHANNEL AICA_ARM_CMDADDR(channel) +#define AICA_ARM_CMD_RATE AICA_ARM_CMDADDR(rate) +#define AICA_ARM_CMD_PRECISION AICA_ARM_CMDADDR(precision) +#define AICA_ARM_CMD_LPARAM AICA_ARM_CMDADDR(l_param) +#define AICA_ARM_CMD_RPARAM AICA_ARM_CMDADDR(r_param) + +#define AICA_ARM_END 0x00010000 + +#define AICA_DMABUF_START 0x00010000 +#define AICA_DMABUF_LEFT 0x00010000 /* DMA buffer for PLAY + 0x00010000-0x0001FFFF */ +#define AICA_DMABUF_RIGHT 0x00020000 /* DMA buffer for PLAY + 0x00020000-0x0002FFFF */ +#define AICA_DMABUF_MONO AICA_DMABUF_LEFT +#define AICA_DMABUF_END 0x00030000 + +#define AICA_DMABUF_SIZE 0x0000ffc0 + +#define AICA_MEMORY_END 0x00200000 + + +#define L256TO16(l) (((l) >> 4) & 0x0f) +#define L16TO256(l) ((((l) << 4) & 0xf0) + ((l) & 0x0f)) + + +enum MIXER_CLASS { + AICA_MASTER_VOL = 0, + AICA_OUTPUT_GAIN, + AICA_OUTPUT_CLASS, + + AICA_NDEVS +}; + +#endif /* _AICAVAR_H_ */ + --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/microcode/Makefile 2003-08-23 14:47:01.000000000 +0900 @@ -0,0 +1,34 @@ +# $NetBSD$ + +S = ${.CURDIR}/../../../.. + +CC = ${TOOLDIR}/bin/arm--netbsdelf-gcc +OBJCOPY = ${TOOLDIR}/bin/arm--netbsdelf-objcopy + +CFLAGS = -W -Wall -mlittle-endian +CFLAGS += -O3 -mcpu=arm7tdmi +CFLAGS += -fomit-frame-pointer -funroll-loops -finline-functions +CFLAGS += -I${S} +#AFLAGS = -mcpu=arm7tdmi -mthumb -mthumb-interwork -mapcs-32 + +all: aica_armcode.h + +aica_armcode.h: aica_armcode.elf + ${OBJCOPY} -O binary aica_armcode.elf aica_armcode.bin + echo '/* $$NetBSD$$ */' > ${.TARGET}.tmp + echo 'static u_int32_t aica_armcode[] = {' >> ${.TARGET}.tmp + hexdump -v -e '" /* %04.4_ax */\t" 1/4 "0x%08x, " "\n"' \ + aica_armcode.bin >> ${.TARGET}.tmp + echo ' 0 };' >> ${.TARGET}.tmp + mv ${.TARGET}.tmp ${.TARGET} + +aica_armcode.elf: aica_arm_locore.o aica_arm.o + ${CC} ${CFLAGS} -Wl,-Ttext,0 -Wl,-T ldscript -nostdlib -e 0 \ + -o aica_armcode.elf aica_arm_locore.o aica_arm.o + +clean: clean-tmp +# rm -f aica_armcode.h + +clean-tmp: + rm -f *.o aica_armcode.elf aica_armcode.bin aica_armcode.h.tmp + --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/microcode/aica_arm.c 2003-08-23 14:47:01.000000000 +0900 @@ -0,0 +1,422 @@ +/* $NetBSD$ */ + +/* + * Copyright (c) 2003 SHIMIZU Ryo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +typedef unsigned char u_int8_t; +typedef unsigned short u_int16_t; +typedef unsigned long u_int32_t; + +#include + +#define DC_REG_ADDR 0x00800000 + +#define REG_READ_1(off) \ + (*(volatile u_int8_t *)(DC_REG_ADDR + (off))) +#define REG_READ_2(off) \ + (*(volatile u_int16_t *)(DC_REG_ADDR + (off))) +#define REG_READ_4(off) \ + (*(volatile u_int32_t *)(DC_REG_ADDR + (off))) +#define REG_WRITE_1(off,val) \ + ((*(volatile u_int8_t *)(DC_REG_ADDR + (off))) = (val)) +#define REG_WRITE_2(off,val) \ + ((*(volatile u_int16_t *)(DC_REG_ADDR + (off))) = (val)) +#define REG_WRITE_4(off,val) \ + ((*(volatile u_int32_t *)((DC_REG_ADDR)+(off))) = (val)) + +#define CH_READ_1(ch,off) REG_READ_1(((ch) << 7) + (off)) +#define CH_READ_2(ch,off) REG_READ_2(((ch) << 7) + (off)) +#define CH_READ_4(ch,off) REG_READ_4(((ch) << 7) + (off)) +#define CH_WRITE_1(ch,off,val) REG_WRITE_1(((ch) << 7) + (off), val) +#define CH_WRITE_2(ch,off,val) REG_WRITE_2(((ch) << 7) + (off), val) +#define CH_WRITE_4(ch,off,val) REG_WRITE_4(((ch) << 7) + (off), val) + +void aica_init(void); +__inline int in_first_half(unsigned int); +__inline int in_second_half(unsigned int); +void bzero_4(void *, unsigned int); +void bzero(void *, unsigned int); +u_int32_t rate2reg(unsigned int); +#ifdef DEBUG +void debugbeep(int); +#endif +void aica_stop(void); +void aica_main(void); + +void +aica_init() +{ + int ch, off; + + /* Initialize AICA channels */ + REG_WRITE_4(0x2800, 0x0000); /* Master volume: Min */ + + for (ch = 0; ch < 64; ch++) { + CH_WRITE_4(ch, 0x00, 0x8000); /* Key off */ + CH_WRITE_4(ch, 0x04, 0x0000); /* DataAddress (low) */ + CH_WRITE_4(ch, 0x08, 0x0000); /* LoopStartPosition */ + CH_WRITE_4(ch, 0x0c, 0x0000); /* LoopEndPosition */ + CH_WRITE_4(ch, 0x10, 0x001f); /* AR = 0x1f = 0 msec */ + CH_WRITE_4(ch, 0x14, 0x001f); /* RR = 0x1f = 0 msec */ + CH_WRITE_4(ch, 0x18, 0x0000); /* Pitch */ + CH_WRITE_4(ch, 0x1c, 0x0000); /* LFO Control */ + CH_WRITE_4(ch, 0x20, 0x0000); /* DSP Channel to send */ + CH_WRITE_4(ch, 0x24, 0x0000); /* Pan & Volume */ + CH_WRITE_4(ch, 0x28, 0x0024); /* Volume & LowPassFilter */ + CH_WRITE_4(ch, 0x2c, 0x0000); /* LowPassFilter for Attack */ + CH_WRITE_4(ch, 0x30, 0x0000); /* LowPassFilter for Decay */ + CH_WRITE_4(ch, 0x34, 0x0000); /* LowPassFilter for Sustain */ + CH_WRITE_4(ch, 0x38, 0x0000); /* LowPassFilter for Keyoff */ + CH_WRITE_4(ch, 0x3c, 0x0000); /* LowPassFilter for Release */ + CH_WRITE_4(ch, 0x40, 0x0000); /* LowPassFilter transition + for Attack, Decay */ + CH_WRITE_4(ch, 0x44, 0x0000); /* LowPassFilter transition + for Decay, Release */ + + for (off = 0x48; off < 0x80; off+=4) { + CH_WRITE_4(ch, off, 0x0000); /* other = 0 */ + } + } + + REG_WRITE_4(0x2800, 0x000f); /* Master volume: Max */ +} + + +__inline int +in_first_half(unsigned int loophalf) +{ + + REG_WRITE_1(0x280d, 0); /* select channel 0 */ + return REG_READ_4(0x2814) < loophalf; +} + +__inline int +in_second_half(unsigned int loophalf) +{ + + REG_WRITE_1(0x280d, 0); /* select channel 0 */ + return REG_READ_4(0x2814) >= loophalf; +} + + +void +bzero_4(void *b, unsigned int len) +{ + u_int32_t *p; + + p = b; + len = (len + 3) & ~3; + for (; len != 0; len -= 4) + *p++ = 0; +} + +void +bzero(void *b,unsigned int len) +{ + u_int8_t *p; + + p = b; + for (; len != 0; len--) + *p++ = 0; +} + + +u_int32_t +rate2reg(unsigned int rate) +{ + u_int32_t base, fns; + int oct; + + base = 44100 << 7; + for (oct = 7; oct >= -8 && rate < base; oct--) + base >>= 1; + + if (rate < base) + return (oct << 11) & 0xf800; + + rate -= base; + +#if 0 + /* (base / 2) : round off */ + fns = (rate * 1024 + (base / 2)) / base; +#else + /* avoid using udivsi3() */ + { + u_int32_t tmp = (rate * 1024 + (base / 2)); + for (fns = 0; tmp >= base; tmp -= base, fns++) + ; + } +#endif + + /* adjustment */ + if (fns == 1024) { + oct++; + fns = 0; + } else { + if ((rate > base * fns / 1024) && + (fns < 1023) && + (rate == base * (fns + 1) / 1024)) { + fns++; + } else if ((rate < base * fns / 1024) && + (fns > 0) && + (rate == base * (fns - 1)/ 1024)) { + fns--; + } + } + + return ((oct << 11) & 0xf800) + fns; +} + + + +#ifdef DEBUG +#include "debug_sound1.h" +#include "debug_sound2.h" +void +debugbeep(int no) +{ + unsigned char *pcmdata; + unsigned int pcmlen; + + if (no) { + pcmdata = (unsigned char *)debug_sound1; + pcmlen = sizeof(debug_sound1); + } else { + pcmdata = (unsigned char *)debug_sound2; + pcmlen = sizeof(debug_sound2); + } + + CH_WRITE_4(2, 0x00, 0x8000); /* Key off */ + + /* setup left */ + CH_WRITE_4(2, 0x08, 0); /* loop start */ + CH_WRITE_4(2, 0x0c, pcmlen / 2); /* loop end */ + CH_WRITE_4(2, 0x18, rate2reg(44100)); /* SamplingRate */ + CH_WRITE_1(2, 0x24, 0x1f); /* left pan */ + CH_WRITE_1(2, 0x25, 0x0f); /* volume MAX */ + CH_WRITE_1(2, 0x28, 0x24); /* LPF=off */ + CH_WRITE_1(2, 0x29, 0x00); /* volume MAX */ + CH_WRITE_4(2, 0x10, 0x1f); /* AR=0ms */ + CH_WRITE_4(2, 0x14, 0x1f); /* RR=0ms */ + CH_WRITE_1(2, 0x24, 0); /* middle balance */ + + CH_WRITE_4(2, 0x04, (u_int32_t)pcmdata & 0xffff); + CH_WRITE_4(2, 0x00, 0xc000 /*PLAY*/ | ((unsigned int)pcmdata >> 16)); +} +#endif + +void +aica_stop() +{ + + CH_WRITE_4(0, 0x00, 0x8000); + CH_WRITE_4(1, 0x00, 0x8000); + bzero_4((void *)AICA_DMABUF_LEFT, AICA_DMABUF_SIZE); + bzero_4((void *)AICA_DMABUF_RIGHT, AICA_DMABUF_SIZE); +} + +void +aica_main() +{ + volatile aica_cmd_t *aicacmd = (volatile aica_cmd_t *)AICA_ARM_CMD; + int play_state; + unsigned int loopend = 0,loophalf = 0; + unsigned int blksize = 0, ratepitch; + u_int32_t cmd, serial; + + aica_init(); + + REG_WRITE_4(0x28b4, 0x0020); /* INT Enable to SH4 */ + + bzero_4((void *)AICA_DMABUF_LEFT, AICA_DMABUF_SIZE); + bzero_4((void *)AICA_DMABUF_RIGHT, AICA_DMABUF_SIZE); + + play_state = 0; + serial = aicacmd->serial = 0; + + for (;;) { + if (serial != aicacmd->serial) { + serial = aicacmd->serial; + cmd = aicacmd->command; + aicacmd->command = AICA_COMMAND_NOP; +#ifdef DEBUG + debugbeep(0); +#endif + } else { + cmd = AICA_COMMAND_NOP; + } + + switch (cmd) { + case AICA_COMMAND_NOP: + /* + * AICA_COMMAND_NOP - Idle process + */ + switch (play_state) { + case 0: /* not playing */ + break; + case 1: /* first half */ + if (in_second_half(loophalf)) { + /* Send INT to SH4 */ + REG_WRITE_4(0x28b8, 0x0020); + play_state = 2; + } + break; + case 2: /* second halt */ + if (in_first_half(loophalf)) { + /* Send INT to SH4 */ + REG_WRITE_4(0x28b8, 0x0020); + play_state = 1; + } + break; + case 3: + if (in_second_half(loophalf)) { + aica_stop(); + play_state = 0; + } + break; + case 4: + if (in_first_half(loophalf)) { + aica_stop(); + play_state = 0; + } + break; + } + break; + + case AICA_COMMAND_PLAY: + blksize = aicacmd->blocksize; + + CH_WRITE_4(0, 0x00, 0x8000); + CH_WRITE_4(1, 0x00, 0x8000); + + switch (aicacmd->precision) { + case 16: + loopend = blksize; + break; + case 8: + loopend = blksize * 2; + break; + case 4: + loopend = blksize * 4; + break; + } + loophalf = loopend / 2; + + ratepitch = rate2reg(aicacmd->rate); + + /* setup left */ + CH_WRITE_4(0, 0x08, 0); /* loop start */ + CH_WRITE_4(0, 0x0c, loopend); /* loop end */ + CH_WRITE_4(0, 0x18, ratepitch); /* SamplingRate */ + CH_WRITE_4(0, 0x24, 0x0f1f); /* volume MAX, + right PAN */ + + /* setup right */ + CH_WRITE_4(1, 0x08,0); /* loop start */ + CH_WRITE_4(1, 0x0c, loopend); /* loop end */ + CH_WRITE_4(1, 0x18, ratepitch); /* SamplingRate */ + CH_WRITE_4(1, 0x24, 0x0f0f); /* volume MAX, + right PAN */ + + { + u_int32_t mode, lparam, rparam; + + if (aicacmd->precision == 4) + mode = 3 << 7; /* 4bit ADPCM */ + else if (aicacmd->precision == 8) + mode = 1 << 7; /* 8bit */ + else + mode = 0; /* 16bit */ + + switch (aicacmd->channel) { + case 2: + CH_WRITE_4(0, 0x04, + AICA_DMABUF_LEFT & 0xffff); + CH_WRITE_4(1, 0x04, + AICA_DMABUF_RIGHT & 0xffff); + lparam = 0xc000 /*PLAY*/ | + 0x0200 /*LOOP*/ | mode | + (AICA_DMABUF_LEFT >> 16); + rparam = 0xc000 /*PLAY*/ | + 0x0200 /*LOOP*/ | mode | + (AICA_DMABUF_RIGHT >> 16); + CH_WRITE_4(0, 0x00, lparam); + CH_WRITE_4(1, 0x00, rparam); + break; + case 1: + CH_WRITE_1(0, 0x24, 0); /* middle + balance */ + CH_WRITE_4(0, 0x04, + AICA_DMABUF_LEFT & 0xffff); + CH_WRITE_4(0, 0x00, 0xc000 /*PLAY*/ | + 0x0200 /*LOOP*/ | mode | + (AICA_DMABUF_LEFT >> 16)); + break; + } + } + play_state = 1; + break; + + case AICA_COMMAND_STOP: + switch (play_state) { + case 1: + bzero_4((void *)(AICA_DMABUF_LEFT + blksize), + blksize); + bzero_4((void *)(AICA_DMABUF_RIGHT + blksize), + blksize); + play_state = 3; + break; + case 2: + bzero_4((void *)AICA_DMABUF_LEFT, blksize); + bzero_4((void *)AICA_DMABUF_RIGHT, blksize); + play_state = 4; + break; + default: + aica_stop(); + play_state = 0; + break; + } + break; + + case AICA_COMMAND_INIT: + aica_stop(); + play_state = 0; + break; + + case AICA_COMMAND_MVOL: + REG_WRITE_4(0x2800, L256TO16(aicacmd->l_param)); + break; + + case AICA_COMMAND_VOL: + CH_WRITE_1(0, 0x29, 0xff - (aicacmd->l_param & 0xff)); + CH_WRITE_1(1, 0x29, 0xff - (aicacmd->r_param & 0xff)); + break; + + } + } +} --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/microcode/aica_arm_locore.S 2003-08-23 14:47:01.000000000 +0900 @@ -0,0 +1,72 @@ +/* $NetBSD$ */ + +/* + * Copyright (c) 2003 SHIMIZU Ryo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + .text + .globl + + b exp_reset + b exp_undef + b exp_swi + b exp_pabort + b exp_dabort + b exp_reserved + b exp_irq +/* b exp_fiq */ +exp_fiq: + sub pc,r14,#4 + +exp_reset: + mov sp,#0xff00 /* setup stack */ + + mrs r0,CPSR /* disable interrupt */ + bic r0,r0,#0x80 + bic r0,r0,#0x40 + msr CPSR_all,r0 + + bl aica_main + +exp_reserved: + b exp_reserved + +exp_irq: + sub pc,r14,#4 + +exp_dabort: + sub pc,r14,#8 + +exp_pabort: + sub pc,r14,#4 + +exp_swi: + mov pc,r14 + +exp_undef: + mov pc,r14 + --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/microcode/aica_armcode.h 2003-08-23 14:47:01.000000000 +0900 @@ -0,0 +1,816 @@ +/* $NetBSD$ */ +static u_int32_t aica_armcode[] = { + /* 0000 */ 0xea000006, + /* 0004 */ 0xea000010, + /* 0008 */ 0xea00000e, + /* 000c */ 0xea00000c, + /* 0010 */ 0xea00000a, + /* 0014 */ 0xea000007, + /* 0018 */ 0xea000007, + /* 001c */ 0xe24ef004, + /* 0020 */ 0xe3a0dcff, + /* 0024 */ 0xe10f0000, + /* 0028 */ 0xe3c00080, + /* 002c */ 0xe3c00040, + /* 0030 */ 0xe129f000, + /* 0034 */ 0xeb0000ac, + /* 0038 */ 0xeafffffe, + /* 003c */ 0xe24ef004, + /* 0040 */ 0xe24ef008, + /* 0044 */ 0xe24ef004, + /* 0048 */ 0xe1a0f00e, + /* 004c */ 0xe1a0f00e, + /* 0050 */ 0xe92d40f0, + /* 0054 */ 0xe3a01502, + /* 0058 */ 0xe2812b0a, + /* 005c */ 0xe3a03000, + /* 0060 */ 0xe1a04003, + /* 0064 */ 0xe1a0e001, + /* 0068 */ 0xe3a06004, + /* 006c */ 0xe0866001, + /* 0070 */ 0xe1a0c004, + /* 0074 */ 0xe3a05010, + /* 0078 */ 0xe0855001, + /* 007c */ 0xe3a07024, + /* 0080 */ 0xe24dd004, + /* 0084 */ 0xe5823000, + /* 0088 */ 0xe1a00384, + /* 008c */ 0xe3a03902, + /* 0090 */ 0xe780300e, + /* 0094 */ 0xe780c006, + /* 0098 */ 0xe3a03008, + /* 009c */ 0xe2833502, + /* 00a0 */ 0xe780c003, + /* 00a4 */ 0xe3a0200c, + /* 00a8 */ 0xe2822502, + /* 00ac */ 0xe780c002, + /* 00b0 */ 0xe3a0101f, + /* 00b4 */ 0xe7801005, + /* 00b8 */ 0xe3a03014, + /* 00bc */ 0xe2833502, + /* 00c0 */ 0xe7801003, + /* 00c4 */ 0xe3a02018, + /* 00c8 */ 0xe2822502, + /* 00cc */ 0xe780c002, + /* 00d0 */ 0xe3a0301c, + /* 00d4 */ 0xe2833502, + /* 00d8 */ 0xe780c003, + /* 00dc */ 0xe3a02020, + /* 00e0 */ 0xe2822502, + /* 00e4 */ 0xe780c002, + /* 00e8 */ 0xe2871502, + /* 00ec */ 0xe780c001, + /* 00f0 */ 0xe3a03028, + /* 00f4 */ 0xe2833502, + /* 00f8 */ 0xe7807003, + /* 00fc */ 0xe3a0202c, + /* 0100 */ 0xe2822502, + /* 0104 */ 0xe780c002, + /* 0108 */ 0xe3a03030, + /* 010c */ 0xe2833502, + /* 0110 */ 0xe780c003, + /* 0114 */ 0xe3a02034, + /* 0118 */ 0xe2822502, + /* 011c */ 0xe780c002, + /* 0120 */ 0xe3a03038, + /* 0124 */ 0xe2833502, + /* 0128 */ 0xe780c003, + /* 012c */ 0xe3a0203c, + /* 0130 */ 0xe2822502, + /* 0134 */ 0xe780c002, + /* 0138 */ 0xe3a03040, + /* 013c */ 0xe2833502, + /* 0140 */ 0xe780c003, + /* 0144 */ 0xe3a02044, + /* 0148 */ 0xe2822502, + /* 014c */ 0xe780c002, + /* 0150 */ 0xe3803048, + /* 0154 */ 0xe783c00e, + /* 0158 */ 0xe380204c, + /* 015c */ 0xe782c00e, + /* 0160 */ 0xe3803050, + /* 0164 */ 0xe783c00e, + /* 0168 */ 0xe3802054, + /* 016c */ 0xe782c00e, + /* 0170 */ 0xe3803058, + /* 0174 */ 0xe783c00e, + /* 0178 */ 0xe380205c, + /* 017c */ 0xe782c00e, + /* 0180 */ 0xe3803060, + /* 0184 */ 0xe783c00e, + /* 0188 */ 0xe3802064, + /* 018c */ 0xe782c00e, + /* 0190 */ 0xe3803068, + /* 0194 */ 0xe783c00e, + /* 0198 */ 0xe380206c, + /* 019c */ 0xe782c00e, + /* 01a0 */ 0xe3803070, + /* 01a4 */ 0xe783c00e, + /* 01a8 */ 0xe3802074, + /* 01ac */ 0xe782c00e, + /* 01b0 */ 0xe3803078, + /* 01b4 */ 0xe783c00e, + /* 01b8 */ 0xe380007c, + /* 01bc */ 0xe780c00e, + /* 01c0 */ 0xe2844001, + /* 01c4 */ 0xe354003f, + /* 01c8 */ 0xdaffffae, + /* 01cc */ 0xe3a03502, + /* 01d0 */ 0xe2833b0a, + /* 01d4 */ 0xe3a0200f, + /* 01d8 */ 0xe5832000, + /* 01dc */ 0xe28dd004, + /* 01e0 */ 0xe8bd80f0, + /* 01e4 */ 0xe92d4010, + /* 01e8 */ 0xe3a0c856, + /* 01ec */ 0xe28ccc22, + /* 01f0 */ 0xe3a04007, + /* 01f4 */ 0xe150000c, + /* 01f8 */ 0x2a000009, + /* 01fc */ 0xe1a0c0ac, + /* 0200 */ 0xe2444001, + /* 0204 */ 0xe3740008, + /* 0208 */ 0xb3a03000, + /* 020c */ 0xa3a03001, + /* 0210 */ 0xe150000c, + /* 0214 */ 0x23a03000, + /* 0218 */ 0x32033001, + /* 021c */ 0xe3530000, + /* 0220 */ 0x1afffff5, + /* 0224 */ 0xe150000c, + /* 0228 */ 0x31a00584, + /* 022c */ 0x32000b3e, + /* 0230 */ 0x38bd8010, + /* 0234 */ 0xe06c0000, + /* 0238 */ 0xe1a030ac, + /* 023c */ 0xe0833500, + /* 0240 */ 0xe3a0e000, + /* 0244 */ 0xe153000c, + /* 0248 */ 0x3a000003, + /* 024c */ 0xe06c3003, + /* 0250 */ 0xe28ee001, + /* 0254 */ 0xe153000c, + /* 0258 */ 0x2afffffb, + /* 025c */ 0xe35e0b01, + /* 0260 */ 0x02844001, + /* 0264 */ 0x03a0e000, + /* 0268 */ 0x0a00001b, + /* 026c */ 0xe0010c9e, + /* 0270 */ 0xe3a02fff, + /* 0274 */ 0xe2822002, + /* 0278 */ 0xe1500521, + /* 027c */ 0x93a03000, + /* 0280 */ 0x83a03001, + /* 0284 */ 0xe15e0002, + /* 0288 */ 0x83a03000, + /* 028c */ 0x92033001, + /* 0290 */ 0xe3530000, + /* 0294 */ 0x0a000004, + /* 0298 */ 0xe28e2001, + /* 029c */ 0xe0030c92, + /* 02a0 */ 0xe1500523, + /* 02a4 */ 0x01a0e002, + /* 02a8 */ 0x0a00000b, + /* 02ac */ 0xe1500521, + /* 02b0 */ 0x23a03000, + /* 02b4 */ 0x33a03001, + /* 02b8 */ 0xe35e0000, + /* 02bc */ 0x03a03000, + /* 02c0 */ 0x12033001, + /* 02c4 */ 0xe3530000, + /* 02c8 */ 0x0a000003, + /* 02cc */ 0xe24e2001, + /* 02d0 */ 0xe0030c92, + /* 02d4 */ 0xe1500523, + /* 02d8 */ 0x01a0e002, + /* 02dc */ 0xe1a00584, + /* 02e0 */ 0xe2000b3e, + /* 02e4 */ 0xe080000e, + /* 02e8 */ 0xe8bd8010, + /* 02ec */ 0xe1a0c00d, + /* 02f0 */ 0xe92ddff0, + /* 02f4 */ 0xe24cb004, + /* 02f8 */ 0xe24dd00c, + /* 02fc */ 0xebffff53, + /* 0300 */ 0xe3a03da2, + /* 0304 */ 0xe2833034, + /* 0308 */ 0xe2833502, + /* 030c */ 0xe3a02020, + /* 0310 */ 0xe5832000, + /* 0314 */ 0xe3a0a000, + /* 0318 */ 0xe1a0800a, + /* 031c */ 0xe3a03801, + /* 0320 */ 0xe3a04cff, + /* 0324 */ 0xe38410c0, + /* 0328 */ 0xe1a02008, + /* 032c */ 0xe50ba02c, + /* 0330 */ 0xe5832000, + /* 0334 */ 0xe5832004, + /* 0338 */ 0xe5832008, + /* 033c */ 0xe583200c, + /* 0340 */ 0xe2833010, + /* 0344 */ 0xe2511010, + /* 0348 */ 0x1afffff8, + /* 034c */ 0xe3a02802, + /* 0350 */ 0xe3a03cff, + /* 0354 */ 0xe28330c0, + /* 0358 */ 0xe3a01000, + /* 035c */ 0xe5821000, + /* 0360 */ 0xe5821004, + /* 0364 */ 0xe5821008, + /* 0368 */ 0xe582100c, + /* 036c */ 0xe2822010, + /* 0370 */ 0xe2533010, + /* 0374 */ 0x1afffff8, + /* 0378 */ 0xe3a00000, + /* 037c */ 0xe5840000, + /* 0380 */ 0xe5942000, + /* 0384 */ 0xe1a05000, + /* 0388 */ 0xe3a07b0a, + /* 038c */ 0xe287700d, + /* 0390 */ 0xe2877502, + /* 0394 */ 0xe3a09502, + /* 0398 */ 0xe3a06902, + /* 039c */ 0xe50b2030, + /* 03a0 */ 0xe5943000, + /* 03a4 */ 0xe51b2030, + /* 03a8 */ 0xe1520003, + /* 03ac */ 0x0a000004, + /* 03b0 */ 0xe5943000, + /* 03b4 */ 0xe50b3030, + /* 03b8 */ 0xe5943004, + /* 03bc */ 0xe5845004, + /* 03c0 */ 0xea000000, + /* 03c4 */ 0xe3a03000, + /* 03c8 */ 0xe3530005, + /* 03cc */ 0x979ff103, + /* 03d0 */ 0xea0001cd, + /* 03d4 */ 0x000003ec, + /* 03d8 */ 0x00000624, + /* 03dc */ 0x00000780, + /* 03e0 */ 0x00000a18, + /* 03e4 */ 0x00000ac8, + /* 03e8 */ 0x00000ae4, + /* 03ec */ 0xe3500004, + /* 03f0 */ 0x979ff100, + /* 03f4 */ 0xea000089, + /* 03f8 */ 0x000003a0, + /* 03fc */ 0x0000040c, + /* 0400 */ 0x00000448, + /* 0404 */ 0x00000484, + /* 0408 */ 0x00000554, + /* 040c */ 0xe5c75000, + /* 0410 */ 0xe3a03b0a, + /* 0414 */ 0xe2833014, + /* 0418 */ 0xe2833502, + /* 041c */ 0xe5932000, + /* 0420 */ 0xe51b302c, + /* 0424 */ 0xe1520003, + /* 0428 */ 0x3affffdc, + /* 042c */ 0xe3a03da2, + /* 0430 */ 0xe2833038, + /* 0434 */ 0xe2833502, + /* 0438 */ 0xe3a02020, + /* 043c */ 0xe5832000, + /* 0440 */ 0xe3a00002, + /* 0444 */ 0xeaffffd5, + /* 0448 */ 0xe5c75000, + /* 044c */ 0xe3a03b0a, + /* 0450 */ 0xe2833014, + /* 0454 */ 0xe2833502, + /* 0458 */ 0xe5932000, + /* 045c */ 0xe51b302c, + /* 0460 */ 0xe1520003, + /* 0464 */ 0x2affffcd, + /* 0468 */ 0xe3a03da2, + /* 046c */ 0xe2833038, + /* 0470 */ 0xe2833502, + /* 0474 */ 0xe3a02020, + /* 0478 */ 0xe5832000, + /* 047c */ 0xe3a00001, + /* 0480 */ 0xeaffffc6, + /* 0484 */ 0xe5c75000, + /* 0488 */ 0xe3a03b0a, + /* 048c */ 0xe2833014, + /* 0490 */ 0xe2833502, + /* 0494 */ 0xe5932000, + /* 0498 */ 0xe51b302c, + /* 049c */ 0xe1520003, + /* 04a0 */ 0x3affffbe, + /* 04a4 */ 0xe5896000, + /* 04a8 */ 0xe3a03080, + /* 04ac */ 0xe2833502, + /* 04b0 */ 0xe5836000, + /* 04b4 */ 0xe3a00cff, + /* 04b8 */ 0xe28000c0, + /* 04bc */ 0xe3a03801, + /* 04c0 */ 0xe3a02000, + /* 04c4 */ 0xe5832000, + /* 04c8 */ 0xe5832004, + /* 04cc */ 0xe5832008, + /* 04d0 */ 0xe583200c, + /* 04d4 */ 0xe5832010, + /* 04d8 */ 0xe5832014, + /* 04dc */ 0xe5832018, + /* 04e0 */ 0xe583201c, + /* 04e4 */ 0xe5832020, + /* 04e8 */ 0xe5832024, + /* 04ec */ 0xe5832028, + /* 04f0 */ 0xe583202c, + /* 04f4 */ 0xe2833030, + /* 04f8 */ 0xe2500030, + /* 04fc */ 0x1afffff0, + /* 0500 */ 0xe3a01cff, + /* 0504 */ 0xe28110c0, + /* 0508 */ 0xe3a03802, + /* 050c */ 0xe1a02000, + /* 0510 */ 0xe5832000, + /* 0514 */ 0xe5832004, + /* 0518 */ 0xe5832008, + /* 051c */ 0xe583200c, + /* 0520 */ 0xe5832010, + /* 0524 */ 0xe5832014, + /* 0528 */ 0xe5832018, + /* 052c */ 0xe583201c, + /* 0530 */ 0xe5832020, + /* 0534 */ 0xe5832024, + /* 0538 */ 0xe5832028, + /* 053c */ 0xe583202c, + /* 0540 */ 0xe2833030, + /* 0544 */ 0xe2511030, + /* 0548 */ 0x1afffff0, + /* 054c */ 0xe1a00001, + /* 0550 */ 0xeaffff92, + /* 0554 */ 0xe5c75000, + /* 0558 */ 0xe3a03b0a, + /* 055c */ 0xe2833014, + /* 0560 */ 0xe2833502, + /* 0564 */ 0xe5932000, + /* 0568 */ 0xe51b302c, + /* 056c */ 0xe1520003, + /* 0570 */ 0x2affff8a, + /* 0574 */ 0xe5896000, + /* 0578 */ 0xe3a03080, + /* 057c */ 0xe2833502, + /* 0580 */ 0xe5836000, + /* 0584 */ 0xe3a00cff, + /* 0588 */ 0xe28000c0, + /* 058c */ 0xe3a03801, + /* 0590 */ 0xe3a02000, + /* 0594 */ 0xe5832000, + /* 0598 */ 0xe5832004, + /* 059c */ 0xe5832008, + /* 05a0 */ 0xe583200c, + /* 05a4 */ 0xe5832010, + /* 05a8 */ 0xe5832014, + /* 05ac */ 0xe5832018, + /* 05b0 */ 0xe583201c, + /* 05b4 */ 0xe5832020, + /* 05b8 */ 0xe5832024, + /* 05bc */ 0xe5832028, + /* 05c0 */ 0xe583202c, + /* 05c4 */ 0xe2833030, + /* 05c8 */ 0xe2500030, + /* 05cc */ 0x1afffff0, + /* 05d0 */ 0xe3a01cff, + /* 05d4 */ 0xe28110c0, + /* 05d8 */ 0xe3a03802, + /* 05dc */ 0xe1a02000, + /* 05e0 */ 0xe5832000, + /* 05e4 */ 0xe5832004, + /* 05e8 */ 0xe5832008, + /* 05ec */ 0xe583200c, + /* 05f0 */ 0xe5832010, + /* 05f4 */ 0xe5832014, + /* 05f8 */ 0xe5832018, + /* 05fc */ 0xe583201c, + /* 0600 */ 0xe5832020, + /* 0604 */ 0xe5832024, + /* 0608 */ 0xe5832028, + /* 060c */ 0xe583202c, + /* 0610 */ 0xe2833030, + /* 0614 */ 0xe2511030, + /* 0618 */ 0x1afffff0, + /* 061c */ 0xe1a00001, + /* 0620 */ 0xeaffff5e, + /* 0624 */ 0xe5948008, + /* 0628 */ 0xe5896000, + /* 062c */ 0xe3a03080, + /* 0630 */ 0xe2833502, + /* 0634 */ 0xe5836000, + /* 0638 */ 0xe5943014, + /* 063c */ 0xe3530008, + /* 0640 */ 0x0a000006, + /* 0644 */ 0x8a000002, + /* 0648 */ 0xe3530004, + /* 064c */ 0x0a000005, + /* 0650 */ 0xea000005, + /* 0654 */ 0xe3530010, + /* 0658 */ 0x01a0a008, + /* 065c */ 0xea000002, + /* 0660 */ 0xe1a0a088, + /* 0664 */ 0xea000000, + /* 0668 */ 0xe1a0a108, + /* 066c */ 0xe5940010, + /* 0670 */ 0xebfffedb, + /* 0674 */ 0xe3a03008, + /* 0678 */ 0xe2833502, + /* 067c */ 0xe5835000, + /* 0680 */ 0xe3a0200c, + /* 0684 */ 0xe2822502, + /* 0688 */ 0xe582a000, + /* 068c */ 0xe3a03018, + /* 0690 */ 0xe2833502, + /* 0694 */ 0xe5830000, + /* 0698 */ 0xe3a01024, + /* 069c */ 0xe2811502, + /* 06a0 */ 0xe3a03ef1, + /* 06a4 */ 0xe283300f, + /* 06a8 */ 0xe5813000, + /* 06ac */ 0xe3a02088, + /* 06b0 */ 0xe2822502, + /* 06b4 */ 0xe5825000, + /* 06b8 */ 0xe3a0308c, + /* 06bc */ 0xe2833502, + /* 06c0 */ 0xe583a000, + /* 06c4 */ 0xe3a02098, + /* 06c8 */ 0xe2822502, + /* 06cc */ 0xe5820000, + /* 06d0 */ 0xe3a010a4, + /* 06d4 */ 0xe2811502, + /* 06d8 */ 0xe3a03c0f, + /* 06dc */ 0xe283300f, + /* 06e0 */ 0xe5813000, + /* 06e4 */ 0xe5942014, + /* 06e8 */ 0xe1a030aa, + /* 06ec */ 0xe50b302c, + /* 06f0 */ 0xe3520004, + /* 06f4 */ 0x03a01d06, + /* 06f8 */ 0x0a000003, + /* 06fc */ 0xe5943014, + /* 0700 */ 0xe3530008, + /* 0704 */ 0x03a01080, + /* 0708 */ 0x13a01000, + /* 070c */ 0xe594300c, + /* 0710 */ 0xe3530001, + /* 0714 */ 0x0a00000f, + /* 0718 */ 0xe3530002, + /* 071c */ 0x1affff56, + /* 0720 */ 0xe3a03004, + /* 0724 */ 0xe2833502, + /* 0728 */ 0xe5835000, + /* 072c */ 0xe3a02084, + /* 0730 */ 0xe2822502, + /* 0734 */ 0xe5825000, + /* 0738 */ 0xe3813cc2, + /* 073c */ 0xe3833001, + /* 0740 */ 0xe5893000, + /* 0744 */ 0xe3812cc2, + /* 0748 */ 0xe3822002, + /* 074c */ 0xe3a03080, + /* 0750 */ 0xe2833502, + /* 0754 */ 0xeaffff47, + /* 0758 */ 0xe3a03024, + /* 075c */ 0xe2833502, + /* 0760 */ 0xe5c35000, + /* 0764 */ 0xe3a02004, + /* 0768 */ 0xe2822502, + /* 076c */ 0xe5825000, + /* 0770 */ 0xe3813cc2, + /* 0774 */ 0xe3833001, + /* 0778 */ 0xe5893000, + /* 077c */ 0xeaffff3e, + /* 0780 */ 0xe3500001, + /* 0784 */ 0x0a000002, + /* 0788 */ 0xe3500002, + /* 078c */ 0x0a00003b, + /* 0790 */ 0xea000074, + /* 0794 */ 0xe2881801, + /* 0798 */ 0xe2883003, + /* 079c */ 0xe3d32003, + /* 07a0 */ 0xe1a0c003, + /* 07a4 */ 0xe288e802, + /* 07a8 */ 0x0a000017, + /* 07ac */ 0xe3a00000, + /* 07b0 */ 0xe2623000, + /* 07b4 */ 0xe213300f, + /* 07b8 */ 0x0a00000c, + /* 07bc */ 0xe353000c, + /* 07c0 */ 0xaa000007, + /* 07c4 */ 0xe3530008, + /* 07c8 */ 0xaa000003, + /* 07cc */ 0xe3530003, + /* 07d0 */ 0xda000006, + /* 07d4 */ 0xe4810004, + /* 07d8 */ 0xe2422004, + /* 07dc */ 0xe4810004, + /* 07e0 */ 0xe2422004, + /* 07e4 */ 0xe4810004, + /* 07e8 */ 0xe2522004, + /* 07ec */ 0x0a000006, + /* 07f0 */ 0xe5810000, + /* 07f4 */ 0xe5810004, + /* 07f8 */ 0xe5810008, + /* 07fc */ 0xe581000c, + /* 0800 */ 0xe2811010, + /* 0804 */ 0xe2522010, + /* 0808 */ 0x1afffff8, + /* 080c */ 0xe1a0100e, + /* 0810 */ 0xe3dc2003, + /* 0814 */ 0x0a000017, + /* 0818 */ 0xe3a00000, + /* 081c */ 0xe2623000, + /* 0820 */ 0xe213300f, + /* 0824 */ 0x0a00000c, + /* 0828 */ 0xe353000c, + /* 082c */ 0xaa000007, + /* 0830 */ 0xe3530008, + /* 0834 */ 0xaa000003, + /* 0838 */ 0xe3530003, + /* 083c */ 0xda000006, + /* 0840 */ 0xe4810004, + /* 0844 */ 0xe2422004, + /* 0848 */ 0xe4810004, + /* 084c */ 0xe2422004, + /* 0850 */ 0xe4810004, + /* 0854 */ 0xe2522004, + /* 0858 */ 0x0a000006, + /* 085c */ 0xe5810000, + /* 0860 */ 0xe5810004, + /* 0864 */ 0xe5810008, + /* 0868 */ 0xe581000c, + /* 086c */ 0xe2811010, + /* 0870 */ 0xe2522010, + /* 0874 */ 0x1afffff8, + /* 0878 */ 0xe3a00003, + /* 087c */ 0xeafffec7, + /* 0880 */ 0xe3a01801, + /* 0884 */ 0xe2883003, + /* 0888 */ 0xe3d32003, + /* 088c */ 0x0a000017, + /* 0890 */ 0xe3a00000, + /* 0894 */ 0xe2623000, + /* 0898 */ 0xe213300f, + /* 089c */ 0x0a00000c, + /* 08a0 */ 0xe353000c, + /* 08a4 */ 0xaa000007, + /* 08a8 */ 0xe3530008, + /* 08ac */ 0xaa000003, + /* 08b0 */ 0xe3530003, + /* 08b4 */ 0xda000006, + /* 08b8 */ 0xe4810004, + /* 08bc */ 0xe2422004, + /* 08c0 */ 0xe4810004, + /* 08c4 */ 0xe2422004, + /* 08c8 */ 0xe4810004, + /* 08cc */ 0xe2522004, + /* 08d0 */ 0x0a000006, + /* 08d4 */ 0xe5810000, + /* 08d8 */ 0xe5810004, + /* 08dc */ 0xe5810008, + /* 08e0 */ 0xe581000c, + /* 08e4 */ 0xe2811010, + /* 08e8 */ 0xe2522010, + /* 08ec */ 0x1afffff8, + /* 08f0 */ 0xe3a01802, + /* 08f4 */ 0xe2883003, + /* 08f8 */ 0xe3d32003, + /* 08fc */ 0x0a000017, + /* 0900 */ 0xe3a00000, + /* 0904 */ 0xe2623000, + /* 0908 */ 0xe213300f, + /* 090c */ 0x0a00000c, + /* 0910 */ 0xe353000c, + /* 0914 */ 0xaa000007, + /* 0918 */ 0xe3530008, + /* 091c */ 0xaa000003, + /* 0920 */ 0xe3530003, + /* 0924 */ 0xda000006, + /* 0928 */ 0xe4810004, + /* 092c */ 0xe2422004, + /* 0930 */ 0xe4810004, + /* 0934 */ 0xe2422004, + /* 0938 */ 0xe4810004, + /* 093c */ 0xe2522004, + /* 0940 */ 0x0a000006, + /* 0944 */ 0xe5810000, + /* 0948 */ 0xe5810004, + /* 094c */ 0xe5810008, + /* 0950 */ 0xe581000c, + /* 0954 */ 0xe2811010, + /* 0958 */ 0xe2522010, + /* 095c */ 0x1afffff8, + /* 0960 */ 0xe3a00004, + /* 0964 */ 0xeafffe8d, + /* 0968 */ 0xe5896000, + /* 096c */ 0xe3a03080, + /* 0970 */ 0xe2833502, + /* 0974 */ 0xe5836000, + /* 0978 */ 0xe3a00cff, + /* 097c */ 0xe28000c0, + /* 0980 */ 0xe3a03801, + /* 0984 */ 0xe3a02000, + /* 0988 */ 0xe5832000, + /* 098c */ 0xe5832004, + /* 0990 */ 0xe5832008, + /* 0994 */ 0xe583200c, + /* 0998 */ 0xe5832010, + /* 099c */ 0xe5832014, + /* 09a0 */ 0xe5832018, + /* 09a4 */ 0xe583201c, + /* 09a8 */ 0xe5832020, + /* 09ac */ 0xe5832024, + /* 09b0 */ 0xe5832028, + /* 09b4 */ 0xe583202c, + /* 09b8 */ 0xe2833030, + /* 09bc */ 0xe2500030, + /* 09c0 */ 0x1afffff0, + /* 09c4 */ 0xe3a01cff, + /* 09c8 */ 0xe28110c0, + /* 09cc */ 0xe3a03802, + /* 09d0 */ 0xe1a02000, + /* 09d4 */ 0xe5832000, + /* 09d8 */ 0xe5832004, + /* 09dc */ 0xe5832008, + /* 09e0 */ 0xe583200c, + /* 09e4 */ 0xe5832010, + /* 09e8 */ 0xe5832014, + /* 09ec */ 0xe5832018, + /* 09f0 */ 0xe583201c, + /* 09f4 */ 0xe5832020, + /* 09f8 */ 0xe5832024, + /* 09fc */ 0xe5832028, + /* 0a00 */ 0xe583202c, + /* 0a04 */ 0xe2833030, + /* 0a08 */ 0xe2511030, + /* 0a0c */ 0x1afffff0, + /* 0a10 */ 0xe1a00001, + /* 0a14 */ 0xeafffe61, + /* 0a18 */ 0xe5896000, + /* 0a1c */ 0xe3a03080, + /* 0a20 */ 0xe2833502, + /* 0a24 */ 0xe5836000, + /* 0a28 */ 0xe3a00cff, + /* 0a2c */ 0xe28000c0, + /* 0a30 */ 0xe3a03801, + /* 0a34 */ 0xe3a02000, + /* 0a38 */ 0xe5832000, + /* 0a3c */ 0xe5832004, + /* 0a40 */ 0xe5832008, + /* 0a44 */ 0xe583200c, + /* 0a48 */ 0xe5832010, + /* 0a4c */ 0xe5832014, + /* 0a50 */ 0xe5832018, + /* 0a54 */ 0xe583201c, + /* 0a58 */ 0xe5832020, + /* 0a5c */ 0xe5832024, + /* 0a60 */ 0xe5832028, + /* 0a64 */ 0xe583202c, + /* 0a68 */ 0xe2833030, + /* 0a6c */ 0xe2500030, + /* 0a70 */ 0x1afffff0, + /* 0a74 */ 0xe3a01cff, + /* 0a78 */ 0xe28110c0, + /* 0a7c */ 0xe3a03802, + /* 0a80 */ 0xe1a02000, + /* 0a84 */ 0xe5832000, + /* 0a88 */ 0xe5832004, + /* 0a8c */ 0xe5832008, + /* 0a90 */ 0xe583200c, + /* 0a94 */ 0xe5832010, + /* 0a98 */ 0xe5832014, + /* 0a9c */ 0xe5832018, + /* 0aa0 */ 0xe583201c, + /* 0aa4 */ 0xe5832020, + /* 0aa8 */ 0xe5832024, + /* 0aac */ 0xe5832028, + /* 0ab0 */ 0xe583202c, + /* 0ab4 */ 0xe2833030, + /* 0ab8 */ 0xe2511030, + /* 0abc */ 0x1afffff0, + /* 0ac0 */ 0xe1a00001, + /* 0ac4 */ 0xeafffe35, + /* 0ac8 */ 0xe5943018, + /* 0acc */ 0xe3a02502, + /* 0ad0 */ 0xe2822b0a, + /* 0ad4 */ 0xe1a03223, + /* 0ad8 */ 0xe203300f, + /* 0adc */ 0xe5823000, + /* 0ae0 */ 0xeafffe2e, + /* 0ae4 */ 0xe5942018, + /* 0ae8 */ 0xe3a03029, + /* 0aec */ 0xe2833502, + /* 0af0 */ 0xe26220ff, + /* 0af4 */ 0xe5c32000, + /* 0af8 */ 0xe594101c, + /* 0afc */ 0xe3a030a9, + /* 0b00 */ 0xe2833502, + /* 0b04 */ 0xe26110ff, + /* 0b08 */ 0xe5c31000, + /* 0b0c */ 0xeafffe23, + /* 0b10 */ 0xe91baff0, + /* 0b14 */ 0xe3a02b0a, + /* 0b18 */ 0xe382300d, + /* 0b1c */ 0xe3833502, + /* 0b20 */ 0xe3a01000, + /* 0b24 */ 0xe5c31000, + /* 0b28 */ 0xe3822014, + /* 0b2c */ 0xe3822502, + /* 0b30 */ 0xe5923000, + /* 0b34 */ 0xe1530000, + /* 0b38 */ 0x23a00000, + /* 0b3c */ 0x33a00001, + /* 0b40 */ 0xe1a0f00e, + /* 0b44 */ 0xe3a02b0a, + /* 0b48 */ 0xe382300d, + /* 0b4c */ 0xe3833502, + /* 0b50 */ 0xe3a01000, + /* 0b54 */ 0xe5c31000, + /* 0b58 */ 0xe3822014, + /* 0b5c */ 0xe3822502, + /* 0b60 */ 0xe5923000, + /* 0b64 */ 0xe1530000, + /* 0b68 */ 0x33a00000, + /* 0b6c */ 0x23a00001, + /* 0b70 */ 0xe1a0f00e, + /* 0b74 */ 0xe2811003, + /* 0b78 */ 0xe3d11003, + /* 0b7c */ 0x01a0f00e, + /* 0b80 */ 0xe3a02000, + /* 0b84 */ 0xe2613000, + /* 0b88 */ 0xe213300f, + /* 0b8c */ 0x0a00000c, + /* 0b90 */ 0xe353000c, + /* 0b94 */ 0xaa000007, + /* 0b98 */ 0xe3530008, + /* 0b9c */ 0xaa000003, + /* 0ba0 */ 0xe3530003, + /* 0ba4 */ 0xda000006, + /* 0ba8 */ 0xe4802004, + /* 0bac */ 0xe2411004, + /* 0bb0 */ 0xe4802004, + /* 0bb4 */ 0xe2411004, + /* 0bb8 */ 0xe4802004, + /* 0bbc */ 0xe2511004, + /* 0bc0 */ 0x01a0f00e, + /* 0bc4 */ 0xe5802000, + /* 0bc8 */ 0xe5802004, + /* 0bcc */ 0xe5802008, + /* 0bd0 */ 0xe580200c, + /* 0bd4 */ 0xe2800010, + /* 0bd8 */ 0xe2511010, + /* 0bdc */ 0x1afffff8, + /* 0be0 */ 0xe1a0f00e, + /* 0be4 */ 0xe2513000, + /* 0be8 */ 0x01a0f00e, + /* 0bec */ 0xe3a02000, + /* 0bf0 */ 0xe2611000, + /* 0bf4 */ 0xe2111003, + /* 0bf8 */ 0x0a000009, + /* 0bfc */ 0xe3510003, + /* 0c00 */ 0xaa000004, + /* 0c04 */ 0xe3510002, + /* 0c08 */ 0xb4c02001, + /* 0c0c */ 0xb2433001, + /* 0c10 */ 0xe4c02001, + /* 0c14 */ 0xe2433001, + /* 0c18 */ 0xe4c02001, + /* 0c1c */ 0xe2533001, + /* 0c20 */ 0x01a0f00e, + /* 0c24 */ 0xe5c02000, + /* 0c28 */ 0xe5c02001, + /* 0c2c */ 0xe5c02002, + /* 0c30 */ 0xe5c02003, + /* 0c34 */ 0xe2800004, + /* 0c38 */ 0xe2533004, + /* 0c3c */ 0x1afffff8, + /* 0c40 */ 0xe1a0f00e, + /* 0c44 */ 0xe3a03502, + /* 0c48 */ 0xe3a01902, + /* 0c4c */ 0xe5831000, + /* 0c50 */ 0xe3a02080, + /* 0c54 */ 0xe7821003, + /* 0c58 */ 0xe3a02801, + /* 0c5c */ 0xe3a03cff, + /* 0c60 */ 0xe28330c0, + /* 0c64 */ 0xe2411902, + /* 0c68 */ 0xe5821000, + /* 0c6c */ 0xe5821004, + /* 0c70 */ 0xe5821008, + /* 0c74 */ 0xe582100c, + /* 0c78 */ 0xe2822010, + /* 0c7c */ 0xe2533010, + /* 0c80 */ 0x1afffff8, + /* 0c84 */ 0xe3a02802, + /* 0c88 */ 0xe3a03cff, + /* 0c8c */ 0xe28330c0, + /* 0c90 */ 0xe3a01000, + /* 0c94 */ 0xe5821000, + /* 0c98 */ 0xe5821004, + /* 0c9c */ 0xe5821008, + /* 0ca0 */ 0xe582100c, + /* 0ca4 */ 0xe2822010, + /* 0ca8 */ 0xe2533010, + /* 0cac */ 0x1afffff8, + /* 0cb0 */ 0xe1a0f00e, + 0 }; --- /dev/null 2003-08-23 14:55:56.000000000 +0900 +++ dev/microcode/ldscript 2003-08-23 14:47:01.000000000 +0900 @@ -0,0 +1,23 @@ +OUTPUT_ARCH(arm) +SECTIONS +{ + .text : + { + *(.text) + *(.text.*) + *(.glue_7t) *(.glue_7) + } + . = ALIGN(16); + .data : + { + } + . = ALIGN(16); + .sbss : + { + } + . = ALIGN(16); + .bss : + { + } +} +