3 * Copyright (c) 2006 acmesystems.it - john@acmesystems.it
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307USA
19 * Feedback, Bugs... info@acmesystems.it
26 #include <sys/ioctl.h>
32 static int mp3_frequency_val
= CRYSTAL12288
;
33 unsigned int volume
= 0x3030;
35 int mp3_open_port(unsigned char *port_name
){
37 if ((fd
= open(port_name
, O_RDWR
)) < 0) {
38 printf("Error whilst opening %s\n", port_name
);
44 void mp3_set_frequency(unsigned int crystal_frequency
){
45 mp3_frequency_val
= crystal_frequency
;
49 mp3_fd
= mp3_open_port("/dev/mp3");
53 ioctl(mp3_fd
, IOCTL_MP3_INIT
, mp3_frequency_val
);
57 void mp3_shutdown(void){
61 void mp3_bass(unsigned char t_freq
, unsigned char t_amp
,
62 unsigned char b_freq
, unsigned char b_amp
){
77 ioctl(mp3_fd
, IOCTL_MP3_BASS
, val
);
81 ioctl(mp3_fd
, IOCTL_MP3_CLEARBUFFER
, 0);
82 ioctl(mp3_fd
, IOCTL_MP3_RESET
, mp3_frequency_val
);
83 ioctl(mp3_fd
, IOCTL_MP3_SETVOLUME
, volume
);
86 unsigned char mp3_send_data_to_buffer(MP3_DATA mp3_data
){
87 return write(mp3_fd
, (void*)&mp3_data
, sizeof(MP3_DATA
));
90 unsigned char mp3_play(void){
91 return ioctl(mp3_fd
, IOCTL_MP3_PLAY
, 0);
95 ioctl(mp3_fd
, IOCTL_MP3_CLEARBUFFER
, 0);
98 void mp3_beep(unsigned char freq
, unsigned int ms
){
100 mp3_beep_
.freq
= freq
;
102 ioctl(mp3_fd
, IOCTL_MP3_BEEP
, &mp3_beep_
);
105 void mp3_set_volume(unsigned char left
, unsigned char right
){
110 ioctl(mp3_fd
, IOCTL_MP3_SETVOLUME
, volume
);
113 unsigned char mp3_buffer_finished(void){
114 return ioctl(mp3_fd
, IOCTL_MP3_END_REACHED
, 0);
117 unsigned char mp3_get_audio_data(AUDIO_DATA
*audio_data
){
118 return ioctl(mp3_fd
, IOCTL_MP3_GETAUDIODATA
, audio_data
);
This page took 0.043844 seconds and 5 git commands to generate.