|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 h: ], O8 V5 h" T$ a, |! ?. T7 q7 S$ ^3 D
- [code]EDMA sample test application8 G* K% n0 b# I( I* c2 m4 V' Y6 V @
- /*( S0 P( ?1 y7 O& @7 U6 w
- * edma_test.c
+ i9 C+ x: y H# ?- W' M: O$ o6 Z - *
" H& b, j% u$ f& `7 C - * brief EDMA3 Test Application8 l, j3 y/ Z5 k# z
- *# q* g1 ^3 R5 S! N: C
- * This file contains EDMA3 Test code. v0 a1 Q5 w, C2 s9 u, ~
- *
8 S2 R8 B. s: f2 b F" x8 | - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! B7 B5 x }/ a - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. e9 a0 k; K/ D) @+ _" j
- * TO CHANGE.
: z/ K2 r+ P3 H/ | - *& `9 U9 ]$ z# S" b' U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
2 w# p) J3 W" n2 a5 r, l - *8 d, r5 Y; @! m" [0 H( j! I
- * This program is free software; you can redistribute it and/or& \9 H: F( g2 G' q9 K
- * modify it under the terms of the GNU General Public License as4 {7 w2 c* w/ v8 k: H/ k
- * published by the Free Software Foundation version 2.4 J8 G$ X6 _/ p: Y( [: f
- *
) P& X5 V* b9 W* x( Y0 x+ Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Q, ]3 r/ j- P( {6 y* t, L! p
- * kind, whether express or implied; without even the implied warranty
' B2 U3 l0 ~7 p) S - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. [5 {* s& d Z- r! M( G% q% ?
- * GNU General Public License for more details.
. G6 P4 [6 f7 J n& C - */# D8 Z) `! G. j0 P9 v4 S
- % N. |" t) E9 e4 s' [. c5 b5 x
- #include <linux/module.h>
; T$ Z4 F/ Q, p9 y& {) C$ b4 n1 C - #include <linux/init.h>/ P8 H( R1 F; m
- #include <linux/errno.h>1 P* u' R3 P& o9 z* }9 M: x
- #include <linux/types.h> x' O' o! }& B- P5 d9 t
- #include <linux/interrupt.h>
6 C+ Q7 M4 y! _5 ?8 y+ ]3 |4 Q) [ - #include <asm/io.h> e% p6 C" z- q/ Y
- #include <linux/moduleparam.h>; }: t v4 q# T
- #include <linux/sysctl.h>
}# g' d; n9 Z. R - #include <linux/mm.h>& e! p, B7 `# c' g ~7 b1 @
- #include <linux/dma-mapping.h>: G/ Y" E) z' q+ I, D) b
- / I2 b5 @, p$ F* ?; w
- #include <mach/memory.h>
- X% Z5 t& P z0 d6 \7 O Z - #include <mach/hardware.h>
2 M4 p# _4 ~+ M8 E. T V - #include <mach/irqs.h>$ A9 R7 |9 F7 R
- #include <asm/hardware/edma.h>& Z0 t. @8 Q6 Q7 j/ @0 Y1 ^5 c
- 5 j T) G8 M0 d! A) @
- #undef EDMA3_DEBUG
# d1 T; a; M: P: a - /*#define EDMA3_DEBUG*/
$ B$ A- U( m; ]# ~8 p' ~
% ?* Q; A# d( t$ n( w w, v: y* Y- #ifdef EDMA3_DEBUG
& S* m7 | W. K$ U7 |) P. r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. M" i0 Q% w! J- O - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ Z+ G4 _# l) Z/ G( P. X0 }: w - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& t5 r" p' O% m9 u
- #else2 }; k8 Q2 j5 z6 s' g- G
- #define DMA_PRINTK( x... )
' O* [, C8 L+ Y. o! ~# {3 R* X - #define DMA_FN_IN2 x( `9 j# Q9 L$ S- a3 x. z: I
- #define DMA_FN_OUT
5 W& f. @. U0 {; g0 ? - #endif
) d% E3 ?9 u& p9 i: |* n, r, d
% W5 t) ~3 m \# |, k3 S. z) p$ c- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- R/ p3 N, F3 _6 i. B6 m
- #define STATIC_SHIFT 3
$ }# j/ N" I2 c: g, l& n0 K - #define TCINTEN_SHIFT 20
7 {* b! H* D# @9 d4 G; g& Z8 n - #define ITCINTEN_SHIFT 21; u) k F$ n) {% o9 b
- #define TCCHEN_SHIFT 22
1 i4 h1 \4 B" r6 t - #define ITCCHEN_SHIFT 23$ [+ O5 E1 G' G8 h7 E
- 2 P5 G( d: s9 u' C7 V) h% K
- static volatile int irqraised1 = 0;
/ @2 } A! Z( M, ^ - static volatile int irqraised2 = 0;, t9 D3 i5 m9 B5 W0 h
- ' n8 @1 E, Q, M- ]: |& b. V3 c" {# {9 X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ M5 J3 q; T6 ~' A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 R+ Q3 t% h1 s1 C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* d% ^0 x! M8 l1 \ - 6 X! |5 _4 \* m, G* J
- dma_addr_t dmaphyssrc1 = 0;
2 B. K0 j& S8 S; ^- T - dma_addr_t dmaphyssrc2 = 0;: z% ~: T: N% k
- dma_addr_t dmaphysdest1 = 0;% L; l, P9 J0 B# s* Z$ _- D
- dma_addr_t dmaphysdest2 = 0;3 s0 Y1 N% P, P0 G+ e
& @, V0 U: x+ ^' ]+ B- char *dmabufsrc1 = NULL;% w" y9 Q8 |& x& U
- char *dmabufsrc2 = NULL;
' p+ r G! u" L/ @, a( t - char *dmabufdest1 = NULL;' M5 c$ r( O$ [, F/ C5 f8 M0 v: @2 Y
- char *dmabufdest2 = NULL;8 w! q2 Z6 S% a8 g) c* j; i
- + ], [! v/ i" Q5 n( m7 S7 C( F
- static int acnt = 512;
" V2 L w! c5 S+ P+ H( m - static int bcnt = 8;
8 W- ?8 z8 c, L' z* P& g& b, J5 v - static int ccnt = 8;
+ ]( o- w, \/ g$ R5 r x
. V$ f) s" O! p9 Q0 D- W6 M- module_param(acnt, int, S_IRUGO);
: \5 \7 e, H( a" n7 B - module_param(bcnt, int, S_IRUGO);
3 i5 Z; v, `# P! B' \1 { o - module_param(ccnt, int, S_IRUGO);
复制代码 9 n3 e6 {3 a1 Z8 M" u' I! ]
7 t/ l6 G* I$ [5 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, ^( Z) Q# B5 R/ M4 d& M: G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" X: A! y2 K6 A/ Q& D4 K$ w2 R
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* @9 k' y5 l8 \( z- W# q
% _; n; O/ v4 T( k* n' k" u+ n( D
9 \. d3 q8 j2 _+ R' ]$ Q |
|