|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , J3 A1 \4 t; X7 I3 U
- [code]EDMA sample test application9 K# M& `( n: n7 N' {
- /*
8 ^+ [1 L( A7 D - * edma_test.c
" H0 Y0 S: I' o D1 v6 H - *( X% c% H6 x: a5 ? Z; y" p3 ?
- * brief EDMA3 Test Application
6 |" e9 y: Z" o1 d; p4 W( k - *( z, ~ x) r/ f4 Z: y! j G. o
- * This file contains EDMA3 Test code.: m# ~; h' z& R% M- r& l/ A
- *
! N1 J I: P# z! u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ l& o: M+ x1 t1 P; s2 S6 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% T3 V0 C. q" [9 [4 Z1 G+ @
- * TO CHANGE.
: S% ]: }9 _. {) }& r - *
5 z* Z- A5 B% t, j+ k: y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 [5 [9 M0 \5 g
- *" U+ z5 J* [: s! Q3 }/ k/ n
- * This program is free software; you can redistribute it and/or3 ^9 u3 w( X5 V) K x
- * modify it under the terms of the GNU General Public License as" m$ x0 e6 L- @+ k* ^
- * published by the Free Software Foundation version 2.
4 V: z! z2 X6 g' U - *& q3 _/ J: \; O5 ?3 f! F8 V; J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' Y) F0 r2 j0 `, r) _7 q# Q' e - * kind, whether express or implied; without even the implied warranty& h' E0 }. z/ g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" S" {! x5 a; y a& `0 E5 u6 b! p
- * GNU General Public License for more details.
& e6 d, d8 B9 S4 O - */
6 N$ m# ~# w! [. J8 q( e6 u - 5 Z6 f, ~+ s( D, r" J
- #include <linux/module.h>* c1 c I. ^2 M
- #include <linux/init.h>
$ W5 y6 V7 L( K" U! g& \ - #include <linux/errno.h>7 U# h( l4 R+ M
- #include <linux/types.h># K2 @5 M4 q P
- #include <linux/interrupt.h>
4 i* M6 V) U- r H7 L - #include <asm/io.h>1 ~' }3 f K. Q1 n4 w
- #include <linux/moduleparam.h>0 x1 c+ v2 q5 r+ k
- #include <linux/sysctl.h>
# |# ~& i2 c+ p3 c2 J2 |# v - #include <linux/mm.h>
, H2 |* S% _& u( K6 E: k7 Q - #include <linux/dma-mapping.h>
* `0 C/ C5 r) I$ R$ F& ] - , V( U( {0 }( O. Z# a ~8 `
- #include <mach/memory.h>
/ V1 Y& z/ `% K9 m& A - #include <mach/hardware.h>
2 Y7 E7 `: ?# y& D' M4 l - #include <mach/irqs.h>
4 Z3 v& v$ f! l. I - #include <asm/hardware/edma.h>
& B9 v, Z' U* y& u O; G
. h9 B, @ P; p0 x( l- #undef EDMA3_DEBUG/ k$ E2 B4 }( I/ w( w" [, ?1 k: g
- /*#define EDMA3_DEBUG*/( c& }: @! H# C: b8 Y
- % |" }) P7 o7 F$ S3 L
- #ifdef EDMA3_DEBUG$ E6 d1 }+ e& t# r$ w% g' H4 @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! y; F9 d- z( ?) ?% [0 ] - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 `% f) g D) Y$ ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 S9 d8 |+ ~ Y# j; ]
- #else
1 S/ K6 p! `6 w( C3 [. {4 K - #define DMA_PRINTK( x... )
4 u2 T- f* m3 L, ^ - #define DMA_FN_IN; {. s( }4 L# K$ c- k
- #define DMA_FN_OUT* A9 T B4 T9 Y& Y7 R
- #endif
9 _+ K9 U. [1 {; j8 A/ ~, _' l s8 B5 W
1 H6 o4 q* [' J( x, R- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# p8 ?" V1 g7 I1 B' O - #define STATIC_SHIFT 3
# r4 ` w+ t7 o5 l - #define TCINTEN_SHIFT 20
" m5 w8 `# f: f$ ?( ^8 ]9 r2 n - #define ITCINTEN_SHIFT 21
, G7 L! q/ Y* p9 V& O) W% w - #define TCCHEN_SHIFT 22
5 R& z& ^$ m' ~ - #define ITCCHEN_SHIFT 23+ X/ O% l& A# o6 {7 w5 L V
- 8 N* {3 G* g( c6 l. b- \5 P, K/ q3 K
- static volatile int irqraised1 = 0;0 z2 P$ s+ ^. ?! @7 \' S8 t9 _
- static volatile int irqraised2 = 0;
9 T+ h& E1 l+ u! q% v( C
' ^' V. l3 ~! d: j7 T J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* z0 L U. D9 r: l& z% ]- i Y! p+ G - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ W; v7 ~2 f5 t6 X - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 f2 n6 l) y2 o0 Y: s: `
- 1 G8 q$ c2 l9 k. m, n
- dma_addr_t dmaphyssrc1 = 0;( j3 n/ g8 l5 b1 B. ]/ f9 E8 O
- dma_addr_t dmaphyssrc2 = 0;8 V) v+ T K- X& l |1 f" |
- dma_addr_t dmaphysdest1 = 0;' n, I, Z& K* ]9 G% L4 B& f: {
- dma_addr_t dmaphysdest2 = 0;+ {$ ?# C0 ]7 P' d2 ]
- + _7 o. l6 p$ p
- char *dmabufsrc1 = NULL;
P) f7 u' e, o* c - char *dmabufsrc2 = NULL;! Z$ H! Q2 @/ `- T! P6 v
- char *dmabufdest1 = NULL;: L* A h; A) W* x
- char *dmabufdest2 = NULL;
% M! N: Z; d2 h6 a& ? - ) g6 i4 c# J" H; S% G' ]' g$ U6 L
- static int acnt = 512;1 R3 n2 m) V/ l( g: ^5 D2 o/ J
- static int bcnt = 8;" I5 u' r, [ w- X- {/ o
- static int ccnt = 8;
, I0 S4 ]0 H+ g% N
9 U7 O! @% R+ B. P; {# ?* m- module_param(acnt, int, S_IRUGO);
# ]* D7 h& t7 t" r - module_param(bcnt, int, S_IRUGO);1 L1 i* u$ y3 ~
- module_param(ccnt, int, S_IRUGO);
复制代码
: n9 Q5 ?" r0 ~; V) i
2 l) L' j; w: w0 o7 o P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: z/ Z% p) A& e/ n+ J ^: narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ o" v+ |3 }/ W: X9 ^1 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& m7 _8 b: }: J) N- |$ d' C1 h6 Q; Z& o; Q9 x2 ^6 ^ c* A& Y
, n/ G9 N" z1 ]0 Z6 S3 d |
|