|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , v9 ^* N2 e/ Y3 |" `' H& N* w
- [code]EDMA sample test application( v) j: ~5 U9 n, H. v7 e( |
- /* Y0 N+ g6 c9 k i
- * edma_test.c* k' q; j+ F7 ^3 D
- *
' H) u. @6 p1 |9 } - * brief EDMA3 Test Application2 n; h4 G2 b4 ]9 _- }
- *
. T$ C- J3 D1 x( W) J - * This file contains EDMA3 Test code." U! Z4 W7 \4 ^1 R
- *8 L6 T, g* Q1 C5 i8 |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
_% w4 L8 x2 ? - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* T. L8 e7 }2 X& ~7 _# j0 ~
- * TO CHANGE.* q" x! I) E0 q0 |# \+ {/ s2 C- B9 p
- * s: I9 L4 `: h2 X8 M0 {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ m" W$ b4 J% A X2 v - *
) v0 }' |' k( Q; K' q' K8 Q: c - * This program is free software; you can redistribute it and/or& ]0 A7 y) v; A- H" m3 O
- * modify it under the terms of the GNU General Public License as G; J; B/ S; Q6 E* ]6 T
- * published by the Free Software Foundation version 2.; P5 z' Q2 d7 s2 T7 k* w
- *
1 \8 z6 ]$ C3 H0 ?# b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 z, Y1 w6 Q. M - * kind, whether express or implied; without even the implied warranty
5 k0 {. x" ? U% ], g `4 D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; G! W- ]4 l/ N; T/ e2 z" W" v - * GNU General Public License for more details." u* L/ R. G2 c5 m5 i$ F( X
- */
" G* T0 O, i+ g3 |2 b* e% w7 T; O- { - * ^6 x5 s: j8 ^. e) e S
- #include <linux/module.h>
5 j1 A+ H! z8 `5 {% c: B$ @ - #include <linux/init.h>3 ~7 z8 m8 U2 }9 Z u$ ~9 f, U
- #include <linux/errno.h>: f% m. z1 b- |
- #include <linux/types.h>2 s `& e2 ?' Q7 {6 v
- #include <linux/interrupt.h>" ~8 W" N! F" y3 r4 m" c
- #include <asm/io.h>& f# M1 Y" I$ X1 k7 ]4 X$ A
- #include <linux/moduleparam.h>. n h: K( \5 ]1 E& K* K, g
- #include <linux/sysctl.h>- w$ d3 D1 i( i5 q
- #include <linux/mm.h>& W9 \) ~) J5 Z$ F& }! q
- #include <linux/dma-mapping.h>
+ W- i0 B4 b1 E" Z* }( \: R# V - 0 d0 e7 n# R/ ]0 c5 k6 f
- #include <mach/memory.h>! n( s2 o- b! @5 A: l* z
- #include <mach/hardware.h>- ?# E# e* b% N+ ?; G
- #include <mach/irqs.h> P8 x% ^2 t7 D
- #include <asm/hardware/edma.h>4 ]6 l' X, L+ [) C! G0 \
- $ U+ z! N5 w4 Y
- #undef EDMA3_DEBUG/ a/ C7 u4 u1 h* W% ]0 l
- /*#define EDMA3_DEBUG*/
# a4 L" R5 S r% z6 M7 b
( Y. i# U4 v, `! V( X0 K2 v$ N6 {, k- #ifdef EDMA3_DEBUG a1 A+ M2 q# K2 C3 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 P; ?6 }) u/ y/ z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! G- L$ S+ t1 L2 S0 A& @! O - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); V& p( S2 \0 U' b
- #else
, j! n3 V, b1 x0 M g - #define DMA_PRINTK( x... )
. H |; C. m1 ~3 F5 o% V - #define DMA_FN_IN; h1 H. G. O+ J8 [7 c( e% P3 D0 l
- #define DMA_FN_OUT
5 |% U. Q4 p/ y0 x% b; G - #endif
4 b( \) |% Y" W9 g0 M - 7 V- B" M8 e8 D( _ g8 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# K5 o4 u# ]# H: ]( U& c- X( N1 Y. l - #define STATIC_SHIFT 3
# B) N; I7 L3 e - #define TCINTEN_SHIFT 20
! ?3 |+ }9 G8 |+ d5 ]2 C- e; S - #define ITCINTEN_SHIFT 21! L* Y/ ~9 a0 Y3 F" @( u; q
- #define TCCHEN_SHIFT 22
. u( X3 d+ ~3 P3 d7 W - #define ITCCHEN_SHIFT 23
2 `, r$ S" e7 J& a! H - 8 n! b2 u/ v! G9 _: t0 w4 A& b; d+ W
- static volatile int irqraised1 = 0;
' a" |; i! M7 p$ \$ o8 Q1 ` - static volatile int irqraised2 = 0; d5 s K- n( n* x+ F$ Q
- * r5 l% y* K# D
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ _1 b, H* i) v - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ A' U8 H4 f( h1 z1 a+ f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; G* T W" m0 _6 K6 Z @
: k2 k7 k/ ^4 X+ _" B$ a1 f- dma_addr_t dmaphyssrc1 = 0;$ \+ ~. k4 h! z3 L$ F' a9 g
- dma_addr_t dmaphyssrc2 = 0;' h/ `- B4 N" E6 ^7 A
- dma_addr_t dmaphysdest1 = 0;
/ X+ i7 L& X6 T& Y' a7 S8 K7 ^6 ~ - dma_addr_t dmaphysdest2 = 0;4 X' Z# W- V7 J3 O. a
% f! V6 a( Y0 z) o: k! l6 ?+ G- char *dmabufsrc1 = NULL;
- h4 s! Q( a8 m B3 M - char *dmabufsrc2 = NULL;4 a& W3 W2 x* X5 w* n
- char *dmabufdest1 = NULL;% y! L7 ?5 d2 P4 Y% T
- char *dmabufdest2 = NULL;- M3 Z& H" [2 G6 i/ s* n+ s8 ]
3 b, l5 Y+ u. s. G+ W- static int acnt = 512;1 N, Q" N( y. l
- static int bcnt = 8;
7 o) q& U4 V s3 A' ?& } q) D - static int ccnt = 8;6 `% d2 w: i3 h. T
- $ l/ {8 S5 o2 N3 c5 }- i* q+ E
- module_param(acnt, int, S_IRUGO);0 X5 T# u1 w* ?% } Q4 X6 d
- module_param(bcnt, int, S_IRUGO);$ t8 E, ^1 I% G4 j& p& W& ]
- module_param(ccnt, int, S_IRUGO);
复制代码
" M( B0 [. [% h) R! T& h; g: C& Z! E$ e0 \! g) H" ^' D+ v6 R
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ?- u* c0 s) j9 @4 `) P+ X7 Z+ e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 R2 ~3 q0 M5 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" V% ?+ j+ w3 {3 C& H& C$ w3 n
& r7 I t# x; Q. ?
; S3 P% U5 S4 N5 y9 s* t9 w' x |
|