* changed pararmeter of audiohw_mute from int to bool

* unification of init and close
  NOTE: audiohw_init is a void function now, because it never (can) fail
        okay  from JdGordon@irc



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13622 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Christian Gmeiner 2007-06-13 06:33:40 +00:00
parent 2f1a262a60
commit d1178d2d76
15 changed files with 31 additions and 38 deletions

View file

@ -130,7 +130,7 @@ void audiohw_reset(void);
/*
* Initialise the PP I2C and I2S.
*/
int audiohw_init(void)
void audiohw_init(void)
{
unsigned int i;
@ -188,8 +188,6 @@ int audiohw_init(void)
{
as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i);
}
return 0;
}
void audiohw_postinit(void)
@ -267,7 +265,7 @@ int audiohw_set_lineout_vol(int vol_l, int vol_r)
return 0;
}
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
if (mute) {
as3514_write_or(HPH_OUT_L, (1 << 7));

View file

@ -218,11 +218,7 @@ void audiohw_set_recvol(int left, int right, int type)
}
}
/**
* Mute (mute=1) or enable sound (mute=0)
*
*/
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
unsigned value_dap = tlv320_regs[REG_DAP];
unsigned value_l, value_r;

View file

@ -159,11 +159,7 @@ void audiohw_set_treble(int value)
| TREBLEL(value) | TREBLER(value));
}
/**
* Mute (mute=1) or enable sound (mute=0)
*
*/
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
unsigned int value = uda1380_regs[REG_MUTE];
@ -260,17 +256,18 @@ void audiohw_set_frequency(unsigned fsel)
}
/* Initialize UDA1380 codec with default register values (uda1380_defaults) */
int audiohw_init(void)
void audiohw_init(void)
{
recgain_mic = 0;
recgain_line = 0;
audiohw_reset();
if (audiohw_set_regs() == -1)
return -1;
return 0;
if (audiohw_set_regs() == -1)
{
/* this shoud never (!) happen. */
logf("uda1380: audiohw_init failed")
}
}
void audiohw_postinit(void)

View file

@ -82,7 +82,7 @@ int tenthdb2mixer(int db)
return -db * 2 / 5;
}
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
if (mute)
{

View file

@ -168,7 +168,7 @@ void audiohw_set_treble(int value)
TREBCTRL_TREB(tone_tenthdb2hw(value)));
}
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
/* Mute: Set DACMU = 1 to soft-mute the audio DACs. */
/* Unmute: Set DACMU = 0 to soft-un-mute the audio DACs. */

View file

@ -151,7 +151,7 @@ void audiohw_set_treble(int value)
(void)value;
}
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
if (mute)
{

View file

@ -190,7 +190,7 @@ void audiohw_set_treble(int value)
}
}
void audiohw_mute(int mute)
void audiohw_mute(bool mute)
{
if (mute)
{

View file

@ -25,11 +25,9 @@
extern int tenthdb2master(int db);
extern void audiohw_reset(void);
extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
extern void audiohw_close(void);
extern void audiohw_set_sample_rate(int sampling_control);
extern void audiohw_enable_recording(bool source_mic);

View file

@ -21,6 +21,7 @@
#define _AUDIOHW_H_
#include "config.h"
#include <stdbool.h>
#ifdef HAVE_UDA1380
#include "uda1380.h"
@ -94,6 +95,20 @@ extern const struct sound_settings_info audiohw_settings[];
* .h file suitable defines are added.
*/
void audiohw_mute(int mute);
/**
* Initialize audio codec to a well defined state.
*/
void audiohw_init(void);
/**
* Close audio codec.
*/
void audiohw_close(void);
/**
* Mute or enable sound.
* @param mute true or false
*/
void audiohw_mute(bool mute);
#endif /* _AUDIOHW_H_ */

View file

@ -27,7 +27,6 @@ extern int tenthdb2master(int db);
/*** definitions ***/
extern void audiohw_init(void);
extern void audiohw_reset(void);
/**
* Sets internal sample rate for DAC and ADC relative to MCLK
@ -42,7 +41,6 @@ extern void audiohw_set_frequency(unsigned fsel);
extern void audiohw_enable_output(bool enable);
extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
extern void audiohw_set_recvol(int left, int right, int type);
extern void audiohw_close(void);
extern void audiohw_enable_recording(bool source_mic);
extern void audiohw_disable_recording(void);
extern void audiohw_set_monitor(bool enable);

View file

@ -28,13 +28,12 @@ extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
extern void audiohw_close(void);
/**
* Sets frequency settings for DAC and ADC relative to MCLK
*

View file

@ -28,13 +28,11 @@ extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
extern void audiohw_close(void);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);

View file

@ -27,7 +27,6 @@ extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
extern int audiohw_init(void);
extern void audiohw_preinit(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
@ -35,7 +34,6 @@ extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
extern void audiohw_close(void);
extern void audiohw_set_frequency(int fsel);
/* Register addresses and bits */

View file

@ -28,14 +28,12 @@ extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
extern void audiohw_close(void);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);

View file

@ -28,14 +28,12 @@ extern int tenthdb2master(int db);
extern int tenthdb2mixer(int db);
extern void audiohw_reset(void);
extern int audiohw_init(void);
extern void audiohw_enable_output(bool enable);
extern int audiohw_set_master_vol(int vol_l, int vol_r);
extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
extern int audiohw_set_mixer_vol(int channel1, int channel2);
extern void audiohw_set_bass(int value);
extern void audiohw_set_treble(int value);
extern void audiohw_close(void);
extern void audiohw_set_nsorder(int order);
extern void audiohw_set_sample_rate(int sampling_control);