|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; e9 ~1 z7 Y' a O" I- [code]EDMA sample test application6 J) x+ U T2 Y; i x4 J& y& g. j
- /*' c: n1 H5 K9 u: C' ?" i0 I0 Q
- * edma_test.c
, r1 }/ {9 t8 R2 B2 g5 K, G' ^ ] - *
4 R9 G6 R8 c a% h$ \ - * brief EDMA3 Test Application0 y+ T- h: R& ~8 e& B
- *" w- J. w l/ g9 _1 G
- * This file contains EDMA3 Test code.* \$ [) F, S5 o) |
- *# s6 ]3 ~) N4 t! ^! p0 v5 l9 ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, z+ ~0 C) h i3 D! r8 v. p( ?$ Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 H) |" g, a' o6 L - * TO CHANGE.
* @9 o" b- T- K- S0 t5 I% e2 g - *
- `; Q' j; Y! E. w2 | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 v, c3 a, M$ P {. h
- *1 p: r- X- o: B* q5 H4 e
- * This program is free software; you can redistribute it and/or
& P# H) g7 x$ Y' [ u' F - * modify it under the terms of the GNU General Public License as K0 P, m" r1 `
- * published by the Free Software Foundation version 2./ d# N- O8 \" p4 u( g
- *
+ b8 s4 S7 G, t$ j7 L! }! j4 P2 ^ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any z0 l$ o1 }4 \1 Z
- * kind, whether express or implied; without even the implied warranty
- A6 Y, S% Z$ Z& U" [; P& ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" o: @) W' w* D - * GNU General Public License for more details.
5 _6 i% ^" K7 {$ M9 r' J - */4 H* W: m8 [9 m: ]
- # ~+ y; x+ m. V* v
- #include <linux/module.h>
- W" P0 `; m! C5 u - #include <linux/init.h>
: a% n$ u# l3 _ - #include <linux/errno.h>
# f4 s7 J( u$ \9 C - #include <linux/types.h>
) P% Y- N( k6 y - #include <linux/interrupt.h>
) ]4 n+ r; S2 A% k8 j - #include <asm/io.h> q9 b/ O* W; v6 _1 C- l
- #include <linux/moduleparam.h>9 U; j) q8 H% L$ T8 m
- #include <linux/sysctl.h>
( X2 G; d, d0 G& ~2 b. d% ~# E* { - #include <linux/mm.h>1 Y) x9 x: Z& [9 h5 x
- #include <linux/dma-mapping.h>
& E( ^) y4 i2 J+ k& ]2 |
l8 G9 Q7 `, y* {2 R7 X4 V/ _- P- #include <mach/memory.h>
$ y3 }( `& b' {, \6 T4 N- O4 d - #include <mach/hardware.h>
3 `8 }7 @/ N; m1 |2 y, C+ F6 ^ - #include <mach/irqs.h>* L, Y7 `2 h( q' @8 i
- #include <asm/hardware/edma.h>+ N2 A/ d0 e+ E0 ?( a- C% D: S* a, q
- 4 E2 v3 X3 j' F; D
- #undef EDMA3_DEBUG1 V/ n" n. h: E( U2 X# e
- /*#define EDMA3_DEBUG*/
% k/ K! L" c1 J: n8 g( W - 3 C2 L% V. V' w0 U6 ~+ y" Y* s
- #ifdef EDMA3_DEBUG
8 d8 t. |1 X5 N& Q9 P+ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 H) d+ V' P, j6 S* c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' J+ ~, _9 W: w8 x" ]: |7 y1 j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 z* W" Q- p- i, g! w) t - #else8 Z( `' W! D, {, D' x G! C
- #define DMA_PRINTK( x... )$ r/ N7 [* c, F F/ m0 V
- #define DMA_FN_IN
8 h3 s, K; l+ a - #define DMA_FN_OUT
( Q8 _( n7 G! a" L( t$ Z - #endif' B$ H, K w! w, H7 O4 g
1 b1 t3 z @, V# E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; J5 }) j* x! m E, a1 \ - #define STATIC_SHIFT 3
" T. g) ^: |5 a. a L% ~ - #define TCINTEN_SHIFT 20* ~3 i/ j: K$ y7 f3 |
- #define ITCINTEN_SHIFT 21
/ G. b5 j+ |' N5 m% p+ T - #define TCCHEN_SHIFT 22
- ^7 J. y7 L7 e - #define ITCCHEN_SHIFT 23
! m1 g; n4 A m$ K' Q9 x - ( E( q/ `! a; G9 T( o
- static volatile int irqraised1 = 0;' E) x l1 P. R- D0 A4 g
- static volatile int irqraised2 = 0;
4 r1 t' U+ @3 Z) ]3 U* [
0 O& y d" P$ H, B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' J) {2 G$ b# U5 I5 I( M6 e- M) ~5 s - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 [. A. B5 ]0 `" {/ x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x7 B- f( m& V/ s$ ]7 z
& l7 O" \2 H) I) I9 g5 R- dma_addr_t dmaphyssrc1 = 0;
9 R$ u- c4 k0 _$ h4 L" x1 y - dma_addr_t dmaphyssrc2 = 0;
$ w6 K C* K3 F% Q# | - dma_addr_t dmaphysdest1 = 0;. |: D$ u' n5 I
- dma_addr_t dmaphysdest2 = 0;
" u/ z( v {" n3 c( n# y$ ^ - $ H- X. ^0 b- L/ ?9 ~, r8 z2 y
- char *dmabufsrc1 = NULL;
1 r" [0 d; c8 y" H1 J) y$ S - char *dmabufsrc2 = NULL;
+ N5 A7 e+ t$ B - char *dmabufdest1 = NULL;) H# J+ f5 c; \
- char *dmabufdest2 = NULL;
% d: e: g* u9 t. @ - 5 N* K! @0 s5 {$ H
- static int acnt = 512; E$ m6 ^4 r$ b
- static int bcnt = 8;
% j. }3 Z/ R/ o7 Y! k C! I' Z - static int ccnt = 8;
V) D, V6 F% S! R. O, ?2 v
4 ]( Y& h( Q3 y8 }& R- module_param(acnt, int, S_IRUGO);
. S U) H/ x# }7 ^! d - module_param(bcnt, int, S_IRUGO);8 S+ N+ k! Z" ~. a% T: |
- module_param(ccnt, int, S_IRUGO);
复制代码 % ?8 `( S+ ^, `& J# I
, i5 @4 o- X0 h7 X: m( Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. D! N; L) c5 ~9 z& iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 k0 D: q9 L9 ]6 y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 i, Q8 b q4 R% E
6 b: W* c( j) W' d0 Q! j
; K" h1 [% E6 m- X4 v& m) O( L |
|