|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . j8 {: P& V7 h+ B2 N9 c& ^- i0 X4 |. H
- [code]EDMA sample test application
% i+ E. ~- S% `7 ? - /*! U/ i4 U2 d: q- E1 P& Q: {" m+ y( M
- * edma_test.c
6 Y2 B5 P/ ]- {( E - *
$ M& \ ]" B1 o. B3 } - * brief EDMA3 Test Application" ] @- R2 w$ h9 }; ?$ R# `
- *5 s; r0 i/ u/ p- @1 {
- * This file contains EDMA3 Test code.
2 b5 _! M' h( H* o3 o - *
" z8 e! B4 L- T0 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 E# f; q9 s& P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; p3 \: [# m5 u- {6 y; m) l
- * TO CHANGE.+ }6 a' Y4 R' `, K8 M6 S
- *3 _* r6 ^- b% \! a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. f: ]& G) |1 N( \0 v' G1 x
- *
5 F' M# U$ D3 C3 T1 q - * This program is free software; you can redistribute it and/or, u0 P0 O! F: V( c& h% k/ L/ d" j
- * modify it under the terms of the GNU General Public License as5 E' R7 t2 t, e/ D) x6 j! X
- * published by the Free Software Foundation version 2.
3 ~3 {1 h3 }1 ~) U - *# `9 k8 `; {0 n; `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any r& @+ D* g3 i" z
- * kind, whether express or implied; without even the implied warranty6 i& m# c1 t/ A$ u, p3 M5 [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- s, v; n* b. K3 t" V, w
- * GNU General Public License for more details.5 ~3 g0 q+ y6 r+ ~. A
- */
6 W' O0 C4 k3 }& p - 1 d( u7 o1 i% \0 Z- @
- #include <linux/module.h>" t) I. _$ W8 D1 {
- #include <linux/init.h>
, c. {& n" V; R/ `" P - #include <linux/errno.h>, T i7 B" b' c; b: c
- #include <linux/types.h>
& H$ V4 C% ]7 G3 {, R1 e - #include <linux/interrupt.h>
* V: {( c, ~, k% ?" F/ T - #include <asm/io.h>( b r2 `# \' \! C+ L# t
- #include <linux/moduleparam.h>1 l7 @' S1 J E R7 {3 R, G
- #include <linux/sysctl.h>5 L; k0 {7 e4 z8 D! p, g3 A
- #include <linux/mm.h>1 l7 }, v7 B2 z4 N) l
- #include <linux/dma-mapping.h>+ q9 r/ n1 g. ]* T8 G$ u
- * |# o1 j/ |" a. c1 {
- #include <mach/memory.h>
# d1 m! r/ f+ b, ]) E7 R - #include <mach/hardware.h># S. ~0 l$ ?! a1 p9 P+ `8 v
- #include <mach/irqs.h>" \% _( |- G) x5 B
- #include <asm/hardware/edma.h>
" J2 k( W0 i5 n/ ] - 8 O+ ^: M. P) n u
- #undef EDMA3_DEBUG: g* b% V2 f1 o9 M9 C t
- /*#define EDMA3_DEBUG*/
# K4 {7 U, f" y" d, p% |# c" Z0 o - & B- \( |) Q5 M$ w# }
- #ifdef EDMA3_DEBUG3 d* j9 l9 B4 p8 n7 Y; R
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 m0 l8 W( H9 U0 t3 p) T+ ?- y5 [
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& g* d' @+ [2 p) F: H( s& C! t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m) r9 u% `7 d) k
- #else Y! t: d- n) q& A5 _+ [
- #define DMA_PRINTK( x... )
5 Q, M. }( ]3 K- e) e$ v9 d! x, G4 H4 Y - #define DMA_FN_IN
; A# K- f9 R. A9 _- V, g' [ - #define DMA_FN_OUT
" o, h) Y/ [. P ?6 U2 l, u - #endif
" h, M3 [+ t+ q, h) `7 D9 ^7 f
" h2 P' O: w: @4 a+ G9 `- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ S) i% e- w/ q
- #define STATIC_SHIFT 3
# Z8 j0 @* G4 X1 R' \ - #define TCINTEN_SHIFT 206 I) _4 D* N7 \5 E7 {
- #define ITCINTEN_SHIFT 211 r1 {0 j I# X2 e, h
- #define TCCHEN_SHIFT 22 A7 i) p( w1 z* Z4 B- |
- #define ITCCHEN_SHIFT 230 S3 Q. n( k! e3 ?% o* l4 O6 q1 i) |
- / r' A, i& ]6 x% N. `+ e; I6 w5 q& G
- static volatile int irqraised1 = 0;
7 y8 e+ k ]3 ?$ A% F$ k - static volatile int irqraised2 = 0;" A0 H; M) x7 z5 |
7 o, x/ g+ H6 [: i8 e4 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H8 \. C0 a7 p! U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 X# h( I( O+ P" [. Y) h - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C d5 V' M& N8 u2 x: `
- : Y8 W- L' }4 ]# f! ^
- dma_addr_t dmaphyssrc1 = 0;
0 a/ r- h& x; M4 z# p* S - dma_addr_t dmaphyssrc2 = 0;
1 }8 _: y) d. l - dma_addr_t dmaphysdest1 = 0;
9 w, s6 \. q% n& m: _# u3 v - dma_addr_t dmaphysdest2 = 0;7 f; Y" I ~- n V( N( r
- / \5 [6 X8 K8 f/ J7 H
- char *dmabufsrc1 = NULL;
+ v1 S) _8 ]; E, t - char *dmabufsrc2 = NULL;
. \4 d- m/ y& L6 S - char *dmabufdest1 = NULL;
! |$ i4 h& Q( r" M5 j - char *dmabufdest2 = NULL;
* D, @& U3 I! d2 W& @, Z- ~
- i* P' L2 `' J- static int acnt = 512;
7 f; u; O) `* B) p. `- \' [/ B - static int bcnt = 8;2 A. p$ _. V1 T# J) m1 M3 c
- static int ccnt = 8;) a: x6 G" V. E; V- l6 w: k
' j: n* F+ T, ?) w- module_param(acnt, int, S_IRUGO);
, b* Z# c0 W, Z# T6 u! v( J - module_param(bcnt, int, S_IRUGO);7 L A8 ]7 [* f6 F6 H
- module_param(ccnt, int, S_IRUGO);
复制代码
) v+ s- t* g7 S. m" |6 F8 b" K; @# C7 J) F/ ~( \# o: B" i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% \' A# ^1 g) N5 Q) |9 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 P5 Y1 H5 B* C0 S" \ @% @/ S 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 U* |; I7 ?3 k. ~# t: k- j
% l/ v% W" d" t: h/ P0 Q, k! T% S7 f* v0 m: ^7 A
|
|