Statistics
| Branch: | Revision:

root / hw / audio / lm4549.h @ a8aec295

History | View | Annotate | Download (1 kB)

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