|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , `8 n$ b* _, ]. L! g
- [code]EDMA sample test application
8 f2 Q# n+ K0 a1 M: j2 t0 G - /*, K7 F( S! c! y9 E; Q$ e0 \
- * edma_test.c" M; s4 I. J, ]: o
- *, \6 y0 @4 t( D2 H1 y
- * brief EDMA3 Test Application
% L# r4 q5 ]- {: k- ?. i7 s/ C# Y - *- |7 _! s+ [* Y# O7 T4 |6 {3 q* z
- * This file contains EDMA3 Test code.( I4 N7 M/ } X& M d3 u& E. a
- *
, `8 u! M5 J3 w7 r( {* K1 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& @/ b# }% m; s) M) R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 R( Y2 o" R/ `, \# o4 U
- * TO CHANGE.' @) ?: U" T2 h' i
- * Q2 P" {; j7 {2 N; U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ S5 A- u6 r3 A. H - *
1 ]4 \$ R9 b5 t7 F' l5 i1 L - * This program is free software; you can redistribute it and/or! y6 i& T6 ^; Z8 u+ h
- * modify it under the terms of the GNU General Public License as; I7 [) Y: {1 ?' P) K
- * published by the Free Software Foundation version 2., _* n' o- f/ I6 `9 {- d* G
- *' m! E" Y: F8 B, A( s. @/ n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# u& v' Y" B- B) W1 o - * kind, whether express or implied; without even the implied warranty
. ~5 l: E* m$ F% C# W1 `% Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% `0 J# c' X8 t% j1 [
- * GNU General Public License for more details.
, \% @: L) u5 y# A2 p - */
# P6 T$ A: v( h$ B8 I$ F
6 ~! k( X M: k4 _: c1 _7 i- #include <linux/module.h>
% f6 K6 s1 k3 ]. o; e - #include <linux/init.h>5 e+ x* u: G% z; K' Z ~5 ]0 O
- #include <linux/errno.h>" s5 t6 P; x6 ?/ I1 E/ b
- #include <linux/types.h>: S; @* h. E$ M
- #include <linux/interrupt.h>
8 m9 r8 a8 b! S: J6 X - #include <asm/io.h># p: r& O" B/ {0 ~" Q$ D* V
- #include <linux/moduleparam.h>/ T! R& W( j+ B0 J! ?
- #include <linux/sysctl.h> a8 O1 j& _* ?1 g
- #include <linux/mm.h>7 E. c5 S& i' r1 J$ W# T: |4 t
- #include <linux/dma-mapping.h>. G/ N, r" `7 p# T! u! A
u9 w! x) m% P, [# Y6 q- #include <mach/memory.h>/ h' r/ \* m# b7 l: s" T2 ^
- #include <mach/hardware.h>3 {6 s; }. V. J* v9 ?
- #include <mach/irqs.h>/ f( s4 }' c. d6 t% w
- #include <asm/hardware/edma.h>8 F& P1 Q9 \. w9 O9 @: y5 M+ B8 l
! g+ P$ D) x" A. u: l) c8 y- #undef EDMA3_DEBUG
& M( o+ s$ M9 U3 g7 C4 x e - /*#define EDMA3_DEBUG*/
6 {: P$ B8 u* m* j0 D
9 i; G1 A! c* @3 {. ?1 ]- #ifdef EDMA3_DEBUG
2 F, Y+ A/ r- h$ K* g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! Z2 [8 y! |3 i. Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ g% Y' l/ Q3 h: v/ F. k9 o. e9 g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
T' d4 P3 a% U8 O: j - #else5 ^3 z, L" K# J# d
- #define DMA_PRINTK( x... )9 o3 e1 G. }2 Z# h% P* [
- #define DMA_FN_IN
& U7 n. [0 S9 M6 M6 X" r# E# y6 j - #define DMA_FN_OUT
. r9 r+ F9 |$ Z h% v - #endif2 F2 N" ]. c$ X$ p/ F f3 A) B( V& Z
% W/ @& V+ Y3 v o( A- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% ^5 J! i; w z1 F9 r# E. O - #define STATIC_SHIFT 3
. N2 E1 s+ B# q9 ^+ \: O( w - #define TCINTEN_SHIFT 20% R# i7 c) O+ D/ o4 y) V: T
- #define ITCINTEN_SHIFT 21
! Q. e% u! t8 ` - #define TCCHEN_SHIFT 22
5 }$ C( z: ?6 c: l( t! s. a - #define ITCCHEN_SHIFT 23. z8 m5 d- D" @. z9 _
- 0 O; b9 { z2 b% o8 G" A3 I) ?/ w0 ]
- static volatile int irqraised1 = 0;5 R# f* j& c5 L
- static volatile int irqraised2 = 0;
, A3 k0 T. _; ?" I# y/ n/ u/ y - 1 s3 }8 |" {/ T8 j- y* l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k7 @# g$ u: l5 @8 V4 F: C, j- e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' A: d- C1 O+ \: e* c, A5 ?) c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, e r0 O8 M% D/ K9 L' O
) I- A. m, l# w- dma_addr_t dmaphyssrc1 = 0;
, v. _: {- L" ~, y: ~ - dma_addr_t dmaphyssrc2 = 0;4 i+ A# q. g( b G, Q
- dma_addr_t dmaphysdest1 = 0;* h$ r7 o! L4 V4 U
- dma_addr_t dmaphysdest2 = 0;" y+ U3 Z W. _/ M' y
- * ?& K6 L0 Z W T& q# g+ _9 S8 D
- char *dmabufsrc1 = NULL;
3 v; L; _/ G, {' S, Z5 ^% o% T1 q - char *dmabufsrc2 = NULL;
+ j. t$ t: k5 c, Q - char *dmabufdest1 = NULL;; V, Z, L( M R6 D5 y6 t# ^
- char *dmabufdest2 = NULL;
; Y6 s1 u7 C% N* s, \ - & v% t5 d3 p! f7 u: p- b" `
- static int acnt = 512;
5 Y5 [( O* r+ i! K% }; _6 R - static int bcnt = 8;
E% H8 `4 c8 k2 V# p - static int ccnt = 8;
+ `- @2 X. M2 F1 d# G, N; c - # U* A4 J6 `$ P5 _
- module_param(acnt, int, S_IRUGO);
. x4 B& g+ g8 d, k3 l/ { - module_param(bcnt, int, S_IRUGO);4 U. k, P/ N5 Q9 T: j
- module_param(ccnt, int, S_IRUGO);
复制代码 p1 j! F8 \- g; w
7 Z/ I# A, A& L; ]+ z! p 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 `' j7 b; p4 o4 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Z" y# ~- Z+ s1 u- r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 q9 r* G& ^5 I6 o2 x2 P( J3 \. \: Z: [) l y' k) J+ H9 w( w' n2 s' k& ^
/ s; r5 B1 U; Z+ N0 w1 {
|
|