Merge remote-tracking branch 'afaerber/qom-cpu-x86-prop.v3' into staging
[qemu.git] / hw / lm4549.h
blob5948780e0092d948152ae746b68ba0541f413e46
1 /*
2 * LM4549 Audio Codec Interface
4 * Copyright (c) 2011
5 * Written by Mathieu Sonet - www.elasticsheep.com
7 * This code is licensed under the GPL.
9 * *****************************************************************
12 #ifndef HW_LM4549_H
13 #define HW_LM4549_H
15 #include "audio/audio.h"
17 typedef void (*lm4549_callback)(void *opaque);
19 #define LM4549_BUFFER_SIZE (512 * 2) /* 512 16-bit stereo samples */
22 typedef struct {
23 QEMUSoundCard card;
24 SWVoiceOut *voice;
25 uint32_t voice_is_active;
27 uint16_t regfile[128];
28 lm4549_callback data_req_cb;
29 void *opaque;
31 uint16_t buffer[LM4549_BUFFER_SIZE];
32 uint32_t buffer_level;
33 } lm4549_state;
35 extern const VMStateDescription vmstate_lm4549_state;
38 void lm4549_init(lm4549_state *s, lm4549_callback data_req, void *opaque);
39 uint32_t lm4549_read(lm4549_state *s, target_phys_addr_t offset);
40 void lm4549_write(lm4549_state *s, target_phys_addr_t offset, uint32_t value);
41 uint32_t lm4549_write_samples(lm4549_state *s, uint32_t left, uint32_t right);
43 #endif /* #ifndef HW_LM4549_H */