|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 `5 J% Q3 }! W+ P/ Z* ^. d- [code]EDMA sample test application3 V Y. M7 o; c# D, `, T5 g* i
- /*
- l! K: U+ u; N3 K - * edma_test.c
; v0 \; t; |& @( i2 K& u) ` - *9 Z# M$ _4 i+ p, f, I/ I
- * brief EDMA3 Test Application# b a8 n1 B9 K* H: A8 B
- *2 k) b' W4 ?! z6 ^: @7 M" X
- * This file contains EDMA3 Test code.
* }3 y( C Y8 c+ Z! h8 v/ k* a$ H - *
: A$ N: ]1 Z5 p: Y& E - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( |5 V5 M* X( V, |, k! M W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
R2 ]8 a s8 z; Z - * TO CHANGE.
3 W) A$ r( u' ]! Y& z. H; l3 q) X - *
, v) d4 n+ d$ S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. k0 I1 J6 k" C+ _! a# l* m# \6 ~9 m# P
- *
6 o" }! S/ k; M8 x" F8 T - * This program is free software; you can redistribute it and/or* d1 i7 K% ~+ v- [! {
- * modify it under the terms of the GNU General Public License as
7 n# i% L7 c9 P" z. u& M( ` - * published by the Free Software Foundation version 2.
! [3 x8 @9 S8 E3 s7 ^ - *
q9 e4 G* s/ u8 r" a1 r - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; N' m8 }2 S/ b7 f, R! K3 T
- * kind, whether express or implied; without even the implied warranty! ?0 B- x" U& h- L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ ~! m* o& ^- {5 @ - * GNU General Public License for more details.
. _ n1 `3 y+ F5 L7 l$ d8 S - */
$ x0 C3 `! s' n" v; F - 4 ^: x' J" K# C0 P9 [: ~
- #include <linux/module.h>
* V9 U$ C& p6 X" o/ O' e4 T - #include <linux/init.h>
, J0 q" v9 X% I1 N" T/ N/ W$ @8 Q - #include <linux/errno.h>
( ^* v% \. k% ]1 B4 s: m. u - #include <linux/types.h>
8 t9 ~& M; d; W' {/ a6 U - #include <linux/interrupt.h>& [% `" Q' N: X- M& V, _+ F9 e
- #include <asm/io.h>: q" \* ]# o3 `8 W
- #include <linux/moduleparam.h>
; T. U J- s7 c1 R q - #include <linux/sysctl.h>
5 B$ k. l0 O" Y! @! f/ v7 t- y+ i' `/ e4 {- h - #include <linux/mm.h>
$ H! c5 t2 \! k0 a0 I - #include <linux/dma-mapping.h>8 ~7 l; t4 s1 M0 Y7 B/ X
3 H4 x. N' O, M% B2 W3 @$ M! R- #include <mach/memory.h>0 H) B9 n9 P' |. o+ x- t+ L
- #include <mach/hardware.h>) b+ d7 s0 i7 e" Y& E' `6 A3 C6 T
- #include <mach/irqs.h>7 a, c! D4 L) l% g9 r
- #include <asm/hardware/edma.h>
* w1 V: H9 n9 Z - , _! p n" u' V
- #undef EDMA3_DEBUG
2 r" Y* x, K- t G$ ~& z - /*#define EDMA3_DEBUG*/1 O. F, b/ D$ B Q3 q2 S
- ! B/ }" L& H, a. d2 t
- #ifdef EDMA3_DEBUG
0 u& l& p0 Y( D/ I1 x' Q5 x. e - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); i" Y9 O) X& {% X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 D E) j. I1 Q/ M3 i6 L+ W
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ s* w9 r: L' N9 q' ]$ n$ W. a - #else+ T4 E6 o( ~3 Y
- #define DMA_PRINTK( x... )
1 F+ f: d7 _- ?7 n - #define DMA_FN_IN
* F( \- G, @3 C0 C# q; C8 `5 a - #define DMA_FN_OUT
9 J, Q: v" v7 S( W, s( R1 j - #endif
& L2 `& p r9 r - * L$ p( G: v- e% w1 t6 P# a
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 u4 b i) Y W2 ?/ v
- #define STATIC_SHIFT 3
9 X7 ^. a* l6 @/ k% a# ?. L! x - #define TCINTEN_SHIFT 203 r1 ?" J' h1 u& f' R. x4 r4 c
- #define ITCINTEN_SHIFT 21
' Y |" s1 U2 U) I9 \0 y2 J - #define TCCHEN_SHIFT 22' `9 z- h7 ^9 a) K, i
- #define ITCCHEN_SHIFT 23
/ R! Q8 N( P0 T7 D& X+ z0 A8 C - 1 K( i1 y# b3 U D, k
- static volatile int irqraised1 = 0;
. [2 K: H( L C% h - static volatile int irqraised2 = 0;
: Z4 Q7 n( ]1 A: ~ K* ]
) |8 ?" W: i( J! a4 E% d- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& \; {! I: s- Q, _3 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 B$ ]7 d+ ]: t4 G9 H0 g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N# d* L( n* ~$ d2 K
/ `4 \4 d! ?. L- dma_addr_t dmaphyssrc1 = 0;
; H% E1 v9 q6 c# r! G - dma_addr_t dmaphyssrc2 = 0;" p; P. q+ x0 Q3 O8 [* \
- dma_addr_t dmaphysdest1 = 0;6 t3 L8 ?) @- |9 w
- dma_addr_t dmaphysdest2 = 0;) j4 a- O1 @: l4 t5 l' d8 G6 P
- / |3 O/ g) U& b2 J' I
- char *dmabufsrc1 = NULL;% ~9 v) K5 i7 V$ f* \8 q m
- char *dmabufsrc2 = NULL;
) O* g* E0 L6 u - char *dmabufdest1 = NULL;
+ e! L4 s) `# p2 U6 _0 I* E - char *dmabufdest2 = NULL;
4 C/ p- L/ c' T' O) Y
; ]2 D# n) i1 c' m- static int acnt = 512;1 B" ~; u) x5 x7 D' e; r5 J
- static int bcnt = 8;# z2 {9 g' i) ]
- static int ccnt = 8;
7 Q# @5 L7 ~" F* h9 U
+ ^$ D! t$ n" C1 e+ f- module_param(acnt, int, S_IRUGO);% ]- i! I6 `* l9 f# N
- module_param(bcnt, int, S_IRUGO);
0 d3 I8 N, V& E7 J) u - module_param(ccnt, int, S_IRUGO);
复制代码 ! R, a3 G" R9 P! s2 I
, I1 N/ n8 H* Z$ w7 z& ^
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 z4 V* Q" R- @) Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 _1 P, @+ \. e8 B4 U/ w7 n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# i! P) J* o& c5 M. i; x
( C! D$ y$ ]2 R/ ~ i. m% |; O( N' v. G3 q$ z) c! ~6 w
|
|