|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : N7 \ H7 \8 m2 @
- [code]EDMA sample test application( t4 X7 O# \7 a; Q* o" S
- /*! F2 G# W* S8 s+ q" M* T
- * edma_test.c. Q+ i0 ~. y( `4 m
- *
! y7 N# ?0 f L# D - * brief EDMA3 Test Application
" v! g V3 B, n% e5 N' z/ k - *3 }% @3 V; [- h. h. {
- * This file contains EDMA3 Test code.
# s* ?' e0 D2 E, n! n |# N1 f - *
1 c8 k1 P; o* j# m5 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 Q' {6 B7 L- P& F$ @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( v$ F! w* K' s: u' v' z% }
- * TO CHANGE.
. W& D$ y+ [$ {. [& ~ - *8 P8 @" U" h4 O0 u: c
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! t+ j3 e+ ~1 U; M4 @6 M: B0 [ z8 F
- *$ E( O/ \5 {1 ]+ r, R* H# N$ P
- * This program is free software; you can redistribute it and/or( R$ K$ k5 U( [7 S& X; ^
- * modify it under the terms of the GNU General Public License as5 q; A# L. D$ L! U+ z
- * published by the Free Software Foundation version 2.
) _/ V; h# ~6 v) s* j2 b w6 L - *3 i/ W( k+ |+ u. P0 v8 f2 P
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 O: w4 b/ b$ c
- * kind, whether express or implied; without even the implied warranty
! T5 H1 M* j; O) l: F& h - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ k( W: V/ o1 c
- * GNU General Public License for more details.) E$ R5 ^1 c* D& t5 [# o
- */
' R3 D% N4 T8 b* M) F
6 f' t o5 }0 E! F) q# W* D: J8 U- #include <linux/module.h>% n+ v, F1 \5 a& O6 }) N
- #include <linux/init.h>& X! C" R% j) Y3 _
- #include <linux/errno.h> ^8 L$ \9 q- t3 h4 x' z3 x
- #include <linux/types.h>
2 c% ~8 J/ P1 R- p; A' n7 _ - #include <linux/interrupt.h>% v6 z5 o# v9 E l8 g- ]
- #include <asm/io.h>
' H t+ `# k0 W" R& M" o - #include <linux/moduleparam.h>
# l, U' K8 g& \* B - #include <linux/sysctl.h>
7 Y7 \, O) n3 b, a - #include <linux/mm.h>
+ O7 H9 n( \" o1 Y- ]9 O - #include <linux/dma-mapping.h>0 u4 V' o7 O3 w* q) Q: U
- 9 P5 L6 C0 g" a+ ]$ \2 B
- #include <mach/memory.h>
) a0 C# Z5 h% k8 {# t$ V - #include <mach/hardware.h>
8 T1 _. t2 j5 ^1 }3 R) l - #include <mach/irqs.h>
6 Y& f# o G |2 _; l; Y - #include <asm/hardware/edma.h>
5 m: E$ S; S) L$ O
# C8 Z) b1 Q& d; Z4 Q7 S$ J2 G* V- #undef EDMA3_DEBUG8 u/ ~* I& Z9 Z- {
- /*#define EDMA3_DEBUG*/ J ~" T/ t. ^) A
- ; ^( i" [! H# Y0 u/ s
- #ifdef EDMA3_DEBUG
' `* \3 b1 o2 p' T# ~1 s/ p - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% L" k9 [% x8 p [9 {$ u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 Q- A& T$ A9 w( I% \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, ^2 T# O& x/ U - #else
/ |3 i9 h6 G: y/ ? - #define DMA_PRINTK( x... )
7 a& Y' r# [* I* n6 H - #define DMA_FN_IN% P0 ^, d* ]0 @; b4 d! V
- #define DMA_FN_OUT: ~; H3 q) }7 z
- #endif. y! T* C$ ?: Y( j& \. D9 c
- 6 G3 m ]; V- t2 F. N6 E. Y8 j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)1 Y1 |" y) w5 g& w" p% Z- n4 N
- #define STATIC_SHIFT 3
. ?, u& A) V% ?3 `9 W5 k9 Y - #define TCINTEN_SHIFT 20' Z& G$ y; b: f) R0 h
- #define ITCINTEN_SHIFT 219 t# T5 g2 @; z3 c8 P
- #define TCCHEN_SHIFT 22
6 V, U' ]6 n( [' V" L3 I - #define ITCCHEN_SHIFT 23! K7 _6 |1 o4 U6 m \
- 3 R2 k. P' e, W% D3 X- v
- static volatile int irqraised1 = 0;- P# h% {1 @( p; j, q
- static volatile int irqraised2 = 0;
g+ g) X4 Q1 I
' h( ?; v0 Y+ _9 [0 C1 v- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Q& }/ v9 P9 B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p* P( n1 B/ ^* I4 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N) Y, Y3 X4 b% c" ~
- % x: d( m0 N0 r( g. F! z. N
- dma_addr_t dmaphyssrc1 = 0;. o4 ?& k3 D% J* S% h* m J' \; F
- dma_addr_t dmaphyssrc2 = 0;6 w. {- P; J8 T3 j% y
- dma_addr_t dmaphysdest1 = 0;( z) b9 k0 p/ |6 ^1 J0 H
- dma_addr_t dmaphysdest2 = 0;4 J# ^+ R9 o. i2 B+ T" J$ Z
t1 x! H H: P: s& l' V6 u$ u- char *dmabufsrc1 = NULL;
8 z7 i7 y: S. G+ c* M - char *dmabufsrc2 = NULL;
6 v/ H# T0 {8 Y7 ^# v9 J& K4 X - char *dmabufdest1 = NULL;
; l! ]- \. F i0 k7 U- D - char *dmabufdest2 = NULL;
' {5 H8 J& V/ `# Z2 T
5 {3 A# |' u2 c4 e2 Q9 |- static int acnt = 512;
" r, r0 m2 H. \3 v4 L1 m - static int bcnt = 8;
( j0 ^; O$ C! ^5 Z; v( m' S0 x - static int ccnt = 8;, c# W3 ~- B5 B! [& f
+ u1 @: s# R& U! z }- module_param(acnt, int, S_IRUGO);
1 ^% b/ O! A1 j% W0 I1 h: e - module_param(bcnt, int, S_IRUGO);
/ {* X' C8 ^/ ^9 q - module_param(ccnt, int, S_IRUGO);
复制代码 . S$ b+ Q( a3 T; `4 y; h; L
6 f; J# D: [: e8 L 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 J& z9 E0 Z- J; Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; a0 H% X1 W+ i, Z. | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: }6 m% r7 q G! y, X w5 F+ C% |" f+ g* M4 U9 Q7 s
& G9 O ~* N. I+ c0 ?( S- s0 x |
|