|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - s3 Q2 P& o5 `4 e+ q+ S
- [code]EDMA sample test application4 d& n: x4 ]& ~) I& R8 F, X
- /*3 R A* N5 |+ t/ ]3 x. |+ q
- * edma_test.c \2 u5 N. R, T6 i
- *
. A9 Q4 u; ~1 H9 n - * brief EDMA3 Test Application) N9 T4 Z: Z6 v! I+ u2 ]4 Z& Y# y5 A
- *5 u; O4 f; }( l
- * This file contains EDMA3 Test code.
( x- ^2 H# X) C& N: o! l - *
1 K1 G9 C* P. Z4 l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
]( p# v9 g6 C+ N/ ~; d8 a& r - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 J) k3 m9 t# C
- * TO CHANGE.
, y+ G6 ]; c! |5 p7 @: x* z9 c - *
1 [0 H, r( V, y8 l! a3 M - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) @/ F# ]8 R7 f
- *$ i% b' W S# g" ^+ o/ [) i
- * This program is free software; you can redistribute it and/or1 t4 H+ b* p8 @
- * modify it under the terms of the GNU General Public License as4 a3 _ X7 ~7 q
- * published by the Free Software Foundation version 2.
w) D' n2 K9 W$ f7 g3 R4 \* z - *
, e+ q8 Z( V6 Y: C% R; i - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& z5 K/ X( C& f; Q! {
- * kind, whether express or implied; without even the implied warranty5 U: |2 J' s1 M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
o N" d; H' [- |' X x! u* g - * GNU General Public License for more details.9 C. i4 `, h- v0 N& ]' F3 S
- */
: D( ?# b9 j. e5 m. h - 5 ]: O' N! y7 E6 l1 ]) A
- #include <linux/module.h>
) Y3 v: s' H/ w, ~8 n: [ - #include <linux/init.h>4 j0 y$ F' c: {7 y/ J' E0 r
- #include <linux/errno.h>8 ^; L1 U# t, M" R4 p- E
- #include <linux/types.h>
9 \ A, O: [/ }1 W, N - #include <linux/interrupt.h>" B2 c" H7 N" X& M
- #include <asm/io.h>3 C5 m8 R; |+ O7 f
- #include <linux/moduleparam.h>8 X8 f; }2 x A0 ~
- #include <linux/sysctl.h>
' m6 m6 _2 I j - #include <linux/mm.h>% c6 s( T3 l4 K4 H& P
- #include <linux/dma-mapping.h>9 B, Q8 f6 O' }1 q; _8 Z1 h4 k
2 D" v2 C$ ]) g0 S. {0 `3 b( U- #include <mach/memory.h>* X# Q5 K4 S8 t$ G$ N- ~
- #include <mach/hardware.h>5 n: s4 P. j- d; F4 T* T k
- #include <mach/irqs.h>& Z" w: O) B5 }4 t; S
- #include <asm/hardware/edma.h>" g* | V. w* |: b+ V" b: R" K
- ) s, \( R: U, g6 A
- #undef EDMA3_DEBUG
: O0 V7 C* z1 V: F - /*#define EDMA3_DEBUG*/
! x: ~! Q s- h/ D. R. C1 Z& N - 9 a3 o5 P0 R+ F+ _- \
- #ifdef EDMA3_DEBUG2 T) H. C- |! ^ G6 W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 ?. R9 ~5 ~$ ?
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 v$ F# R8 A1 I' ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 h: [2 J) y5 E9 ]2 l - #else
. C8 Z o; e; x3 R! i% a2 x - #define DMA_PRINTK( x... )' s; K4 t# j3 i+ y1 V
- #define DMA_FN_IN
( E; ?3 Q9 @" j - #define DMA_FN_OUT$ o' K N0 R- ^1 V9 o
- #endif
2 c. [0 I5 C2 }/ X0 o5 o - - p3 V# Y7 M* [6 `
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: m/ X1 Q! x. q/ M8 F3 j - #define STATIC_SHIFT 3
4 a6 l5 W& t1 K# ^ - #define TCINTEN_SHIFT 20
6 R q& b: R( [6 z& @. \/ r - #define ITCINTEN_SHIFT 21 I, B, b" N' c$ h
- #define TCCHEN_SHIFT 22
2 R' K' I0 F5 F- _0 W8 M+ ?9 N - #define ITCCHEN_SHIFT 23
0 ^2 x( C( f" Y2 S9 M2 Q - + k! W! W0 a9 m
- static volatile int irqraised1 = 0;7 {/ ?4 Y: h1 B0 \4 ]7 V
- static volatile int irqraised2 = 0;2 }( k: p5 W5 n; q7 i: T
- $ V; r& }4 L+ ?5 v: b* o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% ?6 y' A! S: r2 O5 a - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 s% }* n: X" Q# v: c
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [/ L" A/ c% I
; C' I/ C# a* z: }0 c- dma_addr_t dmaphyssrc1 = 0;
% n8 `5 ?2 z7 v% `1 J9 { - dma_addr_t dmaphyssrc2 = 0;
; Y0 g) [9 [) |4 ]$ _, E" N$ I) f - dma_addr_t dmaphysdest1 = 0; C7 u7 A. v; @2 r( H f q
- dma_addr_t dmaphysdest2 = 0;
/ P, o. u+ T/ D) Y, x- r4 t
1 p$ y: x: {6 L5 G( p- char *dmabufsrc1 = NULL;
7 b# K9 ^) D5 O8 b - char *dmabufsrc2 = NULL;
0 b9 p: h' l- z( U7 s - char *dmabufdest1 = NULL;3 q4 Q" ]3 c/ P% ?
- char *dmabufdest2 = NULL;
2 I9 Z1 H2 J- p4 B8 t! f - 3 A9 D. L( P2 }' e5 Y1 {2 \* R
- static int acnt = 512;
+ g3 t q0 b* P( z2 ~, D - static int bcnt = 8;6 N+ D# C6 H. ^2 _; b
- static int ccnt = 8;
6 K, Q& I/ `8 P6 w- Q+ ?' k9 E - 3 J4 G, ~1 S( B0 [1 w0 D
- module_param(acnt, int, S_IRUGO);( \7 ^" }! L% O" _+ j. u" B
- module_param(bcnt, int, S_IRUGO);
$ b( Z5 Z/ [1 M" G - module_param(ccnt, int, S_IRUGO);
复制代码
/ {4 U- A% j/ y6 Z0 {, U$ m! P; M5 j6 c( f+ f; }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- x" M' d5 a& L1 G) c h! I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 P3 B3 k* L7 P& D4 p# ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 _! v" y3 |# C9 o( u
5 l8 a/ d5 X. Q, G" A0 b$ J. p2 ?
|
|