|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 f/ `# P4 j/ ?( n; H8 O5 M. s- [code]EDMA sample test application
# _! {2 @+ K: W6 a0 l. D5 E. k - /*0 D! s6 G/ h% P8 @1 c3 V ]! {* t# N) s- q
- * edma_test.c7 n2 [3 I$ ]1 v: w& h( v5 l
- */ l( k1 D# B" Y
- * brief EDMA3 Test Application$ V9 p) N' l- }! Z, x) W8 H
- *' ~$ o( w5 r* P4 K6 j& t
- * This file contains EDMA3 Test code.
' @! Y5 t6 i8 B - *) y0 Z( K c0 ?" E/ W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. ?9 w( ?) g( K% w" F* m) e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% H1 R* O! H# p( S+ B
- * TO CHANGE.
: f2 }$ v0 [" Q1 P: U7 I - *
; h+ b# T; U5 n8 s8 {6 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ ~8 k/ z: L: q. D9 A
- *) o% I l$ @# U& X) k4 n7 |
- * This program is free software; you can redistribute it and/or8 e/ ?9 m _0 R1 Z
- * modify it under the terms of the GNU General Public License as% N# P9 h8 N! V$ x
- * published by the Free Software Foundation version 2.# ?3 V1 m3 ^1 F
- *$ d" S' M/ U L% \+ ~1 B% v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- A3 v. { D, U
- * kind, whether express or implied; without even the implied warranty
- {: P( ~2 |' f8 I7 h$ k V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' K% R& F; R0 I+ ]4 t - * GNU General Public License for more details.& G" s6 s3 k* |& M* g" L
- */
; y) |" o$ O, s: t - ! h* o1 _9 Z8 G
- #include <linux/module.h>
, {! r" V' e0 U* n- T# }. |2 P - #include <linux/init.h>
- H4 g9 }7 R' u6 L* p - #include <linux/errno.h>% D5 [* R& K: F
- #include <linux/types.h>
7 R1 r0 C0 Y( o. q3 Y - #include <linux/interrupt.h># y& w& j& W8 A4 C- R; d
- #include <asm/io.h>! |& L4 S; I; {4 a
- #include <linux/moduleparam.h>
' M* I9 M) \" K* b% E* q n - #include <linux/sysctl.h>
% z4 r' g- ]4 i/ _3 {5 F1 p% R - #include <linux/mm.h>! c) D% G; f3 X1 ?# h+ O
- #include <linux/dma-mapping.h>4 P# o$ O3 e4 [& f8 Y
! ~; X$ P) q& `- @, ?" ~- #include <mach/memory.h>
6 i3 R5 p. T& d# a - #include <mach/hardware.h>
7 O- }+ l* V% R - #include <mach/irqs.h>
1 M1 P& V6 U+ e% T. X, d5 u - #include <asm/hardware/edma.h># K: N2 l# |9 a/ R
- 4 ~$ @3 |; Q7 V6 s7 ^- T
- #undef EDMA3_DEBUG
7 }$ f+ z& S, ]1 Y& B$ } - /*#define EDMA3_DEBUG*/
5 M5 w$ |/ M6 J* E; S' r
+ Y0 Q5 d3 J# {3 q" r8 e* [$ u- #ifdef EDMA3_DEBUG9 H9 g5 `$ `1 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 g7 P w/ k# B) w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- O2 Z% E9 C3 \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( @5 y' J3 v% V3 w( D% t9 V! h - #else$ z8 ]8 L7 j' P# m" q: W" t
- #define DMA_PRINTK( x... )7 C7 j" N, S0 }4 B: W
- #define DMA_FN_IN
. E6 k. J5 ~$ `" N4 O" K( `% ^ - #define DMA_FN_OUT
; F5 K3 l' F2 m( X2 h - #endif6 {4 }! I. z1 x( l: ^
6 O' B% z8 G, c) r; j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) r0 T1 }1 _! O5 S+ ` - #define STATIC_SHIFT 3# v/ ?# S8 a* b: K5 A: L8 K3 R
- #define TCINTEN_SHIFT 20( z P+ ^$ ]0 l1 z
- #define ITCINTEN_SHIFT 21
/ w. x) X, b% x! _ - #define TCCHEN_SHIFT 224 S: L H( n0 w
- #define ITCCHEN_SHIFT 238 e4 W' T. Z# v( B4 ]
- 1 I3 q* z5 ~- y7 N, u
- static volatile int irqraised1 = 0;
% d; S2 V' v" ?/ O( l3 F - static volatile int irqraised2 = 0;, A- t& W$ K6 r
9 P6 V8 K4 ?# l( m2 D! e( v7 Q. d- M& v3 t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- j& e. n9 J( ~3 g6 f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( u$ U) a* k% M/ @4 x4 h+ c - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 D6 Q' {$ K, z/ Y4 h' Z3 Q K# p5 y, E
- - y& y1 z4 H/ ^1 Y. a: n
- dma_addr_t dmaphyssrc1 = 0;
2 n, [) ^* R1 c+ m) ?4 E - dma_addr_t dmaphyssrc2 = 0;/ t2 ~8 W; {7 S4 e2 q& u4 w, W
- dma_addr_t dmaphysdest1 = 0;* U0 n: {+ K# ^' b2 l; y
- dma_addr_t dmaphysdest2 = 0;, W' A& w( X3 }' u
9 I5 R; j+ c1 i# a; D: E3 D- char *dmabufsrc1 = NULL;1 c/ }) V! F: E; M' J3 L! c
- char *dmabufsrc2 = NULL;
& N& a. _5 [5 ]- B: X( ^3 Q5 I - char *dmabufdest1 = NULL;3 M/ b; E( R7 j+ a# s1 r$ ]
- char *dmabufdest2 = NULL;
' B/ m, K; z$ I- H5 R2 L
' Y' Y. {* u- G$ I' B- static int acnt = 512;3 o! o6 P' W5 K) C
- static int bcnt = 8;" c' h$ D `% ?3 Q2 Z0 k- M
- static int ccnt = 8;
, [: c( }/ r- h' @# n- f
) s' ` O8 Y# D2 ~- module_param(acnt, int, S_IRUGO);
9 c7 _8 Z, w* |1 L - module_param(bcnt, int, S_IRUGO);
( N F3 M! v& U, B! Z' t - module_param(ccnt, int, S_IRUGO);
复制代码 4 W# G. Y5 ?! `& N9 B# }0 g
0 Z t" S/ W% W: Z$ t, G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) G9 N2 I$ w( z- @$ ?& ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& V8 R; T; U" p2 W V% R; H 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( a; U) h+ h1 J8 `
t" T& a' L0 Y( X' {5 n' u, H/ {2 f% s% {$ g
|
|