|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " s( H4 q4 O! y2 v" Z
- [code]EDMA sample test application
( k% S) }, o C* j - /*7 c { |8 r& {) E6 K
- * edma_test.c
1 w) m! w6 Z" ^ - *1 Y# V( ` `1 v/ \# `5 V, E. d' R
- * brief EDMA3 Test Application
7 ^( g7 l% H$ W1 y" | - *% A, D( V# Q J' p7 Y- J6 A9 K
- * This file contains EDMA3 Test code.* _/ V: M4 h1 d1 x" v
- *0 p- k8 E' p: s6 C2 r+ v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 n% l; |; `+ k8 y0 ~3 D9 o. L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ \- D( `9 n7 Y; ^ - * TO CHANGE.
& @9 w% z# q# P( x4 l8 k+ d - *, C) t" M4 }2 J9 a0 E7 A) a* j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( B& B- p6 e& F- m - *1 ^8 P: r! y( j' x2 X3 \" w
- * This program is free software; you can redistribute it and/or
4 K Q6 A' @" O8 k- Q* l- w8 w - * modify it under the terms of the GNU General Public License as# t; s: C. y: u1 k2 b( C8 g
- * published by the Free Software Foundation version 2.5 Q+ x% N$ h$ A8 c) g5 e8 k
- *
: N: b* W5 f$ I7 \- @: N$ S7 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 r) j9 J% C: h/ p, a6 o
- * kind, whether express or implied; without even the implied warranty2 \9 e) c' z. i9 i* f( ?
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; J i8 B% `9 B' V! T - * GNU General Public License for more details.* i6 D! `# }2 E- x* Q e& K, A/ F
- */
, b9 J1 g! B( P9 O( m: M5 {
# ], n; ^& }6 M; y/ {- #include <linux/module.h>2 `4 Y0 _5 Y! W6 u& s# m
- #include <linux/init.h>
1 z( a9 n. ]" ?; T, U - #include <linux/errno.h>
7 j1 p1 X) H; r6 c6 D - #include <linux/types.h>
& U0 A6 D- s+ ^ F9 ? - #include <linux/interrupt.h>
7 x4 R$ G& v* `& R, d; I& |. ^ - #include <asm/io.h>! {$ ?. `* b* P7 S
- #include <linux/moduleparam.h>
$ S, | V6 y8 X - #include <linux/sysctl.h>) j5 `" n& m W
- #include <linux/mm.h>8 Z, C& J+ S) b
- #include <linux/dma-mapping.h>
/ e" k% z: E7 M( T( ?5 C) w
7 e9 V( _3 y6 N- Q% |, n- #include <mach/memory.h>6 H1 d( \7 k6 P9 \2 c+ I
- #include <mach/hardware.h>' G+ v6 |' z. C. V2 {
- #include <mach/irqs.h>+ ? p8 k |! q2 V
- #include <asm/hardware/edma.h>
0 r# w# U, r1 Z - 8 ~& Z$ w) x* F% k
- #undef EDMA3_DEBUG5 [2 g0 u4 L4 b
- /*#define EDMA3_DEBUG*/
2 I9 T! Q% f8 Z$ y; D8 f3 ?
% D1 G; s8 i/ N- #ifdef EDMA3_DEBUG2 H! G0 i$ q8 W l% Y% v- Y
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 k z( V6 |5 t$ c" l$ c4 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Z0 H0 |. H R+ |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), R4 ^# G* l, t( h* [5 `
- #else1 }( e) T2 O% R( ?0 q; s) Q
- #define DMA_PRINTK( x... )% V7 h$ t& U e3 h
- #define DMA_FN_IN
5 w. D/ a3 L; Z8 R" ?; ?' O - #define DMA_FN_OUT
- @4 v4 ^ I( P3 c6 ^/ m3 y' w4 } - #endif, X$ S5 c% k T d1 N* N: S
- * U9 o Z! x& V/ f( m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 b" \" ~+ C- b. F7 a
- #define STATIC_SHIFT 3
% O8 c# D1 A1 @) ]) l - #define TCINTEN_SHIFT 20) O$ |, I5 @ ?; V) R. j
- #define ITCINTEN_SHIFT 212 m1 S3 @& u2 O
- #define TCCHEN_SHIFT 22
. b! a- f. z/ I% h7 p - #define ITCCHEN_SHIFT 23
9 N' Y: |& ?( O0 G" v
& ]: @4 J3 y' M" d+ Y" _- static volatile int irqraised1 = 0;
* s1 D$ S8 a5 h - static volatile int irqraised2 = 0;
& q' B6 v+ u6 Z3 g% K% e0 g
) }# X' c y- K- Q( y# T- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ G q6 k! C% r8 O, W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ v6 U/ q! \% }* [) h4 T( Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
] W6 x# f/ K
: J" r1 t; o( e$ v7 B7 T) h- j/ L* K# {- dma_addr_t dmaphyssrc1 = 0;
. z0 E5 O3 z/ l - dma_addr_t dmaphyssrc2 = 0;
3 f; ~4 J1 f% S4 g - dma_addr_t dmaphysdest1 = 0;
& C% S, D2 T t3 |% q - dma_addr_t dmaphysdest2 = 0;% R8 Q2 f! z/ C; G
/ B b5 ?' b" O$ P j0 i2 J8 P+ V+ h- char *dmabufsrc1 = NULL;# H& ]1 B2 D0 t( e0 c
- char *dmabufsrc2 = NULL;% N& ~/ o6 t$ _
- char *dmabufdest1 = NULL;" f/ R) c7 I! |; \5 \) U, w2 _' J
- char *dmabufdest2 = NULL;- G# K' ~% M1 a
- - A5 g2 K3 ]1 _. }: e
- static int acnt = 512;% I% _4 V! S9 l- @% Z
- static int bcnt = 8;* E* R b" e# d. F- r( Z% ?( ^
- static int ccnt = 8;; ~) V0 B& L- @9 V+ @
, |- v1 P4 y( Q2 s% g& ?- module_param(acnt, int, S_IRUGO);
8 a$ a4 t! {* J+ V - module_param(bcnt, int, S_IRUGO);9 q% K9 t6 F1 P+ ]9 j& S" |% C
- module_param(ccnt, int, S_IRUGO);
复制代码 + Y3 M; F, {( }' t6 h
7 C6 ]/ r" y+ x" T1 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, D' D; W% `! @ r/ Z* 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. c& W/ i8 f' l4 L& X+ K: S
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! j2 V+ P. g7 p" b
' L5 X9 Z, V9 ]3 ~6 j6 S# S. g$ t$ Z) u7 I- d. M6 ] E: z* ~
|
|