Ejemplo n.º 1
0
int dsp_codec_get_bufer_data_len1(struct audiodsp_priv *priv,
				  unsigned long wd_ptr)
{
#define REVERSD_BYTES   32
#define CACHE_ALIGNED(x)    (x&(~0x1f))
	unsigned long rp, wp, len, flags;

	local_irq_save(flags);
	rp = dsp_codec_get_rd_addr(priv);
	wp = ARC_2_ARM_ADDR_SWAP(wd_ptr);
	if (rp > wp)
		len = priv->stream_buffer_size - (rp - wp);
	else
		len = (wp - rp);

	len = (len > REVERSD_BYTES) ? (len - REVERSD_BYTES) : 0;
	len = CACHE_ALIGNED(len);
	local_irq_restore(flags);
	return len;
}
Ejemplo n.º 2
0
int dsp_codec_get_bufer_data_len1(struct audiodsp_priv *priv, unsigned long wd_ptr)
{

#define REVERSD_BYTES   32
#define CACHE_ALIGNED(x)    (x&(~0x1f))
    unsigned long rp, wp, len, flags;
    //if(wd_ptr != DSP_RD(DSP_DECODE_OUT_WD_ADDR))
    //  printk("w1 == %x , w2 == %x, r == %x\n", DSP_RD(DSP_DECODE_OUT_WD_ADDR), wd_ptr, DSP_RD(DSP_DECODE_OUT_RD_ADDR));
    local_irq_save(flags);
    rp = dsp_codec_get_rd_addr(priv);
    wp = ARC_2_ARM_ADDR_SWAP(wd_ptr);
    if (rp > wp) {
        len = priv->stream_buffer_size - (rp - wp);
    } else {
        len = (wp - rp);
    }
    len = (len > REVERSD_BYTES) ? (len - REVERSD_BYTES) : 0;
    len = CACHE_ALIGNED(len);
    local_irq_restore(flags);
    return len;
}