|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + _7 i, o+ W* }* L
- [code]EDMA sample test application
6 D9 [0 ~0 B6 j9 R& O - /*% r8 ?+ g7 @% \7 I# P# f
- * edma_test.c
, y! s( K& w9 _; ] - *3 } K, I3 V, W0 i
- * brief EDMA3 Test Application* q( X% S; L, d1 q3 v- D
- *
8 Q/ ^( k. \/ \+ J! r p - * This file contains EDMA3 Test code.
! t f9 C+ G# E# \ - *
m; n: V/ g1 m6 U$ a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ [$ g4 b6 G/ h2 A! F - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 M7 Q. V' T# H: U- X - * TO CHANGE.5 Z) c( c( C3 x% k1 Y8 q
- *0 i' T$ Y9 v$ R; J7 x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) N# o7 q, h! ^& I! ?& _' ? - *
/ b7 N( F2 F; |' a- c0 L - * This program is free software; you can redistribute it and/or
' U, T% P& A/ ~( n. J - * modify it under the terms of the GNU General Public License as. n: h2 _& w4 l) j
- * published by the Free Software Foundation version 2.
, N$ c7 O( m3 y# J$ d - *
- z4 D* @ P u) F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ E6 r( y* ?2 T* k* W - * kind, whether express or implied; without even the implied warranty
& W( m( g& a0 p - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) N& O7 Z/ l0 h; q& \# [6 ]- v
- * GNU General Public License for more details.
; \9 Z' R' }$ y5 O - *// C9 S/ y. z/ L
3 R2 ^5 X9 ]8 K) N6 c W- #include <linux/module.h>4 Y0 {# Z: h4 g8 X) v
- #include <linux/init.h>2 \# `) p% t$ h. A$ V
- #include <linux/errno.h>3 w' T: \# m6 F- {4 m
- #include <linux/types.h>7 l; I, r! K: H1 e4 q
- #include <linux/interrupt.h>
* m8 R# h1 _3 q4 J) g2 d - #include <asm/io.h>' y+ F1 S9 m i N, Y: r m1 s
- #include <linux/moduleparam.h>
5 Y9 \% r$ Z7 q- j4 F9 Z - #include <linux/sysctl.h>
; U4 @& u+ U8 w/ ?) s. }& c: V - #include <linux/mm.h>8 j$ q' c3 O" \2 L1 U
- #include <linux/dma-mapping.h>" I/ y' g5 p0 R6 Z. h2 C
- " O: h- C3 ?( C
- #include <mach/memory.h>3 ^7 \1 j( ]6 Z; T F% |- ?2 k
- #include <mach/hardware.h>
8 T* Y: ]. [! E! @$ H - #include <mach/irqs.h>4 s; a* E! z' B+ ~3 n. n$ J
- #include <asm/hardware/edma.h>/ a, K$ F6 b1 G, J# \8 N
# N' U: M. o; S; U- #undef EDMA3_DEBUG% E/ O1 j# a& h5 j+ _6 Y5 s
- /*#define EDMA3_DEBUG*/
3 f& j1 r* Q2 P" z2 L
/ C) t! o+ o7 K! z- #ifdef EDMA3_DEBUG( w+ F: t9 f' {; j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) C* Y9 w+ { { |) W$ C/ [; M
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 u9 W" Y0 W! o' y0 w, a8 d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& q4 t. @( F* K% m0 ?+ y; X
- #else) f' v" ~( T- u9 d& k
- #define DMA_PRINTK( x... )0 i; f% U9 A& ]0 f3 c9 v/ f- g% V
- #define DMA_FN_IN! q- A3 d/ g/ ]1 \) }* ?
- #define DMA_FN_OUT! l! u( a0 W+ i5 u" f
- #endif4 r# L n7 L Z5 e
4 R0 Q, u0 @# A4 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 ?7 G% g7 {1 [- J - #define STATIC_SHIFT 3
( u% \0 v! Q f- [3 X# ~; k3 u - #define TCINTEN_SHIFT 20- t0 X( }7 `* J& \% v0 {7 F
- #define ITCINTEN_SHIFT 21, ^9 l% G* h4 |1 k# |
- #define TCCHEN_SHIFT 22
- z* M% s1 y, k) [ - #define ITCCHEN_SHIFT 23
% M$ K! Q# \- _2 V. ~/ m
3 e% p. g4 {. u' ^! n& n- static volatile int irqraised1 = 0;
4 p' f+ q9 O) w& u2 B - static volatile int irqraised2 = 0;6 R/ a# F* g1 v; V1 X8 `
9 G, c0 i+ s: b) V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! [2 f$ q' u) Q% X+ q* M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 f* { w: Q- P7 @5 J$ U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, S" ]9 e( t5 d9 I; ^ - 7 f! L3 c1 ]. |9 ?
- dma_addr_t dmaphyssrc1 = 0;
3 ~3 n: S# ]. o - dma_addr_t dmaphyssrc2 = 0;
: z& Y2 _ |/ M2 K9 q0 q% l+ N - dma_addr_t dmaphysdest1 = 0;( [( m I1 M% A. y2 p6 h) Z
- dma_addr_t dmaphysdest2 = 0;9 r3 a$ ^9 z/ q8 s
- + F' O& w' T+ b, O0 a
- char *dmabufsrc1 = NULL;6 c! ^0 S& _- Q* a6 O# w
- char *dmabufsrc2 = NULL;
/ Q7 l5 \4 _8 m - char *dmabufdest1 = NULL;+ f4 u' @5 b* B7 m S# i7 r
- char *dmabufdest2 = NULL;
4 [" p* G$ ]6 K9 p0 y. }. e# M6 C - 5 M! F6 @: A, `0 {0 p
- static int acnt = 512;' M B! c0 U0 i5 s& z2 u2 Y
- static int bcnt = 8;$ C! j2 ~6 c/ D6 N
- static int ccnt = 8;# ~- e4 t) m9 @- H# Z& t
# e1 h0 f2 f) o5 F1 B) ~+ [- module_param(acnt, int, S_IRUGO);
2 e; ]; b* x6 M8 r/ q - module_param(bcnt, int, S_IRUGO);4 n4 v7 ]8 l1 {. m5 w, ]8 }/ q; t/ K
- module_param(ccnt, int, S_IRUGO);
复制代码 7 W, l3 L$ S1 E. H e
" r# X Z% h3 R4 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 v' J& d% u& H* _ r6 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ A( ~& e0 Y3 x& y& r( S; U6 I9 Q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 _9 K, i' E, D
! k+ a- m1 [ `" Y+ m7 V$ |" ]
8 q7 }8 V* z2 C5 v |
|