|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# h0 ~. r8 s' d! K! C) L5 B0 i+ k- [code]EDMA sample test application% x4 G$ g7 q/ I# r3 m1 h
- /*" r6 v# u' }1 v3 ~& h5 @# c
- * edma_test.c
# b! ~( Y; k3 ^, r - *
) ^8 \* S. X7 w3 c7 Z - * brief EDMA3 Test Application, _. \( j$ ]2 z) {7 d
- *
) ^8 \0 ~6 D4 h$ H4 `: S, m; }7 s - * This file contains EDMA3 Test code.' C8 l4 S( ^/ w. [/ [+ y: h
- *
6 J( o1 M7 a [" u5 a, ~* P- e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, [- I I- k" |5 a+ T) I2 S" x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 U P. f' j( @( J7 z
- * TO CHANGE.
1 U, o: z3 `5 j6 k - *
; \7 E: I7 ]6 X0 L" Y* _& t - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* ^) I. `3 C6 s3 h! F
- *, p. w+ L/ v) X2 f+ u9 N
- * This program is free software; you can redistribute it and/or. _. \- _0 s9 C7 R7 |1 U
- * modify it under the terms of the GNU General Public License as
2 k9 z8 K$ T S6 y, c - * published by the Free Software Foundation version 2.- G$ d: f" T* `; v4 D$ j0 U
- *
$ t4 ]* m; _. q, u3 G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 T( a; _9 f- }5 O, d6 q2 x - * kind, whether express or implied; without even the implied warranty
/ Z" r6 B. G/ A6 S, ]$ [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 ]( q; S. Q1 Y. [- K }1 S" e - * GNU General Public License for more details.. z( I _6 B8 V3 `# H" B5 K1 }) q
- */% V5 A3 w: n2 m2 w
- ) G5 i9 Q: M, F1 A. @ b
- #include <linux/module.h>; f$ E Q1 \: |' D" o
- #include <linux/init.h>! v+ Q. B. V! d+ e
- #include <linux/errno.h>" l) H" }9 _. M* t* ]/ k
- #include <linux/types.h>
7 L& J# C. K5 E - #include <linux/interrupt.h>
: D- |) A' a5 x3 X - #include <asm/io.h>
) V% F# S% w4 p) n - #include <linux/moduleparam.h>
/ S9 P0 O0 w1 G. T - #include <linux/sysctl.h>0 W" g5 Z4 Y# u0 Z
- #include <linux/mm.h>
! P5 F1 b* d# N0 G8 P8 A - #include <linux/dma-mapping.h>
$ A3 x& f: O. ?) _. t: t6 Y - * _* y/ o( a3 l2 G4 u4 i' N
- #include <mach/memory.h>4 ], t- a9 `6 \ U: R' k$ }
- #include <mach/hardware.h>
* m4 T. m% G: V: o; y3 E* n - #include <mach/irqs.h>8 ~+ P: f, ^8 y
- #include <asm/hardware/edma.h>2 e' K1 Y1 | n2 V$ q* l& b
- Y& _, a4 L, E5 E6 _3 |& E0 b! z- #undef EDMA3_DEBUG
0 [- k- F" Z' U# W: A( ~: ^ - /*#define EDMA3_DEBUG*/; y3 o/ {; U& I o6 r6 F0 j$ y
- , V5 o% v" L: g' b# E5 ~
- #ifdef EDMA3_DEBUG
! i; W9 `( @: ~" f! F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 o6 w6 J! w! F$ ~2 H- o
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
, i8 u5 \* I; e* c' p0 N- H# V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ `, i+ i/ N7 F( v# g - #else
$ H R7 x1 [, z' x& q - #define DMA_PRINTK( x... )
4 U; l% U' L' H! Z4 T, ~9 s5 b - #define DMA_FN_IN
' S1 T% W! Y7 H }" ]1 G - #define DMA_FN_OUT5 g6 z7 B+ U" m, R1 M1 z
- #endif- R9 N1 M$ O% m4 o4 K- U
- 0 P* H @/ Y' c6 _8 K, o* I% W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), a0 \5 t* N. I0 W# y
- #define STATIC_SHIFT 36 Q) z' G9 _# L% w" D
- #define TCINTEN_SHIFT 20
. L+ P- o! h! }1 {! y- | - #define ITCINTEN_SHIFT 215 \+ D) K* w2 P9 X7 y
- #define TCCHEN_SHIFT 22
4 D1 b9 B, \& O# g - #define ITCCHEN_SHIFT 23
2 ~) Y" U( W8 H. h
1 }0 E0 t6 ] t$ d5 ~7 F. O' j- static volatile int irqraised1 = 0;
6 M6 C3 L1 j9 \3 j- k$ W; b - static volatile int irqraised2 = 0;
; \5 d( s1 n; |9 [ - ; f+ B) q. n& V4 y( B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ V3 J& y+ |8 M( u+ K. [$ b8 ]" R) B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v; k3 o! N& P& ~% F5 W3 C# b
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; @0 [$ M; i. r& X
' Z7 s4 ]0 `: U- dma_addr_t dmaphyssrc1 = 0;! _& L* G4 O! U1 s7 S( J
- dma_addr_t dmaphyssrc2 = 0;9 u* ?: D: P" Z& _, i
- dma_addr_t dmaphysdest1 = 0;5 a4 y/ ]" N% A5 J' v0 f4 N
- dma_addr_t dmaphysdest2 = 0;
* c2 c3 i/ D; Q) t. n% s/ P: |" r$ t - ; }* r; b9 g* @: V% G1 j* Q$ Y
- char *dmabufsrc1 = NULL;
6 b- A$ p7 l; z, a/ Q: N - char *dmabufsrc2 = NULL;
4 v3 D* t" _( [ g" S3 V8 L - char *dmabufdest1 = NULL;' d( z7 A/ |8 ]0 h8 |
- char *dmabufdest2 = NULL;
+ {( r# ` h, c4 P8 \4 F7 }0 i- ~ - " }. s- S' a7 F' p! m* X
- static int acnt = 512;' R* @6 S& E7 g: S$ f6 X: U+ c, k
- static int bcnt = 8;
1 y6 [' v4 ]; y) k! V) L - static int ccnt = 8;
$ F* S$ X0 e4 F2 f
+ Z% K ~, D2 B0 Z" R/ w, Z5 n- module_param(acnt, int, S_IRUGO);
% c7 x3 \) |3 M7 y0 Y; {1 f6 v' { - module_param(bcnt, int, S_IRUGO);
# r$ a, }2 o" z: h - module_param(ccnt, int, S_IRUGO);
复制代码 . J* O$ R& ?' i2 z
9 j! p# p. N' T. M6 q J) s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 z9 B/ S* _# e( parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! H' H( |% A+ J1 C7 s* Y( a, e; I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! L0 Z+ P: j# d% n8 Q4 d
9 d% F- m" F5 P+ R* x* N
2 \* ^& s! }" z4 X" L8 a* ]
|
|