|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 [ i8 _) {9 [+ v
- [code]EDMA sample test application
; E, I, A- y { - /*+ }, r3 z# \9 u
- * edma_test.c
/ Z+ W6 B8 q0 s% o. p - *5 M, P# @1 U; [, `
- * brief EDMA3 Test Application1 g! {- w O( L9 ^
- *5 H8 a2 z; q _1 `* V5 T4 M1 x3 J
- * This file contains EDMA3 Test code.
+ ]; V2 O) Q3 V! ^" O- T1 m; f - *
; ^+ K% I* E6 E L$ ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) b' O0 t+ S8 i N/ ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# P1 j. o( x4 y3 Q' L - * TO CHANGE.! a! O0 Y3 P; J# p( a4 H: R
- *
. c$ g$ M* j7 u) V - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 D7 s5 V5 l8 F1 I' r1 [7 @ - ** V" J5 |2 V! X: S
- * This program is free software; you can redistribute it and/or
! {& d4 M3 q& t% ?: w - * modify it under the terms of the GNU General Public License as8 q0 {5 q% D2 S+ L
- * published by the Free Software Foundation version 2.2 m2 q! ?$ y; `
- *7 r8 H$ t, i+ F" R8 J8 ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* m2 O, W' p$ c7 c4 y - * kind, whether express or implied; without even the implied warranty( ~! _% L z) F! B: t1 G: w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 t# F+ V$ E7 `; W - * GNU General Public License for more details.' l Y% [" D- K& \
- */
0 z, _1 k8 r& X
* S& B. \8 @; L) l& H- #include <linux/module.h>
4 _2 L' k4 z, i: K1 [% C% s' j - #include <linux/init.h>% m4 T5 z5 |+ y5 ]' a% S0 }( ~% V1 l
- #include <linux/errno.h>
0 S6 E# S/ T0 \* z) X/ q - #include <linux/types.h>
2 J0 L( S- k$ s, m8 i/ S - #include <linux/interrupt.h>
3 |' L6 `; i' I) f6 S - #include <asm/io.h>: q( h/ S/ d& Q. Z- Y" c6 e+ [
- #include <linux/moduleparam.h>, K1 E! h! ]; K
- #include <linux/sysctl.h>/ ]) F3 J. X" y) A
- #include <linux/mm.h>
: i, C& s" }6 |1 M) z, g- i% D - #include <linux/dma-mapping.h>
5 ]# j$ N. Z' ]3 a - * L3 E6 p9 G9 i( h* _
- #include <mach/memory.h>
6 v$ u0 G5 P4 {$ J1 D- @3 z - #include <mach/hardware.h>" P; p8 p% h: ^- N
- #include <mach/irqs.h> C9 ?2 z n# Y; ^
- #include <asm/hardware/edma.h>
! [1 T- f9 ~5 h7 s5 G' A& j
* \+ s$ l; J" ^% T( H% }- #undef EDMA3_DEBUG
/ U& H( D6 `! l; o5 U - /*#define EDMA3_DEBUG*/
4 I. l8 n1 ^! [) f7 M
/ o: I1 p: n7 g: W0 V) h* `+ s- #ifdef EDMA3_DEBUG
3 ?1 n. x- ~$ W$ | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% m2 \2 [2 |" ]4 @, x" F5 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' w0 n: o" X' U" w* i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 z' V8 S0 ]0 ]" C* I- K
- #else
' a: v/ m5 \2 i - #define DMA_PRINTK( x... )
' V2 V, Q/ B' C% ]$ w1 M - #define DMA_FN_IN
9 h. Y- N& X4 g - #define DMA_FN_OUT8 ^+ P+ g* I0 k+ }( U
- #endif
! J* F4 q* W' }' X* U5 S
8 ^0 L, Q7 k8 i; v- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ N! f! r1 E0 w, u; J - #define STATIC_SHIFT 3+ b* \6 m" \; R- u" {
- #define TCINTEN_SHIFT 208 p3 x5 b, g1 r3 L( O9 p9 t
- #define ITCINTEN_SHIFT 210 w _, M" J6 D( r* x
- #define TCCHEN_SHIFT 22
0 n K1 y7 V( w3 f; B% E - #define ITCCHEN_SHIFT 23
6 L/ n3 }; ~ K, _% N; _
, q& ^, U& M8 Y5 B# {- static volatile int irqraised1 = 0;
. n9 t) n6 y8 X- `, F% A0 i5 ] - static volatile int irqraised2 = 0;% i; } R3 }1 Z2 o
: r7 B: R2 W) \' l& R- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 b, `9 S5 T3 r) ?3 H; N; p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( D: b* N! L- B. m5 M, M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |6 D) G! W i" k5 l
# Z& c# {& a! n) S2 {2 R* Y, Z- dma_addr_t dmaphyssrc1 = 0;( t# C$ C! b0 m8 a0 U* D/ [1 H8 w
- dma_addr_t dmaphyssrc2 = 0;' M' a$ a1 V2 p% ]5 D2 j. R1 l- c
- dma_addr_t dmaphysdest1 = 0;; C0 M# p+ \; x1 l& g# d
- dma_addr_t dmaphysdest2 = 0; b4 ?* w4 C% Y* q9 H
: k. R! Q# x' }( {' ~% Q3 m4 ?- char *dmabufsrc1 = NULL;
+ Y1 J N! S( W6 b0 a2 I+ z - char *dmabufsrc2 = NULL;
l$ n2 ~# M$ T% o* z- N2 v$ X7 n - char *dmabufdest1 = NULL;
* G6 t5 f: F% f6 A - char *dmabufdest2 = NULL;/ J$ s# n* a% V8 `# C+ ?3 [3 ]9 t
- " d! ]! u4 ~. o4 E! }2 G4 }
- static int acnt = 512;
# u4 T( d7 S5 J3 ~+ [ - static int bcnt = 8;0 {* ^' G, w5 m1 d& v" C) N& i# q
- static int ccnt = 8;- E4 l) Y- ]5 H/ E7 b/ U, e U
4 B) W' `' w! d4 E$ K- module_param(acnt, int, S_IRUGO);
+ B+ o! x# Q f" Q. j4 k% l - module_param(bcnt, int, S_IRUGO);! d# R- Y4 \& q* [5 I% Y
- module_param(ccnt, int, S_IRUGO);
复制代码
" I7 p3 ^- Y5 P( e! ?$ X, K; t7 L* S$ h5 j* z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 e- k+ T4 ], T- n6 j( p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 h* P( n2 K) m8 A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ ?4 n% U& k% T1 f6 ^- E$ q! N8 k& h# r- Z/ c3 n
' v+ S- K8 y8 \; F4 l
|
|