|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Q" Z n: K, G
- [code]EDMA sample test application6 M! {( `0 l/ A2 B8 J
- /*
- \# J; Z: n* T6 c. ]4 ?2 W4 u2 E - * edma_test.c3 v9 J1 N7 X2 L9 g# q" ?# l. C
- *6 e' u. K/ Q K$ q9 f2 q. q( U
- * brief EDMA3 Test Application
; z3 j& J# g) q* Y- N+ y - *
( U" W3 a' J8 e - * This file contains EDMA3 Test code.: [9 l+ H+ c3 D ~! T I4 P
- *
, a: K" ]1 N. N' d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 k/ J- Y: _2 T" a2 {( A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. e2 b- o( q! p# n" g
- * TO CHANGE.
! e+ x9 E* R# b4 A, ` - *
* p7 `% s" ^8 r - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 U: L/ g, c2 L( _0 F+ [0 O! F - *
6 V3 d2 v, e1 H - * This program is free software; you can redistribute it and/or- K& J ]! ]# ]5 U/ ^1 Q; u
- * modify it under the terms of the GNU General Public License as2 y+ X3 i( X0 g, g: X
- * published by the Free Software Foundation version 2.
x7 C* f) D* F6 n; k - *
) {3 H" p# q, e2 P* k# y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 J$ z9 P4 ?1 n- {# B - * kind, whether express or implied; without even the implied warranty
; h5 S8 Q% I( [5 y& E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the D( J- d0 r7 X G- r! U! n7 [: y
- * GNU General Public License for more details.
7 U& U2 F9 {* I% E) k - */
& U& K# w4 T: o p - . D# Q1 M4 a0 Z9 x! [
- #include <linux/module.h>
( S3 O1 e% }+ L7 I - #include <linux/init.h>
& r3 P7 X6 Q- V8 @1 G - #include <linux/errno.h>
* o" T9 m& R @0 F2 M! k: g& r' C - #include <linux/types.h>0 R S; t" c) ]0 ]
- #include <linux/interrupt.h>) W5 f( l8 r7 r v% n& Z
- #include <asm/io.h>
9 U+ P, v, O! D - #include <linux/moduleparam.h>, |/ ?, }: o! Z( }# R
- #include <linux/sysctl.h>
' ]; y. y, y/ _$ T! b: ~1 i - #include <linux/mm.h>
2 h1 w) J6 X+ p! o& { - #include <linux/dma-mapping.h>
, Q1 M0 l7 w( Z5 R6 ], W
1 g: i9 D% q- y9 }& @5 F! j3 K- #include <mach/memory.h>
8 R# \( R$ s# |& R - #include <mach/hardware.h>
. q1 @8 v; ^9 c: T - #include <mach/irqs.h>
/ r) m% ] O1 H! a9 R6 a - #include <asm/hardware/edma.h>+ |$ t, J7 A5 W/ }5 P/ `
F& A$ f U2 N7 E6 C" U) i2 ~1 ~- #undef EDMA3_DEBUG
* d( q) I3 W( \& `+ O1 D) l8 x - /*#define EDMA3_DEBUG*/* E ~, M O! k" l& s
- ; K4 @' i6 y! W' Y+ p
- #ifdef EDMA3_DEBUG
8 ]2 m. u( {! C. y: `$ C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 B+ ~( x. C( Q& ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( D% v; k) s% n( i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ^; F: K# V2 T
- #else+ V2 x) r' K. w
- #define DMA_PRINTK( x... )/ H0 l- Q" m" x X
- #define DMA_FN_IN
# p" E$ G0 G" w; H - #define DMA_FN_OUT x& M7 W3 D8 I/ I% {9 y
- #endif( D& v% v/ ~1 C0 X# K2 z
# C* j/ ^, j5 [. d9 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
5 \( c& t `" h - #define STATIC_SHIFT 39 m2 B& u/ m" C# F0 A' d
- #define TCINTEN_SHIFT 20
7 t1 J0 \5 w+ u - #define ITCINTEN_SHIFT 21
+ V/ c9 |% g9 [& r7 ]( [. @1 k - #define TCCHEN_SHIFT 22
; i1 q! r* E h" v$ l9 t0 c - #define ITCCHEN_SHIFT 236 D' P& K3 M) @$ T7 u5 o1 R
- + a+ g& O5 x5 `' w _: L# ^3 Z
- static volatile int irqraised1 = 0;
7 f O# Z) F' ^ g% C% \ - static volatile int irqraised2 = 0;
- E+ f8 f& l" X$ z! g
* x' m3 B4 A" D7 x: J! G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% N% w6 x% s0 U7 X) o - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, \$ t& k" B# D) r7 g s/ g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 c: v: k2 e& q- M, \ - * o, ?- i% ^ B8 |6 F
- dma_addr_t dmaphyssrc1 = 0;
d5 Q& e1 `6 ?7 Q - dma_addr_t dmaphyssrc2 = 0;; G- _0 _; Z; ~. k3 h$ e
- dma_addr_t dmaphysdest1 = 0;: m5 K: f2 `2 J* \( ^- K
- dma_addr_t dmaphysdest2 = 0;' _& o# n3 g2 Q q2 ~1 P
- * M* B; |$ e: {% r! q, a6 v6 |* O
- char *dmabufsrc1 = NULL;
1 P! w6 ?+ I& z% J+ k5 Z2 x8 F - char *dmabufsrc2 = NULL;
% z5 f: ~" k4 |! M W - char *dmabufdest1 = NULL;6 O2 ]+ \: a1 ]$ Z+ ~( F$ e
- char *dmabufdest2 = NULL;
# {4 O$ {6 E. m$ w+ q8 G - , F* G4 S& R& O; p
- static int acnt = 512;
8 y3 L3 d4 K8 u7 b& w1 U - static int bcnt = 8;' C# x: K2 T% b0 D
- static int ccnt = 8;/ B( H" k0 s) L3 Y/ s g
- * J" m1 E+ o1 W6 q+ C
- module_param(acnt, int, S_IRUGO);" ]8 b, k+ E4 T q1 n$ B' b
- module_param(bcnt, int, S_IRUGO);
- U m2 N# M9 W# O - module_param(ccnt, int, S_IRUGO);
复制代码
2 d" @% \0 a) n* x( g$ Y# O3 \+ t/ C9 i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, O/ _* X, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) r9 {# M* ^: o3 m& R! {$ j. C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ Q' C* K; d: O3 q4 o" |7 t$ ?- i- h% _( t7 g% X, ~
- c( ?9 ?9 @; \% P |
|