|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d0 p' R3 ^8 J$ A* h: L0 z5 d. Q, y
- [code]EDMA sample test application' s1 h9 m5 J3 K8 H) p
- /*: p r) x. V! `6 F# f
- * edma_test.c6 L6 V, o% S6 s4 x4 H6 M+ Q
- *
9 p/ l7 g8 y7 e, ]/ M% b3 j% |' Z8 R - * brief EDMA3 Test Application2 C5 [5 W3 }, A/ ~. W
- *' }* C4 L5 O0 G# Z- @
- * This file contains EDMA3 Test code.
' t0 O. }- R. x2 u9 K - *' a( R% F5 K! q+ b Q6 i2 m1 }3 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ j& e/ i# b6 K0 E' Y4 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ F: o, y3 i! Y* |0 t0 y& k
- * TO CHANGE.4 _) a7 m" N3 z
- *7 r* a, c! \0 ^ _1 @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 Z/ ?+ }9 m( X% q - *. x, E; i7 g( I5 A: V" l
- * This program is free software; you can redistribute it and/or
4 b" a+ b5 W; l4 j! g: O& r - * modify it under the terms of the GNU General Public License as( x& f0 y, [2 ~( h( f( `% m l/ p
- * published by the Free Software Foundation version 2.
3 o0 U9 m3 e9 _% G: D, L7 R$ C& p9 ~ - *; J# |: x9 r1 |1 E( B9 x& Z8 }; ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: n; M4 D7 ]% y! x
- * kind, whether express or implied; without even the implied warranty5 n- G( V9 M$ f9 s& ~- L$ O( O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) m8 _$ i& M1 Y5 s9 a6 v
- * GNU General Public License for more details.
2 g' M1 M+ T$ z# P" V, ~ - */
% ~8 R$ x% F* ]5 [0 x0 J8 O& T
$ H* x( r6 N6 D+ ], G4 d- #include <linux/module.h>6 l: `: x7 k+ u0 f! e I/ s
- #include <linux/init.h>
! F6 \. d( c4 S+ O& I- A - #include <linux/errno.h>0 W1 D5 f, j7 v! r$ b2 x2 K
- #include <linux/types.h>
% W" s2 |- {& E" P- o) q7 R! \ - #include <linux/interrupt.h>
) n6 C" B9 I p; l2 ^ - #include <asm/io.h>
: s% s0 P1 V! e' S _5 ?0 ]6 } - #include <linux/moduleparam.h>
3 _6 G9 Q5 }( v# W - #include <linux/sysctl.h>
: e' b0 N$ n+ D& D - #include <linux/mm.h>2 G9 D' Q/ W) B( c# k
- #include <linux/dma-mapping.h>0 i2 f' q: k6 w/ \8 m2 x
- 6 |* u: ?2 c4 d$ n8 a$ B; }
- #include <mach/memory.h># U* s# t; h" O* X5 k& I t; k
- #include <mach/hardware.h>6 V" g5 q+ [5 Y" G5 P: N; _
- #include <mach/irqs.h>
- O: C7 m. |! M1 T2 r: u - #include <asm/hardware/edma.h>
. |* L( y }# X2 }
: c# e# [; H. O0 f- U7 k- #undef EDMA3_DEBUG3 r+ i6 { A) k, ^; a8 ]7 I5 l
- /*#define EDMA3_DEBUG*/
, A' Z* D: ~2 [! O% f/ z1 T$ G - 3 A$ K6 t- A6 }5 `
- #ifdef EDMA3_DEBUG+ ]( k5 f3 g3 e% S- v; z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 Y$ X4 h$ z ^7 G" f' o( Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; l- j8 ^! M: u+ q' }, u% c - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ?+ @4 E# j, p
- #else4 [! s0 W' A3 k B" S
- #define DMA_PRINTK( x... )
7 J* j* r/ `5 W# N. H - #define DMA_FN_IN& R( f3 \2 e- F' M& f2 Z
- #define DMA_FN_OUT$ G n1 G, U e6 h5 T* r
- #endif
9 F8 c$ M' a# F' X* X9 N - ( n0 S4 ]/ t$ u q. P2 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# C& _" i2 U$ X( l
- #define STATIC_SHIFT 3# V2 h* J# q; D+ t
- #define TCINTEN_SHIFT 20$ l# \: F _: B) j8 c/ N; p
- #define ITCINTEN_SHIFT 21
/ x7 y+ O; H( S$ d- r1 i - #define TCCHEN_SHIFT 226 t5 ~5 D* J4 e. U9 u( P
- #define ITCCHEN_SHIFT 23
6 S0 e3 M7 l/ ^ - @: w2 U! h \
- static volatile int irqraised1 = 0;
, _) @8 c1 l- G% g: O: w - static volatile int irqraised2 = 0;
; J v% Y' D+ [$ A0 D - $ G) B. z* D* `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k! n; S% N1 s
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s% o$ {6 {# H) T Q5 L
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, {" U5 t: X3 j. M2 z
& Z0 P( |' y! o. U1 y- dma_addr_t dmaphyssrc1 = 0;
; D3 j3 y$ j7 f5 c6 \ - dma_addr_t dmaphyssrc2 = 0;
8 C9 ~0 n) l; J! S - dma_addr_t dmaphysdest1 = 0;- G! w3 e7 W% a7 o+ p2 Y
- dma_addr_t dmaphysdest2 = 0;+ _" ?* h+ Q4 `6 ]- d
- 9 W, J- Q# \) a# q1 @; B& I
- char *dmabufsrc1 = NULL;: g& B+ ~& z Z
- char *dmabufsrc2 = NULL;
4 C0 x6 j! c8 ]7 Q: Z1 o - char *dmabufdest1 = NULL;
, G1 S+ s0 }% u) O& W. M - char *dmabufdest2 = NULL;' }! I! _% C/ v* S/ e# x9 D0 B
- ! d2 @8 P% k# x% w1 Y w ?) N
- static int acnt = 512;; ^: x7 x4 S7 s* v( o, H$ h
- static int bcnt = 8;0 z# j! z1 `- z
- static int ccnt = 8;
3 `1 n% c( R; P/ C, q% _+ j7 G+ r - ( r5 I/ k& i$ G# Z. L5 ?& b& o
- module_param(acnt, int, S_IRUGO);
: T- H: Z3 c/ ^+ L5 Q1 n* D - module_param(bcnt, int, S_IRUGO);$ X# p, Y4 a) s" f
- module_param(ccnt, int, S_IRUGO);
复制代码
- c( z( D" M4 E5 j6 N9 {: |
, t4 X' N( F" {8 ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 @( A# C. @6 h* \2 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% q$ I, G2 \+ I! o7 l 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
l1 G3 x, K( f" [" m
" W7 U9 K3 D! e- l
- R5 {4 o6 f8 N. G x |
|