|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( I& E% k: a8 @8 A8 I4 d
- [code]EDMA sample test application
, E, ^- w2 o: {9 r5 I - /*
% D1 g: Y( K$ f/ m9 b* B - * edma_test.c3 a* |) q3 j Y& o% ~* E2 M) h) f1 ?
- *# [. l% x; K2 c2 E
- * brief EDMA3 Test Application
$ W4 s# w8 @/ F! r c. h4 @" c1 _ - *" n4 D, F% D& Q9 p6 d
- * This file contains EDMA3 Test code.! d% f2 n2 k$ ?- b
- *
( d" \; r3 C4 Y# U! } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE B+ ~' h# b, Y7 S. N* u# R( _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ T2 v L8 g( O( k3 v! m# D - * TO CHANGE.
( r) C) O' x/ ~ - *8 \2 H1 U' ?6 R5 S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ c$ n0 ?- D* l - *
) h6 ?: ~% q3 C2 H* ~: a0 o5 [ - * This program is free software; you can redistribute it and/or
' w' B- b" I; k$ S) M4 \/ G - * modify it under the terms of the GNU General Public License as. } w ~, B5 W% E0 C
- * published by the Free Software Foundation version 2.$ p( |, B: A& N/ ^/ ?: B; J. s
- *+ O) q" @" W- Q$ t4 u K
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ j. h9 z l! u5 a3 o* q! \ - * kind, whether express or implied; without even the implied warranty
) C& E6 F5 o8 N5 g - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' t, W, F5 Y3 k; e: G' v
- * GNU General Public License for more details.0 e+ d# E. R1 f, g2 k+ @4 N
- */
- E: @# e; _, r }/ f* _/ S - + m- u; [& t! Y( ~ b
- #include <linux/module.h>+ Y9 ^8 l8 u1 |6 v
- #include <linux/init.h>% V( s1 T9 K8 `! M! w6 `
- #include <linux/errno.h>
. Q9 q4 C- ^2 ^8 T( y - #include <linux/types.h>
/ T! U! [7 K/ j - #include <linux/interrupt.h>
/ g& o' D9 q% j% K4 V5 j& t - #include <asm/io.h>0 G' s# c9 _/ {( j( }
- #include <linux/moduleparam.h>' w U5 h9 [6 W. {# o, \! C
- #include <linux/sysctl.h>; ~( D% u7 q& m' j: Y+ ^" w
- #include <linux/mm.h>
# `; g! ]( {7 v* Q) ~ [ - #include <linux/dma-mapping.h> a! Y. F! x5 P+ u/ n3 c* Y) H
- # Z+ x2 O& i: ]6 F" g* a' o( F
- #include <mach/memory.h>
6 a F9 r0 w$ z2 w - #include <mach/hardware.h>
4 b q& q1 h9 s5 ^: M. c - #include <mach/irqs.h>
' m1 }6 A; J. F - #include <asm/hardware/edma.h>* `" J$ p; u5 B" Z' w% B- \- @
% n5 C1 s8 t( l( i1 C- #undef EDMA3_DEBUG9 s1 [* j/ S8 U0 S+ I, Z
- /*#define EDMA3_DEBUG*/9 b- `4 Y$ |2 @7 L
- 7 I! O5 z; B* c% S7 \ _
- #ifdef EDMA3_DEBUG0 T% l0 ^3 Y& F! h+ T- P, u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 g( |, q5 D; L; o+ a; U; y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 J/ v4 @' N- ~2 g4 x& j: F1 T - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* v4 {/ A6 h! c! S" ] - #else: M( r4 G# j( j5 Q3 ]8 C
- #define DMA_PRINTK( x... )6 @" U; q+ s" U" I) L. N; P+ X
- #define DMA_FN_IN; X# n5 i1 E2 ]. E: S/ j3 s
- #define DMA_FN_OUT+ }" Y( D* Y6 h1 [; H6 g$ U
- #endif
. V8 E5 f% o( ` - 9 j/ c( `9 C# s9 m0 C9 ?! [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; n0 x9 o& o3 t0 m) ^5 a6 C - #define STATIC_SHIFT 3
- N4 C7 T% Z! V& O" a; y3 A% n - #define TCINTEN_SHIFT 20/ E6 _! v5 [; J! O# y8 ^) K' l4 S! c; b
- #define ITCINTEN_SHIFT 21
3 u, a9 x, j: i5 x+ { - #define TCCHEN_SHIFT 22
; X% r; o; z1 Q* i/ t - #define ITCCHEN_SHIFT 23& n# X' R: h& ^/ ]* V4 D- T4 g4 Q
/ U# \$ ~& R6 ^- static volatile int irqraised1 = 0;
/ N$ o' e' |" p# J; J - static volatile int irqraised2 = 0;+ @! d. ~2 y% U$ w# p, l# v* e" x
7 z6 ?. _6 k# q( r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 r; [; j, P* T7 G; Y/ d) z5 z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?9 d, f: g/ S. }- I9 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& e) K. j9 r0 `! U4 W) d
% j3 S; a) S$ n% {- dma_addr_t dmaphyssrc1 = 0;
( e- |" g% h, |3 o! n - dma_addr_t dmaphyssrc2 = 0;
e) {3 x0 t- t! C. {* k! v - dma_addr_t dmaphysdest1 = 0;' G( Y; H; E/ T+ u4 R) j; D
- dma_addr_t dmaphysdest2 = 0;
% |0 I/ l- N( e: Q
% k. `5 ~" P# w1 a* d0 q- char *dmabufsrc1 = NULL;& {) i& j1 p. Z$ V
- char *dmabufsrc2 = NULL;
. z- v6 p y& z5 h& }* y, r1 n+ b - char *dmabufdest1 = NULL;! V, n/ L. l& e, m$ v
- char *dmabufdest2 = NULL;3 Y& ]' g# R+ ~1 i
- + y% Q3 {& l7 ?' @1 T
- static int acnt = 512;- y8 O. i3 ~6 h- G0 J
- static int bcnt = 8;' D0 K' R5 _' O) m4 c6 U1 g" Q
- static int ccnt = 8;
3 ?0 t" s' }) V B: x
1 j) ~8 f \& g" A {8 Q6 d- module_param(acnt, int, S_IRUGO);
% w' T3 g: I9 }( y" k - module_param(bcnt, int, S_IRUGO);9 Q0 z C: z0 \
- module_param(ccnt, int, S_IRUGO);
复制代码
' q$ O- }. k2 D, ]- F: J- j) m& q$ }
4 A! h* y5 I+ y; f/ _. e# F8 }: j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 U/ f% a X! \/ P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( g8 S, f! K- E/ S5 J, Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 S j) z7 J4 b& s) f7 ]. m
% P; Q$ h/ o6 }4 A1 Z# @, X7 h) m- ~0 b3 J: z& ^" a
|
|