|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + i* @" C. I9 f/ W5 @
- [code]EDMA sample test application* \! E) L9 u& m Q
- /*2 r7 l7 g- @" c! K9 X& k/ Y$ I
- * edma_test.c/ H, y7 H) h& @$ e1 \- R" h; W: A
- *: n7 P7 X1 i9 r! H; Q) F: o% G
- * brief EDMA3 Test Application
2 r& l: f5 H& z* M7 U9 F/ s; w - *. S! F3 |6 C7 G" [* I$ R1 G- ?
- * This file contains EDMA3 Test code." `% @% H# R0 \- V
- */ f2 [ K! l5 _; }0 Q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 a% h6 i" g$ Y8 O - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) _9 Y/ Y8 }3 L5 b% p
- * TO CHANGE.8 z# e" {0 O# R p! B5 @
- *9 k4 T2 a1 G$ s% a! f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ j8 p! n6 Z t4 {. V4 Z
- *
( a: O8 y7 U' D! \. H5 k - * This program is free software; you can redistribute it and/or U5 y& n% q. y0 ?
- * modify it under the terms of the GNU General Public License as
2 g' x2 W* |+ X6 X. e - * published by the Free Software Foundation version 2.1 ]* F: p( \- _- e4 y7 @
- *% \! z+ B# f1 ^" Z& k7 @$ K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 b& u) `0 M. f* B0 e2 o* W - * kind, whether express or implied; without even the implied warranty
8 d7 }& t+ `. ~* H4 U% s/ ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 {' x! w! Y; C+ A8 N
- * GNU General Public License for more details.
4 \+ y2 Y. E, c c5 @5 u4 |+ D% D - */7 n- l4 t9 a+ `8 ?) T- `
. ?& u% T: H H( }- Q6 y) b% h- #include <linux/module.h>
# Z' A6 \0 B2 U4 w5 @3 y5 } - #include <linux/init.h>, z# `& P- n# i+ A. I, V1 ?9 r4 D' ~
- #include <linux/errno.h>
, G: T6 @; U2 a0 p+ n; o - #include <linux/types.h> J. L8 z5 V3 r; ]4 O, v" l
- #include <linux/interrupt.h>
7 n6 g# ]2 g: r) P - #include <asm/io.h>% d$ `( Q+ k! y c9 S% M
- #include <linux/moduleparam.h>
- n1 j# e! L6 B. S9 H; n: c9 h; H- ^ - #include <linux/sysctl.h>
& V( P9 D& m R1 a9 a9 A9 h5 Y# N - #include <linux/mm.h>
6 m4 A9 P' o1 Z5 o6 c - #include <linux/dma-mapping.h>1 y3 m8 \1 K% o- u
- % n% X- @2 u" [" G1 u- R
- #include <mach/memory.h>- R }$ k9 O; E
- #include <mach/hardware.h>$ X( u+ J8 s* c0 W, s& \
- #include <mach/irqs.h>
, B D9 z. w" | - #include <asm/hardware/edma.h>: _" ~ K! @- V4 L* ]" ~
- % p( s7 J- Z% `+ U/ q
- #undef EDMA3_DEBUG. x+ L, A' F' z- }$ P ?) q
- /*#define EDMA3_DEBUG*/
8 _6 \6 c) U) [1 h8 A
6 r! _/ h" \; y1 H. O; m( X- #ifdef EDMA3_DEBUG8 e2 ?5 D& z# M- g0 \7 C8 i
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* R, S# h0 \7 z) y* W- A
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ X3 Q# G! y' x. {+ E3 }3 ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R U0 v/ x; P7 o. P, w a
- #else
) K7 Z$ ^: B2 r" Z - #define DMA_PRINTK( x... )
* A- P1 k! V2 m% }% b/ B2 R0 h& N - #define DMA_FN_IN7 r6 c* { p' V' I
- #define DMA_FN_OUT4 o! W, \# a$ B! m6 Q! R* T' l
- #endif
* G0 e; `" x+ |: y1 `! Q
, b8 y0 P+ ?7 Z2 {5 Q- f/ D" j, m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 {7 M r5 I& @; `. K! f0 G
- #define STATIC_SHIFT 3
, G. Q' w5 N8 c3 H! j" J9 T( X - #define TCINTEN_SHIFT 20
" ^% u5 r) w6 b% r8 W0 [( g - #define ITCINTEN_SHIFT 21
) J+ x" W9 N h3 ?4 P% L$ y - #define TCCHEN_SHIFT 22' X7 ]) G' A X3 Y/ Y& P) `& Y
- #define ITCCHEN_SHIFT 23- g: L5 J- l, u+ n) t
- / Y: Y/ L& @2 [9 k) w8 Z; N. A0 q
- static volatile int irqraised1 = 0;8 s1 u: d/ @% o1 Q( U, x* D- c
- static volatile int irqraised2 = 0;
' j* x! {- f* ^" E5 q& y6 L% L - $ J# t: j3 h, @( V$ m" a* _- q2 m
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d6 u Y8 q% k9 E2 V3 i2 ]& _
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q8 [% p( \! \9 v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 G" ?; a" W% H' I1 o
3 `) x4 f4 s- H5 [- dma_addr_t dmaphyssrc1 = 0;8 B9 ]& O I! j) }
- dma_addr_t dmaphyssrc2 = 0;
+ i+ h b9 z4 q: M; g* P. T, t - dma_addr_t dmaphysdest1 = 0;
* {& O6 _1 g3 _ {" ]- Q9 K - dma_addr_t dmaphysdest2 = 0;8 c$ V% O3 e8 M- K4 r% y+ q
5 x$ D5 J5 r4 w( a/ F! u- char *dmabufsrc1 = NULL;8 i/ g f; R8 j4 ~2 I- @
- char *dmabufsrc2 = NULL;
) }- u# m& W+ g. ~ - char *dmabufdest1 = NULL;. }1 @# z7 [' s5 `3 m
- char *dmabufdest2 = NULL;
8 _5 B& K6 e7 ?" w% [
/ s4 ] a9 j( D- c- static int acnt = 512;( P G* A) K9 @1 {1 g
- static int bcnt = 8;6 B+ V* Y7 x: T
- static int ccnt = 8;
( |- F2 s _7 J1 E$ I5 \& K
# L$ W0 R$ ~6 m5 W- module_param(acnt, int, S_IRUGO);
9 }6 k2 U3 u+ z2 ^1 D% \( K! e - module_param(bcnt, int, S_IRUGO);; X6 b) E$ {/ N* o, v g( u
- module_param(ccnt, int, S_IRUGO);
复制代码
% c' S( A, @0 C. E- M1 k% ~" k$ A; n/ l4 R5 L t) H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& S$ S" i( y- x* darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 |5 l b, O; E' E& U$ w: s: L- \ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
P8 u; S6 V9 u5 A% P
/ q- p+ E; i4 c( P5 Q4 ]$ |* O3 @0 d* g- J
|
|