|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; `% J: S& B$ G7 R/ R1 F- h7 ~. v- [code]EDMA sample test application2 l! p, U1 n$ U! c- c" C9 X7 S
- /*
' n/ K5 @# ^5 z( I7 w& r: F - * edma_test.c5 F' I/ E9 P$ a
- * C3 J/ x8 q; }5 c
- * brief EDMA3 Test Application, y5 T7 \( i- R$ y, u5 S a
- *$ I- }2 Q2 C# e+ l0 o; P
- * This file contains EDMA3 Test code.
3 Y# \0 \6 l2 W! y' [5 S - *
9 e* k+ C0 i9 ]$ h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; W2 g- | Y9 t4 Y5 e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' m9 t0 v6 M j' Z. Q - * TO CHANGE." x, a$ y) i. h3 ?9 [
- *
- _: g. w( l4 T( Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ n, G6 `% P+ X4 I# u - *
) d4 j" h; P' ]7 P - * This program is free software; you can redistribute it and/or& e; @9 ?* a A+ A; B' l9 V
- * modify it under the terms of the GNU General Public License as, |* E& y5 p! F
- * published by the Free Software Foundation version 2.
$ B: w7 l0 c# ?6 E - *
. D5 I$ O& Q2 g- e6 n" Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ T$ E- d; G- |' @7 O - * kind, whether express or implied; without even the implied warranty7 W4 z; z8 D. N3 X4 V7 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' [5 D$ @" y" R+ x4 E7 L- q
- * GNU General Public License for more details.
( Z l& M0 x' I7 x, }# k% \ - */: f3 ~; Z7 [6 ?' O+ s" [2 y
- # a: \1 {) P. {
- #include <linux/module.h>. H' A" y. F' d
- #include <linux/init.h>. i) k7 g2 d/ l& u m* `" ?% `
- #include <linux/errno.h>+ g& v: w' F6 `8 \
- #include <linux/types.h>
7 V9 J! b. {, A3 K, y- A, n6 b3 x - #include <linux/interrupt.h>
0 h% N: x( o3 x( p$ H+ m - #include <asm/io.h>8 I7 l! S3 D: p* {' {3 f! ^
- #include <linux/moduleparam.h>
T; H4 G7 U( Z, d) D - #include <linux/sysctl.h>: ]& t( U f9 l+ }& v: y$ Y( Z
- #include <linux/mm.h>
, f, Z( q" y f1 z3 L% N# S! o - #include <linux/dma-mapping.h>
, q. Z4 ^2 q- V& [; j - - q% r6 C5 j0 q
- #include <mach/memory.h>
" k, K- p( n3 j0 R - #include <mach/hardware.h>7 {& i5 p3 y& ~
- #include <mach/irqs.h>
* J9 w( x$ }8 k; l - #include <asm/hardware/edma.h>
0 ~6 O' l3 B# a6 M5 L% N
9 L# N% h7 `; O5 ^8 v; t2 q- #undef EDMA3_DEBUG
3 f; A, I+ e ~& G8 l3 j; L% @3 Y - /*#define EDMA3_DEBUG*/
1 I: P9 c2 W6 |; @! v - 7 i0 G! C* p8 ]$ X
- #ifdef EDMA3_DEBUG
- @+ Q. N) T) U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, V* ~& a7 y2 A- N. A2 R4 n0 P- V- I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 |" }( U( ~4 L4 f. _8 K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). F! @3 R9 U* ?. J" N
- #else
1 w9 T8 r) ~. O$ p% ? - #define DMA_PRINTK( x... )
$ D5 n! F6 d: H - #define DMA_FN_IN2 @& _4 l4 @$ ]8 D* s
- #define DMA_FN_OUT
( H: d0 {# p: Q! J* N - #endif
6 Y( v6 o n% W
4 X `* S% N* k' _- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 d$ u9 w6 T0 k3 m) U8 k6 e - #define STATIC_SHIFT 3
# ^' o. P. d* \+ h( A E - #define TCINTEN_SHIFT 20+ ?# l5 d& ^1 U) e) [, D: y8 v
- #define ITCINTEN_SHIFT 21
/ z0 x) n- n: D+ J" V/ \& W - #define TCCHEN_SHIFT 22/ w. D" a; n/ u: t+ t9 {4 i( z( ]* j
- #define ITCCHEN_SHIFT 23
) V5 ?3 P, J E0 h% M - 1 f" H0 K" a3 o. Y0 L2 v0 Y# S
- static volatile int irqraised1 = 0;- L* ^$ e: g2 f
- static volatile int irqraised2 = 0;
7 |9 F) q2 H- p8 m# o
6 Y! F: s* l$ _) z8 c- R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @3 F" r' Y( i F2 [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& v6 o/ M8 c, \! u& k' I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 y$ `. Q5 W. |% P - ! P9 [2 z* R$ o& Q4 d) {$ h% i
- dma_addr_t dmaphyssrc1 = 0;6 u2 W9 s( a9 i# d$ z
- dma_addr_t dmaphyssrc2 = 0;
! g1 c! |+ W* \0 {7 W+ V7 I - dma_addr_t dmaphysdest1 = 0;. d3 k6 n5 S$ {: H2 X: E% w, m
- dma_addr_t dmaphysdest2 = 0;8 u) F' {( f. a5 Y) a5 B
- 2 H: h% W/ A( r
- char *dmabufsrc1 = NULL;
4 u9 b9 m/ @6 f" O( g+ h' j$ P3 [ - char *dmabufsrc2 = NULL;( L* o% U$ v \, u- @! x# x
- char *dmabufdest1 = NULL;
3 ~ V2 n2 d. f/ V% o5 h3 w' n4 | - char *dmabufdest2 = NULL;& y. X1 N, h# K, R- t w
8 _+ y$ Y% T$ Q0 y+ q- static int acnt = 512;
9 a7 y- S; M! p3 h: K' n - static int bcnt = 8;' v( O$ j2 j2 U! G$ x) M4 \
- static int ccnt = 8;
^% T: p1 x% Y' w$ j0 H, ^
# e# ~9 [" n0 |' s m- module_param(acnt, int, S_IRUGO);
8 ^! U6 E2 J- t# R$ J - module_param(bcnt, int, S_IRUGO);4 }1 G8 [3 Z* B7 P1 z( j+ a6 l9 j+ L
- module_param(ccnt, int, S_IRUGO);
复制代码
8 M' O: p' J1 D& S, V3 \
+ p# q. y" t5 L7 P C. _* O 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 X5 y* }* E ~6 t7 ~arm-none-linux-gnueabi-gcc -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 T' B. V. i/ w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Z" p) A A! H* _- J# v! `+ J- L/ @' h2 H/ |2 Q- ^. Z& Z6 X
- I6 Y% m% x2 ~8 b! v$ Z% D, t |
|