|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ Z: k7 `8 i8 Q: h! b, n
- [code]EDMA sample test application; T0 n8 I$ O( j3 W
- /*7 c6 f. N6 m) L3 b. _
- * edma_test.c; m# _' n) X; K5 O' b# S; v/ n
- *! B0 R- ~& @" l5 X) p
- * brief EDMA3 Test Application
, M9 p4 I# A/ h8 M% N9 v& W - *, S- Y6 N5 ~0 D. {) a; h& V& ]. u8 h
- * This file contains EDMA3 Test code.
7 o& e' p* ^: _$ P% D - *
% j8 O: X* B. k/ k8 |6 J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 g. Y+ e# f0 r% P4 q/ B - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ h9 W. l9 Q# k( G u2 X7 P+ k$ D/ f
- * TO CHANGE." ]- r8 W+ }/ O- E6 n C4 y1 l
- *: m: a; U! z5 K% T0 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, F9 x9 ~0 e3 W3 V3 v I - *8 q- W$ W: F m
- * This program is free software; you can redistribute it and/or7 e0 W) @8 B2 r
- * modify it under the terms of the GNU General Public License as- H. m) W' [: o H. K$ U7 Q; ~" _
- * published by the Free Software Foundation version 2.
% U+ ~# b/ P( q5 K* t7 ~ - *! R% b: q/ ~5 C
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 N5 R) x- C% z$ R) ~' A
- * kind, whether express or implied; without even the implied warranty7 E# a5 l* @; `; H. Z. w' l6 J: ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% b& m0 q3 C7 ^1 X
- * GNU General Public License for more details.) \, o9 X! W$ C+ l
- */" W) | M% }/ w" J( ?
& e/ l: J7 w) u8 T- #include <linux/module.h>
( Q+ m% y/ R; k5 a - #include <linux/init.h>& I3 g" ~. S. I( A$ Q
- #include <linux/errno.h>
' `/ ~/ ~2 d# S- i$ j - #include <linux/types.h>9 w3 W# ^% L6 ~( d6 M
- #include <linux/interrupt.h>" ^ t% }; o5 J% t" v
- #include <asm/io.h>0 z3 A# u' L& W/ Z. D
- #include <linux/moduleparam.h>; V# e# h/ S( m' ?! W$ b% O
- #include <linux/sysctl.h>
" b; `! P% t6 O - #include <linux/mm.h>
7 H5 K6 l% x% v - #include <linux/dma-mapping.h>
6 F. I) s# P9 a/ n1 Q - . T* q7 A3 H" F8 } F; G
- #include <mach/memory.h>9 X6 t, c- t ^% R; l7 F! l8 x
- #include <mach/hardware.h>- x- i# N4 u4 g. |' J+ @% Y
- #include <mach/irqs.h>
, K6 R5 ~5 f* u! [* t0 G - #include <asm/hardware/edma.h>/ ?! y( g3 q0 |: e* Y! e
: C. R$ R$ l1 D" J% g1 P2 G7 z- #undef EDMA3_DEBUG/ m @3 z2 d. P/ N, |5 P
- /*#define EDMA3_DEBUG*/
2 P; U$ K* t- I9 { l1 Y; P; x
7 `1 c4 t8 s Z& M$ T- #ifdef EDMA3_DEBUG
; X* m- a1 [* D% @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% H, u' i' P, @0 u J5 P9 r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) t3 o1 Q' d2 a! M( N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- H% i9 P1 {9 j* K
- #else
; T$ |0 N6 l6 w, b2 o; Y9 Y0 _ - #define DMA_PRINTK( x... )
0 H% R5 T8 ]9 z T, K- n - #define DMA_FN_IN
' G* w1 P$ ^- q2 |- S7 R - #define DMA_FN_OUT
, l6 @3 J5 o0 A V) M* z0 o( a - #endif- D0 ^, ?8 [& X+ m! F% h; J& c
- K1 @. T5 q- ?- ]. f$ t: r- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& x/ c" O/ U- M/ m ^ - #define STATIC_SHIFT 3
9 ]7 |; |# t7 K" z - #define TCINTEN_SHIFT 20; S/ G3 @# t" Y o9 g; W8 J
- #define ITCINTEN_SHIFT 213 \2 b% T+ q% A
- #define TCCHEN_SHIFT 224 Z% t- Y9 \+ c v8 P o
- #define ITCCHEN_SHIFT 23# y! H& D- F/ O8 v/ T
* p: n* Z; L1 l( `/ z; `% a0 V- static volatile int irqraised1 = 0;( a$ t: e/ F$ N; S: d2 ]
- static volatile int irqraised2 = 0;
: Z. s* ]- G9 n0 H7 B - 7 Z% f/ W" |! {
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! H' B% N% y! r/ Q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J0 b4 D) T+ B7 F6 i1 j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# b8 Q4 o$ v- R
3 T1 v4 s+ n3 I! j* h3 I- dma_addr_t dmaphyssrc1 = 0;
L6 Q( V0 P5 {7 C9 Z - dma_addr_t dmaphyssrc2 = 0;
+ q4 N @" N" L+ f0 j% H8 D - dma_addr_t dmaphysdest1 = 0;5 l2 o( f8 c0 W& d/ G* e
- dma_addr_t dmaphysdest2 = 0;
# U0 X7 I5 A8 E8 g& j2 [ - , g" f+ Z) x4 n! M3 F/ L4 x$ ~
- char *dmabufsrc1 = NULL;
8 E* f$ k; j1 h, ]! e - char *dmabufsrc2 = NULL;
[7 T' Z/ h! h) b( _ - char *dmabufdest1 = NULL;1 e7 h0 x3 t" L+ ^0 e$ m- I6 v, w
- char *dmabufdest2 = NULL;
! e' M' j* p; w3 W$ {
: B9 A6 S7 r1 L# `/ d9 y3 A- static int acnt = 512;. M! E3 i1 Y1 t6 j! N% S( K" m
- static int bcnt = 8;$ o2 J8 ]% \ V0 E
- static int ccnt = 8;9 u6 f& i3 `: S7 B; H: J
- / {8 g6 [& V. A
- module_param(acnt, int, S_IRUGO);
4 L7 W7 }0 F& n7 B) S. B0 q - module_param(bcnt, int, S_IRUGO);
3 Z) A& G7 d% U3 }, a% b - module_param(ccnt, int, S_IRUGO);
复制代码
1 \. \9 I2 x9 C: g( F9 X. i
# ~+ O8 _5 q! d! Q7 u/ E' b 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 g( B F& [% R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; j6 x0 F: ]( ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O' t. Y$ K, N& K4 f7 x, f: K
- `3 J$ K6 w) m; s
9 _! I' ]8 F- N6 W/ C4 X) q |
|