|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) |* x9 J& r% U0 l; _- z
- [code]EDMA sample test application, o0 O& A4 P/ [ V" |2 N! X
- /*, c+ [6 F. V# p2 _) Z" {. Q
- * edma_test.c
$ T; e( f3 e: H# a4 M v - *+ ?% z5 u! W8 O4 T' D y8 m
- * brief EDMA3 Test Application
/ N* p) v/ v. o, N& c - */ L- ]% e/ \$ [* N/ U- z$ i3 A
- * This file contains EDMA3 Test code.5 h) v1 Z3 U% _+ E' l
- *' b6 p( {! O* R# W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) m3 C7 P& G4 C# A4 J - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) b: _9 k [0 r# y" T
- * TO CHANGE.
( L5 | A: z! O C - *
0 q) P4 X' u7 e& F+ a7 I7 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! I2 @7 [4 M( O
- *1 |# W1 a x6 ~8 K, i; j$ e. ~4 t
- * This program is free software; you can redistribute it and/or$ u* K- J. o4 n
- * modify it under the terms of the GNU General Public License as
: c4 z. S6 J$ \ - * published by the Free Software Foundation version 2.7 `8 e' G) d$ n8 C2 E! m
- ** K E3 A f3 G, r9 `" c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ y9 h3 }& c- e- Y% p
- * kind, whether express or implied; without even the implied warranty- l6 H0 I9 }% Y$ } [9 R2 I% x" M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 }0 m1 Y. ?- \! B - * GNU General Public License for more details.
' R, Z( X2 W& A+ u) j/ A! S" T - */
1 W2 A. }: d6 H1 | O% C - 1 ]0 K, _ j/ `, F
- #include <linux/module.h>
3 B1 t. ~9 I; [5 g, b- c1 Q - #include <linux/init.h>
& O$ w, l# x' |+ k( y - #include <linux/errno.h>
/ F5 D7 N* g0 s8 C - #include <linux/types.h>9 }: h2 q8 R( ?: V
- #include <linux/interrupt.h>
6 T, J( H( G) t - #include <asm/io.h>0 S7 Z6 ]4 Q, s& U# n$ l& C9 ^
- #include <linux/moduleparam.h>
9 n1 o( ]! a" R - #include <linux/sysctl.h>& F- h7 F& o7 U. r0 @6 c9 }: r: s
- #include <linux/mm.h>
. g- `$ ]. T, C - #include <linux/dma-mapping.h>
: w2 B+ z* _& K7 s1 @) O4 K% s+ { - a3 s9 d8 {! ~8 r& s s% s& `
- #include <mach/memory.h>
/ p& s; y. J0 q - #include <mach/hardware.h>$ Z! O9 a( `- b) b; o
- #include <mach/irqs.h>9 |! M }! V1 l# q. ~
- #include <asm/hardware/edma.h>8 Y$ F/ o6 a! S
- # N* C' o* Q! Y/ s
- #undef EDMA3_DEBUG" T) _) [: L, @
- /*#define EDMA3_DEBUG*/
0 n# y6 h! v! r( o
2 o& R' V$ c& O8 k% v- #ifdef EDMA3_DEBUG
' z! V. f0 ?0 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 |% b7 Q. w4 v+ t4 w* I0 \+ H4 S$ c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), I n3 ?$ b! U, ~$ t4 _
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: a$ {" S* q6 H - #else# E0 L1 L. _1 s% x
- #define DMA_PRINTK( x... )
5 E' Z# w& g. D2 N - #define DMA_FN_IN
& ?+ v( k- w8 ]! t r) v q; O7 q - #define DMA_FN_OUT" J2 y1 l. K9 G% a& t( y9 v1 b: z F
- #endif$ {; P+ H6 {+ J* H+ F- F7 @
0 c. _5 ]- z' E+ I& X- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 d+ M! M; _8 T# t5 b: r% g1 b i5 H
- #define STATIC_SHIFT 3
. |4 N q% a1 Q9 o6 }' a1 ? - #define TCINTEN_SHIFT 20
& I. s* O* j6 T c7 p - #define ITCINTEN_SHIFT 212 `, u" N" S+ k9 ^5 o3 m a% E( M
- #define TCCHEN_SHIFT 22) L+ n6 Y3 J( Q* p
- #define ITCCHEN_SHIFT 238 M! b* }, K* \ P
- * X- X9 k( g# O& {5 j
- static volatile int irqraised1 = 0;4 b9 J' r" l4 [. Z6 x+ ^+ J" n
- static volatile int irqraised2 = 0;1 W+ k. o3 G0 y0 ~+ h2 L
. {- Y' T. }2 E" H# P- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 ^* p! h- J: n. M v/ i* G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \1 ]& Y6 {; q+ |1 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 Y6 P9 }) B) ~7 E' q$ v9 ~
& K& N: B. X. U4 ?9 ]! ]- dma_addr_t dmaphyssrc1 = 0;; W6 Z1 Y( ~; n; B" g W( J) C3 I5 R' b
- dma_addr_t dmaphyssrc2 = 0;7 O) q9 [, R+ r i( r4 K! D: @1 @5 ^
- dma_addr_t dmaphysdest1 = 0;7 T! l9 x4 S* `5 G8 r# v" m
- dma_addr_t dmaphysdest2 = 0;
; J0 S; I* ^& l n9 ?+ N0 i4 V" ` - 5 q% c/ U$ C: @" w
- char *dmabufsrc1 = NULL;
0 c [' b" y6 b* k - char *dmabufsrc2 = NULL;: o* _- V# ~* c4 F }- q5 f: Z
- char *dmabufdest1 = NULL;4 |9 n) V7 Y7 t- y
- char *dmabufdest2 = NULL;
4 P: [5 G* a8 K- U# H) P/ d2 ]) \ - ; y2 i5 J7 n. @: N3 L9 x8 c7 S6 o
- static int acnt = 512;
. |) B6 r$ \. D8 Q$ W' ` - static int bcnt = 8;- I6 C: q1 B$ O& T& @' P
- static int ccnt = 8;
, p1 K% L$ V# ]; X+ r, d B& Z6 k
) q8 P n |, j- module_param(acnt, int, S_IRUGO);
0 p9 E" j$ P) H M# j - module_param(bcnt, int, S_IRUGO);! `$ `' k( c- S m) x3 `/ F) T
- module_param(ccnt, int, S_IRUGO);
复制代码 / @+ O6 p; l) g# J+ C; t3 L
4 {6 M& f3 B7 D% B- D' t 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- y2 Q6 `# p9 z; ]' y3 J- harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ p. q# w" _6 v* z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 T) V/ t0 Q% E
2 r/ O8 U8 g, a% r
* R% v5 u% _& \6 l5 J x |
|