|
The following C-callable library functions are included
in the V6M6 host application library for controlling IMHC4
modules.
Each of them require, as their first argument, a PCI_MOD pointer
which is obtained using the pci_open function to access an
IMHC4 module. For example:
PCI_MOD *pci;
pci = pciopen("pci0c") /* open IMHC4 on module C of pci0 */
The imhc4_init function initializes the codecs on the IMHC4,
clears the module's interrupt mask and loads certain PCI access control
registers.
It is primarily intented for use by the pciinit program but may
be used by application programs.
int
imhc4_init(pci)
PCI_MOD *pci - pointer to open PCI_MOD structure
The imhc4_tdmclkdiv function sets TDM clock divider for the
frequency synthesizer on an IMHC4.
This function must be called to set the divider for the current TDM
clock frequency.
int
imhc4_tdmclkdiv(pci, clkdiv)
PCI_MOD *pci - pointer to open PCI_MOD structure.
int clkdiv - 0 if TDM clock is 16.048 MHz
1 if TDM clock is 8.192 MHz
2 if TDM clock is 4.096 MHz
3 if TDM clock is 2.048 MHz
The imhc4_sample function controls the sample rate and
data format for codecs on an IMHC4.
int
imhc4_sample(pci, chip, rate, format)
PCI_MOD *pci - pointer to open PCI_MOD structure.
int chip - specifies which codec chip: 0 or 1.
int rate - sample rate in kHz.
Supported values are: 8, 16, 32 or 48.
int format - data format, macros from <pciutil.h>:
IMHC4_ULAW, IMHC4_ALAW, IMHC4_LIN8,
or IMHC4_LIN16.
The imhc4_inputgain function controls the input gain for
a specified codec and audio channel on an IMHC4.
int
imhc4_inputgain(pci, chip, chan, gain)
PCI_MOD *pci - pointer to open PCI_MOD structure.
int chip - specifies which codec chip: 0 or 1.
int chan - specifies which channel: 0 for left,
1 for right or 2 for both.
double gain - input gain value: 0.0 to 42.5 dB in
1.5 dB increments. Values greater than
22.5 enable the 20 dB Mic input gain.
The imhc4_outputatten function controls the output attenuation
for a specified codec and audio channel on an IMHC4.
int
imhc4_outputatten(pci, chip, chan, atten)
PCI_MOD *pci - pointer to open PCI_MOD structure.
int chip - specifies which codec chip: 0 or 1.
int chan - specifies which channel: 0 for left,
1 for right or 2 for both.
double atten - output attenuation: 0.0 to -94.5 dB
in 1.5 dB increments. Values less
than -94.5 specify to mute the output.
The following functions provide access to the direct and indirect
registers in the codecs on an IMHC4 module for cases where additional
or more specific control of the codecs is required.
The _rd functions return the 8 bit value read from
the specified register.
int
imhc4_direct_rd(pci, codec, reg);
int
imhc4_direct_wr(pci, codec, reg, val);
int
imhc4_indirect_rd(pci, chip, reg);
int
imhc4_indirect_wr(pci, chip, reg, val);
PCI_MOD *pci - pointer to open PCI_MOD structure.
int codec - specifies which codec chip: 0 or 1.
int reg - register to read
(0 - 3 for direct, 0 - 31 for indirect)
int val - lower 8 bits are written to register.
The imhc4_instat function reads interrupt status from an
IMHC4 module, which indicates the states of the INT signals from
the two codecs.
The return value has the state on codec 0 INT in bit 0 and
codec 1 in bit 1.
Calling this function does not service the interrupt condition or
clear the status.
int
imhc4_intstat(pci)
PCI_MOD *pci - pointer to open PCI_MOD structure.
The imhc4_intenb function enables PCI interrupts from the
codecs on an IMHC4 module.
int
imhc4_intenb(pci, intmask)
PCI_MOD *pci - pointer to open PCI_MOD structure.
int intmask - specifies which codec INT signals are
enabled to PCI INTA and INTB. A 1 in
each bit enables interrupts as follows:
Bit 0 - Codec 0 Int to PCI INT A
Bit 1 - Codec 1 Int to PCI INT A
Bit 2 - unused
Bit 3 - unused
Bit 4 - Codec 0 Int to PCI INT B
Bit 5 - Codec 1 Int to PCI INT B
|