lm4549.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * LM4549 Audio Codec Interface
  3. *
  4. * Copyright (c) 2011
  5. * Written by Mathieu Sonet - www.elasticsheep.com
  6. *
  7. * This code is licenced under the GPL.
  8. *
  9. * *****************************************************************
  10. */
  11. #ifndef HW_LM4549_H
  12. #define HW_LM4549_H
  13. #include "audio/audio.h"
  14. typedef void (*lm4549_callback)(void *opaque);
  15. #define LM4549_BUFFER_SIZE (512 * 2) /* 512 16-bit stereo samples */
  16. typedef struct {
  17. QEMUSoundCard card;
  18. SWVoiceOut *voice;
  19. uint32_t voice_is_active;
  20. uint16_t regfile[128];
  21. lm4549_callback data_req_cb;
  22. void *opaque;
  23. uint16_t buffer[LM4549_BUFFER_SIZE];
  24. uint32_t buffer_level;
  25. } lm4549_state;
  26. extern const VMStateDescription vmstate_lm4549_state;
  27. void lm4549_init(lm4549_state *s, lm4549_callback data_req, void *opaque);
  28. uint32_t lm4549_read(lm4549_state *s, target_phys_addr_t offset);
  29. void lm4549_write(lm4549_state *s, target_phys_addr_t offset, uint32_t value);
  30. uint32_t lm4549_write_samples(lm4549_state *s, uint32_t left, uint32_t right);
  31. #endif /* #ifndef HW_LM4549_H */