|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 w3 z% F# r6 `! B' \, G
- [code]EDMA sample test application
! G8 A9 }" m, P {1 }$ ^ - /*3 ^1 y$ z( C0 a
- * edma_test.c
R& I- x# R' J6 S& { - *0 {4 w' d" x+ @0 ]
- * brief EDMA3 Test Application
; V& A1 ~6 q! R2 z7 j" f - *% L/ ` _; Z- A! G
- * This file contains EDMA3 Test code.( I* b- ^" [0 M& l. i
- *
! B! k+ }6 Z9 K5 I5 F# r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 P# N6 ]8 P% r4 V# A. G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* O* d' D c5 R
- * TO CHANGE.
$ S- K5 `3 {9 P9 e- h/ b2 p - *' e. t v' K! g/ ~' X# A" K$ x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! z6 A9 m3 T2 v- J+ B - *
. l0 H; M o' f& W6 I( I9 E- o - * This program is free software; you can redistribute it and/or
* U: C1 T- C% @$ R5 v - * modify it under the terms of the GNU General Public License as0 V9 r$ D6 m: p; t$ n/ Z
- * published by the Free Software Foundation version 2.5 }% F8 c; G0 V! Q/ m
- *; U% z: ^- {( W; n9 Q2 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R) s$ p4 t: t+ N
- * kind, whether express or implied; without even the implied warranty
# g7 `% e# F! C' c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; @& s ]) s4 b - * GNU General Public License for more details.- ~6 r4 {+ o$ i( g% S% S2 p. D
- */
E5 E+ N- `; O( Q0 D) T7 D$ ^# X - ]1 }! p' ]) T* D
- #include <linux/module.h>. g7 d# u' C+ c, ]9 E$ w% ^* [% q
- #include <linux/init.h>$ o/ Y/ p' X& C6 w8 e
- #include <linux/errno.h>- X& q6 `+ D5 B& g9 C/ P
- #include <linux/types.h>
& ?3 N& B0 u! V* G4 D: W. y - #include <linux/interrupt.h>
4 z1 B9 H5 z" N& l& k u - #include <asm/io.h># S& v- D8 T. H- ?/ ~
- #include <linux/moduleparam.h>0 t" w5 w6 T9 q# F
- #include <linux/sysctl.h>
6 N4 j% X2 h8 N - #include <linux/mm.h>
/ W1 M/ x; F$ o% x9 X( [1 Z% H - #include <linux/dma-mapping.h>. H6 g- l% `' e8 i/ a
: e: r2 Y2 x+ y1 L- #include <mach/memory.h>
1 v, Y. J1 e w9 G2 e: H) t - #include <mach/hardware.h>
9 W* I- P" F* U! v - #include <mach/irqs.h> w {& `& u( x! U: f
- #include <asm/hardware/edma.h>
& Q+ j& ]7 A* @- ?9 Z - / ^* e% u* q4 D K- z0 @% K
- #undef EDMA3_DEBUG
. Z, {$ `8 |2 f( c; G1 O+ A5 z1 T0 O - /*#define EDMA3_DEBUG*/
3 ^& l8 \) R% C$ U/ i5 w+ Z: H* T0 ^ - 4 K2 ^6 E. m& v' M n3 B
- #ifdef EDMA3_DEBUG
# [$ g* r! Y% ^9 V, v: X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 k3 h+ P5 |; W
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
a! D" U9 n% }2 Z9 z* @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% V- X5 x6 }" a
- #else. Q/ I% [9 i$ D
- #define DMA_PRINTK( x... )5 I4 X) e9 p1 [; h
- #define DMA_FN_IN
8 O. q" K) ?( n H/ D - #define DMA_FN_OUT0 B, Q" v& m P+ L* Y5 P0 K m+ }1 i
- #endif
3 P: Z, Q# i! {( H - 1 |+ o' k& @7 n2 h/ D' Q. K6 k: P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) }0 r a1 p* O5 [7 C P3 u - #define STATIC_SHIFT 3
# ~8 ~! `5 F, T - #define TCINTEN_SHIFT 20$ h, ]# P' ?" N1 p4 m
- #define ITCINTEN_SHIFT 21; u! X& G2 }1 L' d3 ]1 P) e/ Z& j
- #define TCCHEN_SHIFT 22& [$ P( Q: s$ u# q; `+ L
- #define ITCCHEN_SHIFT 234 r" X! }- i) K( M1 s3 b) ^1 y9 }
- : N1 {& G6 U" F( J1 n4 l; Y
- static volatile int irqraised1 = 0;$ H0 s/ R9 t% x
- static volatile int irqraised2 = 0;
* }" Q0 ~; H9 B% k8 j - 9 D3 ?$ [9 Z! L# ~" y( z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ?. ^8 ?& o. G; L* ]7 d - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! U6 b) }* w+ S- u( h+ B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; b5 R! p9 t9 d% C H
- 6 Q4 O, U$ o3 p4 Y a Y# q3 U, b
- dma_addr_t dmaphyssrc1 = 0;
8 n, X3 y8 b! d4 R- d9 s0 b - dma_addr_t dmaphyssrc2 = 0;0 t: o9 A& M2 y* `* q
- dma_addr_t dmaphysdest1 = 0;* x" `$ T5 b( t: M) ^
- dma_addr_t dmaphysdest2 = 0;
; K V- x; C( {9 h0 m8 C f - ; s% E7 n% J( i j. A
- char *dmabufsrc1 = NULL;: T1 B1 f d, g3 A1 H8 ~7 a! G W
- char *dmabufsrc2 = NULL;4 x: l6 q% A8 I2 j0 X2 X
- char *dmabufdest1 = NULL;
% `8 s" A. Y9 U - char *dmabufdest2 = NULL;
. T, E$ }& D7 q N$ l( r - % t3 m7 M8 C1 H q* U1 O
- static int acnt = 512;! H' C+ D9 x( \/ R
- static int bcnt = 8;
4 T( B' z5 d7 F) Q k# _/ b - static int ccnt = 8;$ y9 [% R0 ~% g% b2 F' K4 w
, B4 Y( q7 v3 f! ]5 w$ H9 x- p- module_param(acnt, int, S_IRUGO);6 g5 j. z, j/ h1 C
- module_param(bcnt, int, S_IRUGO);' X+ R: P7 F3 {1 N! |! k2 y
- module_param(ccnt, int, S_IRUGO);
复制代码
) x: I0 o/ k) \ U& w1 m& p4 M* P, u( w' o5 m( W; e! v# @2 d
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ E- D& ?' g: M2 O" \+ v
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; C# N' F6 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 W/ g# C3 s9 Q$ `6 p/ v
; S5 y; ?' J( D4 P( Q. U
: ~- ?8 S) w5 t2 ~8 p |
|