|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 }& w7 e* `' f: i8 \/ ~. Z1 H
- [code]EDMA sample test application4 v! O3 E5 [, c: \9 b
- /*4 L i3 N' M& `+ |
- * edma_test.c: U( y: n) ` f
- *
, V! r, `1 _5 X - * brief EDMA3 Test Application
: U- n2 k4 H( `; U" }9 m5 j - *. B6 }& U: Z+ |2 Q" l
- * This file contains EDMA3 Test code.* {+ B. m" ]( j! E A
- *
6 Q# D) d+ Y u5 L) k% Y0 B0 ^& a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 n2 S" P) `; i: P$ B+ v2 q, h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ }' P3 M' w4 a2 f
- * TO CHANGE.
+ c0 ?* `2 k/ H1 ~9 _& n' O - *% q$ Q: V7 @! H2 _0 t- O# v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. v* m1 X- {% U- T - *5 A; `- l* D8 J+ x. V: q; w
- * This program is free software; you can redistribute it and/or
: l) l- C8 H, ~! k' K1 u - * modify it under the terms of the GNU General Public License as
+ G2 \) f* c1 l8 e9 u3 {2 P4 } - * published by the Free Software Foundation version 2.0 S- N& A0 o2 t+ Z
- *
' c$ ~, q* Z4 x3 g: R# l - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 ]7 y/ [. S: l7 G0 i - * kind, whether express or implied; without even the implied warranty
6 j* |, W- i U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 R) s3 o$ B6 @2 E7 ~2 `1 B - * GNU General Public License for more details., c4 e) n' |- t& V
- */
8 z j( D' Y8 C1 c# f - . W' K5 e; m, K6 l$ x0 ], Y7 o
- #include <linux/module.h>8 K. i7 O5 h0 D7 R; N! V. d9 }. M4 F
- #include <linux/init.h>
: A. J9 `/ X u# S - #include <linux/errno.h>! x" B! ~. |9 o, W
- #include <linux/types.h>
. j% x/ {7 k1 J" | N - #include <linux/interrupt.h>
& n* }$ X u# E0 s1 f" v - #include <asm/io.h>+ n% M+ C$ A9 j- @
- #include <linux/moduleparam.h>/ i1 t2 o+ \" d2 q, Q, a9 v# ^
- #include <linux/sysctl.h>
% F8 ]3 K+ w& g& _ - #include <linux/mm.h>
) u/ j; m- ^9 P0 T% f6 o - #include <linux/dma-mapping.h>
6 ^% t" ?# E; y% p1 L: b - ! k9 ]( Z. G0 `# D
- #include <mach/memory.h>% j' y& B) |+ n& D+ X4 K. J; [
- #include <mach/hardware.h>
% a! B: n, U) v1 x- {5 b' Z0 z& M# p - #include <mach/irqs.h>. C# \: |" }5 y4 q9 g. {3 N' \
- #include <asm/hardware/edma.h>
! u6 L u) Y9 P9 o
2 m; c: n2 A; Z- #undef EDMA3_DEBUG
5 [& I- b; F2 W: k0 _+ Z5 | - /*#define EDMA3_DEBUG*/
' s7 b: A7 z8 S
$ _% M# R9 u. ~1 F* H- T- A& Z% f- #ifdef EDMA3_DEBUG
; i" @+ m8 [0 o) b( ]; @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). N# c: n0 Z* g: Z9 m9 p- W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: A. ~- X* w8 Z/ C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! Z4 _! \" _, v. Y5 @ e! `
- #else
* o$ s* _- Y4 X8 q2 O3 k - #define DMA_PRINTK( x... )6 P! P. J/ q! D: [2 d B: H# ~
- #define DMA_FN_IN5 A6 i4 H/ ]( n9 T
- #define DMA_FN_OUT
s" t3 v( a0 b3 `5 Q - #endif
( a" T2 j4 w6 g; K- a
& ?" L! k6 p7 g8 B a6 A* \5 {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( }9 T) q% R/ T* j/ j - #define STATIC_SHIFT 3 j+ Y4 }2 A, F8 o' {
- #define TCINTEN_SHIFT 20
4 l, o- ~; B3 d4 {- T! i/ q# J - #define ITCINTEN_SHIFT 21' q* ^4 `' q+ E- I0 _
- #define TCCHEN_SHIFT 22
' N ?' j7 E0 [2 T- c) k" W1 i- F - #define ITCCHEN_SHIFT 231 K1 a9 ^0 ]8 V& j3 H
- / I! C" ? r( N9 [# J
- static volatile int irqraised1 = 0;
6 G6 N( C1 k1 c2 t7 a2 _* I! C - static volatile int irqraised2 = 0;: _3 a" y; {% f0 B' s! @
& b' o! P/ | |* z+ l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" @/ K0 v* ^" K) i5 E9 N: p - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); C0 l) N4 c8 P! m' a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 b. c3 ?( F. ^' o* u - + ^4 K2 R5 X4 U F* K% k0 ?" M! F
- dma_addr_t dmaphyssrc1 = 0;
- V+ b: @6 q- ^6 `& Q - dma_addr_t dmaphyssrc2 = 0;
7 {1 {0 f& G: o$ f# b( g+ U" ]6 T Z - dma_addr_t dmaphysdest1 = 0;
K5 N' X) o. C+ a; O - dma_addr_t dmaphysdest2 = 0;
$ d( c; n2 I6 ^) V# R3 T8 Q" e' X2 q - ( ]( w" Z* k U
- char *dmabufsrc1 = NULL;
# x. o! |8 T2 c - char *dmabufsrc2 = NULL;
) c% k! |" q- e6 h+ u$ U - char *dmabufdest1 = NULL;- h4 w* w# F. i# i' Y9 Y
- char *dmabufdest2 = NULL;) n7 s3 g2 n- d P7 G0 G/ U
- 5 I9 |, r( d4 w( L8 x! M( A4 p- Y- i2 n3 D
- static int acnt = 512;: n6 p, W$ |' T# [# K" {
- static int bcnt = 8;9 u( y! Y8 E8 \- u( t
- static int ccnt = 8;& y, w7 m; l+ i. Y9 Z4 l4 ]
- * c; ]. _6 y- K* ~( i( k
- module_param(acnt, int, S_IRUGO);- a* W+ E# P w5 V1 `2 o: {
- module_param(bcnt, int, S_IRUGO);2 S) H: l+ I7 b
- module_param(ccnt, int, S_IRUGO);
复制代码 4 d2 @" B% K- C# c }4 K
/ D% A6 Z" F6 R; Q [
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- @/ e) u6 W& r0 C' D' P7 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 }% x. `; T& S3 O" f0 D" X" P+ c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ H2 P$ i" ^/ \' ?. h/ ~2 }4 l5 x' F
& O3 |; }& [' b8 x
. W$ E+ ^5 s+ `2 n; K+ s! J) m |
|