|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , R- J! v. ~. \3 f6 W
- [code]EDMA sample test application) [2 E) M R+ U+ c3 F! z
- /*; t h- A4 C- w- t9 c* j+ W
- * edma_test.c
) B4 @' v/ a0 a - *
- D! X9 e' }) ^ - * brief EDMA3 Test Application( j* N# p/ z; b# }& D, |* |
- *
0 j) b- D" @! w7 @ - * This file contains EDMA3 Test code.0 m v$ Y7 r x' M! M
- *
+ _ l( @7 e ^+ F! s - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. M0 h* V/ j" o3 ^, C1 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
4 V' I. r4 n. K1 b" a7 J7 S9 T r2 z - * TO CHANGE./ x( ?7 r6 w, q& D6 U) `# G7 T
- *- r. C7 h, D2 c" r4 b2 K) Q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. s# J1 S! B. N, F
- *
u( E3 S2 q8 O! o+ n4 O8 \ - * This program is free software; you can redistribute it and/or
, d- h# w5 e$ r - * modify it under the terms of the GNU General Public License as. V+ \6 w* K! h: b+ J& i
- * published by the Free Software Foundation version 2.
$ S, q8 B/ r' E' E3 x7 o$ k1 s - *# B) r p' C% `# ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* c; l3 H! V$ e( L! j8 [6 } @) j
- * kind, whether express or implied; without even the implied warranty
) u" f/ } H% B+ |3 v2 k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 t$ x6 X1 M$ g C - * GNU General Public License for more details.
6 \+ N( h, m% k6 q - */
0 d/ T- B2 i3 d7 S1 N) n - 6 A3 O: s$ d1 \* e; k9 q& a$ R
- #include <linux/module.h>
& c. k `9 D2 J - #include <linux/init.h>9 N9 t+ \& I; n+ v. B9 i
- #include <linux/errno.h>
; d) i$ Y! v' b, | - #include <linux/types.h>
) ~; m% e1 L2 m7 g3 I$ r: ^/ ~ - #include <linux/interrupt.h>
4 }7 [- G" H @$ r+ O: G9 R5 h8 t0 j - #include <asm/io.h>* S, c" N6 o9 R# @' P7 o7 T
- #include <linux/moduleparam.h>
L3 ~4 ?8 y p9 p - #include <linux/sysctl.h>/ G- b% Z; t5 K2 k6 c
- #include <linux/mm.h>0 k' e2 K+ \9 _. m
- #include <linux/dma-mapping.h>) Q. D7 n4 u+ [0 T: @( C
7 x3 C8 c5 A; @8 `- #include <mach/memory.h>
. l e7 n9 g+ }/ Q9 \( { - #include <mach/hardware.h>$ J& ]. P9 V! x: h
- #include <mach/irqs.h>* Q4 _; p& E# T7 d- Y7 Q
- #include <asm/hardware/edma.h>
9 r1 x0 y) H' z
8 M: A6 t3 P% N7 i- #undef EDMA3_DEBUG
4 E- Y4 Q$ v+ f1 l* R- s/ V - /*#define EDMA3_DEBUG*/
2 o2 w# ]% Q, r' D - / L& [3 ], y+ N8 a
- #ifdef EDMA3_DEBUG
- B8 `* C/ D6 A% {4 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' d) P3 o' y. y3 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% l; _/ ?3 t, F% r/ p6 \8 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- c& }# K/ a# m! h7 _$ t6 r
- #else
" q% Q& L* w( K1 S5 a% w - #define DMA_PRINTK( x... )3 X& ^; ?8 }" t- I
- #define DMA_FN_IN
( E3 k2 t$ x1 q0 M3 M - #define DMA_FN_OUT' u7 M. D' n. \- N0 ^+ D* l( z! g; ^
- #endif/ U% [4 A& A" M x5 K
* g& {1 Z8 l5 A0 d9 J- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 ]# P. u8 Z" `7 E, U& \% g4 A: G6 z
- #define STATIC_SHIFT 3
! J% D6 ~& B8 r2 c& m* A - #define TCINTEN_SHIFT 20
9 J& Z& t1 s+ @* t& Q3 H - #define ITCINTEN_SHIFT 21
* a4 m! L, g9 S% _8 m - #define TCCHEN_SHIFT 22
9 L& ^6 h4 ] R/ H" G6 r - #define ITCCHEN_SHIFT 23
9 T8 _2 G6 i9 Y5 Q
) ^8 b1 N% E1 O! ^- static volatile int irqraised1 = 0;
0 W0 V& s. k# k - static volatile int irqraised2 = 0;0 P1 w) ]: y. u9 H) d [: g9 ^
& D; Y, S2 h. R. O5 P: @ e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ A" `& ?8 z$ y5 R+ @8 { - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y9 B/ C$ r1 Z1 Z d+ C
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 A. F" ~ Y0 q! h - ; f: T# B& h7 i* [3 c' f+ `: U
- dma_addr_t dmaphyssrc1 = 0;* Y9 p; M4 t4 T0 g% S+ i
- dma_addr_t dmaphyssrc2 = 0;
- J5 I9 C% [8 H$ M* S' e - dma_addr_t dmaphysdest1 = 0;7 O! z, N4 ^( k& o% t
- dma_addr_t dmaphysdest2 = 0;1 ~2 M3 a- F! ^, {
. c6 H/ p: M5 y- char *dmabufsrc1 = NULL;
4 Y; u. Z w- u9 X - char *dmabufsrc2 = NULL;
9 P+ }: `& j, Z: R/ @8 k5 K$ Z - char *dmabufdest1 = NULL;
/ F- |& F4 a* }- x1 B } - char *dmabufdest2 = NULL;/ {1 n9 x3 q: q6 f
& l) e7 m$ Q) s+ t, b3 i9 K7 \- static int acnt = 512;' J, W* H$ E D! R, P' R% d C
- static int bcnt = 8;
$ F: e0 M* i1 A: J" q - static int ccnt = 8;
4 x; ~3 ]' {) D0 c1 `
* E- z5 z7 N. c% ^ [0 k5 r* ~7 ?- module_param(acnt, int, S_IRUGO);
' T7 Y, r0 a& @7 Y - module_param(bcnt, int, S_IRUGO);
" l0 y' g5 D( a8 Y4 \3 c1 j - module_param(ccnt, int, S_IRUGO);
复制代码
, `1 F |6 r' R y; z. [- d4 ^' V# m/ D! i& V
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- o& [5 [# x6 ^0 B8 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
d% \2 d$ C1 V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 ?! V4 n X# @( t3 z$ |9 e: L7 P; z# z
+ T M2 P+ a# u
|
|