|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 {2 ^6 ?1 ~6 J( W8 v- [code]EDMA sample test application4 \, }) O2 ?0 m# Y/ I9 G
- /*
, ~3 g3 I$ _7 G( j' c6 M - * edma_test.c
% u+ i @7 T) Q) m j - *
2 S8 Y; ^& v; B( {8 Z- _ - * brief EDMA3 Test Application
2 y" q1 @" D/ i- ] - * m' e g; W8 A1 b
- * This file contains EDMA3 Test code.# G! {! e2 e, i
- *0 K6 ~8 Q5 S% S1 \( @+ E& ]
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" q* f! X m2 C# q h# {8 K5 P- _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ f: n& y# }' k - * TO CHANGE.+ F' h# {8 y- p2 l
- */ G# m' j4 [4 B( b) D, E5 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 x, o" r. E) C. o1 K- P
- *( f: B* `' n; S
- * This program is free software; you can redistribute it and/or& n0 T. [, G* ]1 v
- * modify it under the terms of the GNU General Public License as
- a5 a& D0 ^9 Q - * published by the Free Software Foundation version 2.
( g( U/ i4 J( k, Z( M - *
9 V; A+ _# a# ^" G8 Y# r3 a( b Q3 B1 `$ W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 y/ J. E! Y; q3 L! q+ q" ]3 h) U% J
- * kind, whether express or implied; without even the implied warranty
0 s, |. l2 W9 g* I4 }1 @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) |# K9 G0 x. A - * GNU General Public License for more details.
& K3 G8 p, _/ G1 t7 y2 j8 {6 Z - */
1 R K- j% G m; I) N+ ?
+ `4 T3 a+ h: S, C$ @9 Y- i* Q# a- #include <linux/module.h>! V$ K) G- }( p
- #include <linux/init.h>
! u( z, I, z/ |: ]: a - #include <linux/errno.h>
& A* R) ?5 L0 M# P; H) r0 b - #include <linux/types.h>
' \" @- t8 s, Y( N5 _' g, L - #include <linux/interrupt.h>- o4 D$ W8 t+ m W4 ^4 b
- #include <asm/io.h>
( J# Q# |9 \6 Y: e f X# Q C - #include <linux/moduleparam.h>
0 G) U" M* K, i - #include <linux/sysctl.h>
1 k+ x [" e' e6 h9 e7 \ u4 a - #include <linux/mm.h>
. @( F- h t5 h' k% F - #include <linux/dma-mapping.h>) Q; @6 A @4 e+ K& I4 I; C
' j0 g" d+ S, {) J6 C, l ^- #include <mach/memory.h>& T. [; Z$ m" x/ ^% Y$ H ^
- #include <mach/hardware.h>
: A5 n; Y* Z$ a$ i; Q$ a0 \. x- g - #include <mach/irqs.h>
' S* g; b( F% J9 _. I( E* Y - #include <asm/hardware/edma.h>
, Z1 [7 {7 T# \( t4 i' P- O
8 W; } v# X% C( K0 q6 |$ U- #undef EDMA3_DEBUG( p" a3 n- ]9 g1 [- q$ c% ?
- /*#define EDMA3_DEBUG*/4 q: C. m: ~" | p$ E8 F- A4 j* B/ `
- 2 I; l& u" z. s, T8 m% ?7 s
- #ifdef EDMA3_DEBUG
9 f* k9 ^2 L$ F# ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% N" a! Q0 ?1 i! y- Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 B) @2 u$ z( ^/ {: ^4 N! _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); T% J2 H' [" y" Z6 @
- #else
; y2 ?( L1 n, Z - #define DMA_PRINTK( x... )' `( b, k2 Z' g# L' i+ `! O7 c
- #define DMA_FN_IN
7 ^/ T5 [0 r* F7 G5 P( q - #define DMA_FN_OUT, [- t o6 U' J$ n
- #endif
1 J' K1 _, g7 @# _9 j - 2 C u; r; q4 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 p. O9 L6 @7 D! I% W$ ^3 ? - #define STATIC_SHIFT 3# H6 z. S! Z8 X2 d) H
- #define TCINTEN_SHIFT 20
5 |* H& \. }7 l. b* }( g - #define ITCINTEN_SHIFT 21
0 \7 o+ |. r0 |& g0 p7 G - #define TCCHEN_SHIFT 223 P+ o8 ?9 j" H+ P' L3 s
- #define ITCCHEN_SHIFT 23
* x9 {% g& e. u. Q
+ Q G7 o: L$ c1 w5 i- static volatile int irqraised1 = 0;( N& _8 H" q& e6 ^# q9 f @. ?+ T+ g
- static volatile int irqraised2 = 0; {8 G0 t/ Q0 ?$ X6 ]( V. D
2 a4 N3 s# N0 H5 n( d; d6 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ X# ? P* R7 y+ k+ B, b: k; i. C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" O8 R' P. j' E. a% E/ U) ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o5 ]/ ` r- z* A' @! z
- ; c" X7 P1 o$ G: z5 V
- dma_addr_t dmaphyssrc1 = 0;
% H K! `4 {! o1 e - dma_addr_t dmaphyssrc2 = 0;
. F, C. E- ~. `3 J5 X - dma_addr_t dmaphysdest1 = 0;
2 ^/ |7 m ~& K$ _8 f* H - dma_addr_t dmaphysdest2 = 0;
( t8 N; v/ B0 F/ i" u. y - ' i: M8 D3 S* P# {, X5 g
- char *dmabufsrc1 = NULL;
2 Z- o+ \& ]; _2 c; a5 T0 u( a - char *dmabufsrc2 = NULL;3 a% u$ f" [: r
- char *dmabufdest1 = NULL;
. P. Q& O" b5 V8 o3 i% p5 X - char *dmabufdest2 = NULL;( Q# w5 {6 m( B& v/ Y6 u
- * h1 x. }. z9 r9 g
- static int acnt = 512;+ s& {: z. R" J* Y; o7 Z% _. I
- static int bcnt = 8;1 G* \" r) c+ I
- static int ccnt = 8;3 ^6 j `$ W* w1 d
- ) f' }0 n# G a+ m0 H# R
- module_param(acnt, int, S_IRUGO);
( b, }! Q0 ?' |% I' j2 @( M4 g0 m - module_param(bcnt, int, S_IRUGO);
4 R8 g% N. A; g% J { - module_param(ccnt, int, S_IRUGO);
复制代码
! q4 A- n7 x4 n7 n* c* V
- y' x6 }" p4 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. B8 Z7 U e! e7 M" m6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Q* M& g8 |+ q+ i# E/ d, M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ T( G# \; L4 S9 f! [
( ?7 ^, I2 b. h0 e+ I
- q8 N# t* ?- }6 b* ? |
|