mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-17 00:52:38 -05:00
* 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:
parent
2f1a262a60
commit
d1178d2d76
15 changed files with 31 additions and 38 deletions
|
|
@ -130,7 +130,7 @@ void audiohw_reset(void);
|
||||||
/*
|
/*
|
||||||
* Initialise the PP I2C and I2S.
|
* Initialise the PP I2C and I2S.
|
||||||
*/
|
*/
|
||||||
int audiohw_init(void)
|
void audiohw_init(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
|
@ -188,8 +188,6 @@ int audiohw_init(void)
|
||||||
{
|
{
|
||||||
as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i);
|
as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_postinit(void)
|
void audiohw_postinit(void)
|
||||||
|
|
@ -267,7 +265,7 @@ int audiohw_set_lineout_vol(int vol_l, int vol_r)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_mute(int mute)
|
void audiohw_mute(bool mute)
|
||||||
{
|
{
|
||||||
if (mute) {
|
if (mute) {
|
||||||
as3514_write_or(HPH_OUT_L, (1 << 7));
|
as3514_write_or(HPH_OUT_L, (1 << 7));
|
||||||
|
|
|
||||||
|
|
@ -218,11 +218,7 @@ void audiohw_set_recvol(int left, int right, int type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void audiohw_mute(bool mute)
|
||||||
* Mute (mute=1) or enable sound (mute=0)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void audiohw_mute(int mute)
|
|
||||||
{
|
{
|
||||||
unsigned value_dap = tlv320_regs[REG_DAP];
|
unsigned value_dap = tlv320_regs[REG_DAP];
|
||||||
unsigned value_l, value_r;
|
unsigned value_l, value_r;
|
||||||
|
|
|
||||||
|
|
@ -159,11 +159,7 @@ void audiohw_set_treble(int value)
|
||||||
| TREBLEL(value) | TREBLER(value));
|
| TREBLEL(value) | TREBLER(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void audiohw_mute(bool mute)
|
||||||
* Mute (mute=1) or enable sound (mute=0)
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void audiohw_mute(int mute)
|
|
||||||
{
|
{
|
||||||
unsigned int value = uda1380_regs[REG_MUTE];
|
unsigned int value = uda1380_regs[REG_MUTE];
|
||||||
|
|
||||||
|
|
@ -260,7 +256,7 @@ void audiohw_set_frequency(unsigned fsel)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize UDA1380 codec with default register values (uda1380_defaults) */
|
/* Initialize UDA1380 codec with default register values (uda1380_defaults) */
|
||||||
int audiohw_init(void)
|
void audiohw_init(void)
|
||||||
{
|
{
|
||||||
recgain_mic = 0;
|
recgain_mic = 0;
|
||||||
recgain_line = 0;
|
recgain_line = 0;
|
||||||
|
|
@ -268,9 +264,10 @@ int audiohw_init(void)
|
||||||
audiohw_reset();
|
audiohw_reset();
|
||||||
|
|
||||||
if (audiohw_set_regs() == -1)
|
if (audiohw_set_regs() == -1)
|
||||||
return -1;
|
{
|
||||||
|
/* this shoud never (!) happen. */
|
||||||
return 0;
|
logf("uda1380: audiohw_init failed")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_postinit(void)
|
void audiohw_postinit(void)
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ int tenthdb2mixer(int db)
|
||||||
return -db * 2 / 5;
|
return -db * 2 / 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_mute(int mute)
|
void audiohw_mute(bool mute)
|
||||||
{
|
{
|
||||||
if (mute)
|
if (mute)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ void audiohw_set_treble(int value)
|
||||||
TREBCTRL_TREB(tone_tenthdb2hw(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. */
|
/* Mute: Set DACMU = 1 to soft-mute the audio DACs. */
|
||||||
/* Unmute: Set DACMU = 0 to soft-un-mute the audio DACs. */
|
/* Unmute: Set DACMU = 0 to soft-un-mute the audio DACs. */
|
||||||
|
|
|
||||||
|
|
@ -151,7 +151,7 @@ void audiohw_set_treble(int value)
|
||||||
(void)value;
|
(void)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_mute(int mute)
|
void audiohw_mute(bool mute)
|
||||||
{
|
{
|
||||||
if (mute)
|
if (mute)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ void audiohw_set_treble(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void audiohw_mute(int mute)
|
void audiohw_mute(bool mute)
|
||||||
{
|
{
|
||||||
if (mute)
|
if (mute)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,9 @@
|
||||||
extern int tenthdb2master(int db);
|
extern int tenthdb2master(int db);
|
||||||
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
extern int audiohw_init(void);
|
|
||||||
extern void audiohw_enable_output(bool enable);
|
extern void audiohw_enable_output(bool enable);
|
||||||
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
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_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_set_sample_rate(int sampling_control);
|
||||||
|
|
||||||
extern void audiohw_enable_recording(bool source_mic);
|
extern void audiohw_enable_recording(bool source_mic);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@
|
||||||
#define _AUDIOHW_H_
|
#define _AUDIOHW_H_
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#ifdef HAVE_UDA1380
|
#ifdef HAVE_UDA1380
|
||||||
#include "uda1380.h"
|
#include "uda1380.h"
|
||||||
|
|
@ -94,6 +95,20 @@ extern const struct sound_settings_info audiohw_settings[];
|
||||||
* .h file suitable defines are added.
|
* .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_ */
|
#endif /* _AUDIOHW_H_ */
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ extern int tenthdb2master(int db);
|
||||||
|
|
||||||
/*** definitions ***/
|
/*** definitions ***/
|
||||||
|
|
||||||
extern void audiohw_init(void);
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
/**
|
/**
|
||||||
* Sets internal sample rate for DAC and ADC relative to MCLK
|
* 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_enable_output(bool enable);
|
||||||
extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
|
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_set_recvol(int left, int right, int type);
|
||||||
extern void audiohw_close(void);
|
|
||||||
extern void audiohw_enable_recording(bool source_mic);
|
extern void audiohw_enable_recording(bool source_mic);
|
||||||
extern void audiohw_disable_recording(void);
|
extern void audiohw_disable_recording(void);
|
||||||
extern void audiohw_set_monitor(bool enable);
|
extern void audiohw_set_monitor(bool enable);
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,12 @@ extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
extern int audiohw_init(void);
|
|
||||||
extern void audiohw_enable_output(bool enable);
|
extern void audiohw_enable_output(bool enable);
|
||||||
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
||||||
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
||||||
extern void audiohw_set_bass(int value);
|
extern void audiohw_set_bass(int value);
|
||||||
extern void audiohw_set_treble(int value);
|
extern void audiohw_set_treble(int value);
|
||||||
extern void audiohw_close(void);
|
|
||||||
/**
|
/**
|
||||||
* Sets frequency settings for DAC and ADC relative to MCLK
|
* Sets frequency settings for DAC and ADC relative to MCLK
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -28,13 +28,11 @@ extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
extern int audiohw_init(void);
|
|
||||||
extern void audiohw_enable_output(bool enable);
|
extern void audiohw_enable_output(bool enable);
|
||||||
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
||||||
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
||||||
extern void audiohw_set_bass(int value);
|
extern void audiohw_set_bass(int value);
|
||||||
extern void audiohw_set_treble(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_nsorder(int order);
|
||||||
extern void audiohw_set_sample_rate(int sampling_control);
|
extern void audiohw_set_sample_rate(int sampling_control);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
extern int audiohw_init(void);
|
|
||||||
extern void audiohw_preinit(void);
|
extern void audiohw_preinit(void);
|
||||||
extern void audiohw_enable_output(bool enable);
|
extern void audiohw_enable_output(bool enable);
|
||||||
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
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 int audiohw_set_mixer_vol(int channel1, int channel2);
|
||||||
extern void audiohw_set_bass(int value);
|
extern void audiohw_set_bass(int value);
|
||||||
extern void audiohw_set_treble(int value);
|
extern void audiohw_set_treble(int value);
|
||||||
extern void audiohw_close(void);
|
|
||||||
extern void audiohw_set_frequency(int fsel);
|
extern void audiohw_set_frequency(int fsel);
|
||||||
|
|
||||||
/* Register addresses and bits */
|
/* Register addresses and bits */
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,12 @@ extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
extern int audiohw_init(void);
|
|
||||||
extern void audiohw_enable_output(bool enable);
|
extern void audiohw_enable_output(bool enable);
|
||||||
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
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_lineout_vol(int vol_l, int vol_r);
|
||||||
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
||||||
extern void audiohw_set_bass(int value);
|
extern void audiohw_set_bass(int value);
|
||||||
extern void audiohw_set_treble(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_nsorder(int order);
|
||||||
extern void audiohw_set_sample_rate(int sampling_control);
|
extern void audiohw_set_sample_rate(int sampling_control);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,12 @@ extern int tenthdb2master(int db);
|
||||||
extern int tenthdb2mixer(int db);
|
extern int tenthdb2mixer(int db);
|
||||||
|
|
||||||
extern void audiohw_reset(void);
|
extern void audiohw_reset(void);
|
||||||
extern int audiohw_init(void);
|
|
||||||
extern void audiohw_enable_output(bool enable);
|
extern void audiohw_enable_output(bool enable);
|
||||||
extern int audiohw_set_master_vol(int vol_l, int vol_r);
|
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_lineout_vol(int vol_l, int vol_r);
|
||||||
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
extern int audiohw_set_mixer_vol(int channel1, int channel2);
|
||||||
extern void audiohw_set_bass(int value);
|
extern void audiohw_set_bass(int value);
|
||||||
extern void audiohw_set_treble(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_nsorder(int order);
|
||||||
extern void audiohw_set_sample_rate(int sampling_control);
|
extern void audiohw_set_sample_rate(int sampling_control);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue