* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "hw.h"
#include "audio/audio.h"
#include "qemu-timer.h"
#include "console.h"
-#include "omap.h"
+#include "omap.h" /* For struct i2s_codec_s and struct uwire_slave_s */
+#include "devices.h"
#define TSC_DATA_REGISTERS_PAGE 0x0
#define TSC_CONTROL_REGISTERS_PAGE 0x1
static void tsc2102_audio_output_update(struct tsc210x_state_s *s)
{
int enable;
- audsettings_t fmt;
+ struct audsettings fmt;
if (s->dac_voice[0]) {
tsc210x_out_flush(s, s->codec.out.len);
}
}
-uint32_t tsc210x_txrx(void *opaque, uint32_t value)
+uint32_t tsc210x_txrx(void *opaque, uint32_t value, int len)
{
struct tsc210x_state_s *s = opaque;
uint32_t ret = 0;
+ if (len != 16)
+ cpu_abort(cpu_single_env, "%s: FIXME: bad SPI word width %i\n",
+ __FUNCTION__, len);
+
/* TODO: sequential reads etc - how do we make sure the host doesn't
* unintentionally read out a conversion result from a register while
* transmitting the command word of the next command? */
qemu_put_be16s(f, &s->pll[0]);
qemu_put_be16s(f, &s->pll[1]);
qemu_put_be16s(f, &s->volume);
- qemu_put_be64(f, (uint64_t) (s->volume_change - now));
- qemu_put_be64(f, (uint64_t) (s->powerdown - now));
+ qemu_put_sbe64(f, (s->volume_change - now));
+ qemu_put_sbe64(f, (s->powerdown - now));
qemu_put_byte(f, s->softstep);
qemu_put_be16s(f, &s->dac_power);
qemu_get_be16s(f, &s->pll[0]);
qemu_get_be16s(f, &s->pll[1]);
qemu_get_be16s(f, &s->volume);
- s->volume_change = (int64_t) qemu_get_be64(f) + now;
- s->powerdown = (int64_t) qemu_get_be64(f) + now;
+ s->volume_change = qemu_get_sbe64(f) + now;
+ s->powerdown = qemu_get_sbe64(f) + now;
s->softstep = qemu_get_byte(f);
qemu_get_be16s(f, &s->dac_power);
return 0;
}
-static int tsc2102_iid = 0;
-
struct uwire_slave_s *tsc2102_init(qemu_irq pint, AudioState *audio)
{
struct tsc210x_state_s *s;
s->tr[0] = 0;
s->tr[1] = 1;
- s->tr[2] = 0;
- s->tr[3] = 1;
+ s->tr[2] = 1;
+ s->tr[3] = 0;
s->tr[4] = 1;
s->tr[5] = 0;
- s->tr[6] = 0;
- s->tr[7] = 1;
+ s->tr[6] = 1;
+ s->tr[7] = 0;
s->chip.opaque = s;
s->chip.send = (void *) tsc210x_write;
AUD_register_card(s->audio, s->name, &s->card);
qemu_register_reset((void *) tsc210x_reset, s);
- register_savevm(s->name, tsc2102_iid ++, 0,
+ register_savevm(s->name, -1, 0,
tsc210x_save, tsc210x_load, s);
return &s->chip;
s->tr[0] = 0;
s->tr[1] = 1;
- s->tr[2] = 0;
- s->tr[3] = 1;
+ s->tr[2] = 1;
+ s->tr[3] = 0;
s->tr[4] = 1;
s->tr[5] = 0;
- s->tr[6] = 0;
- s->tr[7] = 1;
+ s->tr[6] = 1;
+ s->tr[7] = 0;
s->chip.opaque = s;
s->chip.send = (void *) tsc210x_write;
AUD_register_card(s->audio, s->name, &s->card);
qemu_register_reset((void *) tsc210x_reset, s);
- register_savevm(s->name, tsc2102_iid ++, 0,
- tsc210x_save, tsc210x_load, s);
+ register_savevm(s->name, -1, 0, tsc210x_save, tsc210x_load, s);
return &s->chip;
}