/* * vx_modify_board_clock - tell the board that its clock has been modified * @sync: DSP needs to resynchronize its FIFO
*/ staticint vx_modify_board_clock(struct vx_core *chip, int sync)
{ struct vx_rmh rmh;
vx_init_rmh(&rmh, CMD_MODIFY_CLOCK); /* Ask the DSP to resynchronize its FIFO. */ if (sync)
rmh.Cmd[0] |= CMD_MODIFY_CLOCK_S_BIT; return vx_send_msg(chip, &rmh);
}
/* * vx_read_one_cbit - read one bit from UER config * @index: the bit index * returns 0 or 1.
*/ staticint vx_read_one_cbit(struct vx_core *chip, int index)
{ int val;
/* * vx_write_one_cbit - write one bit to UER config * @index: the bit index * @val: bit value, 0 or 1
*/ staticvoid vx_write_one_cbit(struct vx_core *chip, int index, int val)
{
val = !!val; /* 0 or 1 */
mutex_lock(&chip->lock); if (vx_is_pcmcia(chip)) {
vx_outb(chip, CSUER, 0); /* write */
vx_outb(chip, RUER, (val << 7) | (index & XX_UER_CBITS_OFFSET_MASK));
} else {
vx_outl(chip, CSUER, 0); /* write */
vx_outl(chip, RUER, (val << 7) | (index & XX_UER_CBITS_OFFSET_MASK));
}
mutex_unlock(&chip->lock);
}
/* * vx_read_uer_status - read the current UER status * @mode: pointer to store the UER mode, VX_UER_MODE_XXX * * returns the frequency of UER, or 0 if not sync, * or a negative error code.
*/ staticint vx_read_uer_status(struct vx_core *chip, unsignedint *mode)
{ int val, freq;
/* Default values */
freq = 0;
/* Read UER status */ if (vx_is_pcmcia(chip))
val = vx_inb(chip, CSUER); else
val = vx_inl(chip, CSUER); if (val < 0) return val; /* If clock is present, read frequency */ if (val & VX_SUER_CLOCK_PRESENT_MASK) { switch (val & VX_SUER_FREQ_MASK) { case VX_SUER_FREQ_32KHz_MASK:
freq = 32000; break; case VX_SUER_FREQ_44KHz_MASK:
freq = 44100; break; case VX_SUER_FREQ_48KHz_MASK:
freq = 48000; break;
}
} if (val & VX_SUER_DATA_PRESENT_MASK) /* bit 0 corresponds to consumer/professional bit */
*mode = vx_read_one_cbit(chip, 0) ?
VX_UER_MODE_PROFESSIONAL : VX_UER_MODE_CONSUMER; else
*mode = VX_UER_MODE_NOT_PRESENT;
return freq;
}
/* * compute the sample clock value from frequency * * The formula is as follows: * * HexFreq = (dword) ((double) ((double) 28224000 / (double) Frequency)) * switch ( HexFreq & 0x00000F00 ) * case 0x00000100: ; * case 0x00000200: * case 0x00000300: HexFreq -= 0x00000201 ; * case 0x00000400: * case 0x00000500: * case 0x00000600: * case 0x00000700: HexFreq = (dword) (((double) 28224000 / (double) (Frequency*2)) - 1) * default : HexFreq = (dword) ((double) 28224000 / (double) (Frequency*4)) - 0x000001FF
*/
staticint vx_calc_clock_from_freq(struct vx_core *chip, int freq)
{ int hexfreq;
/* * vx_change_frequency - called from interrupt handler
*/ int vx_change_frequency(struct vx_core *chip)
{ int freq;
if (chip->chip_status & VX_STAT_IS_STALE) return 0;
if (chip->clock_source == INTERNAL_QUARTZ) return 0; /* * Read the real UER board frequency
*/
freq = vx_read_uer_status(chip, &chip->uer_detected); if (freq < 0) return freq; /* * The frequency computed by the DSP is good and * is different from the previous computed.
*/ if (freq == 48000 || freq == 44100 || freq == 32000)
chip->freq_detected = freq;
return 0;
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.