|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 |9 a( ~0 V2 v+ i% z$ {1 M
- [code]EDMA sample test application2 b- v1 a' z1 h/ q
- /*, s2 {1 N' I3 D: v- G
- * edma_test.c
3 g7 E3 Y% O0 i) Q2 k# T - *
4 v- G: m( i' D* y - * brief EDMA3 Test Application1 i* O& J/ k! O+ o* d
- *
+ N2 ]: d+ B& D. R* t - * This file contains EDMA3 Test code.' }8 v3 B0 i( Q6 U' P2 c, ~6 R
- *
* ^. C/ i! k6 }2 u1 F) d - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ Q4 A7 @- Z! v9 T7 f% p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: O, L/ U- n( m$ w# x
- * TO CHANGE.
! ` M: u+ k' f; I - *6 L+ }9 m* l2 s) Y9 M
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 j# W! t" H3 | - *( I) \" G* p2 l' b0 W# |. v% F9 O
- * This program is free software; you can redistribute it and/or
# k: H2 B% T+ t% P7 Y - * modify it under the terms of the GNU General Public License as% q. k6 }3 L& s! [/ j
- * published by the Free Software Foundation version 2.* i; ^& Y" |- g7 L& V$ d4 v
- *
& {7 X. g. L4 h8 [' Y2 d$ T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any, r d1 g; C/ a3 E
- * kind, whether express or implied; without even the implied warranty
/ W6 O& W1 B; Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 W1 w# {, a# n- m7 D; k5 W
- * GNU General Public License for more details.
5 K! V# h, Q" J' z8 Y - */
) J4 Z$ y( F4 z6 k4 }2 g
9 z, e2 e5 o6 o/ _( \2 J! z8 y- #include <linux/module.h>
. N- A8 V/ T T - #include <linux/init.h>+ p1 W# N }6 E+ K% g6 N. y
- #include <linux/errno.h>
$ a- R5 v1 I' y- k3 N - #include <linux/types.h>( m3 S+ y) E; U: Y* f4 z h
- #include <linux/interrupt.h>& C) p o, V4 U3 c4 y$ l4 e8 N
- #include <asm/io.h>
6 x& |" h8 R$ |/ q: K& U - #include <linux/moduleparam.h>
- D+ t2 J1 k& M) A7 h) E) b v - #include <linux/sysctl.h>
$ K: i( M, D2 j: r" @ - #include <linux/mm.h>3 H0 n" Q$ U$ R8 S
- #include <linux/dma-mapping.h>) v$ U# e c r
/ r3 w3 \4 _! R( Z. [2 h- #include <mach/memory.h>
4 c1 x$ g$ h8 ~9 Y! r. Q - #include <mach/hardware.h>1 V, j7 F) R( n5 G4 g
- #include <mach/irqs.h>
; O; J2 d" P3 p6 D - #include <asm/hardware/edma.h>
( d9 _* k' G6 Z1 ^( @ - 3 z( n6 J! c/ x8 e( n& f
- #undef EDMA3_DEBUG
" X) r% J+ _6 \$ S8 l* j* ], z - /*#define EDMA3_DEBUG*/
; k8 L. D- @1 y% l* R9 L1 r7 v
, _: C. ], @4 `& [$ ~- #ifdef EDMA3_DEBUG N3 m! i! y* ~: K) _0 a' S
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), b# P _9 \, B7 C1 Z% r. _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), j$ u. ^/ o; q* W s' A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% `* S% M; u: \6 Q6 J - #else* @( f* L! _8 T8 X6 I" y9 m
- #define DMA_PRINTK( x... )
% c- y8 p1 q8 S: w. j1 J, [ - #define DMA_FN_IN/ q$ o: Z' c0 R7 t+ v3 {
- #define DMA_FN_OUT: P0 q, `# v2 |; ^
- #endif
. D8 G" Q6 h7 m
1 |. P3 [; `. ?- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- q2 m5 F3 X8 J& M6 ] - #define STATIC_SHIFT 3
( C& c6 F6 W a" ~2 C- g# `, @ - #define TCINTEN_SHIFT 20# ?3 }5 f. x0 ] n
- #define ITCINTEN_SHIFT 21, R' w* p! C4 ?( X9 ], J+ o
- #define TCCHEN_SHIFT 22
, @4 a* u' D B+ b# P; H: _ - #define ITCCHEN_SHIFT 23$ O5 r0 ?% |! }* L" t
- 0 P! x9 ?/ t0 r2 v
- static volatile int irqraised1 = 0;
' i2 Z/ i5 o) K( @9 E2 S4 K7 r: Q - static volatile int irqraised2 = 0;- a& V* }# j: n( `
" t0 y4 V$ G' r) n& C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 u( k; {# ~' m6 V
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W- ]; F' `2 J1 g& o. A) F8 f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- S3 c2 o% b; t - 6 \% ]# t: U- N0 `" |" S
- dma_addr_t dmaphyssrc1 = 0;
! Y6 d/ R8 ?# o4 v - dma_addr_t dmaphyssrc2 = 0;) C2 L/ o7 U: B# }8 E) O
- dma_addr_t dmaphysdest1 = 0;
1 w" z2 f2 w- i0 p - dma_addr_t dmaphysdest2 = 0;& H: R; A8 q- s1 Q5 h2 l8 B7 L
- : t! B8 e% h7 X' }
- char *dmabufsrc1 = NULL;
* V- T# p: D5 e. x - char *dmabufsrc2 = NULL;2 o7 t+ G) p: B/ J
- char *dmabufdest1 = NULL;
3 v# f. C$ W- u. u - char *dmabufdest2 = NULL;
3 ]7 b! e% c3 s( r" T
6 d' v5 ~9 n0 a8 }' M- static int acnt = 512;
7 Y7 Z5 R: g$ Z - static int bcnt = 8;
1 W& a* i: J' z2 r6 \' y - static int ccnt = 8;
% o) F5 V( V U2 Q- X8 ^
& C% x9 ~3 X3 x3 S9 Y- module_param(acnt, int, S_IRUGO);; s& _1 P" K* j; I2 G
- module_param(bcnt, int, S_IRUGO);
+ E9 J% _. @! P$ b( \! s - module_param(ccnt, int, S_IRUGO);
复制代码
$ m: I! ]8 S9 X, c _) k! x
+ g+ @, z I& { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! v+ D" X9 V, u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! K5 [+ J2 L- H$ c& r; t( }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" v4 }" r6 [; j2 b1 I, H. n
: T) ~9 F/ b' E
j) K5 ^% ^, {' U' ?" { |
|