|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. x# \5 M6 m/ l- [code]EDMA sample test application1 G7 [7 n K' i9 Z# d
- /*
N( p* J' D g/ N. P* }6 F - * edma_test.c7 ~; C- M( @' ?' l" v; I9 `6 F1 a
- *
6 k0 d+ `2 |9 E: c# S0 ^. p b - * brief EDMA3 Test Application" M) f2 p! n- }/ h- {3 j: \# J: Z
- *
! q! m& P& W; h' a8 O - * This file contains EDMA3 Test code.5 J. l- c: P% E+ u) V; L
- *9 v3 `/ J5 D% w+ H, u' e c# v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 z& [* v# V+ F1 Y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' `/ }9 B- X( @. C2 \ - * TO CHANGE.
5 a: R% _- h" ?/ L& M% } - *
& ?) \. |7 D2 Y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 W+ A) L: u1 K' A
- *
( q; y5 n0 { _$ c - * This program is free software; you can redistribute it and/or
* s1 e% J1 w1 @. t - * modify it under the terms of the GNU General Public License as
* E( E; n/ A' r5 U: n0 o7 t - * published by the Free Software Foundation version 2.. x. [7 ]/ [' @% E; v/ R
- *" Z. x- `. [2 F& w5 q: U$ M
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ]( k7 u) U0 O. N- g2 @7 q9 X: C
- * kind, whether express or implied; without even the implied warranty
. }2 g& Q3 g* B1 h, i - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ B5 w5 i# C0 u* z+ G0 c
- * GNU General Public License for more details.9 C5 i4 G& N. d0 R
- */* }" B, E% b. P3 Y# I! s
- + S" m& M5 T) i% G! K
- #include <linux/module.h>
7 u/ ^6 m1 |* H - #include <linux/init.h>
; k+ k9 @4 D" @+ m/ Q - #include <linux/errno.h>
+ h8 T5 V, ?/ q) x - #include <linux/types.h>
) G2 ~$ b- ?" @5 w9 Q! X7 n - #include <linux/interrupt.h>6 W* j# ^- \; n" y/ k$ O
- #include <asm/io.h>
6 `3 G" F( ?2 R* F9 x N - #include <linux/moduleparam.h>
: O" {! X7 A D" |/ i8 P; j5 p - #include <linux/sysctl.h>
8 O$ f4 B4 R% L - #include <linux/mm.h>
. Q6 h) F' \ T' r/ y; u$ v. p$ U - #include <linux/dma-mapping.h>, o+ \ ?& V+ x' m. D4 w4 N8 U, J8 O
4 u' w; j) U0 p2 F2 F8 V- #include <mach/memory.h>; ?+ O+ E7 z ?& J) B
- #include <mach/hardware.h>
% ~7 M& {" t: x, c# Y0 U - #include <mach/irqs.h>
3 q+ c* d0 w, U P# u2 ` - #include <asm/hardware/edma.h> ~! v t+ o5 M9 q: b0 s
; L' B/ p- t8 Z9 d" S! p- #undef EDMA3_DEBUG
5 P- g( J% W/ P# z5 K - /*#define EDMA3_DEBUG*/
# Z e" a1 h0 ^" ]0 D - 2 [0 I8 w- _( H) O2 N. j
- #ifdef EDMA3_DEBUG+ F( b! L& n( a8 D: G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 g" p y( K8 Y$ ]2 y! h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' P( @8 r) c0 r0 i6 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ l. [+ {3 E8 M# a9 U) l - #else, a2 M7 c- U: `7 ]
- #define DMA_PRINTK( x... )
. M" y- j$ W* c# O; B5 P$ A4 I - #define DMA_FN_IN
# h1 U# W3 X8 u - #define DMA_FN_OUT4 j4 |& y! F7 I% u* i+ j8 o
- #endif/ H& A. ~7 m5 [5 K( ], o
* c. u/ F, X; N, c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ b/ p$ d S& `# m
- #define STATIC_SHIFT 3
+ {8 j0 W- ?3 M: ?! n v+ R. M - #define TCINTEN_SHIFT 20
7 H' b/ ^' d3 K! ]9 Y& G - #define ITCINTEN_SHIFT 21
( i8 d+ x$ S Z8 U - #define TCCHEN_SHIFT 22
1 j5 f6 E7 t4 J# p/ I - #define ITCCHEN_SHIFT 23
) [# W1 Y" ?7 i1 ~! D" N - : Z: X# L) J" P0 L! `1 x
- static volatile int irqraised1 = 0;2 U, _- \% c ~4 W- ], ~
- static volatile int irqraised2 = 0;
1 Q" H/ {4 @/ c1 T, S T
t0 ]$ Y& `9 e1 L7 ]% {: ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Y2 N4 E+ Y9 ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# c1 m: w+ N3 d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 \; o6 W" B! J - + y2 ^6 @& ^ U0 ?2 T
- dma_addr_t dmaphyssrc1 = 0;( Y2 T' a1 t& v) o ]& O
- dma_addr_t dmaphyssrc2 = 0;7 ^2 G0 Q' s; @* T
- dma_addr_t dmaphysdest1 = 0;( E i" A% G. r
- dma_addr_t dmaphysdest2 = 0;
0 z2 W! w2 |- k
) a I( A, y/ ^( z5 E0 s( u% Z- char *dmabufsrc1 = NULL;
! q. Q l# S) @) h2 Z# x; n - char *dmabufsrc2 = NULL;1 z. g- X1 D* P, K
- char *dmabufdest1 = NULL; y( Y2 N2 j" P( E
- char *dmabufdest2 = NULL;
& K: n" l' W: Y$ d' k! }
8 H& Q" K8 }& Y( A5 l; g- static int acnt = 512;6 Z2 v4 N% H$ w
- static int bcnt = 8;
' s3 [& K8 @2 `1 ] - static int ccnt = 8;: j3 l9 @1 I1 V; H$ s4 O" F% ^
& U2 u |9 S! _* v- module_param(acnt, int, S_IRUGO);
% W! t3 o* I( `: k - module_param(bcnt, int, S_IRUGO);) N1 w! C, Y1 Q+ v% L
- module_param(ccnt, int, S_IRUGO);
复制代码 ! i( C5 k9 z+ G0 y) K
: ~4 P' Q- d9 w; o' L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- _) `& v2 ?8 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( i/ j5 d& t% R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 a& y0 U1 R! P& m5 R1 j
' D- f# I @. A% U0 u4 j8 j- J- k4 ^0 F5 i* Z% ^7 P
|
|