|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 h. u5 G2 J+ b& k- [code]EDMA sample test application K; L) i2 H- d, B' `
- /*0 ~5 ?& V q- Y H
- * edma_test.c
, E; R0 @2 E! Q3 \8 d3 { - *
0 m% N! \4 q" ~- W& U% k - * brief EDMA3 Test Application
6 Y' z, f$ d& P( ?+ @2 w - *& K# M/ W' s8 p2 i2 l
- * This file contains EDMA3 Test code.
: I6 x' I4 t3 p8 d' F) t - *
5 w5 \) _8 g% p3 c7 P1 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 o4 P# c3 J( B- m5 \3 B1 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
0 Y( T) v1 N1 `8 Y" K% W4 D - * TO CHANGE.
( C# F7 ]+ T4 f3 w2 N - *
7 [5 q$ l' H1 Z3 k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ k9 k: U( r q5 y# J! P4 L1 U - *
& Y" c0 i/ w& u - * This program is free software; you can redistribute it and/or* c$ o9 i% |8 \/ y% s$ H& G
- * modify it under the terms of the GNU General Public License as% h a I% j4 O9 A
- * published by the Free Software Foundation version 2.1 Z4 d, j4 u) X% f- ~% |' n
- *
S/ t: X' a% V- f& n9 d: O4 U2 U4 b% W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ f% }7 O0 Q$ Y6 W# X x& }* t - * kind, whether express or implied; without even the implied warranty$ P* J4 D+ [, }6 p! O& e1 h7 u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# A" h" R# f9 M) h
- * GNU General Public License for more details.% d& |! _( |5 @
- */
! b5 ?5 J5 d N
9 [( a' n) Y5 J4 q t; x- #include <linux/module.h>' m! Y* e0 ^; o, W' u
- #include <linux/init.h>! u. g1 f0 x5 }4 ]( F/ ~+ D, L5 I
- #include <linux/errno.h>$ `* r+ h% `$ g/ \
- #include <linux/types.h>6 S; |' v( O5 O3 p2 h
- #include <linux/interrupt.h>; }+ L+ |% |8 j
- #include <asm/io.h>) U; T6 D* N/ o8 Z, u# M- A. ]
- #include <linux/moduleparam.h>; f# y5 V* K8 m2 r8 L
- #include <linux/sysctl.h>$ _; J8 K: A+ G5 q, B0 ^ z
- #include <linux/mm.h>, F5 x) h, D5 B, ~! b( i
- #include <linux/dma-mapping.h>$ T' j% A7 G8 n4 r' H) t1 }7 h
- . U3 G2 c9 E7 o; Z% Q, I: l
- #include <mach/memory.h>8 Y4 D. b# L2 _; o- y% N
- #include <mach/hardware.h>4 J; U* d* ?: j7 j9 ~
- #include <mach/irqs.h># ?7 k; i9 Y. C+ u* H% C, {
- #include <asm/hardware/edma.h>' k9 A, d* a! M1 A7 r- ]
- $ O( r, C" J; E$ n" ]3 Z
- #undef EDMA3_DEBUG
! ~0 l4 C$ o* C- W; m8 ?- D7 N# [ - /*#define EDMA3_DEBUG*/
& O5 ~6 @1 y8 v& F y - . |+ ^- G: M) l; T
- #ifdef EDMA3_DEBUG/ ~; j3 o# W4 N) R* U+ T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) l/ ~; z* e) i8 I. H& c9 \0 A/ o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
* B. E& Z& l. H9 [5 k: ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) p7 h0 U. A( Z1 t# ^
- #else% y3 A' v; [9 v" B; m8 P
- #define DMA_PRINTK( x... ). r% ~+ J4 s9 Q) U$ I# j+ k( i
- #define DMA_FN_IN
. A3 Q5 |: ]7 Z# v0 w8 T - #define DMA_FN_OUT
3 ~6 H S. b) i0 Q, K: c/ Q; | - #endif
) j; V6 C; D0 L" H
3 n5 ^6 D E0 V; o- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# p! C# q* I# Y0 e0 x: x - #define STATIC_SHIFT 3
, l( N7 Y0 D6 U2 C - #define TCINTEN_SHIFT 20
$ U+ O- h, Z5 }- s% M - #define ITCINTEN_SHIFT 21
$ ^/ v* |, r' D$ k - #define TCCHEN_SHIFT 228 p; z9 R0 U' q9 M/ L
- #define ITCCHEN_SHIFT 230 ~; I6 G9 w; Z* f) D5 m2 ^- B1 W
' H+ y, e) F; y) n X6 J- v- static volatile int irqraised1 = 0;
9 a0 h* w) i+ D - static volatile int irqraised2 = 0;5 K" G* P4 L c; Y6 |. Q q( a$ X
5 i2 v. b$ a Z- O* m2 `; e" F2 \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# e# b+ }4 H" @$ Z' `( f- \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; z j' o6 i, ]' u8 w- J1 M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 V! f+ f6 k' f0 S6 Y5 h/ o
- " B: Z3 K) O7 a/ H" I1 [
- dma_addr_t dmaphyssrc1 = 0;
" n" V' Z0 f2 n% Y" b8 F- | - dma_addr_t dmaphyssrc2 = 0;! H! m4 @, n: u, ~+ M8 k; {0 l
- dma_addr_t dmaphysdest1 = 0;4 _ c7 c# E5 C& W* Y# ~( W
- dma_addr_t dmaphysdest2 = 0;* j( ^2 c8 x6 F; c7 c
! k8 o- y+ L2 m6 H- char *dmabufsrc1 = NULL;" h( h1 l& F0 S+ `
- char *dmabufsrc2 = NULL;5 d. {1 Y' p* P+ Y& K
- char *dmabufdest1 = NULL;; ~/ v1 Q' m. f% O( P$ E E
- char *dmabufdest2 = NULL;
O7 f# w! w+ B1 m/ `7 f7 l - 1 c9 Q; R4 n i$ F+ I
- static int acnt = 512;3 ]- C# |" W4 E
- static int bcnt = 8;
9 |3 d6 O! h; ] E$ D. l( W - static int ccnt = 8;5 i; O: }2 E0 B& _! B/ r$ X8 {
: c8 S; H" d' }7 @" h- module_param(acnt, int, S_IRUGO);
3 h4 G( \. }' T+ \ - module_param(bcnt, int, S_IRUGO);0 A5 s" c" ? O" Q9 w1 E# }
- module_param(ccnt, int, S_IRUGO);
复制代码 9 k& a: k# x3 p% h
/ {3 l* Q% N4 W
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 w: z, K' T. u c* d$ B7 S6 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 N: E5 B" W% q0 R, r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ @0 H% j! w7 r/ d0 j0 C
" i) D; T3 e3 U# m/ v/ k& J& @. D9 h; ^; |( c% @. e( W
|
|