|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 @6 f/ l; U3 i9 D g S- w
- [code]EDMA sample test application
" K$ P0 E# V X7 U - /*
! s. m5 B @/ F - * edma_test.c5 X. }4 M7 p& r; ]) A2 F+ `3 m. i
- *7 G! \3 j- m" C5 l: [' n1 k! _
- * brief EDMA3 Test Application
" G5 s7 W7 W. m# D - *& F3 A% z0 M; D9 T
- * This file contains EDMA3 Test code.
. C4 O7 Q m8 \5 j; J3 o - *
0 m& U! _1 d" ]- z: R: M - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE z$ v. k# Q4 [9 h- v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* [6 w0 j8 ], ?/ A) ` - * TO CHANGE.' z: Y6 {! z3 ]5 Z' e# |
- *( @# A8 R8 C' E2 v, f6 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 Q/ ` B( ^! f+ Z7 C0 n - *- |) W, ~. D% k( q; H
- * This program is free software; you can redistribute it and/or; q1 C6 x3 z8 G$ S* Z j7 {+ d- |* n
- * modify it under the terms of the GNU General Public License as, ~4 x- G* a& F2 \0 \- ~
- * published by the Free Software Foundation version 2.- C1 f+ p7 o3 G; v7 ~; {1 r- ]
- *& e/ P' _! k6 V8 D2 u' z7 Z- j
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 V, W. C) S/ V7 V5 X! e
- * kind, whether express or implied; without even the implied warranty& w( S; H j' y9 `- a6 K. x1 y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" N; [& b R: F9 v' X' {2 Q - * GNU General Public License for more details.3 ]6 }/ O5 k7 S+ q0 c
- */
+ W' x; w, s3 S: Z9 W
) }+ f! v$ K5 ]# H4 D% o9 F- #include <linux/module.h>
# n2 y( N, t# v+ { - #include <linux/init.h>
6 U' V2 u4 F+ G- X8 E - #include <linux/errno.h># B3 L; D% }0 P$ Z) g: s
- #include <linux/types.h>3 X8 t7 c0 B- p0 M* Q) P9 G
- #include <linux/interrupt.h>
% X- v8 N b0 n - #include <asm/io.h>
+ g: {5 u, U. v0 r2 ?9 p+ B2 O - #include <linux/moduleparam.h>
/ H" Q ?) m) T! } - #include <linux/sysctl.h>
L$ x. [; w# q R - #include <linux/mm.h>7 @5 M+ v0 X' D/ D
- #include <linux/dma-mapping.h>
) H$ n) f) o7 S: ]" Y, M( H
0 ?7 y- ], `; p6 X& ?0 A- #include <mach/memory.h>
7 P3 y# z* Y, Y* W) ~ - #include <mach/hardware.h>
+ {* H$ r* ^* W - #include <mach/irqs.h>
0 Z/ c& o+ ?/ \$ W' o2 n! v - #include <asm/hardware/edma.h>
# m( W0 A: i% w5 M% `3 T, F P
1 c# ]3 J; I0 T) D5 ~) Y/ v- #undef EDMA3_DEBUG: a3 @8 K8 K- Q
- /*#define EDMA3_DEBUG*/2 A2 V- q/ |+ Q: s, k/ E. V
/ G+ U9 F9 ~# F- #ifdef EDMA3_DEBUG
i; z1 J, r, S% A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: }' Q, r' a6 v1 J3 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% ?) V, V6 v$ J; k- j
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): t/ k" ?. W8 H1 ?
- #else- Y3 O, n* S C: l" r
- #define DMA_PRINTK( x... )
" ^3 X- D: a; l/ C& c - #define DMA_FN_IN
( z, E" G3 ]3 a! p ~* p' i - #define DMA_FN_OUT$ D7 S' U H4 v3 V/ H" f
- #endif6 i3 x% R8 B4 x' g9 Q2 p1 Z+ n, [4 O. _
, t9 [& r& U2 K5 x0 m- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 o# S5 J- Y R - #define STATIC_SHIFT 3
6 U% Y' {5 `& [9 B% j" O. }" l3 q3 a F - #define TCINTEN_SHIFT 20- p! a8 `) i3 x% l
- #define ITCINTEN_SHIFT 21
( f! C0 F: C+ Z9 B2 z; A - #define TCCHEN_SHIFT 22$ _5 p0 {, F- Q# F; r
- #define ITCCHEN_SHIFT 23
3 n3 w! `1 p2 p2 P$ e3 ?& w - 9 y" @" w$ s; z$ i7 c; h
- static volatile int irqraised1 = 0;
+ X/ o& b& C5 b. i0 ] - static volatile int irqraised2 = 0;
4 Y: K9 n" f. U8 U
5 e0 X Q. _. w1 z! F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) j, o; S+ b" a7 a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- m1 ]% u( H) X1 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 {, z$ P/ G/ Q" e) H - / \" ^% D% h; }1 w4 t
- dma_addr_t dmaphyssrc1 = 0;
! w. a* g$ e `6 x) z - dma_addr_t dmaphyssrc2 = 0;
7 T7 R+ _6 W. u - dma_addr_t dmaphysdest1 = 0;
- r, p. |: K; j4 y - dma_addr_t dmaphysdest2 = 0;
: j3 V/ {1 m6 m- ^* P4 Y6 q
0 f: w$ v6 [8 s3 j1 z. g+ c! M- char *dmabufsrc1 = NULL;& _: Z- W# k, O: P) I1 ~9 Y+ O6 @
- char *dmabufsrc2 = NULL;
! h& v R& A; k! j0 h* ^ - char *dmabufdest1 = NULL;/ X6 Y+ [( ^: ?# h* L5 c J
- char *dmabufdest2 = NULL;
" U4 ?8 a( |: ]' v& ~
5 p9 u0 T0 W0 H+ k7 ^& g2 P- static int acnt = 512;' m7 j8 o4 A% T
- static int bcnt = 8;6 c6 t c* t. f1 h y1 r
- static int ccnt = 8;% d, H" `) f+ V7 A
- - t" f- n' l7 M; {
- module_param(acnt, int, S_IRUGO);
1 c5 j8 V! w& [1 L- p - module_param(bcnt, int, S_IRUGO);
, [/ ^! u5 H0 h! u0 k: c: q! g - module_param(ccnt, int, S_IRUGO);
复制代码 $ }) @# J3 U5 H- X% K
`: {$ E! a: A0 T/ z3 h( S/ A% v) ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, n$ y- \$ N a& O, ?" Darm-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% T% o' g: Q7 r" O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* U% B2 f; W$ t0 D- g) P* L3 H
5 p: z' b8 o2 b4 O1 S$ O- t- i' o2 v, i P3 d7 z
|
|