/**
* Copyright (C) 2008, Creative Technology Ltd. All Rights Reserved.
*
* This source file is released under GPL v2 license (no other versions).
* See the COPYING file included in the main directory of this source
* distribution for the license terms and conditions.
*
* @File ctsrc.c
*
* @Brief
* This file contains the implementation of the Sample Rate Convertor
* resource management object.
*
* @Author Liu Chun
* @Date May 13 2008
*
*/
#include "ctsrc.h"
#include "cthardware.h"
#include <linux/slab.h>
#define SRC_RESOURCE_NUM 256
#define SRCIMP_RESOURCE_NUM 256
static unsigned int conj_mask;
static int src_default_config_memrd(struct src *src);
static int src_default_config_memwr(struct src *src);
static int src_default_config_arcrw(struct src *src);
static int (*src_default_config[3])(struct src *) = {
[MEMRD] = src_default_config_memrd,
[MEMWR] = src_default_config_memwr,
[ARCRW] = src_default_config_arcrw
};
static int src_set_state(struct src *src, unsigned int state)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_state(src->rsc.ctrl_blk, state);
return 0;
}
static int src_set_bm(struct src *src, unsigned int bm)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_bm(src->rsc.ctrl_blk, bm);
return 0;
}
static int src_set_sf(struct src *src, unsigned int sf)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_sf(src->rsc.ctrl_blk, sf);
return 0;
}
static int src_set_pm(struct src *src, unsigned int pm)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_pm(src->rsc.ctrl_blk, pm);
return 0;
}
static int src_set_rom(struct src *src, unsigned int rom)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_rom(src->rsc.ctrl_blk, rom);
return 0;
}
static int src_set_vo(struct src *src, unsigned int vo)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_vo(src->rsc.ctrl_blk, vo);
return 0;
}
static int src_set_st(struct src *src, unsigned int st)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_st(src->rsc.ctrl_blk, st);
return 0;
}
static int src_set_bp(struct src *src, unsigned int bp)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_bp(src->rsc.ctrl_blk, bp);
return 0;
}
static int src_set_cisz(struct src *src, unsigned int cisz)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_cisz(src->rsc.ctrl_blk, cisz);
return 0;
}
static int src_set_ca(struct src *src, unsigned int ca)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_ca(src->rsc.ctrl_blk, ca);
return 0;
}
static int src_set_sa(struct src *src, unsigned int sa)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_sa(src->rsc.ctrl_blk, sa);
return 0;
}
static int src_set_la(struct src *src, unsigned int la)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_la(src->rsc.ctrl_blk, la);
return 0;
}
static int src_set_pitch(struct src *src, unsigned int pitch)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_pitch(src->rsc.ctrl_blk, pitch);
return 0;
}
static int src_set_clear_zbufs(struct src *src)
{
struct hw *hw;
hw = src->rsc.hw;
hw->src_set_clear_zbufs(src->rsc.ctrl_blk, 1);
return 0;
}
static int src_commit_write(struct src *src)
{
struct hw *hw;
int i;
unsigned int dirty = 0;
hw = src->rsc.hw;
src->rsc.ops->master(&src->