|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; s1 U) Q6 s2 K: [- [code]EDMA sample test application
" P9 f- e2 D' c1 d" r# _# o e4 F* f - /*: S# f) \: J/ v; P6 h! e
- * edma_test.c
# Q# ~5 |8 {- y - *
3 ^, ]$ I$ {- q: Z: W9 d - * brief EDMA3 Test Application
4 {' u. Z# h4 x" s# J+ B/ e - *1 A4 u. D# r0 v+ i8 x* B6 f
- * This file contains EDMA3 Test code.
5 P8 I2 Q1 \/ W2 P1 Z$ ] - *7 }" q* j" n: q- E
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, c' W: W5 n4 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( x( T4 m# f% Y
- * TO CHANGE.
. G+ \3 T) j; j& c& Q# y" R - *( [9 t$ K6 I! j8 W% R2 A
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, e* \, C' F/ a: x
- *
: T6 [4 I/ K' D- M& `. O m7 f - * This program is free software; you can redistribute it and/or( w. A t5 h+ L7 o3 m$ o2 b
- * modify it under the terms of the GNU General Public License as
7 W6 O* H; [' H7 B- P - * published by the Free Software Foundation version 2.
3 y. f3 ?: e/ y9 D - *
2 Y% X, B0 M$ d& Z. j& K& s - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }: b: ^: Y+ B' P, J
- * kind, whether express or implied; without even the implied warranty; w3 }. i) J; Z) g
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, F! y/ v3 Z( u9 x) f. H, V+ w
- * GNU General Public License for more details.% y- T: U, _' {" R3 |2 H8 t
- */( P7 e: y5 l9 `* E2 U: S- Y7 M' T5 e
- * T9 W/ E6 E. Z% U3 y: F# r
- #include <linux/module.h>
+ e$ l5 t! I, x4 b% ^# K - #include <linux/init.h>
; b2 i0 c6 s1 L; M5 p( |; A - #include <linux/errno.h>
. P$ r$ H* n4 v7 { - #include <linux/types.h>1 z* s- [- v0 P: K3 g$ J
- #include <linux/interrupt.h>
, P% p3 ]6 h! Z! E! V2 C. d1 W - #include <asm/io.h>
1 D& ^5 d `# \: u; n8 l, W$ Y) P - #include <linux/moduleparam.h>( H0 f% ?& i2 f2 }# S/ u! l
- #include <linux/sysctl.h>
/ K7 t( m; f2 B+ V( J) i+ L; z - #include <linux/mm.h>
- V5 P! X0 O/ |8 p6 z8 K - #include <linux/dma-mapping.h>
! M2 M" O3 b) ^( c6 `
$ n( P3 U8 E0 A* s# ?9 T. M- #include <mach/memory.h>) O& Y4 \4 D7 s3 @, ~9 M7 e
- #include <mach/hardware.h>9 |$ O5 T2 k% R4 {) V3 G% a* x
- #include <mach/irqs.h>$ T9 s1 N3 u) F, J1 i' ~1 D5 }' z
- #include <asm/hardware/edma.h> x- j) q8 {/ m3 {$ f% v
- ! r' ~' F+ T$ s" a
- #undef EDMA3_DEBUG
8 e6 h% m3 @ o4 W% U - /*#define EDMA3_DEBUG*/% v/ e! z0 c& L1 w2 _* a$ l
, H7 y% g2 g! c- #ifdef EDMA3_DEBUG
9 e6 Y9 m. }0 f1 Q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ U# p1 E4 C% P4 e! j/ t
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
5 X% ~* Q: E6 `* Y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* A4 ~; K; h0 \$ [0 C0 P
- #else& d. Y z4 _. n7 D4 y/ q: _- U) S
- #define DMA_PRINTK( x... )4 T* i3 f6 V% X2 f
- #define DMA_FN_IN
7 b" \& g9 U$ @5 A - #define DMA_FN_OUT
) \- U1 U: P% y3 C# N L - #endif
$ S9 n) H) e' ?/ y# a5 @2 T
5 q/ Q$ v# L! Z: t# ~. v! W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 M9 t( {& h1 \ y
- #define STATIC_SHIFT 3
4 d1 b" S& J! U p - #define TCINTEN_SHIFT 20
( E5 w f0 M* j( V; Q4 @ - #define ITCINTEN_SHIFT 21
# Y" C1 n( K, t& k9 p' O - #define TCCHEN_SHIFT 22& w6 J/ `; | \) f! x: ?, {
- #define ITCCHEN_SHIFT 23+ U) m$ f3 g0 g; x R* }
% o( K% p0 f# W/ h! [. K- static volatile int irqraised1 = 0;! g5 U1 M1 o# k, a: M1 n4 W h
- static volatile int irqraised2 = 0;3 V, J: p! m, }! D+ U
- + H5 U' [9 }7 O3 p1 ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! w: E0 d p* m& I2 \; ? a8 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. {8 S8 E' ^9 n# F2 O: k9 |1 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 C5 [& \5 @7 ^! s - 2 e5 r5 u, n$ O% [
- dma_addr_t dmaphyssrc1 = 0;& B* [+ v/ Z$ i' D% X
- dma_addr_t dmaphyssrc2 = 0;
N1 y$ y1 @+ m0 q - dma_addr_t dmaphysdest1 = 0;
2 }* [( Y0 H$ a; X0 | - dma_addr_t dmaphysdest2 = 0;
3 a/ P2 a4 L6 P* `
; t! @! \' j$ X4 F4 \$ S1 ^- char *dmabufsrc1 = NULL;4 k8 C. v" a0 F% r+ ?+ l3 c
- char *dmabufsrc2 = NULL;
0 \& I9 z1 c3 _ - char *dmabufdest1 = NULL;* F/ N. {5 `) l' k- E9 k. x
- char *dmabufdest2 = NULL;
, l/ G, P/ r. v, t( p' f - , ~, ]! @% r1 h
- static int acnt = 512;' c/ f4 x F+ v: ~
- static int bcnt = 8;" b! Z1 K. J+ u3 b6 i( c# G
- static int ccnt = 8;, K7 y( M n+ S- G
5 G* |# B7 @' r3 O J- module_param(acnt, int, S_IRUGO);0 C" i8 Y; }3 K. D; T9 Q8 k
- module_param(bcnt, int, S_IRUGO);/ N* W2 H/ e) G% ?; |" G5 K/ [/ ~
- module_param(ccnt, int, S_IRUGO);
复制代码 1 b- x6 i- e$ T
( M& q w( ^* t' q$ T/ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. s6 e$ d a& r% \( X& Aarm-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/ Q& [1 f" G7 \; _+ c4 R/ s 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, p' c, E8 Y2 W. j' _4 W" W6 v, F. L- d
3 S# G' @2 v- |; T
|
|