|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; R8 L6 j3 z; ?- [code]EDMA sample test application: C+ z; _ O( H3 m" M8 _
- /*
Y' b% F( l: N) g - * edma_test.c, ~" ^2 X& A" k+ {% t
- * j/ y1 |4 Y/ w) Q) i1 g
- * brief EDMA3 Test Application
, {2 r$ j; @. s5 g - *
8 V+ Z* ^2 p1 c# s; u - * This file contains EDMA3 Test code.. k& t8 a$ Z0 k6 C
- *
; Z( |7 n. ^. }! ] - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; t) U2 }* T) s! ~% m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 e/ t+ z) x @1 y z
- * TO CHANGE.; [& }2 n' s% c
- *
! I& R; R, `, f& F; } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: x& ], q4 c' h, ~7 Y9 c7 s, o. W
- *! j3 A- q; ?3 b; v# _ g. t: [! r. M- ?$ T
- * This program is free software; you can redistribute it and/or
% m, F4 h) I8 V! k: x; |/ {" D( t - * modify it under the terms of the GNU General Public License as
' H4 J# _' D# h8 E& K - * published by the Free Software Foundation version 2.
5 F U/ H/ t/ R* i t - ** Y5 X; v- p, N, f: E: T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ [1 C# f- O7 j: I. M4 r m - * kind, whether express or implied; without even the implied warranty
% r( P- N8 k" u! N/ z7 v% c5 u2 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ m1 n9 u& F# |/ }* b7 P( ^, N" P
- * GNU General Public License for more details.( d/ \# N X P$ N6 \
- */) M# A$ I R" U! O' Y! a- {
- / I9 ~$ D! C7 B
- #include <linux/module.h>! ~; g5 b7 @0 |1 c5 M! D
- #include <linux/init.h>7 g* p' z3 s" |5 L A" e
- #include <linux/errno.h>
1 k, ~4 F. O3 m d$ m0 ^& E - #include <linux/types.h>
3 w1 h k( C; ^0 q- U! n. T - #include <linux/interrupt.h>. I. ?% O# z* Q2 A$ M! [
- #include <asm/io.h>' w4 R3 L' u; C- K
- #include <linux/moduleparam.h>
1 |5 ?- `, U- X" d5 ] P& X! z- v - #include <linux/sysctl.h>$ c7 L' R/ {! b2 N/ r
- #include <linux/mm.h>
8 ?* O4 J5 ]: }2 _- J7 D - #include <linux/dma-mapping.h>5 O- M# u) o5 v. H$ }
+ r' S, ^ m$ R7 w- #include <mach/memory.h>6 I, z0 H( y/ L9 F6 x
- #include <mach/hardware.h>
. ^& m7 }: R7 `9 V5 ^* p2 j& y - #include <mach/irqs.h>
+ O( p/ ~3 C# X, L# i" j - #include <asm/hardware/edma.h>
# q: ?' D. u3 {* M& F3 H" _
2 T$ q3 h6 D& i) \- #undef EDMA3_DEBUG% E6 N8 |# u, u" ~
- /*#define EDMA3_DEBUG*/
7 f0 O# r- S' A+ \2 S
" S) |$ c* ] J5 }6 t# Q- #ifdef EDMA3_DEBUG
# O) z1 T" z3 I) f - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); H2 f0 y, M7 }7 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ F8 Y' E/ b5 U: D. {8 ]9 _8 [
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* g) I5 S. m/ O6 g! a1 s$ ?+ c
- #else6 \: ]9 [# U% m# _- d2 r
- #define DMA_PRINTK( x... )
0 {0 g: E! u% H4 X - #define DMA_FN_IN
' i; q% {, i! N9 Y s7 v - #define DMA_FN_OUT
4 L" _' H* v* r% a; L - #endif
0 x- Y5 I V) `3 q - ( Z; \: I8 H; E2 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 M4 j- J- @! b; o. U2 m - #define STATIC_SHIFT 32 \( x) K6 h+ M6 c
- #define TCINTEN_SHIFT 20
# c5 G( Q, v/ `4 o- W - #define ITCINTEN_SHIFT 21
o2 b0 @2 ]- @% A L6 ?% ]' D" X - #define TCCHEN_SHIFT 22/ L/ V8 U$ M6 G0 x2 q
- #define ITCCHEN_SHIFT 23
7 X+ B# f9 \- T# k9 H5 Y% f6 D
8 L$ j+ i" ^1 {1 c2 L0 P* w2 w, |- static volatile int irqraised1 = 0;/ _8 f; `. c- b c0 E' j
- static volatile int irqraised2 = 0;
4 B; A# |: [% O. V8 ]3 i - ! [9 H3 _% m6 r5 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 }* D1 H+ ~- d0 `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" H3 N0 ^: @. N6 u7 l u% m - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `" D- f5 T% I0 [# w" S' M2 S
- + H0 m* G( D X: A* @
- dma_addr_t dmaphyssrc1 = 0;: B/ f0 k2 q, W. s
- dma_addr_t dmaphyssrc2 = 0;, N3 S z7 B1 G5 c. B7 w9 I# s
- dma_addr_t dmaphysdest1 = 0;
2 O9 K/ _( h0 Q( S+ x+ e - dma_addr_t dmaphysdest2 = 0;. n4 S4 n! q7 {- J4 |
- ) L( L i6 F5 m0 U; J" F2 H
- char *dmabufsrc1 = NULL;4 J& R5 Y' q. s6 U- ~
- char *dmabufsrc2 = NULL;
7 G& s! b' v- U& I - char *dmabufdest1 = NULL;# x7 } R1 b4 r6 d" J
- char *dmabufdest2 = NULL;2 @0 V; v4 _; U3 T* o
9 a7 b; S& P8 W7 O3 I- static int acnt = 512;
, F$ S! P* I5 S0 j$ g- K - static int bcnt = 8;/ [# [9 n D0 p7 Y$ z/ ^3 @, \
- static int ccnt = 8;
6 \: Y- E5 v* t; i ]9 F0 l+ | - : F4 a0 Z2 Z% w2 m$ D4 }# u$ }
- module_param(acnt, int, S_IRUGO);+ J6 ~; ^9 E* s0 X& q3 s% Z% j$ \5 M
- module_param(bcnt, int, S_IRUGO);. n/ y4 p3 \8 m! W$ `( R+ G
- module_param(ccnt, int, S_IRUGO);
复制代码 4 N) @3 i* w5 k% l! Y3 c6 x
* E* L9 m8 h6 C* O3 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 [8 j8 z7 M6 S# c6 r' Varm-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 R9 G# Z7 }2 m. @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; {+ a1 B% P+ L9 E/ m! q2 i4 i
6 `& [- m7 V! X4 {$ \# Z; c" O8 }
" _( R/ ^1 T3 Q5 U4 V- z( q |
|