|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 @1 L4 @- ]$ W" l2 M5 A
- [code]EDMA sample test application( d: ^) S% Z( P
- /*
" k4 }( X/ y! {) |) _( I) W - * edma_test.c3 c4 v3 J* m" o; c; P+ B3 p Z! ^
- *2 W, \9 v1 I9 s( B
- * brief EDMA3 Test Application7 q0 \+ n: i: k/ Q
- *+ E/ U4 a6 F/ c- E/ H' A# o" y
- * This file contains EDMA3 Test code.4 I/ |& F3 N r$ R
- *
5 h; D1 O% m3 ~* o/ q: ~0 z; F+ q- o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
% |% r7 l+ s& N3 X: e6 m( I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ \" [; S: q2 R8 [ - * TO CHANGE.
( n T# P3 D4 p) ?" N5 n - *' c& i8 q8 [( T! k K; F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ X! x+ @; F6 M' s) @
- *
) D! U5 P8 c+ F, c; `2 | - * This program is free software; you can redistribute it and/or& Q; [; Z0 N! \+ N9 B
- * modify it under the terms of the GNU General Public License as2 z2 o, s: C& v+ m6 L, |6 \
- * published by the Free Software Foundation version 2. B, _+ U; _4 d
- *0 F, W: z9 Q" j( a4 B$ L/ i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any m0 J3 \6 Y7 B' r; b" r& Q1 Z
- * kind, whether express or implied; without even the implied warranty
* e% B8 `0 r4 V [ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' a5 g+ d, g9 [; Y
- * GNU General Public License for more details.% |+ v+ g1 b J2 ~; [7 Z- Y9 O' L
- *// M4 O2 V( ]8 @& E* J* y0 o
9 \8 A" C, J1 }5 E# u3 ]- #include <linux/module.h>% U2 i0 H# _( `: h
- #include <linux/init.h> d u$ S8 J3 K2 S3 d$ f
- #include <linux/errno.h>
6 ?/ I+ E3 n9 u# R7 W1 w - #include <linux/types.h>; J$ z K4 O4 A5 U3 `3 m
- #include <linux/interrupt.h>9 z4 K8 _. G* Y# Z
- #include <asm/io.h>4 B: W: c% Z# T. m3 S1 R S0 b
- #include <linux/moduleparam.h>
4 x- J; B/ r$ Q7 v& F - #include <linux/sysctl.h>4 P- O7 x; P. g- y
- #include <linux/mm.h>9 @) A' G" _4 ~. I9 s7 h" ]' }
- #include <linux/dma-mapping.h>' D3 I4 y& p9 O( p+ u% J
- P* C* J- h1 g/ x9 {- #include <mach/memory.h>
. Z! @! t3 [5 e - #include <mach/hardware.h>3 W6 M; ]9 C/ W. Y! Y
- #include <mach/irqs.h>8 h- H2 n3 X3 @* d! H- O. |
- #include <asm/hardware/edma.h>
1 u3 ~/ E" X* [6 D# c
% W/ ]4 u/ u1 o) g2 z5 Q- #undef EDMA3_DEBUG
5 ^2 R* X1 |) d - /*#define EDMA3_DEBUG*/
" R9 D8 ?2 @6 l7 R- p" d - 5 Z S. y/ @" D* `& k c8 g
- #ifdef EDMA3_DEBUG, \ `; V" |$ L' N& _' _" E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# r0 d* m$ k5 q5 P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' V8 e6 F5 [ h9 s& f# T$ ] - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ _+ B, }) G5 p% V+ c& X$ H - #else
3 J5 p5 \( A( D/ d - #define DMA_PRINTK( x... ), t! l8 {9 q) o/ t$ J
- #define DMA_FN_IN, i% p+ \5 Y. {! | Q# s& \6 D% K
- #define DMA_FN_OUT; |) w) E- M1 \. E! z% ~) y- o
- #endif K5 c3 ^5 k0 l8 g F' i
1 n: n& H S2 G$ H; ?3 ]- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% ?4 K. U4 E) c3 r5 y3 X - #define STATIC_SHIFT 3
" |# N: _: b- r z - #define TCINTEN_SHIFT 20
3 n; ?/ T2 q# |0 M T& x - #define ITCINTEN_SHIFT 21
) T" g/ C% f2 a - #define TCCHEN_SHIFT 22- I+ i7 }3 S7 @( V" V
- #define ITCCHEN_SHIFT 23
6 f R/ N4 H& D+ R6 {. e4 T
* @! c2 w& v# q3 S. J# _! Y- static volatile int irqraised1 = 0;, P7 t7 g+ M" C" B8 J
- static volatile int irqraised2 = 0;
, p: e4 U6 [6 D8 Z
5 \( A4 e. ^8 b3 U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 I. z2 M+ W+ w8 M/ a* p
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' z M1 N& @8 O8 |% Q2 Z - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 K2 C9 f0 P; S& _6 K
- 0 ^ Q' [+ R+ O0 U9 h5 M5 H
- dma_addr_t dmaphyssrc1 = 0;# ?7 U3 j1 v( _3 H9 W2 }" w. i
- dma_addr_t dmaphyssrc2 = 0;
) t) t- K' g9 H! Y# s6 z - dma_addr_t dmaphysdest1 = 0;
; P! o1 w( ` G7 T8 i, a" h: O - dma_addr_t dmaphysdest2 = 0;
. g) d' i. C6 t* d - ! J3 U, Q3 }9 ]* _0 T* D
- char *dmabufsrc1 = NULL;
8 x0 o' T4 I# W7 \ - char *dmabufsrc2 = NULL;9 J) n( f- k# W
- char *dmabufdest1 = NULL;
+ P' C3 ?! ^: @1 @6 P/ V$ [! a - char *dmabufdest2 = NULL;
$ t; t5 M5 y+ u4 |' ?' d( N7 `
0 a4 f, \6 m! d z- static int acnt = 512;
) i* L% r8 g r9 s - static int bcnt = 8;
% D! x+ M. }* a; R - static int ccnt = 8;
+ ^9 R {5 U( n: r
$ D9 [/ w/ i* z2 R- module_param(acnt, int, S_IRUGO);
) I& g8 }$ K, |* }: [+ N! D - module_param(bcnt, int, S_IRUGO);
2 @" P. t( q! S- G B) J, s# ^ - module_param(ccnt, int, S_IRUGO);
复制代码
& \, s- k7 U( [+ K- n/ b
( Q# \4 f8 c+ X( K 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 I* Y- J n& s R6 k0 R4 C6 l* {- r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 z! H8 }. f( b. C# R$ ?& W& | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 {( G- b! Q0 X1 P9 F, o
" r, p9 b8 q) v. j% T- ]
; a* j9 V% @2 f, }9 _5 h& f |
|