|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, U" w5 `0 s2 T$ i& S; R- [code]EDMA sample test application6 u4 x7 ?3 w8 l) N2 |
- /*
1 L4 R/ k: |( l3 r- Q; Y - * edma_test.c
# P" a# u( d4 d7 x) F- y* u S - *+ k2 J( T8 B8 q5 k0 J! n
- * brief EDMA3 Test Application
8 ~0 v5 I/ T4 W( \ - *$ p y, N5 K' w, a$ ?' h
- * This file contains EDMA3 Test code.7 C0 ~5 x- I& n
- *, t* ^- H# B: \+ u* J% L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 n# `5 o4 \3 H8 ?" Q j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 I! E' y7 T9 A$ ~7 a/ P! U0 n# ~- W - * TO CHANGE.
8 j0 j5 ~! m7 }* B0 B- f5 ~( S$ Y0 A6 m - *; ^1 K$ L; l9 A9 A: Y# k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& f% z- g; \6 { ]
- *2 m# W3 b" `8 ^2 Z* h
- * This program is free software; you can redistribute it and/or8 W' l% [ x+ R3 n; g
- * modify it under the terms of the GNU General Public License as2 C$ V3 V5 A/ @
- * published by the Free Software Foundation version 2.0 D, x- I7 ~6 b. d
- *- x$ ^/ J6 F5 {( E: `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. K' e7 W, M: n. ]
- * kind, whether express or implied; without even the implied warranty
1 e M7 }7 }1 W; I6 K G( ] - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ W9 V8 J4 D5 Y% n& V9 N3 L - * GNU General Public License for more details.5 b! V. i/ V1 |5 G* ?( _4 c3 O G. S# ?
- */
* n9 \/ i2 ^1 E8 N- V% J - / {- X' }* R1 z! Q2 t. Q8 m
- #include <linux/module.h>$ m* r+ d# L/ F' t5 M& l
- #include <linux/init.h>) q0 Y+ k/ X3 f% {( p
- #include <linux/errno.h>
8 i3 u% X4 N" g4 N - #include <linux/types.h>
% r# A S# R1 Z( Q% @9 d) {3 o9 } - #include <linux/interrupt.h>
% R# X+ G& e! ]6 X5 u/ w3 Y7 g - #include <asm/io.h>, |3 M& R$ h7 }0 F, k% S
- #include <linux/moduleparam.h>2 B7 b7 W8 i4 }# V8 @
- #include <linux/sysctl.h>
4 H' Z- G8 i) t; b - #include <linux/mm.h>: ]3 p8 o2 d* R0 z; r I+ O
- #include <linux/dma-mapping.h>
0 m* v# k+ @: m5 z" h2 v' p
8 A* H( j; O# q6 H- #include <mach/memory.h>
9 C5 l0 }" ?# n% N7 x4 p - #include <mach/hardware.h>6 @+ R; {) ^# ~" @
- #include <mach/irqs.h>- t; R& S* e) `6 F% v+ C
- #include <asm/hardware/edma.h>
" S8 K9 I6 A" Z* k' |5 e* J - 3 U7 x6 q- v$ V7 r
- #undef EDMA3_DEBUG( K+ F7 p5 F b; W9 j1 f9 b
- /*#define EDMA3_DEBUG*/
! b3 w8 T ^3 _
* z$ ]9 }! U k2 j9 E5 m# J! E- #ifdef EDMA3_DEBUG
$ G# l- ]1 M( O% z6 S) j5 l7 L, H - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ `+ _4 M: o: U/ X7 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 |9 H0 P5 P0 l* O& t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- X. c* q$ k1 g1 V7 \
- #else8 v# E2 N# o( x: V5 N1 E/ Z5 t
- #define DMA_PRINTK( x... ); u) [) _# `% L
- #define DMA_FN_IN
0 e% N5 ^; Q& {7 b: r" r1 x& U+ O - #define DMA_FN_OUT
. l s2 {9 _" n+ b4 K5 v$ g - #endif
, x! t J N% b. j2 ]
7 j0 ?. H$ N0 r9 y& |0 N$ h- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: x6 x7 v9 I' A1 B! l f% e - #define STATIC_SHIFT 3
: w% H2 D. f" d. G: K* `& {) k( T - #define TCINTEN_SHIFT 20, s7 e q( N* Z" }% F4 g( d% H
- #define ITCINTEN_SHIFT 21
1 ?$ O9 @- B: l- ^! m! C0 ^2 c - #define TCCHEN_SHIFT 22
" I) O6 B& K& o* W& m# s) t% F3 U - #define ITCCHEN_SHIFT 23
4 _3 d t& r/ q2 D# @5 ?: | - / x+ K9 ?1 W* \. j: z
- static volatile int irqraised1 = 0;
7 g% J5 ~. n4 n6 D- [ - static volatile int irqraised2 = 0;
' g6 o! ]; V3 v7 c q
0 A8 v* U! H+ [* d1 `- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" m( f% Q/ |* d$ O9 r" b" l# O* {0 \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b) J. i4 ?$ R9 o$ S& B
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# \. k' T$ u7 E1 V' g
; l6 \. T3 ~4 S/ |- dma_addr_t dmaphyssrc1 = 0;
$ j4 t8 H5 Y7 K6 L5 n - dma_addr_t dmaphyssrc2 = 0;
+ t/ e2 x1 n6 |8 j7 i3 Q% j - dma_addr_t dmaphysdest1 = 0;% V K! ~+ f( i+ l7 } ^
- dma_addr_t dmaphysdest2 = 0;
% `: ?) T. [, `& L% ]' M% {6 y' n - + e6 T( T. p7 e6 F J# N& K7 M1 T* h- P
- char *dmabufsrc1 = NULL;$ C% i9 i* Q8 ~: s; s5 l- U
- char *dmabufsrc2 = NULL;3 Q7 E& w) [6 }& z( q+ u- d
- char *dmabufdest1 = NULL;
0 ^. h5 e. S" v1 n - char *dmabufdest2 = NULL;
7 A5 u7 }9 ~' ~6 ~" F
D# m2 M" O; P) h# r- static int acnt = 512;
0 Q' K& G( o* m4 z" {5 N: r# H& v - static int bcnt = 8;( X2 | q& R+ v7 v) \4 j
- static int ccnt = 8;
[! V+ Q9 T: P* L
. j3 C2 y; p; D; D- module_param(acnt, int, S_IRUGO);" O% V1 _, ?+ l% z8 x5 V
- module_param(bcnt, int, S_IRUGO);
+ x3 b' O3 g# W; C# J - module_param(ccnt, int, S_IRUGO);
复制代码
9 |/ b l, F' F1 G( p* R4 u' [/ o
/ h1 f3 X( z, f/ A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ~3 h4 _% {3 Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 T$ B- c( Q2 [) P1 G9 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* `& \. x, _) r& D* c6 q( p+ S+ H- [0 J4 t
& \5 |8 q4 O0 F% y1 s: _& Q
|
|