|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: X7 P s; D& K* i- O! T% g- [code]EDMA sample test application
& u) w- {/ i- M, t; Q" k9 w2 F7 m - /*
. W0 A( l q0 Z- ]! b - * edma_test.c
# c+ v( [+ ?4 T; m" A2 P - *
& V- U' U. q9 x- \3 m - * brief EDMA3 Test Application
. J1 R7 X& }6 H) N+ |6 { - *
% q( w0 s& a, Q, F. Z5 Z - * This file contains EDMA3 Test code.
7 M) w9 |. B9 y# @* L - *6 s/ K9 W' }1 s A B9 Z, B% N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S! d6 @& y& p3 X9 s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ?9 [: z# B9 k! ?5 A
- * TO CHANGE.
* b. a- ?4 @. |# o# v - *0 C/ Y: u) S( }1 E2 z$ N8 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" O0 ], w6 o, ^
- *+ c& O. u0 B( j; r+ I# W
- * This program is free software; you can redistribute it and/or X6 { B1 O @" s( \1 p" c
- * modify it under the terms of the GNU General Public License as. ]! n' T6 ?/ c5 A- Q+ G
- * published by the Free Software Foundation version 2.
, u- f! S" n: u" h1 P - *
- i5 I' {5 ^# ?% S. W$ C; n/ r+ K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
% t0 i6 F3 {* y2 L - * kind, whether express or implied; without even the implied warranty
0 K' ~$ s( j1 b3 g6 e* o# K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 L3 Q" J& T8 [/ D- R6 l - * GNU General Public License for more details.
3 b& G% {+ q$ `* H! t3 q - */
' z* y! i5 P) z9 J- f6 N7 r! T6 ^, s - 8 P0 `! B+ x3 I& q% E
- #include <linux/module.h>, V+ c8 y( Q0 [8 S
- #include <linux/init.h>( n6 I8 J1 \6 ~& c
- #include <linux/errno.h>
$ h/ P9 C, Q, L! {% u# L - #include <linux/types.h>
0 Q+ A j6 A, V: ~% j - #include <linux/interrupt.h>
) Y2 @6 o; c o, ]/ R( D7 s3 P - #include <asm/io.h>% w, G( N7 n3 ?
- #include <linux/moduleparam.h>
+ Z$ q- g! n8 h - #include <linux/sysctl.h>
, k0 d o7 m* \* S - #include <linux/mm.h># W6 G" k" h+ m& v6 y) T9 I2 a
- #include <linux/dma-mapping.h>: S( [0 v/ F7 Y9 A
/ W6 T7 j+ P0 J, a, ]6 g% z- #include <mach/memory.h>" ]7 L) N8 b: Z5 Z. u
- #include <mach/hardware.h>5 Z+ z# s* }( T' M9 q' Q' B
- #include <mach/irqs.h>7 G( E$ I$ Q1 p' K8 Y; ~8 u
- #include <asm/hardware/edma.h>
$ ]9 p+ a: C: g. |6 I
i; X3 w/ b; v( @7 r# P! e- #undef EDMA3_DEBUG: R4 _" E3 z9 j) j
- /*#define EDMA3_DEBUG*/
( {, X! r7 T) x/ S& }
3 D$ t7 U; w- s. `" M- n- #ifdef EDMA3_DEBUG
: g) p" |% J8 b o$ R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
^3 l1 O& M3 t# g C% |$ ?% I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. Z) I& h# p9 |/ {, i/ M/ X2 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- O7 W( K2 w7 }$ V
- #else
) \% l) P2 r- F/ v- T5 a - #define DMA_PRINTK( x... )
! w9 ~. L! l/ u8 M: t) p9 d - #define DMA_FN_IN
* @; n9 p- w4 L. }; P) C - #define DMA_FN_OUT
# w( W2 @) O; Y7 ?! ]" ~, u* O - #endif
+ X" P. g1 @9 P4 f- u# k
5 }3 ~9 i5 C) _3 c+ ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
3 A% t$ C% z4 g3 j( B - #define STATIC_SHIFT 3, k2 i" _2 P5 _( g& r& c
- #define TCINTEN_SHIFT 20
8 v3 h, E2 X" R% [9 _ - #define ITCINTEN_SHIFT 211 a# q3 L3 ]/ C4 Y6 v
- #define TCCHEN_SHIFT 22
+ l/ g' c4 P; p - #define ITCCHEN_SHIFT 23
3 G* b0 J! |4 U
- B/ l# k9 O1 h, \- static volatile int irqraised1 = 0;- J! d/ u5 {7 k
- static volatile int irqraised2 = 0;2 V; o t4 R" k' C; t0 h* x1 g
- " T+ k' t8 c" |/ q. O
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
l* c& l: X! c7 r h6 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; V$ y+ Q# @# }3 k% g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 K, Z6 c: L; m( M' m4 {. U# N+ @ - $ q4 b# g- v. C2 e
- dma_addr_t dmaphyssrc1 = 0;, ?8 w1 j* }$ @* W5 U. Q
- dma_addr_t dmaphyssrc2 = 0;& r3 n V- z7 L0 i+ ]
- dma_addr_t dmaphysdest1 = 0;
4 I1 O0 ^# N$ H0 E! C: V$ G/ R, ^/ i9 S - dma_addr_t dmaphysdest2 = 0;
( Q4 K( X m/ s7 s. D - / q9 q# h8 w7 |' b( l: G
- char *dmabufsrc1 = NULL;
- t6 F$ p$ _: J1 }! q$ G - char *dmabufsrc2 = NULL;
E* t) T" e q' p; Y5 Q - char *dmabufdest1 = NULL;
% Q# p( f$ k- t# G6 Z6 V - char *dmabufdest2 = NULL;
- H' z) R7 V$ g2 n: e - ; [. Z( F1 N: g5 n: ^& N
- static int acnt = 512;4 Z, |: j5 s2 P' u# C; U7 ^5 v
- static int bcnt = 8;
, q, B& b; w# F3 g - static int ccnt = 8;) ~; ~) i3 x3 _) `$ D/ r" u1 {, r
- . [" k% Z2 A B
- module_param(acnt, int, S_IRUGO);
. `6 Z. G4 _" y+ s8 G0 q# e - module_param(bcnt, int, S_IRUGO);5 C1 Q+ l+ A( N5 M+ Y6 d
- module_param(ccnt, int, S_IRUGO);
复制代码
1 F; n; w4 K6 d: S. ~6 P) U! S; l9 W4 d3 s2 [8 p$ H% h8 c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ]" l' l6 g3 x) W! Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. i5 S& ` r3 @- X( h: @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k& ^/ i) N7 q1 l, i: h7 J* C0 G# b3 m1 D2 r- d
3 N/ E. | k' w* K A, u |
|