|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 |" i9 u+ ~ X7 V- [code]EDMA sample test application
8 l" H" `% [' Y6 l% X1 A/ V) E - /*
$ e% C7 u) O i - * edma_test.c
* B- I ~5 }, s; b& n5 x' m0 Y" y - *
- r# Y) W5 _. Y0 N' g - * brief EDMA3 Test Application
8 ~( V& M5 b" H4 ]3 C( Z# Z - *
* [0 f) \# S+ m. B$ ? - * This file contains EDMA3 Test code.
3 N) K7 G, g; H# P) z - *
; ?9 G1 S7 d. N7 N- ?; n" P8 a- e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 e$ c4 V, y. q8 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- i0 K. L# t& K7 L
- * TO CHANGE.* K) v4 _! b# c8 L9 b: @: A9 a
- *
, P' a3 ~/ `# N+ \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 S5 v( b9 O) l
- *
3 d. N( M& b5 L+ h$ u$ a: C- `5 ]8 i - * This program is free software; you can redistribute it and/or
1 W7 k F" A" u4 U6 n* a - * modify it under the terms of the GNU General Public License as6 J, U9 |! g$ H) v; O `2 M- t
- * published by the Free Software Foundation version 2.
1 @5 {$ I- m3 R! | - *
! ~1 S& a2 g, e* u* A6 Q) M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ C( L3 F& h' g# p
- * kind, whether express or implied; without even the implied warranty' u* b- t/ j8 H( _) n/ `+ j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, A" Q7 |2 Z) T4 ^ g
- * GNU General Public License for more details.5 I- @. b' Z) O: T
- */
, h( G1 }* ], S- k$ ?. m. Y/ h - ; {- d! V" a8 d6 ^5 Q
- #include <linux/module.h>$ d3 d# U: z; {1 \% J; c$ f( v
- #include <linux/init.h>
- ?# E! M) V& s! n! t0 e1 s - #include <linux/errno.h>8 G" U5 j& Q& r2 `" J, o U
- #include <linux/types.h>
9 e. n9 u8 U ~7 E1 U - #include <linux/interrupt.h>0 W+ {; i& \+ v% A
- #include <asm/io.h> X" A9 I% N* z0 y$ o
- #include <linux/moduleparam.h>
/ p0 a# P* P& U5 v! q7 b& C - #include <linux/sysctl.h>
& L5 v5 a+ U1 y" W/ B6 ]9 ~: B/ A - #include <linux/mm.h> R$ q% ^- \ H8 d! a
- #include <linux/dma-mapping.h>: y0 d1 h. F5 F1 E* ?/ J) z
* p5 H9 d. @6 J" e2 Z9 e- #include <mach/memory.h>2 _/ j$ }; \* B4 {4 F6 h' a9 M$ [
- #include <mach/hardware.h>! a4 j" J9 a8 a k: O) `
- #include <mach/irqs.h>$ {$ w7 T, ?' Q* N: Y
- #include <asm/hardware/edma.h>
$ e! o1 P2 g3 T/ R: I$ j - - T$ _% _8 a- n9 T$ |0 W6 i3 B
- #undef EDMA3_DEBUG
: [; M0 b1 R: s' y5 l; X+ g2 M# u2 p - /*#define EDMA3_DEBUG*/
! R' Z2 g9 r0 g$ f# w+ [9 y6 k% P& Z0 Z - $ X- i" f/ \( x3 z& F; k
- #ifdef EDMA3_DEBUG( q$ k8 c% l5 {- P" e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' [7 R" b! h+ _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* ?9 w4 z4 r& M; u* A% w3 h3 a - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 n! e; R2 g5 M3 g0 ^( f7 w3 | - #else6 a$ k! L& x% U, y4 U
- #define DMA_PRINTK( x... )
: V6 g/ q3 I( F$ p5 H$ \% E) z - #define DMA_FN_IN3 i2 f9 E- `0 P
- #define DMA_FN_OUT
# I! c. d. G+ [6 K3 { - #endif( B' B6 e" J# U o. i$ c
* ?, g: j4 o5 q3 L- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
8 @0 S" Q1 K/ n/ q0 m - #define STATIC_SHIFT 3' `/ u5 B& g' F( f
- #define TCINTEN_SHIFT 20
/ y6 n' e$ o2 ]7 k1 H% ~: [ - #define ITCINTEN_SHIFT 21
* {1 a5 }$ | M5 W& r - #define TCCHEN_SHIFT 22" z: a3 D/ b& T( g" K' Y! F; {
- #define ITCCHEN_SHIFT 23, S$ S8 u5 X, s% J1 u4 L" b* p# x
6 Y1 W" p. Q: I, Q8 Y2 F- static volatile int irqraised1 = 0;
) Y! T; o& k! x% C" G; I9 I - static volatile int irqraised2 = 0;9 O% Q+ ^& r* f* Z
4 [% k* N3 R/ ^3 N$ X: F" E. e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# G! B9 h& a0 C. f
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 D# Z7 \' W: d - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ^& \! e+ _) F' V8 M+ T - / O5 ?) [, Y" L" e5 G, Y, ~
- dma_addr_t dmaphyssrc1 = 0;
; H% |) t. W$ a6 p- ]0 N+ X - dma_addr_t dmaphyssrc2 = 0;
3 A& j# Y, k: ~! S - dma_addr_t dmaphysdest1 = 0;
0 t( t# O, P* J9 |- T* } - dma_addr_t dmaphysdest2 = 0;
1 P. v* _# M7 E9 T9 _
6 L$ Y. f1 W5 t: R& v7 ~& F, G1 g- char *dmabufsrc1 = NULL;
' O6 M4 B* `" m& y1 B: i B0 Y - char *dmabufsrc2 = NULL;) u7 |: F4 V( L) c1 v# Q
- char *dmabufdest1 = NULL;6 }& D: w) w$ b5 c
- char *dmabufdest2 = NULL;
2 F( l, w( f K7 ~
0 F% r$ b: v; }* a$ I9 _2 @- static int acnt = 512; p( f: S2 w8 O! J O4 P
- static int bcnt = 8;
3 ?7 {# y6 m2 R& r+ B! K: P - static int ccnt = 8;
7 C+ X3 R0 L/ p, v' L& I
* R* V5 p. w* A2 w- module_param(acnt, int, S_IRUGO);: F) q- H# c, L0 t
- module_param(bcnt, int, S_IRUGO);* Q0 f7 V+ u* ~# _" P6 @
- module_param(ccnt, int, S_IRUGO);
复制代码 9 P( M/ G8 }$ e* \" E( b$ B' i
/ v/ ]& R, | b$ p5 w- l1 D8 g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O4 }; F& C) U' {! A1 i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# m6 }9 w0 i, a9 M2 w0 c/ Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 q$ U* `: {6 B" M. t/ T
) E. n- P+ ]$ m) a, Q2 O. j& Q; f# o1 B4 @; @! J9 C E
|
|