コード例 #1
0
void read_ai_regs(void* opaque, uint32_t address, uint32_t* value)
{
    struct ai_controller* ai = (struct ai_controller*)opaque;
    uint32_t reg = ai_reg(address);

    if (reg == AI_LEN_REG)
    {
        *value = get_remaining_dma_length(ai);
        if (*value < ai->last_read)
        {
            unsigned int diff = ai->fifo[0].length - ai->last_read;
            unsigned char *p = (unsigned char*)&ai->ri->rdram->dram[ai->fifo[0].address/4];
            ai->iaout->push_samples(ai->aout, p + diff, ai->last_read - *value);
            ai->last_read = *value;
        }
    }
    else
    {
        *value = ai->regs[reg];
    }
}
コード例 #2
0
/* Reads a word from the AI MMIO register space. */
int read_ai_regs(void* opaque, uint32_t address, uint32_t* value)
{
    struct ai_controller* ai = (struct ai_controller*)opaque;
    uint32_t reg = AI_REG(address);

    if (reg == AI_LEN_REG)
    {
       *value = get_remaining_dma_length(ai);
       if (*value < ai->last_read)
       {
		   //should never read greater than the fifo length
		   unsigned int diff =ai->fifo[0].length - ai->last_read;
		   unsigned char *p = (unsigned char*)&ai->ri->rdram.dram[ai->fifo[0].address / 4];
		   ai->push_audio_samples(&ai->backend,p + diff,ai->last_read - *value);
			 
		 }
		  ai->last_read = *value;
    }
    else
        *value = ai->regs[reg];

    return 0;
}
コード例 #3
0
unsigned int AiReadLength(usf_state_t * state) {
	return get_remaining_dma_length(state);
}