|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- }8 d4 r* o, Z3 R8 S- [code]EDMA sample test application" g0 {' J' L* Q' t+ \) S" W2 W
- /*
d+ E( m: N1 Q# F: W - * edma_test.c, M' r- _2 E+ b) B- F
- *
! k: S z# D- y! k - * brief EDMA3 Test Application
8 _- m2 _6 \# f) Q7 _- S) i - *
0 C5 c3 n$ X$ ^0 P4 W - * This file contains EDMA3 Test code.
' U# S2 k r; e - *
0 f# @9 G6 V! V) e3 O% a' p - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 r& L1 o. P/ q- v+ \$ v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 f3 `6 @0 n, b - * TO CHANGE.2 [# w" X6 S j8 `
- *
. x/ L0 p, u: Q4 v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ }" d( {$ V% R3 K1 Q$ Q - *
) H. w! ?, t: M/ @; m. ]0 P$ b - * This program is free software; you can redistribute it and/or; X0 A! t* m6 r- q9 P! G
- * modify it under the terms of the GNU General Public License as0 a+ g7 d* g4 S$ O6 n
- * published by the Free Software Foundation version 2.% T) b, P3 ]8 a% I
- *" n. {7 g/ F- C( Y0 J0 Z
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; J$ [+ K+ v" X* z! R5 [+ T/ n1 X - * kind, whether express or implied; without even the implied warranty
2 c c( d6 T8 Q) I: d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
) _0 I8 f+ s7 o& N0 x$ h - * GNU General Public License for more details.
) a' j/ P* x$ T/ i* B1 P' Q' F - */
- H/ j8 v% J% [
7 U, G, L+ i& ^- #include <linux/module.h>$ ~" B" N% e1 w9 K% E
- #include <linux/init.h>0 u5 O+ m) h* E; M4 \* _8 F* N
- #include <linux/errno.h>8 h, @4 _4 x" X9 Y R+ J
- #include <linux/types.h>$ U8 E% f" |+ J% L, [/ ?
- #include <linux/interrupt.h>2 @: k( p9 K; M' H1 n& {1 v% ]
- #include <asm/io.h>
5 D& ]% [" M9 W* ?" a - #include <linux/moduleparam.h>) ?; v( f$ L3 @# m2 ]
- #include <linux/sysctl.h>
1 P2 s+ q3 u% _% A% N4 X - #include <linux/mm.h>
! w( ?0 l2 r) J! r% L, W' E0 t% f - #include <linux/dma-mapping.h>
4 m/ {8 Z+ t; A8 g+ R6 [. A - * ?* q9 u$ ^2 j
- #include <mach/memory.h>8 y( ^' u" M$ e
- #include <mach/hardware.h>4 J( j1 d. \& R2 J& Z
- #include <mach/irqs.h>' |. F. n* X0 }& `: J6 x# @
- #include <asm/hardware/edma.h>! Q2 G$ z# O8 G/ S4 Z: g2 B& R
0 A0 `# ~& ?0 c8 v. y0 ]- #undef EDMA3_DEBUG
: u; \3 D8 U. T0 n# {" S, \ - /*#define EDMA3_DEBUG*/
; Z3 o' R/ F1 b7 ^3 {& {; N& [. W/ ` - 9 E5 O0 ^! p! b9 P4 V) R' J
- #ifdef EDMA3_DEBUG
9 Q7 _! l+ k! m4 A9 r2 P - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 n5 W/ d* H# [9 e0 i0 j% w0 K/ Z9 ]
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ S. F0 G" E, U! a* ]5 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: G1 X5 `: O$ _. n" h+ e" L' y - #else
2 f! u% {% Q9 }2 w F, ~" z - #define DMA_PRINTK( x... )3 w& a" P* @% w& B( w$ @# E2 u
- #define DMA_FN_IN
2 n$ p4 P2 X. q) J& l; x; A4 y - #define DMA_FN_OUT& ]0 p- p. {' O- Y1 a% s
- #endif: T: m+ a6 E0 U$ h1 c
+ @7 w3 ~% K. t) t, v& x5 w' j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' }& T9 b2 A* i% e2 L' M - #define STATIC_SHIFT 3
# G& u. Z# ?" E5 q ^; t: Q - #define TCINTEN_SHIFT 20) A$ c4 _" c( ?5 o. e( {
- #define ITCINTEN_SHIFT 21
. H4 Y' J9 P; N - #define TCCHEN_SHIFT 22
% T, N4 B3 F3 N$ A6 K - #define ITCCHEN_SHIFT 23, A! O* f+ m! S0 q# R2 u, A
! d/ @- j4 j6 e6 {4 [9 I- static volatile int irqraised1 = 0;
) `* d. o( {. V6 D - static volatile int irqraised2 = 0;( D U" t2 H. k# r9 [. g n
- , K8 }4 K* ? m/ ]: r) A
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& O/ n4 k! q" q5 O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
v# x6 V: N+ m; k! ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' s0 x. |1 ^. q, ^: F6 C2 v# y
- 7 w' R+ i2 F, @% f0 n! B
- dma_addr_t dmaphyssrc1 = 0;
% \5 t+ ]( P* [1 d! u4 J @4 H - dma_addr_t dmaphyssrc2 = 0;( q) b" n; {: J: L
- dma_addr_t dmaphysdest1 = 0;
; Z- t7 Y5 [4 V% v" V - dma_addr_t dmaphysdest2 = 0;# w- t4 S9 X( v
% x, h9 M. ]; K9 X# Y- char *dmabufsrc1 = NULL;' b9 `! @3 K; K3 C, k5 A8 ^
- char *dmabufsrc2 = NULL;
4 B- K2 z* r U% w' } - char *dmabufdest1 = NULL;
, \3 w6 p" ?, S& s - char *dmabufdest2 = NULL;
5 q/ \/ j7 m6 x3 e6 u
; U) L- b& d' ^- static int acnt = 512;
" v( d2 O& V3 V8 Q4 H4 T0 N/ Q - static int bcnt = 8;- s3 N8 U+ c# P% k6 d x9 E
- static int ccnt = 8;4 ~4 @; i: T# a8 X7 M# ~, k
- * m6 _+ k, [( L/ e; s9 U
- module_param(acnt, int, S_IRUGO);* {( ^: L2 Z1 t9 y$ i; N
- module_param(bcnt, int, S_IRUGO);4 y$ u& b1 B$ z, F
- module_param(ccnt, int, S_IRUGO);
复制代码 - i7 Y0 K: d8 t, F% J
. \" s3 |& j G+ Q6 f( S/ s" V9 m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
b6 M3 a% @' B6 p2 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# I+ \' H& k& o9 s
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. b: ~/ {* g Z& `) K1 W, O' j4 h) u$ S' x7 K2 T
6 U+ C7 F" Z& A7 w3 U
|
|