#include <linux/io.h>
#include <linux/pci.h>
#include <linux/time.h>
#include <linux/mutex.h>
#include <sound/core.h>
#include "trident.h"
#define __set_tlb_bus(trident,page,addr) …
#define __tlb_to_addr(trident,page) …
#if PAGE_SIZE == 4096
#define ALIGN_PAGE_SIZE …
#define MAX_ALIGN_PAGES …
#define set_tlb_bus(trident,page,addr) …
#define set_silent_tlb(trident,page) …
#define get_aligned_page(offset) …
#define aligned_page_offset(page) …
#define page_to_addr(trident,page) …
#elif PAGE_SIZE == 8192
#define ALIGN_PAGE_SIZE …
#define MAX_ALIGN_PAGES …
#define get_aligned_page …
#define aligned_page_offset …
#define page_to_addr …
static inline void set_tlb_bus(struct snd_trident *trident, int page,
dma_addr_t addr)
{
page <<= 1;
__set_tlb_bus(trident, page, addr);
__set_tlb_bus(trident, page+1, addr + SNDRV_TRIDENT_PAGE_SIZE);
}
static inline void set_silent_tlb(struct snd_trident *trident, int page)
{
page <<= 1;
__set_tlb_bus(trident, page, trident->tlb.silent_page->addr);
__set_tlb_bus(trident, page+1, trident->tlb.silent_page->addr);
}
#else
#define UNIT_PAGES …
#define ALIGN_PAGE_SIZE …
#define MAX_ALIGN_PAGES …
#define get_aligned_page …
#define aligned_page_offset …
#define page_to_addr …
static inline void set_tlb_bus(struct snd_trident *trident, int page,
dma_addr_t addr)
{
int i;
page *= UNIT_PAGES;
for (i = 0; i < UNIT_PAGES; i++, page++) {
__set_tlb_bus(trident, page, addr);
addr += SNDRV_TRIDENT_PAGE_SIZE;
}
}
static inline void set_silent_tlb(struct snd_trident *trident, int page)
{
int i;
page *= UNIT_PAGES;
for (i = 0; i < UNIT_PAGES; i++, page++)
__set_tlb_bus(trident, page, trident->tlb.silent_page->addr);
}
#endif
#define firstpg(blk) …
#define lastpg(blk) …
static struct snd_util_memblk *
search_empty(struct snd_util_memhdr *hdr, int size)
{ … }
static int is_valid_page(unsigned long ptr)
{ … }
static struct snd_util_memblk *
snd_trident_alloc_sg_pages(struct snd_trident *trident,
struct snd_pcm_substream *substream)
{ … }
static struct snd_util_memblk *
snd_trident_alloc_cont_pages(struct snd_trident *trident,
struct snd_pcm_substream *substream)
{ … }
struct snd_util_memblk *
snd_trident_alloc_pages(struct snd_trident *trident,
struct snd_pcm_substream *substream)
{ … }
int snd_trident_free_pages(struct snd_trident *trident,
struct snd_util_memblk *blk)
{ … }