|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + M) L6 q; L( Z: Y9 E. _4 a2 i
- [code]EDMA sample test application
+ |2 c- I7 ]# a& L1 } - /*2 R0 y0 P. |. p! |$ k
- * edma_test.c7 p7 m) L6 S- Q2 K
- *
5 ~1 X4 ^+ ~. Z0 c - * brief EDMA3 Test Application0 A- T- E" W6 N5 u: ? V& `
- *( E- g6 O7 \" _+ s
- * This file contains EDMA3 Test code.
4 u# n. y; C9 [' C - *9 I% y: x6 c; L5 G; K4 M+ ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ U0 w- ]$ a8 s! e2 @8 j2 l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT L5 o* F. g9 H8 m1 g
- * TO CHANGE.; Z, `& u" {9 \# b* r8 R( c
- *
6 _( o1 f; F- U8 T6 p7 I% n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 a- ]+ U1 Z+ n$ Z
- *
& X, {: |3 y/ Q. m - * This program is free software; you can redistribute it and/or
, m/ ~3 R: t. u: w - * modify it under the terms of the GNU General Public License as6 W' w( C) w* n: L5 `
- * published by the Free Software Foundation version 2.0 ^/ M4 S! C# S8 m" }: t) i" z
- *
! Z- |/ p) {* n* r: E - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. J) U2 p8 I$ N - * kind, whether express or implied; without even the implied warranty
7 s( D( D- p' ?& _' b4 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
, `7 m7 \9 s$ `8 V, Q0 ?1 X5 I - * GNU General Public License for more details.. R7 g1 o5 O, Q! O
- */
, E0 F' d) m! }+ L P6 I \ - 7 p! p0 a( p$ _0 m
- #include <linux/module.h>$ \/ a O+ I# \ Q
- #include <linux/init.h>% o0 ^1 n/ g8 [8 x/ _
- #include <linux/errno.h>! K2 R$ h7 `: b* c4 K9 ]
- #include <linux/types.h>+ _+ I5 B5 J% c; Z& `. A# D; Y# J+ ~
- #include <linux/interrupt.h>9 D2 j7 u: j0 U& [0 J3 ~6 w
- #include <asm/io.h>+ C; i: L K. i t
- #include <linux/moduleparam.h>, {: t; K' E0 Q6 d+ q6 }6 H9 l
- #include <linux/sysctl.h>
2 I* a8 \5 L+ B' P) G' S - #include <linux/mm.h>
; m- i! n+ j9 p& x! j# x E - #include <linux/dma-mapping.h>
7 V2 y. d' {6 H5 S$ q - 7 z l& o6 i1 T, S
- #include <mach/memory.h>$ g( N8 h, p, `
- #include <mach/hardware.h>3 m# E' @ }- N) f6 G
- #include <mach/irqs.h>: X4 e- D: R/ l9 U) _
- #include <asm/hardware/edma.h>! m4 l L, E% @' B+ s
5 P2 Z- ~- i/ T! V- #undef EDMA3_DEBUG6 b3 c; h# U0 d
- /*#define EDMA3_DEBUG*/
1 e% K8 P; O* Q/ _ - * `# l3 i1 L& J5 Y
- #ifdef EDMA3_DEBUG
! `; {" a# V1 s { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 G3 s2 P2 e- |6 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ X1 V* @8 f7 b+ z# l6 V
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
' O# G! J+ b& W* ]3 F$ o) Q3 k - #else6 h& ?& P6 u* l
- #define DMA_PRINTK( x... )
& A, y! i; B0 I: o - #define DMA_FN_IN! c% b3 _ k: S) r7 O: M0 t* P
- #define DMA_FN_OUT
, {+ O; X" x4 `. T: l7 I& S - #endif
# s0 w9 b2 S! A% p! R, |) P - 7 [7 _- g' ^7 ^. k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; H' \) B) \8 N8 d* h5 v& W - #define STATIC_SHIFT 3( D* F5 \. K, v# ?0 F2 Z O% H) u0 ~% D
- #define TCINTEN_SHIFT 20$ n' q# s7 f- S& s
- #define ITCINTEN_SHIFT 21
# ~. j; @ N4 \" e' P& U - #define TCCHEN_SHIFT 22) y8 J8 r. x. ?% e- Z
- #define ITCCHEN_SHIFT 23
7 n! U( S/ q* B' I
% x7 p" l }5 I. F3 p8 q- static volatile int irqraised1 = 0;0 y3 W# u9 p, x2 G
- static volatile int irqraised2 = 0;
M( z" q8 q \% a3 ? - 8 N! B: W0 c6 `" z6 u
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( X- D7 a4 p& _0 G3 I0 U5 y& F7 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 c. h0 Y# a% m* ?8 N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 c/ L! b; _* f3 h7 b2 ]; @# j - 4 {$ n( ] z: k3 _$ I' }. b
- dma_addr_t dmaphyssrc1 = 0;, T" h- Q+ l- Y) F% ^& C, e" {
- dma_addr_t dmaphyssrc2 = 0;
; S' n* @% f: t, I - dma_addr_t dmaphysdest1 = 0;+ ^& w& D C |) K$ ^) E/ E( P
- dma_addr_t dmaphysdest2 = 0;' d( U6 D+ \9 @5 a: a
- . }! Y5 N3 f0 x. H
- char *dmabufsrc1 = NULL;
: c$ w3 B) ?; s0 G( _5 u - char *dmabufsrc2 = NULL;* Y2 o8 o6 q0 }+ p( e
- char *dmabufdest1 = NULL;
5 {7 V8 w& s3 g- ? - char *dmabufdest2 = NULL;
. Q0 H. U, W3 D0 d4 Q2 J
7 O" v: ^* w/ o- }9 O- n- static int acnt = 512;* S/ p$ Y( }5 o4 ]
- static int bcnt = 8;$ S, `5 [* a) u# a4 \
- static int ccnt = 8;
; B" p- L% l8 W5 X" C7 K - * o* `8 Z' K3 z* S- C
- module_param(acnt, int, S_IRUGO);
1 H$ z/ f7 O: Q3 @ q) l - module_param(bcnt, int, S_IRUGO);& w G0 M+ F1 |+ f2 S, f; J
- module_param(ccnt, int, S_IRUGO);
复制代码 3 n& j- w$ L+ d
7 z9 y! f# M1 N& o# D4 r$ B% g 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! U# C" l1 Q6 Q; l. f4 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 y$ d( C2 d2 r: Y% | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 h& b- g$ `4 p
3 _/ q4 z0 h6 U3 K4 n3 U
1 z$ p0 {: F: G( V4 i |
|