void pcm_play_dma_postinit(void)
{
    /* Configure clock divider */
    tsc2100_writereg(CONTROL_PAGE2, TSPP1_ADDRESS, 0x1120);
    tsc2100_writereg(CONTROL_PAGE2, TSAC3_ADDRESS, 0x0800);
    tsc2100_writereg(CONTROL_PAGE2, TSCPC_ADDRESS, 0x3B00);
    tsc2100_writereg(CONTROL_PAGE2, TSAC1_ADDRESS, 0x0300);
    tsc2100_writereg(CONTROL_PAGE2, TSCSC_ADDRESS, 0xC580);
    audiohw_postinit();
}
Beispiel #2
0
void tsc2100_adc_init(void)
{
    /* Set the TSC2100 to read touchscreen */
    tsc2100_set_mode(true, 0x02);

    tsc2100_writereg(TSSTAT_PAGE, TSSTAT_ADDRESS, 
                     (0x1<<TSSTAT_PINTDAV_SHIFT) /* Data available only */
                     );

    /* An additional 2 mA can be saved here by powering down vref between
     * conversions, but it adds a click to the audio on the M:Robe 500
     */
    tsc2100_writereg(TSREF_PAGE, TSREF_ADDRESS,
                     TSREF_VREFM|TSREF_IREFV);
}
void audiohw_set_frequency(int fsel)
{
    int reg_val;
    reg_val = tsc2100_readreg(CONTROL_PAGE2, TSAC1_ADDRESS);
    
    reg_val &= ~(0x07<<3);
    
    switch(fsel) 
    {
    case HW_FREQ_8:
        reg_val |= (0x06<<3);
        break;
    case HW_FREQ_11:
        reg_val |= (0x04<<3);
        break;
    case HW_FREQ_22:
        reg_val |= (0x02<<3);
        break;
    case HW_FREQ_44:
    default:
        break;
    }

    tsc2100_writereg(CONTROL_PAGE2, TSAC1_ADDRESS, reg_val);
}
void audiohw_init(void)
{
    short val = tsc2100_readreg(TSAC4_PAGE, TSAC4_ADDRESS);
    /* disable DAC PGA soft-stepping */
    val |= TSAC4_DASTDP;
    
    tsc2100_writereg(TSAC4_PAGE, TSAC4_ADDRESS, val);
}
static void audiohw_mute(bool mute)
{
    short vol = tsc2100_readreg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS);
    /* left  mute bit == 1<<15
       right mute bit == 1<<7
     */
    if (mute) 
    {
        vol |= (1<<15)|(1<<7);
    } else 
    {
        vol &= ~((1<<15)|(1<<7));
    }
    is_muted = mute;
    tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, vol);
}
Beispiel #6
0
void tsc2100_set_mode(bool poweron, unsigned char scan_mode)
{
    short tsadc=(scan_mode<<TSADC_ADSCM_SHIFT)| /* mode */
                 (0x3<<TSADC_RESOL_SHIFT)| /* 12 bit resolution */
                 (0x2<<TSADC_ADCR_SHIFT )| /* 2 MHz internal clock */
                 (0x2<<TSADC_PVSTC_SHIFT);
                 
    if(!poweron)
    {
        tsadc|=TSADC_ADST;
    }
                 
    if(scan_mode<6)
        tsadc|=TSADC_PSTCM;
        
    tsc2100_writereg(TSADC_PAGE, TSADC_ADDRESS, tsadc);
}
void audiohw_set_master_vol(int vol_l, int vol_r)
{
   tsc2100_writereg(TSDACGAIN_PAGE, TSDACGAIN_ADDRESS, (short)((vol_l<<8) | vol_r) );
}
Beispiel #8
0
void tsc2100_keyclick(void)
{
    // 1100 0100 0001 0000
    //short val = 0xC410;
    tsc2100_writereg(TSAC2_PAGE, TSAC2_ADDRESS, tsc2100_readreg(TSAC2_PAGE, TSAC2_ADDRESS)&0x8000);
}