retire PUBLIC, PRIVATE and FORWARD
This commit is contained in:
@@ -26,15 +26,15 @@
|
||||
#define MUTE 0x80
|
||||
|
||||
|
||||
FORWARD int ak4531_write(u8_t address, u8_t data);
|
||||
FORWARD int ak4531_finished(void);
|
||||
FORWARD int set_volume(struct volume_level *level, int cmd_left, int
|
||||
static int ak4531_write(u8_t address, u8_t data);
|
||||
static int ak4531_finished(void);
|
||||
static int set_volume(struct volume_level *level, int cmd_left, int
|
||||
cmd_right, int max_level);
|
||||
|
||||
PRIVATE u16_t base_address;
|
||||
PRIVATE u16_t status_register;
|
||||
PRIVATE u16_t status_bit;
|
||||
PRIVATE u16_t poll_address;
|
||||
static u16_t base_address;
|
||||
static u16_t status_register;
|
||||
static u16_t status_bit;
|
||||
static u16_t poll_address;
|
||||
|
||||
u8_t mixer_values[0x20] = {
|
||||
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, /* 0x00 - 0x07 */
|
||||
@@ -53,7 +53,7 @@ u8_t mixer_values[0x20] = {
|
||||
|
||||
|
||||
|
||||
PRIVATE int ak4531_finished(void) {
|
||||
static int ak4531_finished(void) {
|
||||
int i;
|
||||
u16_t cstat;
|
||||
for (i = 0; i < 0x40000; i++) {
|
||||
@@ -66,7 +66,7 @@ PRIVATE int ak4531_finished(void) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int ak4531_write (u8_t address, u8_t data) {
|
||||
static int ak4531_write (u8_t address, u8_t data) {
|
||||
u16_t to_be_written;
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ PRIVATE int ak4531_write (u8_t address, u8_t data) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
|
||||
int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
|
||||
u16_t poll) {
|
||||
int i;
|
||||
|
||||
@@ -107,7 +107,7 @@ PUBLIC int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
|
||||
}
|
||||
|
||||
|
||||
PUBLIC int ak4531_get_set_volume(struct volume_level *level, int flag) {
|
||||
int ak4531_get_set_volume(struct volume_level *level, int flag) {
|
||||
int cmd_left, cmd_right, max_level;
|
||||
|
||||
max_level = 0x1f;
|
||||
@@ -160,7 +160,7 @@ PUBLIC int ak4531_get_set_volume(struct volume_level *level, int flag) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_volume(struct volume_level *level, int cmd_left, int cmd_right,
|
||||
static int set_volume(struct volume_level *level, int cmd_left, int cmd_right,
|
||||
int max_level) {
|
||||
|
||||
if(level->right < 0) level->right = 0;
|
||||
|
||||
@@ -28,32 +28,32 @@
|
||||
|
||||
|
||||
/* prototypes of private functions */
|
||||
FORWARD int detect_hw(void);
|
||||
FORWARD int disable_int(int sub_dev);
|
||||
FORWARD int set_stereo(u32_t stereo, int sub_dev);
|
||||
FORWARD int set_bits(u32_t nr_of_bits, int sub_dev);
|
||||
FORWARD int set_sample_rate(u32_t rate, int sub_dev);
|
||||
FORWARD int set_sign(u32_t val, int sub_dev);
|
||||
FORWARD int get_max_frag_size(u32_t * val, int *len, int sub_dev);
|
||||
FORWARD int set_frag_size(u32_t fragment_size, int sub_dev);
|
||||
FORWARD int set_int_cnt(int sub_dev);
|
||||
FORWARD int free_buf(u32_t *val, int *len, int sub_dev);
|
||||
FORWARD int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
|
||||
FORWARD int get_set_volume(struct volume_level *level, int *len, int
|
||||
static int detect_hw(void);
|
||||
static int disable_int(int sub_dev);
|
||||
static int set_stereo(u32_t stereo, int sub_dev);
|
||||
static int set_bits(u32_t nr_of_bits, int sub_dev);
|
||||
static int set_sample_rate(u32_t rate, int sub_dev);
|
||||
static int set_sign(u32_t val, int sub_dev);
|
||||
static int get_max_frag_size(u32_t * val, int *len, int sub_dev);
|
||||
static int set_frag_size(u32_t fragment_size, int sub_dev);
|
||||
static int set_int_cnt(int sub_dev);
|
||||
static int free_buf(u32_t *val, int *len, int sub_dev);
|
||||
static int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
|
||||
static int get_set_volume(struct volume_level *level, int *len, int
|
||||
sub_dev, int flag);
|
||||
FORWARD int reset(int sub_dev);
|
||||
static int reset(int sub_dev);
|
||||
|
||||
|
||||
DEV_STRUCT dev;
|
||||
aud_sub_dev_conf_t aud_conf[4];
|
||||
|
||||
|
||||
PUBLIC sub_dev_t sub_dev[4];
|
||||
PUBLIC special_file_t special_file[4];
|
||||
PUBLIC drv_t drv;
|
||||
sub_dev_t sub_dev[4];
|
||||
special_file_t special_file[4];
|
||||
drv_t drv;
|
||||
|
||||
|
||||
PUBLIC int drv_init(void) {
|
||||
int drv_init(void) {
|
||||
drv.DriverName = DRIVER_NAME;
|
||||
drv.NrOfSubDevices = 4;
|
||||
drv.NrOfSpecialFiles = 4;
|
||||
@@ -106,7 +106,7 @@ PUBLIC int drv_init(void) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC int drv_init_hw (void) {
|
||||
int drv_init_hw (void) {
|
||||
u16_t i, j;
|
||||
u16_t chip_sel_ctrl_reg;
|
||||
|
||||
@@ -167,7 +167,7 @@ PUBLIC int drv_init_hw (void) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int detect_hw(void) {
|
||||
static int detect_hw(void) {
|
||||
u32_t device;
|
||||
int devind;
|
||||
u16_t v_id, d_id;
|
||||
@@ -210,7 +210,7 @@ PRIVATE int detect_hw(void) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int reset(int chan) {
|
||||
static int reset(int chan) {
|
||||
drv_stop(chan);
|
||||
sub_dev[chan].OutOfData = 1;
|
||||
|
||||
@@ -455,7 +455,7 @@ int drv_resume(int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
|
||||
static int set_bits(u32_t nr_of_bits, int sub_dev) {
|
||||
/* set format bits for specified channel. */
|
||||
u16_t size_16_bit, ser_interface;
|
||||
|
||||
@@ -479,7 +479,7 @@ PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
|
||||
static int set_stereo(u32_t stereo, int sub_dev) {
|
||||
/* set format bits for specified channel. */
|
||||
u16_t stereo_bit, ser_interface;
|
||||
|
||||
@@ -501,12 +501,12 @@ PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
|
||||
static int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
|
||||
static int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
|
||||
if (fragment_size > (sub_dev[sub_dev_nr].DmaSize /
|
||||
sub_dev[sub_dev_nr].NrOfDmaFragments) ||
|
||||
fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) {
|
||||
@@ -518,7 +518,7 @@ PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
|
||||
static int set_sample_rate(u32_t rate, int sub_dev) {
|
||||
/* currently only 44.1kHz */
|
||||
u32_t controlRegister;
|
||||
|
||||
@@ -536,7 +536,7 @@ PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_int_cnt(int chan) {
|
||||
static int set_int_cnt(int chan) {
|
||||
/* Write interrupt count for specified channel.
|
||||
After <DspFragmentSize> bytes, an interrupt will be generated */
|
||||
|
||||
@@ -573,7 +573,7 @@ PRIVATE int set_int_cnt(int chan) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
|
||||
static int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
|
||||
*len = sizeof(*val);
|
||||
*val = (sub_dev[sub_dev_nr].DmaSize /
|
||||
sub_dev[sub_dev_nr].NrOfDmaFragments);
|
||||
@@ -581,7 +581,7 @@ PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int disable_int(int chan) {
|
||||
static int disable_int(int chan) {
|
||||
u16_t ser_interface, int_en_bit;
|
||||
|
||||
switch(chan) {
|
||||
@@ -597,7 +597,7 @@ PRIVATE int disable_int(int chan) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
|
||||
static int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
|
||||
u16_t samp_ct_reg;
|
||||
u16_t curr_samp_ct_reg;
|
||||
u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */
|
||||
@@ -629,7 +629,7 @@ PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
|
||||
|
||||
|
||||
/* returns 1 if there are free buffers */
|
||||
PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
|
||||
static int free_buf (u32_t *val, int *len, int sub_dev_nr) {
|
||||
*len = sizeof(*val);
|
||||
if (sub_dev[sub_dev_nr].BufLength ==
|
||||
sub_dev[sub_dev_nr].NrOfExtraBuffers) {
|
||||
@@ -642,7 +642,7 @@ PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_set_volume(struct volume_level *level, int *len, int sub_dev,
|
||||
static int get_set_volume(struct volume_level *level, int *len, int sub_dev,
|
||||
int flag) {
|
||||
*len = sizeof(struct volume_level);
|
||||
if (sub_dev == MIXER) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
/*===========================================================================*
|
||||
* helper functions for I/O *
|
||||
*===========================================================================*/
|
||||
PUBLIC u32_t pci_inb(u16_t port) {
|
||||
u32_t pci_inb(u16_t port) {
|
||||
u32_t value;
|
||||
int s;
|
||||
if ((s=sys_inb(port, &value)) !=OK)
|
||||
@@ -23,7 +23,7 @@ PUBLIC u32_t pci_inb(u16_t port) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC u32_t pci_inw(u16_t port) {
|
||||
u32_t pci_inw(u16_t port) {
|
||||
u32_t value;
|
||||
int s;
|
||||
if ((s=sys_inw(port, &value)) !=OK)
|
||||
@@ -32,7 +32,7 @@ PUBLIC u32_t pci_inw(u16_t port) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC u32_t pci_inl(u16_t port) {
|
||||
u32_t pci_inl(u16_t port) {
|
||||
u32_t value;
|
||||
int s;
|
||||
if ((s=sys_inl(port, &value)) !=OK)
|
||||
@@ -41,21 +41,21 @@ PUBLIC u32_t pci_inl(u16_t port) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void pci_outb(u16_t port, u8_t value) {
|
||||
void pci_outb(u16_t port, u8_t value) {
|
||||
int s;
|
||||
if ((s=sys_outb(port, value)) !=OK)
|
||||
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void pci_outw(u16_t port, u16_t value) {
|
||||
void pci_outw(u16_t port, u16_t value) {
|
||||
int s;
|
||||
if ((s=sys_outw(port, value)) !=OK)
|
||||
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void pci_outl(u16_t port, u32_t value) {
|
||||
void pci_outl(u16_t port, u32_t value) {
|
||||
int s;
|
||||
if ((s=sys_outl(port, value)) !=OK)
|
||||
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);
|
||||
|
||||
@@ -6,15 +6,15 @@
|
||||
|
||||
/* AC97 Mixer and Mode control function prototypes */
|
||||
|
||||
FORWARD int AC97_write(const DEV_STRUCT * pCC, u16_t wAddr, u16_t
|
||||
static int AC97_write(const DEV_STRUCT * pCC, u16_t wAddr, u16_t
|
||||
wData);
|
||||
FORWARD int AC97_write_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
static int AC97_write_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
u16_t wData);
|
||||
FORWARD int AC97_read_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
static int AC97_read_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
u16_t *data);
|
||||
FORWARD void set_nice_volume(void);
|
||||
FORWARD int AC97_get_volume(struct volume_level *level);
|
||||
FORWARD int AC97_set_volume(const struct volume_level *level);
|
||||
static void set_nice_volume(void);
|
||||
static int AC97_get_volume(struct volume_level *level);
|
||||
static int AC97_set_volume(const struct volume_level *level);
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ static DEV_STRUCT *dev;
|
||||
|
||||
|
||||
#if 0
|
||||
PRIVATE void set_src_sync_state (int state)
|
||||
static void set_src_sync_state (int state)
|
||||
{
|
||||
if (state < 0)
|
||||
SrcSyncState = SRC_UNSYNCED;
|
||||
@@ -68,7 +68,7 @@ PRIVATE void set_src_sync_state (int state)
|
||||
#endif
|
||||
|
||||
|
||||
PRIVATE int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
|
||||
static int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
|
||||
{
|
||||
u32_t dtemp, i;
|
||||
u16_t wBaseAddr = pCC->base;
|
||||
@@ -133,7 +133,7 @@ u16_t wBaseAddr = pCC->base;
|
||||
|
||||
|
||||
#if 0
|
||||
PRIVATE int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data)
|
||||
static int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data)
|
||||
{
|
||||
u32_t dtemp, i;
|
||||
u16_t base = pCC->base;
|
||||
@@ -207,7 +207,7 @@ u16_t base = pCC->base;
|
||||
#endif
|
||||
|
||||
|
||||
PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
static int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
u16_t wData)
|
||||
{
|
||||
/* wait for WIP to go away */
|
||||
@@ -220,7 +220,7 @@ PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
static int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
|
||||
u16_t *data)
|
||||
{
|
||||
u32_t dtemp;
|
||||
@@ -309,7 +309,7 @@ int AC97_init( DEV_STRUCT * pCC ) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE void set_nice_volume(void) {
|
||||
static void set_nice_volume(void) {
|
||||
/* goofy code to set the DAC1 channel to an audibe volume
|
||||
to be able to test it without using the mixer */
|
||||
|
||||
@@ -340,7 +340,7 @@ PRIVATE void set_nice_volume(void) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_volume(u8_t *left, u8_t *right, int cmd) {
|
||||
static int get_volume(u8_t *left, u8_t *right, int cmd) {
|
||||
u16_t value;
|
||||
|
||||
AC97_read_unsynced(dev, (u16_t)cmd, &value);
|
||||
@@ -352,7 +352,7 @@ PRIVATE int get_volume(u8_t *left, u8_t *right, int cmd) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_volume(int left, int right, int cmd) {
|
||||
static int set_volume(int left, int right, int cmd) {
|
||||
u16_t waarde;
|
||||
|
||||
waarde = (u16_t)((left<<8)|right);
|
||||
@@ -393,7 +393,7 @@ int AC97_get_set_volume(struct volume_level *level, int flag) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int AC97_get_volume(struct volume_level *level) {
|
||||
static int AC97_get_volume(struct volume_level *level) {
|
||||
int cmd;
|
||||
u8_t left;
|
||||
u8_t right;
|
||||
@@ -453,7 +453,7 @@ PRIVATE int AC97_get_volume(struct volume_level *level) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int AC97_set_volume(const struct volume_level *level) {
|
||||
static int AC97_set_volume(const struct volume_level *level) {
|
||||
int cmd;
|
||||
int left;
|
||||
int right;
|
||||
|
||||
@@ -34,32 +34,32 @@
|
||||
|
||||
|
||||
/* prototypes of private functions */
|
||||
FORWARD int detect_hw(void);
|
||||
FORWARD int disable_int(int sub_dev);
|
||||
FORWARD int set_stereo(u32_t stereo, int sub_dev);
|
||||
FORWARD int set_bits(u32_t nr_of_bits, int sub_dev);
|
||||
FORWARD int set_sample_rate(u32_t rate, int sub_dev);
|
||||
FORWARD int set_sign(u32_t val, int sub_dev);
|
||||
FORWARD int get_max_frag_size(u32_t * val, int *len, int sub_dev);
|
||||
FORWARD int set_frag_size(u32_t fragment_size, int sub_dev);
|
||||
FORWARD int set_int_cnt(int sub_dev);
|
||||
FORWARD int free_buf(u32_t *val, int *len, int sub_dev);
|
||||
FORWARD int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
|
||||
FORWARD int get_set_volume(struct volume_level *level, int *len, int
|
||||
static int detect_hw(void);
|
||||
static int disable_int(int sub_dev);
|
||||
static int set_stereo(u32_t stereo, int sub_dev);
|
||||
static int set_bits(u32_t nr_of_bits, int sub_dev);
|
||||
static int set_sample_rate(u32_t rate, int sub_dev);
|
||||
static int set_sign(u32_t val, int sub_dev);
|
||||
static int get_max_frag_size(u32_t * val, int *len, int sub_dev);
|
||||
static int set_frag_size(u32_t fragment_size, int sub_dev);
|
||||
static int set_int_cnt(int sub_dev);
|
||||
static int free_buf(u32_t *val, int *len, int sub_dev);
|
||||
static int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
|
||||
static int get_set_volume(struct volume_level *level, int *len, int
|
||||
sub_dev, int flag);
|
||||
FORWARD int reset(int sub_dev);
|
||||
static int reset(int sub_dev);
|
||||
|
||||
|
||||
DEV_STRUCT dev;
|
||||
aud_sub_dev_conf_t aud_conf[4];
|
||||
|
||||
|
||||
PUBLIC sub_dev_t sub_dev[4];
|
||||
PUBLIC special_file_t special_file[4];
|
||||
PUBLIC drv_t drv;
|
||||
sub_dev_t sub_dev[4];
|
||||
special_file_t special_file[4];
|
||||
drv_t drv;
|
||||
|
||||
|
||||
PUBLIC int drv_init(void) {
|
||||
int drv_init(void) {
|
||||
drv.DriverName = DRIVER_NAME;
|
||||
drv.NrOfSubDevices = 4;
|
||||
drv.NrOfSpecialFiles = 4;
|
||||
@@ -112,7 +112,7 @@ PUBLIC int drv_init(void) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC int drv_init_hw (void) {
|
||||
int drv_init_hw (void) {
|
||||
u16_t i, j;
|
||||
|
||||
/* First, detect the hardware */
|
||||
@@ -169,7 +169,7 @@ PUBLIC int drv_init_hw (void) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int detect_hw(void) {
|
||||
static int detect_hw(void) {
|
||||
u32_t device;
|
||||
int devind;
|
||||
u16_t v_id, d_id;
|
||||
@@ -212,7 +212,7 @@ PRIVATE int detect_hw(void) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int reset(int chan) {
|
||||
static int reset(int chan) {
|
||||
drv_stop(chan);
|
||||
sub_dev[chan].OutOfData = 1;
|
||||
|
||||
@@ -456,7 +456,7 @@ int drv_resume(int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
|
||||
static int set_bits(u32_t nr_of_bits, int sub_dev) {
|
||||
/* set format bits for specified channel. */
|
||||
u16_t size_16_bit, ser_interface;
|
||||
|
||||
@@ -480,7 +480,7 @@ PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
|
||||
static int set_stereo(u32_t stereo, int sub_dev) {
|
||||
/* set format bits for specified channel. */
|
||||
u16_t stereo_bit, ser_interface;
|
||||
|
||||
@@ -502,12 +502,12 @@ PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
|
||||
static int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
|
||||
static int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
|
||||
if (fragment_size > (sub_dev[sub_dev_nr].DmaSize /
|
||||
sub_dev[sub_dev_nr].NrOfDmaFragments) ||
|
||||
fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) {
|
||||
@@ -519,7 +519,7 @@ PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
|
||||
static int set_sample_rate(u32_t rate, int sub_dev) {
|
||||
u32_t src_base_reg;
|
||||
|
||||
if (rate > MAX_RATE || rate < MIN_RATE) {
|
||||
@@ -538,7 +538,7 @@ PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int set_int_cnt(int chan) {
|
||||
static int set_int_cnt(int chan) {
|
||||
/* Write interrupt count for specified channel.
|
||||
After <DspFragmentSize> bytes, an interrupt will be generated */
|
||||
|
||||
@@ -575,7 +575,7 @@ PRIVATE int set_int_cnt(int chan) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
|
||||
static int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
|
||||
*len = sizeof(*val);
|
||||
*val = (sub_dev[sub_dev_nr].DmaSize /
|
||||
sub_dev[sub_dev_nr].NrOfDmaFragments);
|
||||
@@ -583,7 +583,7 @@ PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int disable_int(int chan) {
|
||||
static int disable_int(int chan) {
|
||||
u16_t ser_interface, int_en_bit;
|
||||
|
||||
switch(chan) {
|
||||
@@ -599,7 +599,7 @@ PRIVATE int disable_int(int chan) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
|
||||
static int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
|
||||
u16_t samp_ct_reg;
|
||||
u16_t curr_samp_ct_reg;
|
||||
u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */
|
||||
@@ -631,7 +631,7 @@ PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
|
||||
|
||||
|
||||
/* returns 1 if there are free buffers */
|
||||
PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
|
||||
static int free_buf (u32_t *val, int *len, int sub_dev_nr) {
|
||||
*len = sizeof(*val);
|
||||
if (sub_dev[sub_dev_nr].BufLength ==
|
||||
sub_dev[sub_dev_nr].NrOfExtraBuffers) {
|
||||
@@ -644,7 +644,7 @@ PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int get_set_volume(struct volume_level *level, int *len, int sub_dev,
|
||||
static int get_set_volume(struct volume_level *level, int *len, int sub_dev,
|
||||
int flag) {
|
||||
*len = sizeof(struct volume_level);
|
||||
if (sub_dev == MIXER) {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
/*===========================================================================*
|
||||
* helper functions for I/O *
|
||||
*===========================================================================*/
|
||||
PUBLIC u32_t pci_inb(u16_t port) {
|
||||
u32_t pci_inb(u16_t port) {
|
||||
u32_t value;
|
||||
int s;
|
||||
if ((s=sys_inb(port, &value)) !=OK)
|
||||
@@ -23,7 +23,7 @@ PUBLIC u32_t pci_inb(u16_t port) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC u32_t pci_inw(u16_t port) {
|
||||
u32_t pci_inw(u16_t port) {
|
||||
u32_t value;
|
||||
int s;
|
||||
if ((s=sys_inw(port, &value)) !=OK)
|
||||
@@ -32,7 +32,7 @@ PUBLIC u32_t pci_inw(u16_t port) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC u32_t pci_inl(u16_t port) {
|
||||
u32_t pci_inl(u16_t port) {
|
||||
u32_t value;
|
||||
int s;
|
||||
if ((s=sys_inl(port, &value)) !=OK)
|
||||
@@ -41,21 +41,21 @@ PUBLIC u32_t pci_inl(u16_t port) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void pci_outb(u16_t port, u8_t value) {
|
||||
void pci_outb(u16_t port, u8_t value) {
|
||||
int s;
|
||||
if ((s=sys_outb(port, value)) !=OK)
|
||||
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void pci_outw(u16_t port, u16_t value) {
|
||||
void pci_outw(u16_t port, u16_t value) {
|
||||
int s;
|
||||
if ((s=sys_outw(port, value)) !=OK)
|
||||
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
|
||||
}
|
||||
|
||||
|
||||
PUBLIC void pci_outl(u16_t port, u32_t value) {
|
||||
void pci_outl(u16_t port, u32_t value) {
|
||||
int s;
|
||||
if ((s=sys_outl(port, value)) !=OK)
|
||||
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
|
||||
|
||||
|
||||
FORWARD int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t
|
||||
static int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t
|
||||
*data);
|
||||
FORWARD int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val);
|
||||
static int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val);
|
||||
|
||||
|
||||
int src_init ( DEV_STRUCT * DSP ) {
|
||||
@@ -103,7 +103,7 @@ int src_init ( DEV_STRUCT * DSP ) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
|
||||
static int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
|
||||
u32_t dtemp;
|
||||
|
||||
/* wait for ready */
|
||||
@@ -129,7 +129,7 @@ PRIVATE int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
|
||||
}
|
||||
|
||||
|
||||
PRIVATE int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) {
|
||||
static int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) {
|
||||
u32_t dtemp;
|
||||
|
||||
/* wait for ready */
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
|
||||
|
||||
FORWARD int get_set_volume(struct volume_level *level, int flag);
|
||||
FORWARD int get_set_input(struct inout_ctrl *input, int flag, int
|
||||
static int get_set_volume(struct volume_level *level, int flag);
|
||||
static int get_set_input(struct inout_ctrl *input, int flag, int
|
||||
channel);
|
||||
FORWARD int get_set_output(struct inout_ctrl *output, int flag);
|
||||
static int get_set_output(struct inout_ctrl *output, int flag);
|
||||
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ FORWARD int get_set_output(struct inout_ctrl *output, int flag);
|
||||
/*=========================================================================*
|
||||
* mixer_ioctl
|
||||
*=========================================================================*/
|
||||
PUBLIC int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
|
||||
int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
|
||||
int status;
|
||||
|
||||
switch(request) {
|
||||
@@ -36,7 +36,7 @@ PUBLIC int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
|
||||
/*=========================================================================*
|
||||
* mixer_init
|
||||
*=========================================================================*/
|
||||
PUBLIC int mixer_init() {
|
||||
int mixer_init() {
|
||||
/* Try to detect the mixer by writing to MIXER_DAC_LEVEL if the
|
||||
* value written can be read back the mixer is there
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ PUBLIC int mixer_init() {
|
||||
/*=========================================================================*
|
||||
* get_set_volume *
|
||||
*=========================================================================*/
|
||||
PRIVATE int get_set_volume(struct volume_level *level, int flag) {
|
||||
static int get_set_volume(struct volume_level *level, int flag) {
|
||||
int cmd_left, cmd_right, shift, max_level;
|
||||
|
||||
shift = 3;
|
||||
@@ -133,7 +133,7 @@ PRIVATE int get_set_volume(struct volume_level *level, int flag) {
|
||||
/*=========================================================================*
|
||||
* get_set_input *
|
||||
*=========================================================================*/
|
||||
PRIVATE int get_set_input(struct inout_ctrl *input, int flag, int channel) {
|
||||
static int get_set_input(struct inout_ctrl *input, int flag, int channel) {
|
||||
int input_cmd, input_mask, mask, del_mask, shift;
|
||||
|
||||
input_cmd = (channel == 0 ? MIXER_IN_LEFT : MIXER_IN_RIGHT);
|
||||
@@ -187,7 +187,7 @@ PRIVATE int get_set_input(struct inout_ctrl *input, int flag, int channel) {
|
||||
/*=========================================================================*
|
||||
* get_set_output *
|
||||
*=========================================================================*/
|
||||
PRIVATE int get_set_output(struct inout_ctrl *output, int flag) {
|
||||
static int get_set_output(struct inout_ctrl *output, int flag) {
|
||||
int output_mask, mask, del_mask, shift;
|
||||
|
||||
mask = mixer_get(MIXER_OUTPUT_CTRL);
|
||||
@@ -233,7 +233,7 @@ PRIVATE int get_set_output(struct inout_ctrl *output, int flag) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int mixer_set(int reg, int data) {
|
||||
int mixer_set(int reg, int data) {
|
||||
int i;
|
||||
|
||||
sb16_outb(MIXER_REG, reg);
|
||||
@@ -245,7 +245,7 @@ PUBLIC int mixer_set(int reg, int data) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int mixer_get(int reg) {
|
||||
int mixer_get(int reg) {
|
||||
int i;
|
||||
|
||||
sb16_outb(MIXER_REG, reg);
|
||||
|
||||
@@ -11,34 +11,34 @@
|
||||
#include "mixer.h"
|
||||
|
||||
|
||||
FORWARD void dsp_dma_setup(phys_bytes address, int count, int sub_dev);
|
||||
static void dsp_dma_setup(phys_bytes address, int count, int sub_dev);
|
||||
|
||||
FORWARD int dsp_ioctl(int request, void *val, int *len);
|
||||
FORWARD int dsp_set_size(unsigned int size);
|
||||
FORWARD int dsp_set_speed(unsigned int speed);
|
||||
FORWARD int dsp_set_stereo(unsigned int stereo);
|
||||
FORWARD int dsp_set_bits(unsigned int bits);
|
||||
FORWARD int dsp_set_sign(unsigned int sign);
|
||||
FORWARD int dsp_get_max_frag_size(u32_t *val, int *len);
|
||||
static int dsp_ioctl(int request, void *val, int *len);
|
||||
static int dsp_set_size(unsigned int size);
|
||||
static int dsp_set_speed(unsigned int speed);
|
||||
static int dsp_set_stereo(unsigned int stereo);
|
||||
static int dsp_set_bits(unsigned int bits);
|
||||
static int dsp_set_sign(unsigned int sign);
|
||||
static int dsp_get_max_frag_size(u32_t *val, int *len);
|
||||
|
||||
|
||||
PRIVATE unsigned int DspStereo = DEFAULT_STEREO;
|
||||
PRIVATE unsigned int DspSpeed = DEFAULT_SPEED;
|
||||
PRIVATE unsigned int DspBits = DEFAULT_BITS;
|
||||
PRIVATE unsigned int DspSign = DEFAULT_SIGN;
|
||||
PRIVATE unsigned int DspFragmentSize;
|
||||
static unsigned int DspStereo = DEFAULT_STEREO;
|
||||
static unsigned int DspSpeed = DEFAULT_SPEED;
|
||||
static unsigned int DspBits = DEFAULT_BITS;
|
||||
static unsigned int DspSign = DEFAULT_SIGN;
|
||||
static unsigned int DspFragmentSize;
|
||||
|
||||
PRIVATE phys_bytes DmaPhys;
|
||||
PRIVATE int running = FALSE;
|
||||
static phys_bytes DmaPhys;
|
||||
static int running = FALSE;
|
||||
|
||||
|
||||
PUBLIC sub_dev_t sub_dev[2];
|
||||
PUBLIC special_file_t special_file[3];
|
||||
PUBLIC drv_t drv;
|
||||
sub_dev_t sub_dev[2];
|
||||
special_file_t special_file[3];
|
||||
drv_t drv;
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_init(void) {
|
||||
int drv_init(void) {
|
||||
drv.DriverName = "SB16";
|
||||
drv.NrOfSubDevices = 2;
|
||||
drv.NrOfSpecialFiles = 3;
|
||||
@@ -72,7 +72,7 @@ PUBLIC int drv_init(void) {
|
||||
}
|
||||
|
||||
|
||||
PUBLIC int drv_init_hw(void) {
|
||||
int drv_init_hw(void) {
|
||||
int i;
|
||||
int DspVersion[2];
|
||||
Dprint(("drv_init_hw():\n"));
|
||||
@@ -114,7 +114,7 @@ PUBLIC int drv_init_hw(void) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_reset(void) {
|
||||
int drv_reset(void) {
|
||||
int i;
|
||||
Dprint(("drv_reset():\n"));
|
||||
|
||||
@@ -131,7 +131,7 @@ PUBLIC int drv_reset(void) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_start(int channel, int DmaMode) {
|
||||
int drv_start(int channel, int DmaMode) {
|
||||
Dprint(("drv_start():\n"));
|
||||
|
||||
drv_reset();
|
||||
@@ -178,7 +178,7 @@ PUBLIC int drv_start(int channel, int DmaMode) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_stop(int sub_dev) {
|
||||
int drv_stop(int sub_dev) {
|
||||
if(running) {
|
||||
Dprint(("drv_stop():\n"));
|
||||
dsp_command((DspBits == 8 ? DSP_CMD_DMA8HALT : DSP_CMD_DMA16HALT));
|
||||
@@ -190,7 +190,7 @@ PUBLIC int drv_stop(int sub_dev) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
|
||||
int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
|
||||
Dprint(("drv_set_dma():\n"));
|
||||
DmaPhys = dma;
|
||||
return OK;
|
||||
@@ -198,7 +198,7 @@ PUBLIC int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_reenable_int(int UNUSED(chan)) {
|
||||
int drv_reenable_int(int UNUSED(chan)) {
|
||||
Dprint(("drv_reenable_int()\n"));
|
||||
sb16_inb((DspBits == 8 ? DSP_DATA_AVL : DSP_DATA16_AVL));
|
||||
return OK;
|
||||
@@ -206,33 +206,33 @@ PUBLIC int drv_reenable_int(int UNUSED(chan)) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_int_sum(void) {
|
||||
int drv_int_sum(void) {
|
||||
return mixer_get(MIXER_IRQ_STATUS) & 0x0F;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_int(int sub_dev) {
|
||||
int drv_int(int sub_dev) {
|
||||
return sub_dev == AUDIO && mixer_get(MIXER_IRQ_STATUS) & 0x03;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_pause(int chan) {
|
||||
int drv_pause(int chan) {
|
||||
drv_stop(chan);
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_resume(int UNUSED(chan)) {
|
||||
int drv_resume(int UNUSED(chan)) {
|
||||
dsp_command((DspBits == 8 ? DSP_CMD_DMA8CONT : DSP_CMD_DMA16CONT));
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
|
||||
int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
|
||||
Dprint(("dsp_ioctl: got ioctl %d, argument: %d sub_dev: %d\n", request, val, sub_dev));
|
||||
|
||||
if(sub_dev == AUDIO) {
|
||||
@@ -246,7 +246,7 @@ PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_get_irq(char *irq) {
|
||||
int drv_get_irq(char *irq) {
|
||||
Dprint(("drv_get_irq():\n"));
|
||||
*irq = SB_IRQ;
|
||||
return OK;
|
||||
@@ -254,7 +254,7 @@ PUBLIC int drv_get_irq(char *irq) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
|
||||
int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
|
||||
Dprint(("drv_get_frag_size():\n"));
|
||||
*frag_size = DspFragmentSize;
|
||||
return OK;
|
||||
@@ -262,7 +262,7 @@ PUBLIC int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_ioctl(int request, void *val, int *len) {
|
||||
static int dsp_ioctl(int request, void *val, int *len) {
|
||||
int status;
|
||||
|
||||
switch(request) {
|
||||
@@ -281,7 +281,7 @@ PRIVATE int dsp_ioctl(int request, void *val, int *len) {
|
||||
|
||||
|
||||
|
||||
PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
|
||||
static void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
|
||||
pvb_pair_t pvb[9];
|
||||
|
||||
Dprint(("Setting up %d bit DMA\n", DspBits));
|
||||
@@ -326,7 +326,7 @@ PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_set_size(unsigned int size) {
|
||||
static int dsp_set_size(unsigned int size) {
|
||||
Dprint(("dsp_set_size(): set fragment size to %u\n", size));
|
||||
|
||||
/* Sanity checks */
|
||||
@@ -341,7 +341,7 @@ PRIVATE int dsp_set_size(unsigned int size) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_set_speed(unsigned int speed) {
|
||||
static int dsp_set_speed(unsigned int speed) {
|
||||
Dprint(("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo));
|
||||
|
||||
if(speed < DSP_MIN_SPEED || speed > DSP_MAX_SPEED) {
|
||||
@@ -369,7 +369,7 @@ PRIVATE int dsp_set_speed(unsigned int speed) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_set_stereo(unsigned int stereo) {
|
||||
static int dsp_set_stereo(unsigned int stereo) {
|
||||
if(stereo) {
|
||||
DspStereo = 1;
|
||||
} else {
|
||||
@@ -381,7 +381,7 @@ PRIVATE int dsp_set_stereo(unsigned int stereo) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_set_bits(unsigned int bits) {
|
||||
static int dsp_set_bits(unsigned int bits) {
|
||||
/* Sanity checks */
|
||||
if(bits != 8 && bits != 16) {
|
||||
return EINVAL;
|
||||
@@ -394,7 +394,7 @@ PRIVATE int dsp_set_bits(unsigned int bits) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_set_sign(unsigned int sign) {
|
||||
static int dsp_set_sign(unsigned int sign) {
|
||||
Dprint(("sb16: set sign to %u\n", sign));
|
||||
|
||||
DspSign = (sign > 0 ? 1 : 0);
|
||||
@@ -404,7 +404,7 @@ PRIVATE int dsp_set_sign(unsigned int sign) {
|
||||
|
||||
|
||||
|
||||
PRIVATE int dsp_get_max_frag_size(u32_t *val, int *len) {
|
||||
static int dsp_get_max_frag_size(u32_t *val, int *len) {
|
||||
*len = sizeof(*val);
|
||||
*val = sub_dev[AUDIO].DmaSize / sub_dev[AUDIO].NrOfDmaFragments;
|
||||
return OK;
|
||||
@@ -412,7 +412,7 @@ PRIVATE int dsp_get_max_frag_size(u32_t *val, int *len) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int dsp_command(int value) {
|
||||
int dsp_command(int value) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < SB_TIMEOUT; i++) {
|
||||
@@ -428,7 +428,7 @@ PUBLIC int dsp_command(int value) {
|
||||
|
||||
|
||||
|
||||
PUBLIC int sb16_inb(int port) {
|
||||
int sb16_inb(int port) {
|
||||
int s;
|
||||
u32_t value;
|
||||
|
||||
@@ -440,7 +440,7 @@ PUBLIC int sb16_inb(int port) {
|
||||
|
||||
|
||||
|
||||
PUBLIC void sb16_outb(int port, int value) {
|
||||
void sb16_outb(int port, int value) {
|
||||
int s;
|
||||
|
||||
if ((s=sys_outb(port, value)) != OK)
|
||||
|
||||
Reference in New Issue
Block a user