OpenCores
URL https://opencores.org/ocsvn/aic1106_avalon_ip/aic1106_avalon_ip/trunk

Subversion Repositories aic1106_avalon_ip

[/] [aic1106_avalon_ip/] [trunk/] [software driver example/] [audio_drv.h] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 AlexO
/*
2
 * audio_drv.h
3
 *
4
 *  Created on: Jun 22, 2014
5
 *      Author: AlexO
6
 */
7
 
8
#ifndef AUDIO_DRV_H_
9
#define AUDIO_DRV_H_
10
 
11
#include "sys/alt_dev.h"
12
// -------------------- TLV320AIC1106 definitions
13
#define AIC1106_p3db                    0
14
#define AIC1106_0db                             1
15
#define AIC1106_m3db                    2
16
#define AIC1106_m6db                    3
17
#define AIC1106_m9db                    4
18
#define AIC1106_m12db                   5
19
#define AIC1106_m15db                   6
20
#define AIC1106_m18db                   7
21
#define AIC1106_off                             AIC1106_MUTE
22
 
23
#define AIC1106_MUTE                    0x08
24
#define AIC1106_ENABLE                  0x10
25
#define AIC1106_LOOPBACK                0x20
26
#define AIC1106_RESET                   0x40
27
 
28
#define AIC1106_ALMOST_EMPTY    16
29
#define AIC1106_ALMOST_FULL             AIC1106_OUTPUT_FIFO_IN_FIFO_DEPTH - 16
30
#define AIC1106_SAMPLE_RATE     8000
31
#define AIC1106_BITS_PER_SAMPLE 16
32
 
33
// ioctl codes
34
#define AUDIO_IOCTL_SET_VOL             0
35
#define AUDIO_IOCTL_GET_VOL             1
36
#define AUDIO_IOCTL_RESET               2
37
#define AUDIO_IOCTL_LOOPBACK    3
38
#define AUDIO_IOCTL_IOCANCEL    4
39
 
40
#define AUDIO_FAIL                              -1
41
#define AUDIO_SUCCESS                   0
42
 
43
 
44
int             audio_driver_init();
45
 
46
void    audio_set_volume(int volume);
47
int             audio_get_volume();
48
 
49
int             audio_beep(int volume, int freq, int duration_ms, int pause_ms, int beep_count);
50
 
51
alt_16* audio_read_wav(char* fname, int* samples_num);
52
int             audio_write_wav(char* fname, alt_16 *sample_ptr, int samples_num);
53
 
54
int             audio_play_wav(char* fname);
55
int             audio_record_wav(char* fname, int (*rec_callback)(int time));
56
 
57
int     audio_io_cancel();
58
 
59
void    audio_set_idle_callback(void (*idle_fn)(alt_fd* fd));
60
 
61
int     audio_write_direct(char* ptr, int len);
62
 
63
/*
64
 * Old API compatible functions
65
 * */
66
 
67
int             PlayWavFile(char* fname, int volume);
68
void    SoundToneAlarm(int volume, int freq, int duration_ms, int pause_ms, int beep_count);
69
 
70
#endif /* AUDIO_DRV_H_ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.