Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

dma_mx2.c File Reference

Detailed Description

This file contains functions for DMA API.

Definition in file dma_mx2.c.

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/sched.h>
#include <linux/mman.h>
#include <linux/init.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <linux/clk.h>
#include <linux/proc_fs.h>
#include <linux/io.h>
#include <mach/hardware.h>
#include <mach/dma.h>
#include <asm/delay.h>
#include <asm/atomic.h>

Go to the source code of this file.


#define flush_dma_bd(private)
 flush buffer descriptor ring
#define next_dma_bd(private)
 get next buffer discriptor
#define restore_dma_interrupt(flags)   __raw_writel(flags, IO_ADDRESS(DMA_BASE_ADDR) + DMA_DIMR)
 restore the mask of dma interrupts
#define save_dma_interrupt(flags)   flags = __raw_readl(IO_ADDRESS(DMA_BASE_ADDR) + DMA_DIMR)
 save the mask of dma interrupts


static unsigned long __clear_dma_interrupt (int channel)
 clean all event of dma interrupt and return the valid event.
static void __disable_dma_clk (void)
 This function disables dma clocks without lock.
static void __enable_dma_clk (void)
 This function enables dma clocks without lock.
static unsigned long __get_dma_interrupt (int channel)
 get interrupt event of dma channel
static int __init_dma_channel (mxc_dma_channel_t *chan, mx2_dma_info_t *dma_info)
 setup interrupt and setup dma channel by dma parameter
 arch_initcall (mxc_dma_init)
static int consume_dma_bd (mxc_dma_channel_t *dma, int error)
 select next buffer descripter to transfer. return 1: need call call-back function. 0: Not need call call-back. it just is called in ISR
static DEFINE_SPINLOCK (dma_list_lock)
static void disable_dma_clk (void)
 This function disables dma clocks without locked.
static irqreturn_t dma_irq_handler (int irq, void *dev_id)
 interrupt handler of dma channel
static void enable_dma_clk (void)
 This function enables dma clocks with lock.
 EXPORT_SYMBOL (mxc_dump_dma_register)
 EXPORT_SYMBOL (mxc_dma_sg_config)
 EXPORT_SYMBOL (mxc_dma_config)
 EXPORT_SYMBOL (mxc_dma_disable)
 EXPORT_SYMBOL (mxc_dma_enable)
 EXPORT_SYMBOL (mxc_dma_callback_set)
 EXPORT_SYMBOL (mxc_dma_free)
 EXPORT_SYMBOL (mxc_dma_request_ext)
static int fill_dma_bd (mxc_dma_channel_t *dma, mxc_dma_requestbuf_t *buf, int num, mxc_dma_mode_t mode)
 add dma buffer into buffer descriptor ring
static int fill_dma_bd_by_sg (mxc_dma_channel_t *dma, struct scatterlist *sg, int num, int real_bytes, mxc_dma_mode_t mode)
 add sg-list into buffer descriptor ring
static int get_dma_channel (int idx)
 allocate a dma channel.
static void init_dma_bd (mx2_dma_priv_t *private)
 initialize buffer descriptor ring.
static void mask_dma_interrupt (int channel)
 disable interrupt of dma channel
int mxc_dma_callback_set (int channel_num, mxc_dma_callback_t callback, void *arg)
int mxc_dma_config (int channel_num, mxc_dma_requestbuf_t *dma_buf, int num_buf, mxc_dma_mode_t mode)
int mxc_dma_disable (int channel_num)
int mxc_dma_enable (int channel_num)
int mxc_dma_free (int channel_num)
int __init mxc_dma_init (void)
int mxc_dma_request_ext (mxc_dma_device_t channel_id, char *dev_name, struct dma_channel_info *info)
int mxc_dma_sg_config (int channel_num, struct scatterlist *sg, int num_buf, int num_of_bytes, mxc_dma_mode_t mode)
void mxc_dump_dma_register (int channel)
 Dump DMA registers.
static int mxc_get_dma_list (char *buf)
 Get dma list for /proc/dma.
static void put_dma_channel (int idx)
 release a dma channel.
static int setup_dma_channel (mxc_dma_channel_t *dma, mx2_dma_info_t *dma_info)
 Set DMA channel parameters.
static void setup_dmac (mxc_dma_channel_t *dma)
 select a buffer to transfer and setup dma channel for current transfer
static void unmask_dma_interrupt (int channel)
 enable interrupt of dma channel


static struct clk * dma_clk
static atomic_t g_dma_actived = ATOMIC_INIT(0)
static mx2_dma_bd_t g_dma_bd_table [MXC_DMA_CHANNELS][MAX_BD_SIZE]
static mxc_dma_channel_t g_dma_channels [MAX_DMA_CHANNELS]
static mx2_dma_priv_t g_dma_privates [MXC_DMA_CHANNELS]
static struct proc_dir_entry * g_proc_dir

Generated by  Doxygen 1.6.0   Back to index