|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' j5 ^- j: z# a0 e; r% ?- [code]EDMA sample test application6 `. s# Q }7 j9 E1 K
- /*; O: E4 y- {- m, {8 @
- * edma_test.c
1 J4 O0 T5 B9 F8 x - *9 R9 a1 P, V5 A1 G, }% u
- * brief EDMA3 Test Application% i/ O7 q* |4 j" s+ J% l
- *
6 w O* _) {2 D. \ g0 o - * This file contains EDMA3 Test code.) Q, ]$ X4 e* b$ l
- *
0 d2 \9 u4 j5 m. [! C$ y( R8 O3 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 [5 F7 f; \6 P5 @5 w: Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Y O! S# t/ N) G7 H' u5 r
- * TO CHANGE.
9 v- C5 [8 _2 Z# @ - *
5 B/ j9 w5 p8 A2 V8 g$ E$ B) d - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. |/ U5 f) p. ^% G, P7 D - *& m8 e" o' R0 \5 T p9 y3 z- W
- * This program is free software; you can redistribute it and/or
, p% J1 D6 T/ R4 x4 I - * modify it under the terms of the GNU General Public License as0 H. U- D8 ?5 p1 K! U1 o4 U
- * published by the Free Software Foundation version 2.' c( F1 Y; P( ~7 q
- *
0 \- V) k& I: y6 x" b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 \; \2 I# S0 G- z1 d* z3 j - * kind, whether express or implied; without even the implied warranty1 R- U' y; d. D( E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) t9 P: C" G9 ^4 {/ V/ X - * GNU General Public License for more details.+ O0 T7 `7 \5 R' ~- A( G
- */' [* e/ J8 o6 P, s2 s
1 s: l+ B4 u% B& P. l$ [- #include <linux/module.h>) N! G+ `# L, m2 }
- #include <linux/init.h>
# N4 [. e, s/ N4 H# m: n! @ - #include <linux/errno.h>
% I' C9 J6 v* \4 t' g" E. ]4 t6 I - #include <linux/types.h>
# @* n8 `0 J+ w% P$ ` - #include <linux/interrupt.h>) _3 ^3 c' Z+ m7 c9 ~; ]6 P3 p& S
- #include <asm/io.h>
1 D; D( }# {; D$ B+ ?3 a0 f - #include <linux/moduleparam.h>$ q$ i& g7 V% g) Q
- #include <linux/sysctl.h> L! V% n# J5 L u7 ]- T
- #include <linux/mm.h>& t" l, a& M/ V: ]+ c! ~5 W
- #include <linux/dma-mapping.h>
' Y6 G1 t' }- `/ K2 B
9 j4 ~+ U t, k/ r7 o- ~! }- #include <mach/memory.h>
: L# V. t! B8 D - #include <mach/hardware.h>
% }+ [" M2 L6 s# Z0 r# i - #include <mach/irqs.h>
# N6 V9 H0 \/ {! s - #include <asm/hardware/edma.h>
9 \. N$ T3 O S" c - 1 a) G+ ~# d; x! l
- #undef EDMA3_DEBUG" A% F6 J; {4 ^$ q
- /*#define EDMA3_DEBUG*/
' B, f5 y- g8 V: }5 ]% i - $ a) H4 u' B- B/ P& Z% {5 k1 x
- #ifdef EDMA3_DEBUG& n0 k5 }" x7 i) q; ]: Q5 X4 B, w8 U
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) [& k1 _( s) g. S7 E) N5 b) G5 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& ~7 ]2 g+ B0 l$ ^. I' S3 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 ~2 Y+ z/ o2 t/ N4 ]( p3 n2 _
- #else
* V5 ^3 f: [4 p, P9 ^ - #define DMA_PRINTK( x... )
, i2 l( V% d$ o+ A! k. @ - #define DMA_FN_IN0 ]5 M: F$ x l: |+ x
- #define DMA_FN_OUT2 s5 v3 V: j, x8 a
- #endif
, _$ O* N( i( t+ H Z - ) D& X5 u- I0 Q$ c. E B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# W0 O$ q [2 p2 B% J6 U( Q) o
- #define STATIC_SHIFT 3 A' O5 c: o; N
- #define TCINTEN_SHIFT 202 [5 q2 T) R* h3 a" q( |* Q
- #define ITCINTEN_SHIFT 21 B" \* u2 {* T
- #define TCCHEN_SHIFT 22
& s8 ?' \3 m5 c$ P - #define ITCCHEN_SHIFT 239 N& i# g+ _* O' F
- + g% \$ i; t \, Y3 E% [; q
- static volatile int irqraised1 = 0;
# h, q. H4 ~1 L p: i* |0 T. H! u - static volatile int irqraised2 = 0;
- m) } N6 p: Y8 W& F( R
/ z3 \. ^' P9 d: ?, G" C' |2 e& Y- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 W" g( M: P/ |; q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 _. ^+ J( \% z1 Z3 K - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) R4 N9 `) P+ |6 i5 n' _
( M$ W/ b4 X. x9 d- dma_addr_t dmaphyssrc1 = 0;
; M6 o+ D' |1 H6 W$ H' A - dma_addr_t dmaphyssrc2 = 0;" i& `: F' p3 S0 F9 y- |
- dma_addr_t dmaphysdest1 = 0;9 g* Z9 E" m$ a1 `+ O/ v
- dma_addr_t dmaphysdest2 = 0;
V) M6 O" r% _' b' z8 C, B! k - 5 L3 [$ m4 w9 r* @# y# A
- char *dmabufsrc1 = NULL;
7 V5 k: x E C; G - char *dmabufsrc2 = NULL;
2 _$ i4 u+ N% @ D6 K& _& t3 u' c - char *dmabufdest1 = NULL;. _# }0 T$ `1 H* z/ F
- char *dmabufdest2 = NULL;
/ [0 E: [! G# X8 U1 N: q8 F - & F7 ] b2 c$ l2 }( W
- static int acnt = 512;
3 H ~& ]) Q2 p* t% P - static int bcnt = 8;. m6 ^( `6 `. a$ N1 E' \" P. S
- static int ccnt = 8;
2 o7 W0 V, d) @ h. g' ~) X
L- @7 d8 t$ x; Y1 ^. T; m' R- module_param(acnt, int, S_IRUGO);
6 B; X9 _, f0 Z' I. z# ? - module_param(bcnt, int, S_IRUGO);8 Y# C8 f- c( W& i
- module_param(ccnt, int, S_IRUGO);
复制代码
! D( z, @( o5 l2 m' u: ?' z+ Q( D+ d: c$ a' z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 x0 K7 p @. Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 t* S/ P! m0 U$ ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 {8 K& H7 a: C$ H) M" F+ Z8 {0 o) K q1 t
, Y) |6 @0 e) X, I9 g8 e: M; n |
|