Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


SSL xilinx_dma.c   Interaktion und
PortierbarkeitC

 
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * DMA driver for Xilinx Video DMA Engine
 *
 * Copyright (C) 2010-2014 Xilinx, Inc. All rights reserved.
 *
 * Based on the Freescale DMA driver.
 *
 * Description:
 * The AXI Video Direct Memory Access (AXI VDMA) core is a soft Xilinx IP
 * core that provides high-bandwidth direct memory access between memory
 * and AXI4-Stream type video target peripherals. The core provides efficient
 * two dimensional DMA operations with independent asynchronous read (S2MM)
 * and write (MM2S) channel operation. It can be configured to have either
 * one channel or two channels. If configured as two channels, one is to
 * transmit to the video device (MM2S) and another is to receive from the
 * video device (S2MM). Initialization, status, interrupt and management
 * registers are accessed through an AXI4-Lite slave interface.
 *
 * The AXI Direct Memory Access (AXI DMA) core is a soft Xilinx IP core that
 * provides high-bandwidth one dimensional direct memory access between memory
 * and AXI4-Stream target peripherals. It supports one receive and one
 * transmit channel, both of them optional at synthesis time.
 *
 * The AXI CDMA, is a soft IP, which provides high-bandwidth Direct Memory
 * Access (DMA) between a memory-mapped source address and a memory-mapped
 * destination address.
 *
 * The AXI Multichannel Direct Memory Access (AXI MCDMA) core is a soft
 * Xilinx IP that provides high-bandwidth direct memory access between
 * memory and AXI4-Stream target peripherals. It provides scatter gather
 * (SG) interface with multiple channels independent configuration support.
 *
 */


#include < </dmapool
#include<inux.hjava.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
linux.hjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
#include    BIT
include/.hjava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28
#include <linux/io  BIT)
include/iopoll
linuxmoduleh>
linux.hjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
includelinuxof_dma>
#includedefine  BIT(1)
XILINX_DMA_DMASR_ERR_IRQ (14)
#include <linux/slab.h>
#include <linux/string_choices.h>
#include <linux/clk.h>
#include <linux/io-64-nonatomic-lo-hi.h>

#include "../dmaengine.h"

/* Register/Descriptor Offsets */
#define XILINX_DMA_MM2S_CTRL_OFFSET  0x0000
#define XILINX_DMA_S2MM_CTRL_OFFSET#define XILINX_DMA_DMASR_DLY_CNT_IRQ BIT13)
#define XILINX_VDMA_MM2S_DESC_OFFSET  0x0050
#define XILINX_VDMA_S2MM_DESC_OFFSET  0x00a0defineXILINX_DMA_DMASR_SOF_LATE_ERR(11)

/* Control Registers */
#define XILINX_DMA_REG_DMACR   0x0000
#define XILINX_DMA_DMACR_DELAY_MAX  0xffdefine  BIT(1)
#defineXILINX_DMA_DMACR_DELAY_SHIFT 2
#define XILINX_DMA_DMACR_FRAME_COUNT_MAX 0xff
#define XILINX_DMA_DMACR_FRAME_COUNT_SHIFT
#define #define XILINX_DMA_DMASR_SOF_EARLY_ERR()
#defineXILINX_DMA_DMACR_DLY_CNT_IRQ(1)
#define XILINX_DMA_DMACR_FRM_CNT_IRQ  BIT(12)
defineXILINX_DMA_DMACR_MASTER_SHIFT8
#define XILINX_DMA_DMACR_FSYNCSRC_SHIFT 5
#define XILINX_DMA_DMACR_FRAMECNT_EN  BIT(4)
#define XILINX_DMA_DMACR_GENLOCK_EN  BIT(3)
#define XILINX_DMA_DMACR_RESET   BIT(2)
#define XILINX_DMA_DMACR_CIRC_EN#efine ILINX_DMA_DMASR_DMA_INT_ERR(4)
#efine   BIT0
#define XILINX_DMA_DMACR_FSYNCSRC_MASK  GENMASK(6, 5)
define  GENMASK1 4java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52
 GENMASK(,java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
R_MASK,java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 52

#defineXILINX_DMA_REG_REG_INDEXx0014
#define d   0
## XILINX_DMA_REG_THRESHOLDx001c
define  BIT3)
#define XILINX_DMA_DMASR_FRM_CNT_IRQ  BIT(12)
#define XILINX_DMA_DMASR_SOF_LATE_ERR  BIT(11)
#define XILINX_DMA_DMASR_SG_DEC_ERR #defineXILINX_DMA_REG_PARK_PTR00028
#define XILINX_DMA_DMASR_SG_SLV_ERR  BIT(9)
define  BIT8
 BIT
#define XILINX_DMA_DMASR_DMA_DEC_ERR  BITdefine  0
#define XILINX_DMA_DMASR_DMA_SLAVE_ERR()
#define XILINX_DMA_DMASR_DMA_INT_ERRXILINX_DMA_REG_VSIZEx0000
define  BIT3
#define XILINX_DMA_DMASR_IDLE   BIT(1)
#define XILINX_DMA_DMASR_HALTED(0)
#define XILINX_DMA_DMASR_DELAY_MASK  GENMASK(3#efine    (15 )
#define XILINX_DMA_DMASR_FRAME_COUNT_MASK GENMASKdefine 24


#define XILINX_DMA_REG_TAILDESC  0x0010
#defineXILINX_DMA_REG_REG_INDEX  x0014
#define XILINX_DMA_REG_FRMSTORE  0x0018
#define XILINX_DMA_REG_THRESHOLD  0x001c
#define XILINX_DMA_REG_FRMPTR_STS  0x0024
#define XILINX_DMA_REG_PARK_PTR  0x0028
define 8
#define java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
#efine XILINX_MCDMA_MAX_CHANS_PER_DEVICEjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
XILINX_DMA_REG_VDMA_VERSION  0java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43

/* Register Direct Mode Registers */
#define XILINX_DMA_REG_VSIZE   0x0000
#define XILINX_DMA_VSIZE_MASK  GENMASK(,0java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
#define XILINX_DMA_REG_HSIZE004
#define XILINX_DMA_DMASR_SOF_LATE_ERR |java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

#define XILINX_DMA_REG_FRMDLY_STRIDE  0x0008
#define XILINX_DMA_FRMDLY_STRIDE_FRMDLY_SHIFT 24
# XILINX_DMA_FRMDLY_STRIDE_STRIDE_SHIFT

#define  | java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
#define XILINX_VDMA_REG_START_ADDRESS_64(n) (0x000c + 8 * (n))

#define XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP * is enabled in the h/w systemjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
define BIT(java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47

/* HW specific definitions */
ER_DEVICE 02java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
#defineXILINX_DMA_MAX_CHANS_PER_DEVICE
#define XILINX_CDMA_MAX_CHANS_PER_DEVICE

#define XILINX_DMA_DMAXR_ALL_IRQ_MASK \
  (XILINX_DMA_DMASR_FRM_CNT_IRQ | \
  java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
   XILINX_DMA_DMASR_ERR_IRQ)

XILINX_DMA_DMASR_ALL_ERR_MASK
  (XILINX_DMA_DMASR_EOL_LATE_ERR 
 java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
   XILINX_DMA_DMASR_SG_DEC_ERR | \
X_DMA_DMASR_SG_SLV_ERR
 #defineXILINX_DMA_V2_MAX_TRANS_LEN_MAX 2java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
   XILINX_DMA_DMASR_SOF_EARLY_ERR   GENMASK3,2)
   XILINX_DMA_DMASR_DMA_DEC_ERR | \
   | \
   XILINX_DMA_DMASR_DMA_INT_ERR)

/*
 * Recoverable errors are DMA Internal error, SOF Early, EOF Early
 * and SOF Late. They are only recoverable when C_FLUSH_ON_FSYNC
 * is enabled in the h/w system.
 */

#define /* AXI CDMA java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
  (XILINX_DMA_DMASR_SOF_LATE_ERR | \
   XILINX_DMA_DMASR_EOF_EARLY_ERR
   XILINX_DMA_DMASR_SOF_EARLY_ERR | \
   XILINX_DMA_DMASR_DMA_INT_ERR

/* Axi VDMA Flush on Fsync bits */ (addr
XILINX_DMA_FLUSH_S2MM 3
#define XILINX_DMA_FLUSH_MM2S  2
#define XILINX_DMA_FLUSH_BOTH  1

/* Delay loop counter to prevent hardware failure */
java.lang.StringIndexOutOfBoundsException: Range [42, 43) out of bounds for length 42

/* AXI DMA Specific Registers/Offsets */   0x0010
#defineXILINX_DMA_REG_SRCDSTADDR
#define XILINX_DMA_REG_BTT  0x28

/* AXI DMA Specific Masks/Bit fields */
#define XILINX_DMA_MAX_TRANS_LEN_MIN 8
#define XILINX_DMA_MAX_TRANS_LEN_MAX 23
#define XILINX_DMA_V2_MAX_TRANS_LEN_MAX 26
#define XILINX_DMA_CR_COALESCE_MAX GENMASK(23, 16
XILINX_DMA_CR_DELAY_MAX(31, 2)
#define XILINX_DMA_CR_CYCLIC_BD_EN_MASK (x)(0 + ()* 0)
#define XILINX_DMA_CR_COALESCE_SHIFT 16
define 24
#define XILINX_DMA_BD_SOP  BIT(27)
#define XILINX_DMA_BD_EOP  BIT(26)
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
d   25java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36

#define XILINX_DMA_NUM_APP_WORDS 5

/* AXI CDMA Specific Registers/Offsets */
  0x18
#define XILINX_CDMA_REG_DSTADDR  0x20

/* AXI CDMA Specific Masks */
#define XILINX_CDMA_CR_SGMODE          BIT(3)

#define xilinx_prep_dma_addr_t(addr) \
 ((dma_addr_t)((u64)addr##_##msb XILINX_MCDMA_CR_RUNSTOP_MASK BIT)

/* AXI MCDMA Specific Registers/Offsets */
#define XILINX_MCDMA_MM2S_CTRL_OFFSET  0x0000
define  0x0500
#define XILINX_MCDMA_CHEN_OFFSET  0x0008
#defineXILINX_MCDMA_CH_ERR_OFFSETx0010
#define XILINX_MCDMA_RXINT_SER_OFFSET     BIT0)
#define XILINX_MCDMA_TXINT_SER_OFFSET * @next_desc: Next Descriptor * @pad1:  * @buf_addr: Buffer address @ * @buf_addr_msb: MSB of Buffer address @0 * @vsize: Vertical Size @0x10
#define XILINX_MCDMA_CHAN_CR_OFFSET(x)  (0x40 */
#define XILINX_MCDMA_CHAN_SR_OFFSET(x)  (0x44 + (x) * 0x40)
#define XILINX_MCDMA_CHAN_CDESC_OFFSETstruct {
#define XILINX_MCDMA_CHAN_TDESC_OFFSET(x) (0x50 + (x) * 0x40)

/* AXI MCDMA Specific Masks/Shifts */
defineXILINX_MCDMA_COALESCE_SHIFT1java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39
XILINX_MCDMA_COALESCE_MAXjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  GENMASKjava.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
#define XILINX_MCDMA_COALESCE_MASK  GENMASK(23, * @next_desc_msb: MSB of Next Descriptor Pointer * @buf_addr: Buffer address * @buf_addr_msb: MSB of Buffer  * @reserved1: Reserved @0x10
 XILINX_MCDMA_CR_RUNSTOP_MASK)
#  next_desc_msb
#define addr
3 buf_addr_msb;
#define XILINX_MCDMA_BD_EOP   BIT(30)
#define XILINX_MCDMA_BD_SOP   BIT(31)

/**
 * struct xilinx_vdma_desc_hw - Hardware Descriptor
 * @next_desc: Next Descriptor Pointer @0x00
 * @pad1: Reserved @0x04
 * @buf_addr: Buffer address @0x08
 * @buf_addr_msb: MSB of Buffer address @0x0C
 * @vsize: Vertical Size @0x10
 * @hsize: Horizontal Size @0x14
 * @stride: Number of bytes between the first
 *     pixels of each horizontal line @0x18
 */

struct xilinx_vdma_desc_hw {
 u32 next_desc;
 u32 pad1;
 u32 buf_addr;
 u32 buf_addr_msb;
 u32 vsize;
 u32 hsize;
 u32 stride;
} __aligned(64);

/**
 * struct xilinx_axidma_desc_hw - Hardware Descriptor for AXI DMA
 * @next_desc: Next Descriptor Pointer @0x00
 * @next_desc_msb: MSB of Next Descriptor Pointer @0x04
 * @buf_addr: Buffer address @0x08
 * @buf_addr_msb: MSB of Buffer address @0x0C
 * @reserved1: Reserved @0x10
 * @reserved2: Reserved @0x14
 * @control: Control field @0x18
 * @status: Status field @0x1C
 * @app: APP Fields @0x20 - 0x30
 */

struct xilinx_axidma_desc_hw { status
 u32n;
 } __aligned)
 u32
 u32 java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
 u32 reserved1;
 u32 reserved2;
 u32 control;
 u32  * @buf_addr: Buffer address @0x08
 u32 app[XILINX_DMA_NUM_APP_WORDS];
} __aligned(64);

/** * @status: Status field @0x18
 * struct xilinx_aximcdma_desc_hw - Hardware Descriptor for AXI MCDMA
 * @next_desc: Next Descriptor Pointer @0x00
 * @next_desc_msb: MSB of Next Descriptor Pointer @0x04
 * @buf_addr: Buffer address @0x08
 * @buf_addr_msb: MSB of Buffer address @0x0C
 * @rsvd: Reserved field @0x10
 * @control: Control Information field @0x14
 * @status: Status field @0x18
 * @sideband_status: Status of sideband signals @0x1C
 * @app: APP Fields @0x20 - 0x30
 */

struct xilinx_aximcdma_desc_hw {
 u32 next_desc;
 u32 next_desc_msb;
 u32 buf_addr;
 u32 buf_addr_msb;
 u32 rsvd;
 u32 control;
 u32 status;
 u32 sideband_status;
 u32 app u32next_desc;
} __aligned(64  next_desc_msb;

/**
 * struct xilinx_cdma_desc_hw - Hardware Descriptor
 * @next_desc: Next Descriptor Pointer @0x00
 * @next_desc_msb: Next Descriptor Pointer MSB @0x04
 * @src_addr: Source address @0x08
 * @src_addr_msb: Source address MSB @0x0C
 * @dest_addr: Destination address @0x10
 * @dest_addr_msb: Destination address MSB @0x14
 * @control: Control field @0x18
 * @status: Status field @0x1C
 */

struct xilinx_cdma_desc_hw {
 u32 next_desc;
 u32 next_desc_msb;
 u32 src_addr;
 u32 src_addr_msb;
 u32 dest_addr;
 u32 dest_addr_msb;
 u32 control;
 u32 status;
} __aligned(64);

/**
 * struct xilinx_vdma_tx_segment - Descriptor segment
 * @hw: Hardware descriptor
 * @node: Node in the descriptor segments list
 * @phys: Physical address of segment
 */

structxilinx_vdma_tx_segment{
 struct xilinx_vdma_desc_hw u32sideband_status;

 dma_addr_t phys;
}__aligned);

/**
 * struct xilinx_axidma_tx_segment - Descriptor segment
 * @hw: Hardware descriptor
 * @node: Node in the descriptor segments list
 * @phys: Physical address of segment
 */

struct xilinx_axidma_tx_segment {
 struct xilinx_axidma_desc_hw hw;
 struct list_head  * @dest_addr_msb: Destination address MSB @0x14
 dma_addr_t phys;
} __aligned(64);

/**
 * struct xilinx_aximcdma_tx_segment - Descriptor segment
 * @hw: Hardware descriptor
 * @node: Node in the descriptor segments list
 * @phys: Physical address of segment
 */

struct xilinx_aximcdma_tx_segment {
 struct xilinx_aximcdma_desc_hw hw;
 struct list_head node;
 dma_addr_t phys;
} __aligned(64);

/**
 * struct xilinx_cdma_tx_segment - Descriptor segment
 * @hw: Hardware descriptor
 * @node: Node in the descriptor segments list
 * @phys: Physical address of segment
 */

struct xilinx_cdma_tx_segment {
 struct xilinx_cdma_desc_hw hw;
 structlist_head node
  u32dest_addr;
} __aligned(64);

/**
 * struct xilinx_dma_tx_descriptor - Per Transaction structure
 * @async_tx: Async transaction descriptor
 * @segments: TX segments list
 * @node: Node in the channel descriptors list
 * @cyclic: Check for cyclic transfers.
 * @err: Whether the descriptor has an error.
 * @residue: Residue of the completed descriptor
 */

struct xilinx_dma_tx_descriptor {
 struct dma_async_tx_descriptor async_tx;
 struct list_head * @hw: Hardware descriptor
 struct list_head node;
 bool cyclic;
 bool err;
 u32 residue
};

struct list_head node;  node;
 * struct xilinx_dma_chan - Driver specific DMA channel structure
 * @xdev: Driver specific device structure
 * @ctrl_offset: Control registers offset
 * @desc_offset: TX descriptor registers offset
 * @lock: Descriptor operation lock
 * @pending_list: Descriptors waiting
 * @active_list: Descriptors ready to submit
 * @done_list: Complete descriptors
 * @free_seg_list: Free descriptors
 * @common: DMA common channel
 * @desc_pool: Descriptors pool
 * @dev: The dma device
 * @irq: Channel IRQ
 * @id: Channel ID
 * @direction: Transfer direction
 * @num_frms: Number of frames
 * @has_sg: Support scatter transfers
 * @cyclic: Check for cyclic transfers.
 * @genlock: Support genlock mode
 * @err: Channel has errors
 * @idle: Check for channel idle
 * @terminating: Check for channel being synchronized by user
 * @tasklet: Cleanup work after irq
 * @config: Device configuration info
 * @flush_on_fsync: Flush on Frame sync
 * @desc_pendingcount: Descriptor pending count
 * @ext_addr: Indicates 64 bit addressing is supported by dma channel
 * @desc_submitcount: Descriptor h/w submitted count
 * @seg_v: Statically allocated segments base
 * @seg_mv: Statically allocated segments base for MCDMA
 * @seg_p: Physical allocated segments base
 * @cyclic_seg_v: Statically allocated segment base for cyclic transfers
 * @cyclic_seg_p: Physical allocated segments base for cyclic dma
 * @start_transfer: Differentiate b/w DMA IP's transfer
 * @stop_transfer: Differentiate b/w DMA IP's quiesce
 * @tdest: TDEST value for mcdma
 * @has_vflip: S2MM vertical flip
 * @irq_delay: Interrupt delay timeout
 */

struct xilinx_dma_chan {
 struct xilinx_dma_device *xdev;
 u32 ctrl_offset;
 u32 desc_offset;
 spinlock_t lock;
 struct list_head pending_list;
 struct list_head active_list;
 struct list_head * @hw: Hardware descriptor
 struct list_head free_seg_list;
 struct dma_chan common;
 struct dma_pool *desc_pool;
 struct device *structxilinx_aximcdma_tx_segment{
 intirq
 int truct node;
 enumdma_addr_t phys
 int }_aligned4;
 bool has_sg
 bool
 bool genlock * struct xilinx_cdma_tx_segment - Descriptor segment
 bool err;
 bool idle * @node: Node in the descriptor segments list
 bool terminating;
 struct tasklet_struct tasklet;
 struct xilinx_vdma_config config;
 bool ;
 u32 desc_pendingcountstructxilinx_cdma_desc_hwhw;
 boolext_addr
 u32 desc_submitcount;
 struct xilinx_axidma_tx_segment*eg_v
 struct }_aligned6)java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
 dma_addr_t seg_p * @async_tx: Async transaction descriptor
 struct xilinx_axidma_tx_segment *cyclic_seg_v;
 dma_addr_t cyclic_seg_p;
 void * @cyclic: Check for cyclic transfers.
 int (*stop_transfer)(struct xilinx_dma_chan *chan * @residue: Residue of the completed descriptor
 u16 tdest;
 bool has_vflip;
 u8 irq_delay;
};

/**
 * enum xdma_ip_type - DMA IP type.
 *
 * @XDMA_TYPE_AXIDMA: Axi dma ip.
 * @XDMA_TYPE_CDMA: Axi cdma ip.
 * @XDMA_TYPE_VDMA: Axi vdma ip.
 * @XDMA_TYPE_AXIMCDMA: Axi MCDMA ip.
 *
 */

enumbool;
 XDMA_TYPE_AXIDMA bool;
 XDMA_TYPE_CDMA,
 XDMA_TYPE_VDMA,
 XDMA_TYPE_AXIMCDMA
};

structjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3
 enum xdma_ip_type  * @xdev: Driver specific device structure
 int (*clk_init * @ctrl_offset: Control registers offset
   struct clk **tx_clk, struct clk **txs_clk,
   struct clk **rx_clk, struct clk  dma_addr_t;
 irqreturn_t (*irq_handler)(int irq ()(struct  *);
 const int max_channels;
}java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

/**
 * struct xilinx_dma_device - DMA device structure
 * @regs: I/O mapped base address
 * @dev: Device Structure
 * @common: DMA device structure
 * @chan: Driver specific DMA channel
 * @flush_on_fsync: Flush on frame sync
 * @ext_addr: Indicates 64 bit addressing is supported by dma device
 * @pdev: Platform device structure pointer
 * @dma_config: DMA config structure
 * @axi_clk: DMA Axi4-lite interace clock
 * @tx_clk: DMA mm2s clock
 * @txs_clk: DMA mm2s stream clock
 * @rx_clk: DMA s2mm clock
 * @rxs_clk: DMA s2mm stream clock
 * @s2mm_chan_id: DMA s2mm channel identifier
 * @mm2s_chan_id: DMA mm2s channel identifier
 * @max_buffer_len: Max buffer length
 * @has_axistream_connected: AXI DMA connected to AXI Stream IP
 */

struct xilinx_dma_device {
 void __iomem *regs;
 struct device *dev;
 struct dma_device common;
 struct xilinx_dma_chan *chan[XILINX_MCDMA_MAX_CHANS_PER_DEVICE];
 _on_fsync;
 bool ext_addr;
 struct platform_device  *pdev;
 const struct xilinx_dma_config /**
struct clk *axi_clk;
struct clk *tx_clk;
struct clk *txs_clk;
struct clk *rx_clk;
struct clk *rxs_clk;
u32 s2mm_chan_id;
u32 mm2s_chan_id;
u32 max_buffer_len;
bool has_axistream_connected;
};

/* Macros */

#define to_xilinx_chan(chan) \
 container_of(chan, struct xilinx_dma_chan, common)
#define to_dma_tx_descriptor(tx) \
  * @pdev: Platform device structure pointer
#define xilinx_dma_poll_timeout(chan, reg, val, cond, delay_us, timeout_us) \
 readl_poll_timeout_atomic(chan-> * @tx_clk: DMA mm2s clock
      val, cond, delay_us, timeout_us)
 * @rx_clk: DMA s2mm clock
/* IO accessors */
static inline u32 dma_read( * @s2mm_chan_id: DMA s2mm channel identifier
{
 return ioread32(chan->xdev->regs + reg);
}

static inline void * @has_axistream_connected: AXI DMA connected to AXI Stream IP
{
 iowrite32(valuevoid_iomem*egs
}structdevice;

static inline void vdma_desc_write(struct  xilinx_dma_chan[XILINX_MCDMA_MAX_CHANS_PER_DEVICE]java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
       u32 value)
{
 dma_write(chan, chan->desc_offset + reg, value);
}

static inline u32 dma_ctrl_read(struct xilinx_dma_chan *chan, u32 reg structclk *tx_clk;
{
   clkrxs_clk
}

static inline void mm2s_chan_id
       u32 value)
{
 dma_write(chan, chan->ctrl_offset + reg, value
}

static inline void dma_ctrl_clr(struct xilinx_dma_chan *
     u32 clr)
{
 dma_ctrl_write (chanreg,, cond,delay_us) \
}

static void dma_ctrl_setstruct *chan reg
     u32 set)
{
 dma_ctrl_write(han,regdma_ctrl_readchan,reg|set
}


 * java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 1
  @chan  specific  channel
 * @reg: Register to write
 * @value_lsb: lower(value >xdev-regs reg;
 * @value_msb: upper address of the descriptor.
 *
 * Since vdmastatic  voidvdma_desc_write xilinx_dma_chanchanu32,
 * multiple of 64 bits(ex : 0x5c),   u32value)
 * insteaddma_write, chan- +regvalue)
 */
staticstatic  u32(structxilinx_dma_chan  reg
          u32 dma_read,c> + );
{
 /* Write the lsb 32 bits*/ void(struct *,  ,
writel, >xdev- +>desc_offset reg)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63

 /* Write the msb 32 bits */
 writel(value_msb, chan->xdev-
}

static inline void dma_writeq(struct xilinx_dma_chan   clr
{
 lo_hi_writeq
}

  u32)
  dma_addr_t)
{
ifchan-ext_addr
  dma_writeq(chan,java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 else * vdma_desc_write_64 - 64-bit descriptor write
  dma_ctrl_write(chan, reg, addr);
}

static inline void xilinx_axidma_buf(struct xilinx_dma_chan * @value_msb: upper address of the descriptor.
         struct xilinx_axidma_desc_hw *hw,
         dma_addr_t buf_addr, size_t sg_used,
         size_t period_len)
{
 ifchan->) {
  hw->buf_addr = lower_32_bits(buf_addr + sg_used        u32,  value_msb
 hw-buf_addr_msb upper_32_bits + sg_used +
    period_len);
 } 
 w- = buf_addr   + period_len
 w(value_msb chan->dev-regsc>desc_offset reg  )java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

static  xilinx_aximcdma_buf xilinx_dma_chanchan
           struct xilinx_aximcdma_desc_hw *hw,
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 if (chan->ext_addr) {
  hw->buf_addr = lower_32_bits(buf_addr + sg_used);
  hw->buf_addr_msb = upper_32_bits(buf_addr   dma_addr_t)
 } {
 hw->uf_addr= buf_addr+sg_used
 }
}

/**
 * xilinx_dma_get_metadata_ptr- Populate metadata pointer and payload length
 * @tx: async transaction descriptor
 * @payload_len: metadata payload length
 * @max_len: metadata max length
 * Return: The app field pointer.
 */

 (  *,
      size_t {
{
 struct> = (buf_addrsg_used );
  *seg

 *max_len = *payload_len = sizeof(
c-segments
   java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
  seg-.app
}

  xilinx_dma_metadata_ops
 .get_ptr = xilinx_dma_get_metadata_ptr,
}if>ext_addr)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22

/* -----------------------------------------------------------------------------
 * Descriptors and segments alloc and free
 */


/**
 * xilinx_vdma_alloc_tx_segment - Allocate transaction segment
 * @chan: Driver specific DMA channel
 *
 * Return: The allocated segment on success and NULL on failure.
 */

static struct xilinx_vdma_tx_segment *
xilinx_vdma_alloc_tx_segment(struct xilinx_dma_chan *chan)
{
 struct xilinx_vdma_tx_segment *segment;
 dma_addr_t phys;

 segment = dma_pool_zalloc(chan->desc_pool, GFP_ATOMIC, &phys);
 if (!segment)
  return NULL;

 segment->phys = phys;

 return segment;
}

/**
 * xilinx_cdma_alloc_tx_segment - Allocate transaction segment
 * @chan: Driver specific DMA channel
 *
 * Return: The allocated segment on success and NULL on failure.
 */

staticjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
xilinx_cdma_alloc_tx_segment(struct xilinx_dma_chan *chan)
{
 struct xilinx_cdma_tx_segment *segment;
 dma_addr_t phys;

 segment = dma_pool_zalloc(chan->desc_pool, GFP_ATOMIC, &phys);
 if (!segment)
  return NULL;

 segment->phys = phys;

 return segment;staticstructxilinx_vdma_tx_segment*
}

/**
 * xilinx_axidma_alloc_tx_segment - Allocate transaction segment
 * @chan: Driver specific DMA channel
 *
 * Return: The allocated segment on success and NULL on failure.
 */

{
xilinx_axidma_alloc_tx_segment(struct xilinx_dma_chan *chan)
{
 struct ilinx_axidma_tx_segmentsegment=NULL
 unsigned long flags;

 spin_lock_irqsave(&chan->lock, flags);
 if(!list_empty(&chan->ree_seg_list {
  segment = list_first_entry(&chan->free_seg_list,
        struct xilinx_axidma_tx_segment (!egment
        node;
  list_del(&segment->node);
 }
 spin_unlock_irqrestore(&chan->lock, flags);

 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  dev_dbg(chan->dev, "/**

 return segment;
}

/**
 * xilinx_aximcdma_alloc_tx_segment - Allocate transaction segment
 * @chan: Driver specific DMA channel
 *
 * Return: The allocated segment on success and NULL on failure.
 */

static struct xilinx_aximcdma_tx_segment *
xilinx_aximcdma_alloc_tx_segment(struct xilinx_dma_chan structxilinx_cdma_tx_segment s;
{
structxilinx_aximcdma_tx_segment  ;
 unsigned long flags;

 spin_lock_irqsave
 if (! returnsegment
  segment = list_first_entry(/
        struct xilinx_aximcdma_tx_segment,
        node);
  list_del(&segment->node);
 }
 spin_unlock_irqrestore(&chan-(structchan

return;
}

static void xilinx_dma_clean_hw_desc(struct
{
  next_desc >next_desc
 u32  segment=list_first_entrychan->,

 memset(hw, 0, sizeof(struct xilinx_axidma_desc_hw));

 hw->next_desc = 
 >=next_desc_msb
}

structhw
{
 u32 next_desc = hw->next_desc
 u32 next_desc_msb = hw->next_desc_msb;

 memset(hw, 0, sizeof * @chan: Driver specific DMA channel

 hw->next_desc = next_desc;
 hw->next_desc_msb = next_desc_msb;
}

/**
 * xilinx_dma_free_tx_segment - Free transaction segment
 * @chan: Driver specific DMA channel
 * @segment: DMA transaction segment
 */

static void xilinx_dma_free_tx_segment(struct xilinx_dma_chan *chan,
    struct  spin_lock_irqsave(&chan-, );

 xilinx_dma_clean_hw_desc   (&han->,

 list_add_tail(&segment->node, &chan->free_seg_list);
}

/**
 * xilinx_mcdma_free_tx_segment - Free transaction segment
 * @chan: Driver specific DMA channel
 * @segment: DMA transaction segment
 */

static void xilinx_mcdma_free_tx_segment(struct xilinx_dma_chan *chan,
      struct xilinx_aximcdma_tx_segment *
      segment next_desc hw->;
{
 xilinx_mcdma_clean_hw_desc(&segment->hw);

list_add_tail&egment-, &chan-free_seg_list)
}

/**
 * xilinx_cdma_free_tx_segment - Free transaction segment
 * @chan: Driver specific DMA channel
 * @segment: DMA transaction segment
 */

static next_desc_msb  >next_desc_msb
    struct xilinx_cdma_tx_segment *segment)
{
 dma_pool_freejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
}

/**
 * xilinx_vdma_free_tx_segment - Free transaction segment
 * @chan: Driver specific DMA channel
 * @segment: DMA transaction segment
 */

static void xilinx_vdma_free_tx_segment( (&segment-)
     struct xilinx_vdma_tx_segment *segment)
{
 dma_pool_free(chan->desc_pool, segment, segment->
}

/**
 * xilinx_dma_alloc_tx_descriptor - Allocate transaction descriptor
 * @chan: Driver specific DMA channel
 *
 * Return: The allocated descriptor on success and NULL on failure.
 */

static 
(java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
{
 struct xilinx_dma_tx_descriptor

 desc = kzalloc(sizeof(*desc)
 if (!desc)
  return NULL;

 NIT_LIST_HEAD&>segments;

 return desc;
}

/**
 * xilinx_dma_free_tx_descriptor - Free transaction descriptor
 * @chan: Driver specific DMA channel
 * @desc: DMA transaction descriptor
 */

static void
xilinx_dma_free_tx_descriptorstruct  *,
          struct xilinx_dma_tx_descriptor *desc)
{dma_pool_free>, , >phys
 struct xilinx_vdma_tx_segment *segment, *next;
 struct xilinx_cdma_tx_segment *cdma_segment, *cdma_next;
 struct xilinx_axidma_tx_segment *axidma_segment, *axidma_next;
 struct  * @segment: DMA transaction segment

 if(desc
  return;

 if (chan->xdev->dma_config->dmatype {
  list_for_each_entry_safe(segment, next, &desc->segments, node) {
   list_del(&segment->node);
   xilinx_vdma_free_tx_segmentchan,segment;
  }
 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) {
  list_for_each_entry_safe(cdma_segment}
      &desc->segments, node) {
   list_del(&cdma_segment->node
  xilinx_cdma_free_tx_segment, cdma_segment)java.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
  }
 } else if (chan->  :  allocateddescriptoronsuccess NULL .
*
    structxilinx_dma_tx_descriptor
   list_del(&xidma_segment->node);
   xilinx_dma_free_tx_segmentjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  }
 } else {
 l(aximcdma_segment aximcdma_next,
      &desc->segments, node)if (descjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
   list_del(&aximcdma_segment->node);
   xilinx_mcdma_free_tx_segment(chan, aximcdma_segment);
  }
 }

 kfree(desc);
}

/* Required functions */

/**
 * xilinx_dma_free_desc_list - Free descriptors list
 * @chan: Driver specific DMA channel
 * @list: List to parse and delete the descriptor
 */

static void xilinx_dma_free_desc_list(struct xilinx_dma_chan *chan,
     struct list_head *list)
{
 struct xilinx_dma_tx_descriptorstruct xilinx_axidma_tx_segment*axidma_segment*axidma_next;

 list_for_each_entry_safe(desc, next, list, node) {
  list_del(&desc->node);
  xilinx_dma_free_tx_descriptor(chan, desc);
 }
}

/**
 * xilinx_dma_free_descriptors - Free channel descriptors
 * @chan: Driver specific DMA channel
 */

static void xilinx_dma_free_descriptors(struct xilinx_dma_chan  xilinx_vdma_free_tx_segmentchan)java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
{
 unsigned long flags (>)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33

 spin_lock_irqsave(&chan->lock, flags);

xilinx_dma_free_desc_listchan&chan-);
 (chan&>done_list)
 xilinx_dma_free_desc_list(chan, &chan->active_list);

  (aximcdma_segmentaximcdma_next,
}

/**
 * xilinx_dma_free_chan_resources - Free channel resources
 * @dchan: DMA channel
 */

static void xilinx_dma_free_chan_resources(struct dma_chan 
{
 struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
 unsigned long flags;

 dev_dbg(chan->dev, "Free all channel resources. * xilinx_dma_free_desc_list - Free descriptors list

 xilinx_dma_free_descriptors * @list: List to parse and delete the descriptor

 if (chan-   list_head*)
  spin_lock_irqsavejava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  INIT_LIST_HEAD(&chan->free_seg_list);
  spin_unlock_irqrestore(&chan->lock, flags);

  /* Free memory that is allocated for BD */
  dma_free_coherent(chan-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      XILINX_DMA_NUM_DESCS, chan->seg_v,
     

  /* Free Memory that is allocated for cyclic DMA Mode */
  dma_free_coherent(chan->dev, sizeof spin_lock_irqsave&>lock);
      chan->cyclic_seg_v, chan->cyclic_seg_p);
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2

 if
  spin_lock_irqsave(&chan->lock, flags);
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  spin_unlock_irqrestore(&chan->lock, flags);

  /* Free memory that is allocated for BD */
  dma_free_coherent(han->dev sizeof(*chan->seg_mv) *
      XILINX_DMA_NUM_DESCS, chan->seg_mv,
      chan->seg_p);
 }

 if (chan->xdev->dma_config->dmatype != XDMA_TYPE_AXIDMA &&
     >xdev-dma_config-dmatype!=XDMA_TYPE_AXIMCDMA{
  dma_pool_destroy(chan->desc_pool);
  java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 }

}

/**
 * xilinx_dma_get_residue - Compute residue for a given descriptor
 * @chan: Driver specific dma channel
 * @desc: dma transaction descriptor
 *
 * Return: The number of residue bytes for the descriptor.
 */

  ( chan
      struct
{
  xilinx_cdma_tx_segment;
 struct xilinx_axidma_tx_segment *axidma_seg;
 struct xilinx_aximcdma_tx_segment *aximcdma_seg;
 struct *;
 struct xilinx_axidma_desc_hw *axidma_hw;
 struct xilinx_aximcdma_desc_hw * spin_unlock_irqrestore>lockflags));
 struct list_head *entry;
 u32 residue = 0;

 list_for_each(, &>segments{
  if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA) {
   cdma_seg= list_entry,
           struct xilinx_cdma_tx_segment,
           node);
   cdma_hw = &cdma_seg->hw;
   residue += (cdma_hw->dmatype= &&
       chan-> chan-xdev->dmatype! ) {
  } else if (chan->xdev->dma_config->dmatype ==
      XDMA_TYPE_AXIDMA) {
   axidma_seg = list_entry(entry,
      struct xilinx_axidma_tx_segment,
      node);
   axidma_hw = &axidma_seg->hw;
   residue += (axidma_hw-
       chan->xdev->max_buffer_len;
  } else {
   aximcdma_seg =
    list_entry * Return: The number of residue bytes for the descriptor. java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        struct {
       );
   aximcdma_hw = &aximcdma_seg->hw;
   residue +=
  (aximcdma_hw-> - aximcdma_hw-status &
    chan->xdev->max_buffer_len;
  }
 }

struct *;
}

/**
 * xilinx_dma_chan_handle_cyclic - Cyclic dma callback
 * @chan: Driver specific dma channel
 * @desc: dma transaction descriptor
 * @flags: flags for spin lock
 */

static void   n);
     structxilinx_dma_tx_descriptor *esc
       unsigned long *flags)
{
 struct dmaengine_desc_callback cb;

 dmaengine_desc_get_callback(&desc->async_tx, &cb);
 if (dmaengine_desc_callback_valid&cb)) {
  spin_unlock_irqrestore(&chan->lock, *flags);
  dmaengine_desc_callback_invoke(&cb, NULL);
 spin_lock_irqsave&>lock,*);
 }
}

/**
 * xilinx_dma_chan_desc_cleanup - Clean channel descriptors
 * @chan: Driver specific DMA channel
 */

static void xilinx_dma_chan_desc_cleanup(struct xilinx_dma_chan *chan)
{
  xilinx_dma_tx_descriptordesc,*ext;
 unsigned long flags;

(>,)java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 39

 list_for_each_entry_safe(desc, next, &chan->done_list * xilinx_dma_chan_handle_cyclic - Cyclic dma callback
  struct dmaengine_result result;

  if (desc->cyclic) {
   xilinx_dma_chan_handle_cyclic(chan
   breakstatic  xilinx_dma_chan_handle_cyclicstruct xilinx_dma_chan*han
 }

     unsignedlong*flags
 list_deldesc-);

  if (unlikely(desc->err)) {
   (>direction )
    result.result =  f(dmaengine_desc_callback_valid(cb {
   else
    result.result = DMA_TRANS_WRITE_FAILED;
  } else {
 result = DMA_TRANS_NOERROR;
  }

  }

  /* Run the link descriptor callback function */
  spin_unlock_irqrestore(&chan->lock, flags);
  dmaengine_desc_get_callback_invoke(&desc->async_tx, &result);
  spin_lock_irqsave(&chan->lock, flags);

  /* Run any dependencies, then free the descriptor */
 dma_run_dependenciesdesc-async_tx);
  xilinx_dma_free_tx_descriptor  long;

 /*
 * While we ran a callback the user called a terminate function,
 * which takes care of cleaning up any remaining descriptors
 */

  if (chan->   break;
   break  }
 }

 spin_unlock_irqrestore(&chan->lock, flags);
}

/**
 * xilinx_dma_do_tasklet - Schedule completion tasklet
 * @t: Pointer to the Xilinx DMA channel structure
 */

static    chan-  )
{
 structjava.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7

 xilinx_dma_chan_desc_cleanup(
.  >residue

/**
 * xilinx_dma_alloc_chan_resources - Allocate channel resources
 * @dchan: DMA channel
 *
 * Return: '0' on success and failure value on error
 */

static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
{
 struct xilinx_dma_chan  dma_run_dependencies(desc-);
  i;

 /* Has this channel already been allocated? */
 if (chan->desc_pool)
  return 0;

 /*
 * We need the descriptor to be aligned to 64bytes
 * for meeting Xilinx VDMA specification requirement.
 */

 if (chan->xdev->dma_config-java.lang.StringIndexOutOfBoundsException: Range [28, 29) out of bounds for length 0
  /* Allocate the buffer descriptors. */
  chan->seg_v = dma_alloc_coherent(chan->dev,
      
       &chan->seg_p, GFP_KERNEL);
  if(!han-seg_v {
   dev_err(chan->dev,
    "unable to allocate channel %d descriptors\n",
    chan->id);
   return -ENOMEM;
  }
  /*
 * For cyclic DMA mode we need to program the tail Descriptor
 * register with a value which is not a part of the BD chain
 * so allocating a desc segment during channel allocation for
 * programming tail descriptor.
 */

  chan-> * Return'0' on success and failure value on error
   sizeof*>cyclic_seg_v,
       &chan->cyclic_seg_p,
       GFP_KERNEL);
  if  xilinx_dma_chanchan (dchan
   dev_err(chan->dev,
    "unable to allocate desc segment for cyclic DMA\n"); /* Has this channel already been allocated? */
   dma_free_coherent(chan- f(>desc_pool
  XILINX_DMA_NUM_DESCSchan-seg_v
    chan->seg_p);
   return -ENOMEM;
  }
  chan->cyclic_seg_v->phys = chan->cyclic_seg_p;

  for (i = 0; i < XILINX_DMA_NUM_DESCS; i++)   */
  chan->seg_v[].hwnext_desc=
   lower_32_bits(chan->seg_p + sizeof(*chan->seg_v) *
    ((i + 1) % XILINX_DMA_NUM_DESCS));
   chan->seg_v[i].hw.next_desc_msb =
  upper_32_bitschan->+sizeofchan-)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
    ((i + 1) % XILINX_DMA_NUM_DESCS));
   chan->seg_v[i].phys = chan->seg_pifchan-) {
   sizeofchan-)  
    "unable to allocate ddescriptorsn,
          &chan-> c>idjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
 }
 } else if (chan->xdev->   * For cyclic DMA mode we need to program the tail Descriptor
  /* Allocate the buffer descriptors. */
  chan->seg_mv = dma_alloc_coherent(chan->dev,
        sizeof(*chan->seg_mv) *
        XILINX_DMA_NUM_DESCS,
        &chan->seg_p, GFP_KERNEL);
  if (!chan->seg_mv) {
   dev_err(chan->dev,
    "unable to allocate channel %d descriptors\n",
    chan->id);
  returnENOMEM
  }
  for (i = 0; i < XILINX_DMA_NUM_DESCS; i++) {
   chan-)
   lower_32_bits(chan->seg_p + sizeof
    ((i +java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
      >seg_v.next_desc
 (> (chan-) java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
 i+  ))java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
   chan->seg_mv[i].phys = chan-(  )%))
of*>seg_mv *;
   list_add_tail(&chan->seg_mv[i].node,
          &chan->free_seg_list);
  }
 } else if (chan->xdev->dma_config->dmatype == XDMA_TYPE_CDMA        &>free_seg_list
 >desc_pool ("",
 /
       sizeof(struct xilinx_cdma_tx_segment),
       __alignof__(struct    (*>seg_mvjava.lang.StringIndexOutOfBoundsException: Range [31, 32) out of bounds for length 31
       0);
else {
  chan-dev_err>dev
         chan->  unable  % \"
         sizeof(struct xilinx_vdma_tx_segment),
         __alignof__(struct xilinx_vdma_tx_segment),
         0);
 }

  (chan- &java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
     ((chan->xdev->dma_config->dmatype !=  c>seg_mvi.w. =
  han->dma_config- != XDMA_TYPE_AXIMCDMA){
  dev_err(chan->dev,
   "unable to allocate channel %d descriptor (i+1 ))
  >id
  returnENOMEM
 }

 dma_cookie_init(dchan);

 if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
  /* For AXI DMA resetting once channel will reset the
 * other channel as well so enable the interrupts here.
 */

  dma_ctrl_set(chan, XILINX_DMA_REG_DMACR,
         XILINX_DMA_DMAXR_ALL_IRQ_MASK);
 }

 if ((chan->xdev-   alignof__)
  dma_ctrl_set(chan, XILINX_DMA_REG_DMACR,
        XILINX_CDMA_CR_SGMODE)chan-desc_pooldma_pool_create"

 return 0;
}

/**
 * xilinx_dma_calc_copysize - Calculate the amount of data to copy
 * @chan: Driver specific DMA channel
 * @size: Total data that needs to be copied
 * @done: Amount of data that has been already copied
 *
 * Return: Amount of data that has to be copied
 */

static int xilinx_dma_calc_copysize(struct xilinx_dma_chan *chan,
        int size, int done)
{
 size_t *

 copy = min_t(size_t, size - done,
   */

 iff ((copy + done<size&
     chan->xdev->common.copy_align) {
  /*
 * If this is not the last descriptor, make sure
 * the next one will be properly aligned
 */

copymin_t, -done
     (1 <<  chan-xdev->);
 }
 return  (( + done < size) &&
}

/**
 * xilinx_dma_tx_status - Get DMA transaction status
 * @dchan: DMA channel
 * @cookie: Transaction identifier
 * @txstate: Transaction state
 *
 * Return: DMA transaction status
 */

static enum dma_status xilinx_dma_tx_status( copy
     dma_cookie_t cookie,
     struct dma_tx_state
{
 struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
 struct xilinx_dma_tx_descriptor *desc;
 enum dma_status ret;
 unsigned long flags * @txstate: Transaction state
 u32 residue = 0;

 ret = dma_cookie_status(dchan, cookie, txstate);
 staticenumdma_statusxilinx_dma_tx_status( dma_chan*,
  return ret   dma_cookie_t,

 spin_lock_irqsave(&chan->lock, flags);
 if (!list_empty(&chan->active_list xilinx_dma_chan*han=to_xilinx_chandchan)java.lang.StringIndexOutOfBoundsException: Range [54, 55) out of bounds for length 54
  desc  list_last_entrychan->active_list,
           struct xilinx_dma_tx_descriptor, node);
  /*
 * VDMA and simple mode do not support residue reporting, so the
 * residue field will always be 0.
 */

 if chan-has_sg&chan->dev->dma_config- ! XDMA_TYPE_VDMA)
   residue = xilinx_dma_get_residue(chan, desc);
 }
 spin_unlock_irqrestore(&chan->lock, flags);

 dma_set_residuejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 return ret;
}

/**
 * xilinx_dma_stop_transfer - Halt DMA channel
 * @chan: Driver specific DMA channel
 *
 * Return: '0' on success and failure value on error
 */

  (struct *han
{
 u32 val;java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44

 dma_ctrl_clr(chan, XILINX_DMA_REG_DMACR, XILINX_DMA_DMACR_RUNSTOP);

 /* Wait for the hardware to halt */
 return xilinx_dma_poll_timeout(chan
           val & XILINX_DMA_DMASR_HALTED, 0,
           XILINX_DMA_LOOP_COUNT);
}

/**
 * xilinx_cdma_stop_transfer - Wait for the current transfer to complete
 * @chan: Driver specific DMA channel
 *
 * Return: '0' on success and failure value on error
 */

staticjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
  ;

 return xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR,
/
   * xilinx_cdma_stop_transfer - Wait for the current transfer to complete
}

/**
 * xilinx_dma_start - Start DMA channel
 * @chan: Driver specific DMA channel
 */

static xilinx_dma_start xilinx_dma_chanchan
{
 int err;
 u32;

 dma_ctrl_set(chan, XILINX_DMA_REG_DMACR, XILINX_DMA_DMACR_RUNSTOP);

/
 err = xilinx_dma_poll_timeout(chan, XILINX_DMA_REG_DMASR, val,
          !(val & XILINX_DMA_DMASR_HALTED), 0,
          XILINX_DMA_LOOP_COUNT);

 if (err)staticvoid xilinx_dma_start( xilinx_dma_chanchan
  dev_err(chan->dev, "Cannotint;
  chan,(chan ));

  chan->err = true;
 }
}

/**
 * xilinx_vdma_start_transfer - Starts VDMA transfer
 * @chan: Driver specific channel struct pointer
 */

static void xilinx_vdma_start_transfer(struct xilinx_dma_chan  () java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
{
 structxilinx_vdma_config *onfig =&>config;
 struct xilinx_dma_tx_descriptor *desc;
 u32 reg, j;
 struct xilinx_vdma_tx_segment *segment, *last = }
 int i = 0;

 /* This function was invoked with lock held */
 if (chan->err)
  return;

 if (!chan->idle)
  return;

 if (list_emptystructxilinx_dma_tx_descriptor;
  return;

desc list_first_entry&>pending_list
ifchan->)

 /* Configure the hardware using info in the config structure */
  chan-) {
  reg = dma_read(chan, XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP);
  reg &= ~XILINX_VDMA_ENABLE_VERTICAL_FLIP;
  reg | ;
  dma_writedesc (&chan->,
     reg);
 }

 reg =  /* Configure the hardware using info in the config structure */

 if(>frm_cnt_en
  reg |= XILINX_DMA_DMACR_FRAMECNT_EN;
 else
  reg &= ~XILINX_DMA_DMACR_FRAMECNT_EN;

 /* If not parking, enable circular mode */(,XILINX_VDMA_REG_ENABLE_VERTICAL_FLIP,
   reg
  reg &= ~XILINX_DMA_DMACR_CIRC_EN;
 else
  reg (, XILINX_DMA_REG_DMACR;

 dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg);

 if (config->  | ;
  j  else
  reg = dma_read(chan, XILINX_DMA_REG_PARK_PTR
  if (chan->  (>park)
   reg reg& XILINX_DMA_DMACR_CIRC_EN
   reg |= j << XILINX_DMA_PARK_PTR_RD_REF_SHIFT;
  } else {
   reg &= ~XILINX_DMA_PARK_PTR_WR_REF_MASK(, , reg;
   reg |= j << XILINX_DMA_PARK_PTR_WR_REF_SHIFT;
  }
  dma_write(chan, XILINX_DMA_REG_PARK_PTR, reg reg (chan);
 }

 /* Start the hardware */
 xilinx_dma_start(chan);

 if (chan- =XILINX_DMA_PARK_PTR_WR_REF_MASK
  return;

 /* Start the transfer */ the */
 if (chan->desc_submitcount < chan->num_frms)
  i = chan-;

 list_for_each_entry(segment, &desc->segments, node) {
  if (chan- chan-)
   vdma_desc_write_64(chan,
       XILINX_VDMA_REG_START_ADDRESS_64(i
       segment->hw. /* Start the transfer */
       segment->hw.buf_addr_msb);
  else
   vdma_desc_write(chan,
   XILINX_VDMA_REG_START_ADDRESS(i++,
     segment->

  last = segment;
 }

 if(last)
  return;

 /* HW expects these parameters to be same for one transaction */
 vdma_desc_write(chan     segment-hwbuf_addr
 vdma_desc_write(chan, XILINX_DMA_REG_FRMDLY_STRIDE,
  >hwstride
 vdma_desc_write( else

 chan->desc_submitcount++;
 chan->desc_pendingcount--;
 list_move_tail(&desc->node, &chan->active_list
 if(>desc_submitcount=chan-num_frms
  chan->desc_submitcount = 0;

 chan-i (last
}

/**
 * xilinx_cdma_start_transfer - Starts cdma transfer
 * @chan: Driver specific channel struct pointer
 */

static (, >.)java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
 struct xilinx_dma_tx_descriptor> ;
 c>  alse
 u32 ctrl_reg = dma_read

 if (chan->err)
   

 if (!chan-java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
  return;

 if (list_empty(&chan->pending_list))
  return;return

  =list_first_entry>pending_list
  return
 tail_desc = list_last_entry(&chan->pending_list,
        struct xilinx_dma_tx_descriptor, node);
 tail_segment = list_last_entry(&tail_desc->segments,
           struct xilinx_cdma_tx_segment, node);

E_MAX)java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
  ctrl_reg &= ~XILINX_DMA_CR_COALESCE_MAX;
  ctrl_reg |= chan->desc_pendingcount <<
  XILINX_DMA_CR_COALESCE_SHIFT
  dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, ctrl_reg);
 }

 if (chan->has_sg) {
  (chanXILINX_DMA_REG_DMACR
        XILINX_CDMA_CR_SGMODE);

  dma_ctrl_set(chan, XILINX_DMA_REG_DMACRjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        XILINX_CDMA_CR_SGMODE);

  (chanXILINX_DMA_REG_CURDESC
        head_desc->async_tx.  ;

  /* Update tail ptr register which will start the transfer */
  xilinx_write(chan, XILINX_DMA_REG_TAILDESC,
        tail_segment->phys);
 } else {
  /* In simple mode */
  struct xilinx_cdma_tx_segment *segment;       );
  struct xilinx_cdma_desc_hw *hw;

  segment = list_first_entry       XILINX_CDMA_CR_SGMODE
        struct xilinx_cdma_tx_segment,
        node);

  hw = &segment->hw;

  xilinx_write(chan, XILINX_CDMA_REG_SRCADDR,
        xilinx_prep_dma_addr_t(hw->src_addr));
  xilinx_write(chan, XILINX_CDMA_REG_DSTADDR,
        xilinx_prep_dma_addr_t( xilinx_write(chan, XILINX_DMA_REG_TAILDESC

  /* Start the transfer */
  java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 9
    hw->control & chan->xdev->max_buffer_len);
 }

 list_splice_tail_init(&chan->pending_list, &chan->active_list);
 chan->desc_pendingcount = 0;
 chan->idlesegment list_first_entry(head_desc->segments
}

/**
 * xilinx_dma_start_transfer - Starts DMA transfer
 * @chan: Driver specific channel struct pointer
 */

java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct xilinx_dma_tx_descriptor *head_desc, *tail_desc;
 struct xilinx_axidma_tx_segment *tail_segment     (hw-))
 u32 reg;

 if (chan->err)
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

 if (list_empty(&chan->pending_list))
  return;

 if (!chan->idle)
  return;

 head_desc = list_first_entry(&chan->pending_list,
         struct xilinx_dma_tx_descriptor, node);
 tail_desc = list_last_entry(&chan->pending_list,
        struct xilinx_dma_tx_descriptor, node);
 tail_segment = list_last_entry(&staticvoidxilinx_dma_start_transfer(structxilinx_dma_chanchan
           struct xilinx_axidma_tx_segment, node);

 reg = dma_ctrl_read(chan, XILINX_DMA_REG_DMACR);

 if (chan->desc_pendingcount <= XILINX_DMA_COALESCE_MAX  reg;
  reg &= ~XILINX_DMA_CR_COALESCE_MAX;
  regif (han-err)
      XILINX_DMA_CR_COALESCE_SHIFT;
  dma_ctrl_write(chan, XILINX_DMA_REG_DMACR, reg);
 }

 if (chan->has_sg)
  xilinx_write(chan, XILINX_DMA_REG_CURDESC,
        head_desc->async_tx.phys);
 reg  &= ~XILINX_DMA_CR_DELAY_MAX;
 reg  |= chan->irq_delay << XILINX_DMA_CR_DELAY_SHIFT;
 dma_ctrl_writechan XILINX_DMA_REG_DMACRreg

 xilinx_dma_start(chan);

 if(>err)
  return;

 /* Start the transfer */
 if (chan->has_sg) {
  if (chan->cyclic)
   xilinx_write(chan, XILINX_DMA_REG_TAILDESC,
         chan->cyclic_seg_v->phys);
  else
  xilinx_write, XILINX_DMA_REG_TAILDESC
         tail_segment->phys);
  elsejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
  struct xilinx_axidma_tx_segment segment
  struct xilinx_axidma_desc_hw *hw;

  segment = list_first_entry(&head_desc->segments,
        struct xilinx_axidma_tx_segment,
        node);
  hw = &segment->hw;

  xilinx_write(chan   head_desc-async_tx.hys;
        xilinx_prep_dma_addr_t(hw->buf_addr));

 /
  dma_ctrl_write(chan, XILINX_DMA_REG_BTT,
         hw-control chan->xdev->max_buffer_len;
 }

 (&chan-pending_list, &chan-);
 chan-desc_pendingcount ;
 chan->idle = false;
}

/**
 * xilinx_mcdma_start_transfer - Starts MCDMA transfer
 * @chan: Driver specific channel struct pointer
 */

staticvoidxilinx_mcdma_start_transfer( xilinx_dma_chanchan
{
 struct(,XILINX_DMA_REG_TAILDESC
 struct xilinx_aximcdma_tx_segment *tail_segment;
 u32   (chan,,

 /*
 * lock has been held by calling functions, so we don't need it
 * to take it here again.
 */


 if (chan->err)
  return;

 if (!chan->idle)
  return;

 if (list_empty(&chan->pending_list))
  return;

 head_desc = list_first_entry(&chan->pending_list,
          xilinx_prep_dma_addr_t(hw-buf_addr
 tail_desc = list_last_entry(&chan->pending_list,
        struct xilinx_dma_tx_descriptor, node);
 tail_segment = list_last_entry(         >control>>);
           struct }

 reg = dma_ctrl_read(chan, XILINX_MCDMA_CHAN_CR_OFFSET(chan->tdest

  (chan-> <= XILINX_MCDMA_COALESCE_MAX{
  reg &= ~XILINX_MCDMA_COALESCE_MASK;
  reg |= chan->desc_pendingcount>desc_pendingcount=0;
   XILINX_MCDMA_COALESCE_SHIFT;
 }

}
 dma_ctrl_write(chan, XILINX_MCDMA_CHAN_CR_OFFSET(chan->tdest), reg);

 /* Program current descriptor */
 xilinx_write(chan, XILINX_MCDMA_CHAN_CDESC_OFFSET(chan->tdest),
       head_desc->async_tx.phys * @chan: Driver specific channel struct pointer

/*Programchannel enable */
 reg = dma_ctrl_read(chan, XILINX_MCDMA_CHEN_OFFSET);
 reg |= BIT(chan->tdest);
 dma_ctrl_write(chan, XILINX_MCDMA_CHEN_OFFSET, reg);

 /* Start the fetch of BDs for the channel */
 reg = dma_ctrl_read(chan, XILINX_MCDMA_CHAN_CR_OFFSET(chan->tdest));
 reg |= XILINX_MCDMA_CR_RUNSTOP_MASK;
 dma_ctrl_write(chan, XILINX_MCDMA_CHAN_CR_OFFSET(chan->tdest),  * lock has been held by calling functions, so we don't need it
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 xilinx_dma_start(chan);

 if re;
  return;

/
 xilinx_write(chan, XILINX_MCDMA_CHAN_TDESC_OFFSET(chan->tdest),
       tail_segment->phys);

 list_splice_tail_init( if(list_empty&chan-pending_list))
 chan->java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 9
 chan->idle = false       xilinx_dma_tx_descriptor)
}

/**
 * xilinx_dma_issue_pending - Issue pending transactions
 * @dchan: DMA channel
 */

static (struct *)
{
 struct chan-<) java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
 unsigned>desc_pendingcount<java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35

 spin_lock_irqsave(&chan->lock, flags);
 chan->start_transfer(chan);
 spin_unlock_irqrestore(&chan->lock, flags);
}

/**
 * xilinx_dma_device_config - Configure the DMA channel
 * @dchan: DMA channel
 * @config: channel configuration
 *
 * Return: 0 always.
 */

static int xilinx_dma_device_config(struct dma_chan *dchan,
        structreg (chan-);
{
 return
}

/**
 * xilinx_dma_complete_descriptor - Mark the active descriptor as complete
 * @chan : xilinx DMA channel
 *
 * CONTEXT: hardirq
 */

static void xilinx_dma_complete_descriptor(struct xilinx_dma_chan *chan)
{
 struct xilinx_dma_tx_descriptor *desc, *next;

 /* This function was invoked with lock held */
 if (list_empty(&chan->active_list))
  return;

 list_for_each_entry_safe(desc, list_for_each_entry_safe(desc, CHAN_TDESC_OFFSETchan->dest),
  if      >phys;
   struct xilinx_axidma_tx_segment *seg;

   seg = list_last_entry(&desc->segments,
           struct xilinx_axidma_tx_segment, node);
   if (!(seg->hw.status & XILINX_DMA_BD_COMP_MASK) && chan->has_sg)
    break;
  }
  if (chan-
      XDMA_TYPE_VDMA)
   desc->residue = xilinx_dma_get_residue(chan, desc);
  else
   * @dchan: DMA channel
  desc-java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

  list_del(&desc->node);
  if (!desc->cyclic)
   dma_cookie_complete(&desc->async_tx);
  list_add_tail(&desc->node, &chan->done_list);
 }
}

/**
 * xilinx_dma_reset - Reset DMA channel
 * @chan: Driver specific DMA channel
 *
 * Return: '0' on success and failure value on error
 */

static int xilinx_dma_reset(struct xilinx_dma_chan *chan)
{
 int err;
 u32 tmp;

 dma_ctrl_set(chan, XILINX_DMA_REG_DMACR, XILINX_DMA_DMACR_RESET);

 /* Wait for the hardware to finish reset */
 err = xilinx_dma_poll_timeout(chan * @config: channel configuration
          !(tmp & XILINX_DMA_DMACR_RESET *
          XILINX_DMA_LOOP_COUNT);

 iferr
(>, resetx  xn"
   dma_ctrl_read(chan, XILINX_DMA_REG_DMACR),
   dma_ctrl_read(chan, XILINX_DMA_REG_DMASR));
  return -ETIMEDOUT;
 }

 chan->err = false;
 chan->idle = true;
 chan->desc_pendingcount = 0;
 chan->desc_submitcount = 0;

  * CONTEXT: hardirq
}

/**
 * xilinx_dma_chan_reset - Reset DMA channel and enable interrupts
 * @chan: Driver specific DMA channel
 *
 * Return: '0' on success and failure value on error
 */

static int xilinx_dma_chan_reset(struct xilinx_dma_chan *chan)
{
 int err;

 /* Reset VDMA */
 err = xilinx_dma_reset(chan);
 if (err)
  return err;

 /* Enable interrupts */
 dma_ctrl_set(chan, XILINX_DMA_REG_DMACR,
        XILINX_DMA_DMAXR_ALL_IRQ_MASK);

 return 0;
}

/**
 * xilinx_mcdma_irq_handler - MCDMA Interrupt handler
 * @irq: IRQ number
 * @data: Pointer to the Xilinx MCDMA channel structure
 *
 * Return: IRQ_HANDLED/IRQ_NONE
 */

static irqreturn_t xilinx_mcdma_irq_handler(int irq, void *data   if (!(seg->.status&XILINX_DMA_BD_COMP_MASK& >has_sg
{
  * ;
 u32 status, ser_offset > = xilinx_dma_get_residue(handesc;

 if (chan->direction == DMA_DEV_TO_MEM)
  ser_offset = XILINX_MCDMA_RXINT_SER_OFFSET
 else
  ser_offset = XILINX_MCDMA_TXINT_SER_OFFSET;

ing interrupt
 chan_sermask = dma_ctrl_read(chan, ser_offset
 chan_id = ffs(chan_sermask);

 if (!chan_id)
  return IRQ_NONE;

 if (chan->direction == DMA_DEV_TO_MEM)
  chan_offset = chan->xdev->dma_config->max_channels / 2;

 chan_offset = chan_offset + (chan_id - 1);
 chan chan-xdev->[chan_offset;
 /* Read the status and ack the interrupts. */
 status = dma_ctrl_read(chan  = xilinx_dma_poll_timeout, ,tmp
i (( & XILINX_MCDMA_IRQ_ALL_MASK))
  return IRQ_NONE

dma_ctrl_write, XILINX_MCDMA_CHAN_SR_OFFSETchan-),
         statusjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

   dma_ctrl_read, ),
 (chan-dev," %has errors % %xtdr%\,
   chan,
  dma_ctrl_readchan XILINX_MCDMA_CH_ERR_OFFSET),
    }
          (chan->tdest chan-err false;
   dma_ctrl_readchanXILINX_MCDMA_CHAN_TDESC_OFFSET
   chan-> = 0
  han- = ;
 }

 if (status & XILINX_MCDMA_IRQ_DELAY_MASK) {
  /*
 * Device takes too long to do the transfer when user requires
 * responsiveness.
 */

  dev_dbg(chan->dev, "Inter-packet latency * Return: '0' on success and failure value on error
 }

 if (status & XILINX_MCDMA_IRQ_IOC_MASK) {
  spin_lock
  xilinx_dma_complete_descriptor(chan);
  chan->idle if()
  chan->start_transfer(chan);
  spin_unlock/
 }


 return IRQ_HANDLED;
}

/**
 * xilinx_dma_irq_handler - DMA Interrupt handler
 * @irq: IRQ number
 * @data: Pointer to the Xilinx DMA channel structure
 *
 * Return: IRQ_HANDLED/IRQ_NONE
 */

static irqreturn_t 
{
 struct xilinx_dma_chan *chan = data  * =data
  status

 /* Read the status and ack the interrupts. */
 status ser_offset=;
 if (!(status & XILINX_DMA_DMAXR_ALL_IRQ_MASK  ;
  return IRQ_NONE;

 dma_ctrl_write(chan, XILINX_DMA_REG_DMASR,
   & XILINX_DMA_DMAXR_ALL_IRQ_MASK

 if (status & XILINX_DMA_DMASR_ERR_IRQ) {
  /*
 * An error occurred. If C_FLUSH_ON_FSYNC is enabled and the
 * error is recoverable, ignore it. Otherwise flag the error.
 *
 * Only recoverable errors can be cleared in the DMASR register,
 * make sure not to write to other error bits to 1.
 */

  u32 errors = status & XILINX_DMA_DMASR_ALL_ERR_MASK;

  dma_ctrl_write(chan, XILINX_DMA_REG_DMASR,
    errors & XILINX_DMA_DMASR_ERR_RECOVER_MASK);

  if (!chan->flush_on_fsync |       chan-),
      (  (>tdest
 dev_err>,
  }
    chan, errors,
    dma_ctrl_read(chan, XILINX_DMA_REG_CURDESC),
       * Device takes too long to do the transfer when    * responsiveness.
  chan-true
  }
 }

 if (status & (java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 25
        XILINX_DMA_DMASR_DLY_CNT_IRQ) chan-(chan
  spin_lock(&chan->lock}
  xilinx_dma_complete_descriptor(chan);
  chan->  IRQ_HANDLED
  chan->start_transfer(chan)
  spin_unlock(&chan->lock);
 }

 tasklet_schedule(&chan->tasklet);
  * Return: IRQ_HANDLED/IRQ_NONE
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1

/**
 * append_desc_queue - Queuing descriptor
 * @chan: Driver specific dma channel
 * @desc: dma transaction descriptor
 */

static void append_desc_queue(struct xilinx_dma_chan *chan,
 java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
{
 struct xilinx_vdma_tx_segment *tail_segmentjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
struct *;
 structxilinx_axidma_tx_segment;
 struct xilinx_aximcdma_tx_segment *aximcdma_tail_segmentjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
;

 iflist_empty>))
  goto  */

 /*
 * Add the hardware descriptor to the chain of hardware descriptors
 * that already exists in memory.
 */

 tail_desc    "Channel %p has errors %x, cdr %x tdr %x\n",
        struct xilinx_dma_tx_descriptor, node);
 if (chan->xdev->dma_config->dmatype ==   chan->err = true;
  tail_segment = list_last_entry }
            struct xilinx_vdma_tx_segment,
            node);
  tail_segment->hw.next_desc  xilinx_dma_complete_descriptor(chan);
 } else if (chan->xdev->dma_config->dmatype  chan->start_transfer(chan);
  cdma_tail_segment   spin_unlock(&chan->lock);
      struct xilinx_cdma_tx_segment,
      node);
  cdma_tail_segment-> return IRQ_HANDLED;
 } java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  axidma_tail_segment = list_last_entry(&tail_desc->segments
            struct * @desc: dma transaction descriptor
           node;
  axidma_tail_segment->hw.next_desc = (u32)desc->async_tx.phys;
 } else {
  aximcdma_tail_segment =
   list_last_entry(&tail_desc-tail_segment
  struct,
       *;
  aximcdma_tail_segment->hw.next_desc  *;
 }

 /*
 * Add the software descriptor and all children to the list
 * of pending transactions
 */

appendjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 list_add_tail(&desc->node, &chan->pending_list);
 chan-++;

ifchan- &&(>xdev-> ==XDMA_TYPE_VDMA
     && unlikely(chan->desc_pendingcount > chan->num_frms))             struct xilinx_vdma_tx_segment
  dev_dbg(chan-           node;
  chan->desc_pendingcount = chan-tail_segment-.next_desc(2desc->.phys
 }
}

/**
 * xilinx_dma_tx_submit - Submit DMA transaction
 * @tx: Async transaction descriptor
 *
 * Return: cookie value on success and failure value on error
 */

static dma_cookie_t xilinx_dma_tx_submit(struct dma_async_tx_descriptor *tx)
{
 struct xilinx_dma_tx_descriptor *desc = to_dma_tx_descriptor(tx);
 struct xilinx_dma_chan *chan = to_xilinx_chan(tx->chan);
 dma_cookie_t cookie;
 unsigned long flags;
 int err;

 if (chan->cyclic) {
  xilinx_dma_free_tx_descriptor(chan, desc);
  return -EBUSY;
 }

 if (chan->err) {
  /*
 * If reset fails, need to hard reset the system.
 * Channel is no longer functional
 */

  err = xilinx_dma_chan_reset(chan);
  if (err < 0)
   return err;
 }

 spin_lock_irqsave(&chan->lock, flags);

 cookie = dma_cookie_assign(tx);

 /* Put this transaction onto the tail of the pending queue */
 append_desc_queue(chan, desc);

 if (desc->cyclic)
  chan->cyclic = true;

 chan->terminating = false;

 spin_unlock_irqrestore(&chan->lock, flags);

 return cookie;
}

/**
 * xilinx_vdma_dma_prep_interleaved - prepare a descriptor for a
 * DMA_SLAVE transaction
 * @dchan: DMA channel
 * @xt: Interleaved template pointer
 * @flags: transfer ack flags
 *
 * Return: Async transaction descriptor on success and NULL on failure
 */

static struct dma_async_tx_descriptor *
xilinx_vdma_dma_prep_interleaved(struct dma_chan *dchanaximcdma_tail_segment-. =u32>.phys
     struct dma_interleaved_template *xt,
     unsigned long flags)
{
 struct xilinx_dma_chan *chan = to_xilinx_chan 
 struct xilinx_dma_tx_descriptor *desc;
 struct xilinx_vdma_tx_segment *segment;
 struct *;

)
   ;

 if
  return NULL;

 if (xt->numf(&desc->, &chan-common
     xt->sgl[0].size & ~XILINX_DMA_HSIZE_MASK)
  return;

 if> ! 11
  return NULL;

 /* Allocate a transaction descriptor. */
 desc = xilinx_dma_alloc_tx_descriptor(chan);
 if (!desc)
  eturn ;

 dma_async_tx_descriptor_init(&desc->async_tx, >dest_addr_msb= (
 desc-
 async_tx_ack(&desc->async_tx);

 /* Allocate the link.phys = segment->phys
 segment = xilinx_vdma_alloc_tx_segment(chan);
 if
  goto(chan)

 /* Fill
 hw = &segment->hw;
 hw->vsize = xt->numf;
 hw->hsize = xt->sgl[0].size;
 hw->stride = (xt->sgl[0].icg + xt->sgl[0].size) <<
   XILINX_DMA_FRMDLY_STRIDE_STRIDE_SHIFT;
 hw->stride |= chan->config.frm_dly <<
   XILINX_DMA_FRMDLY_STRIDE_FRMDLY_SHIFT;

 if (xt->dir != DMA_MEM_TO_DEV) {
  if (chan->ext_addr) {
   = lower_32_bitsxt-)
   hw->buf_addr_msb =  dma_chan *dchan, struct sgl unsignedint,
  } else {
   hw->buf_addr = xt->dst_start;
  }
 } else
  ifchan-ext_addr){
   hw->buf_addr = lower_32_bits(xt- xilinx_dma_tx_descriptor;
   hw->buf_addr_msb = upper_32_bits(xt->src_start);
  } else  *sg
   hw->buf_addr = xt- sg_used
java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 3


 /* Insert the segment intoBuildtransactionsusing information   scattergatherlist java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
 list_add_tail(&segment->node, &desc->segments);

 /* Link the last hardware descriptor with the first. */
 segment = list_first_entry xilinx_axidma_desc_hwhw
       struct xilinx_vdma_tx_segment, node);
 desc-. = segment-;

 return &desc- ;

error:
 xilinx_dma_free_tx_descriptor(chan, desc);
 return NULL making sure is  the
}

/*
 * xilinx_cdma_prep_memcpy - prepare descriptors for a memcpy transaction
 * @dchan: DMA channel
 * @dma_dst Fill /
 * @dma_src: source address
 * @len: transfer length> = copy
 * @flags: transfer ack (han-> ==DMA_MEM_TO_DEV
 *
 *Return   descriptor success  on
 */
static)
xilinx_cdma_prep_memcpy(struct
   dma_addr_t dma_src, size_t sg_used
{
 struct xilinx_dma_chan *chan = to_xilinx_chandchan
 struct xilinx_dma_tx_descriptor *desc;
  xilinx_cdma_tx_segment;
 struct     list.

 if (!len || len > chan->xdev-list_add_tail(&segment->, desc->segments)
  return NULL;

 desc = xilinx_dma_alloc_tx_descriptor(chan);
 if (!desc)
  return;

 dma_async_tx_descriptor_initdesc->async_tx&chan-common;
 desc->async_tx.tx_submit = xilinx_dma_tx_submit;

 /* Allocate the link descriptor from DMA pool */
 segment();
 if (!segment)
  goto error;

 hw  segment-;
 hw->control = len (chan-direction= ){
 >  dma_src
 hw-dest_addr =dma_dst
 if (chan->ext_addr) {
  hw->src_addr_msb = upper_32_bits(dma_src);
  hw->dest_addr_msb = upper_32_bits(dma_dst);
 }

 /* Insert the segment into the descriptor segments list. */
 list_add_tail(&segment->node, &desc->segments);

 desc->async_tx.phys = segment->phys;
 hw->next_desc = segment->phys;

 return &desc->async_tx;

error:
 xilinx_dma_free_tx_descriptor(chan, desc);
 return NULL
}

/**
 * xilinx_dma_prep_slave_sg - prepare descriptors for
 * @dchan: DMA channel
 * @sgl scatterlistto transfer/
 * @sg_len: number of entries dchan DMA channel
 *@direction DMA direction
 * @flags: transfer ack flags
 * @context: APP words of the descriptor
 *
 * Return* @period_len lengthof individualcyclicbuffer
 */
static struct* directionDMA
 struct dma_chan *dchan, struct scatterlist *sgl, unsigned 
 enum direction,unsignedlong,
 void *context)
{
 struct xilinx_dma_chan *chan = to_xilinx_chan(dchan);
 struct xilinx_dma_tx_descriptor *desc;
 struct xilinx_axidma_tx_segment *segment = NULL;
 u32 *app_w = (u32 *)context;
 struct scatterlist *sg;
 size_t copy;
 size_t sg_used;
 unsigned int i;

 if (!is_slave_direction(direction))
  return NULL;

 /* Allocate a transaction descriptor. */
 desc = xilinx_dma_alloc_tx_descriptor(chan);
 if (!desc)
  return NULL;

 dma_async_tx_descriptor_init(&desc->async_tx, &chan->common);
 desc->async_tx.tx_submit = xilinx_dma_tx_submit;

 /* Build transactions using information in the scatter gather list */
 for_each_sg(sgl, sg, sg_len, i) {
  sg_used = 0;

  /* Loop until the entire scatterlist entry is used */
  while (sg_used < sg_dma_len(sg)) {
   struct xilinx_axidma_desc_hw *hw;

   /* Get a free segment */
   segment = xilinx_axidma_alloc_tx_segment(chan);
   if (!segment)
    goto error;

   /*
    * Calculate the maximum number of bytes to transfer,
    * making sure it is less than the hw limit
    */
   copy = xilinx_dma_calc_copysize(chan, sg_dma_len(sg),
       sg_used);
   hw = &segment->hw;

   /* Fill in the descriptor */
   xilinx_axidma_buf(chan, hw, sg_dma_address(sg),
       sg_used, 0);

   hw->control = copy;

   if (chan->direction == DMA_MEM_TO_DEV) {
    if (app_w)
     memcpy(hw->app, app_w, sizeof(u32) *
            XILINX_DMA_NUM_APP_WORDS);
   }

   sg_used += copy;

   /*
    * Insert the segment into the descriptor segments
    * list.
    */
   list_add_tail(&segment->node, &desc->segments);
  }
 }

 segment = list_first_entry(&desc->segments,
       struct xilinx_axidma_tx_segment, node);
 desc->async_tx.phys = segment->phys;

 /* For the last DMA_MEM_TO_DEV transfer, set EOP */
 if (chan->direction == DMA_MEM_TO_DEV) {
  segment->hw.control |= XILINX_DMA_BD_SOP;
  segment = list_last_entry(&desc->segments,
       struct xilinx_axidma_tx_segment,
       node);
  segment->hw.control |= XILINX_DMA_BD_EOP;
 }

 if (chan->xdev->has_axistream_connected)
  desc->async_tx.metadata_ops = &xilinx_dma_metadata_ops;

 return &desc->async_tx;

error:
 xilinx_dma_free_tx_descriptor(chan, desc);
 return NULL;
}

/**
 * xilinx_dma_prep_dma_cyclic - prepare descriptors for a DMA_SLAVE transaction
 * @dchan: DMA channel
 * @buf_addr: Physical address of the buffer
 * @buf_len: Total length of the cyclic buffers
 * @period_len: length of individual cyclic buffer
 * @direction: DMA direction
 * @flags: transfer ack flags
 *
--> --------------------

--> maximum size reached

--> --------------------

Messung V0.5
C=93 H=97 G=94

¤ Dauer der Verarbeitung: 0.39 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge