|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 C0 r1 t$ {0 Y/ p; S* e- [code]EDMA sample test application
% {: b2 l$ R/ `' i! |' ^ - /*8 Y) v, ?. X( F1 S2 y1 h0 i b5 u
- * edma_test.c
" c; K- s) z4 [ - *
3 T R! K6 { j& o x. C3 r) ^! \# i - * brief EDMA3 Test Application _8 _5 C5 F0 f$ ]' ~1 C& F W
- *
0 C$ c1 B! b% w* [: c$ w - * This file contains EDMA3 Test code.
' l5 J0 l( T- i4 Q p% K5 A7 r0 I - *2 S- _* x+ j& o0 c" L) O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ y5 ~( D" P7 w6 L6 Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 w5 @2 L( S: J/ O h7 r6 j! m2 \% S - * TO CHANGE.( Q/ J& @: ^: P6 l) q0 x8 H
- *
* u# u+ m' L1 E+ V3 M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* J; S2 T, v4 E% H( V @- X& | - *
- }" }" H: B# {3 f - * This program is free software; you can redistribute it and/or
3 F0 H3 T* D, t u& ?" R) q& t - * modify it under the terms of the GNU General Public License as+ }3 B0 g G L
- * published by the Free Software Foundation version 2.% L2 c. ?$ v2 A( @; e
- *
' R2 |- A1 v/ j2 F! y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any! T9 L: O' w, j1 N% J+ K8 a6 d
- * kind, whether express or implied; without even the implied warranty
6 {+ G; S% C" j5 a# H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ S3 t" [! j, j5 Y( X" o' D" T
- * GNU General Public License for more details.
% B' k% |2 n1 ~8 k; \( s$ V9 p - */
$ a! l+ K, i2 b H7 e - " `3 p1 ^: Y- t3 Z0 V/ Y4 V+ Q
- #include <linux/module.h>
& W/ |3 y4 I4 T! ` - #include <linux/init.h>
- V( o" z* ~; W7 v$ _# | - #include <linux/errno.h>
+ l" _1 ]7 @. H) e6 l7 w4 Y - #include <linux/types.h>
# J2 ]5 ? o: \' ^3 l' O0 _1 N - #include <linux/interrupt.h># M+ I% l+ M# d: y7 L$ w" G( |0 O
- #include <asm/io.h>/ z I6 I9 ^9 d
- #include <linux/moduleparam.h>
1 }! @* Q9 `+ W0 K3 H - #include <linux/sysctl.h>/ L: `: @/ c$ d, m* c
- #include <linux/mm.h>6 P) t+ G9 ]! `
- #include <linux/dma-mapping.h>; A6 @5 w6 q) O% R) c
- " B9 V1 m5 b! o' J2 d
- #include <mach/memory.h>
% m/ ~8 ]# p& m' y - #include <mach/hardware.h>
! r* a& Z# O$ x2 M- Z7 z# L - #include <mach/irqs.h>
) |8 s! v+ [* d+ X+ `, O - #include <asm/hardware/edma.h>
) N8 `1 w# {+ B) D
: o {! Q& I5 p" n- H& W7 c' @- #undef EDMA3_DEBUG7 `+ r2 K* P* d% r
- /*#define EDMA3_DEBUG*/) h7 W0 k. R' f, I
- * X6 {: q' Z: K- J, c' @! O
- #ifdef EDMA3_DEBUG
, B. W- r; ^: U2 O - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 }) D; [2 U9 q; Z9 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, |7 X! O& k7 P+ U, x( Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ M0 Y: ^( i9 l' M5 D - #else- Y7 x* g4 t' r4 V. F
- #define DMA_PRINTK( x... )& V( m4 a' ~# D% j7 G
- #define DMA_FN_IN
x5 I9 O1 V/ R6 o$ B g# k - #define DMA_FN_OUT% u$ R" j% F3 r/ o4 [
- #endif
, ?6 M8 m3 g7 _7 E. j4 ~ - * P9 F$ }: F/ {/ j* c' ]" i7 B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. I8 H& q% A+ M7 Y! R - #define STATIC_SHIFT 3: V5 ~% i) t! t
- #define TCINTEN_SHIFT 20
( z$ v* f; o& W$ M0 i - #define ITCINTEN_SHIFT 21* X: g- `8 O; [
- #define TCCHEN_SHIFT 22
- h- @+ X- z( z' P& B' T: Q - #define ITCCHEN_SHIFT 23& d/ C' {* U0 u1 o3 [
- 1 Z- U* y W2 Z6 G- b
- static volatile int irqraised1 = 0;! \8 K/ o6 H$ e; p
- static volatile int irqraised2 = 0;
! Q% E$ S! j+ N& K
& u2 H) L3 j* E! F( m- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 g6 O$ E6 y" g( i3 e - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% j% m" C$ |, i+ K7 i6 C4 \7 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 H3 Z$ u. ~# p+ b) }; {4 M
* h# Q0 j3 r$ `7 A- dma_addr_t dmaphyssrc1 = 0;0 }& @$ A% V. a8 ~, F& u5 _6 k) z: |( E
- dma_addr_t dmaphyssrc2 = 0;1 U. o7 U/ K4 l; v
- dma_addr_t dmaphysdest1 = 0;
* t' r$ N0 j6 e' d - dma_addr_t dmaphysdest2 = 0;. S t+ q- ~6 R- H" f
5 E7 s: a r$ q% P- char *dmabufsrc1 = NULL;. P$ x& N! Q1 B' T
- char *dmabufsrc2 = NULL;; t( D- w& ]- Q
- char *dmabufdest1 = NULL;
' k' D& n2 U3 L, D2 v* [ - char *dmabufdest2 = NULL;2 \3 X/ h9 b$ t* B( a
- Y$ a+ l2 q9 O9 g7 U$ X! l9 ?
- static int acnt = 512;+ e! k$ ~1 @7 D
- static int bcnt = 8;
1 X& Y: m1 ?; z/ e - static int ccnt = 8;
3 Z9 r( ?& k$ r
# m5 S N9 X% ~1 Q; G+ y% O- module_param(acnt, int, S_IRUGO);
" G0 L/ R& m; \ - module_param(bcnt, int, S_IRUGO);
- G$ ]9 [- y( m( Y - module_param(ccnt, int, S_IRUGO);
复制代码
( [4 q* D( h, ?. c8 n/ Q( y; U! a! a: I8 Q" E# ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 J& ?/ R8 F& W/ }, X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& \* |, k1 |% R1 c# Q% U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ q9 i6 n/ Z* i4 i0 Y s6 }5 I. x# G
" r9 {. R( _8 X: @% l' X0 w: {' k. s, }- M% [4 v/ i) M
|
|