|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; N# U( a1 {( T8 @3 \: c- [code]EDMA sample test application
4 P7 F2 I! |1 Z* D% ~ p - /*
) e2 ?! u& i* I9 D - * edma_test.c
# g% T$ ?' G, {! O* Y7 Y% d - *, B" z8 C/ }1 [% `+ g
- * brief EDMA3 Test Application
7 k: `" F3 T0 g5 d* C, N - *
G1 j5 S. ?0 ]5 ^9 F! g' r - * This file contains EDMA3 Test code.* m" j' j7 b+ ~9 Q' |- ^
- ** O' J9 i1 K$ C; C6 `
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m: ^/ E& t7 ^# o4 W: H/ ~! X* u
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* [$ z: |% W: {, [# ?, [$ D
- * TO CHANGE.( P* { A7 M) f. ]8 O
- *' a4 M; `8 M% C2 I0 J$ [
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" R. i/ ~7 K. g& P) z2 A9 K - *
4 g% |3 d9 D6 X6 _ - * This program is free software; you can redistribute it and/or" m. X6 W# o: {3 `, k) n, K: |) e
- * modify it under the terms of the GNU General Public License as
+ R, C9 Z9 a8 D3 s - * published by the Free Software Foundation version 2.
_& E( U6 @) ]) \+ n9 H# M0 [) y* H* \ - *
8 }. Q O( K0 \8 p6 u0 g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 M9 B9 A8 a/ b6 c+ A8 U - * kind, whether express or implied; without even the implied warranty4 `6 R# ^( [6 ]7 e; B) K h# O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Z1 f1 Z" z ~% v
- * GNU General Public License for more details.
+ M% |& I, d" v$ V5 @, E - */$ l! L4 @0 R' ^ `. n/ K3 q
2 e" e7 }4 x- f, S9 k2 ~$ h* ?- #include <linux/module.h>
+ T' ^. P! S! X8 B/ N9 z' q3 v - #include <linux/init.h>- s" T+ }) s) d- }. j
- #include <linux/errno.h> |: h2 L" j! I; A ]6 I
- #include <linux/types.h>. W$ j! \* v' e# ~0 B# v$ A* Z
- #include <linux/interrupt.h>
1 _+ a7 A' l0 J" J! c% G - #include <asm/io.h>" U& K p: k% b# F: h; W
- #include <linux/moduleparam.h>
$ c. E) a1 A5 E8 K) ~ - #include <linux/sysctl.h>
8 m3 u- t' T) L6 Q: H+ ^ - #include <linux/mm.h>" P( r' y0 T! E) k
- #include <linux/dma-mapping.h>- F+ L4 i5 O* T8 h8 V" w: B
- 7 V% [. L0 w+ X$ I3 l
- #include <mach/memory.h>
, H4 y/ d( @9 G, I0 G, E. g - #include <mach/hardware.h>
. x( S) Q X# @. l& i, q* \ - #include <mach/irqs.h>6 m, \6 ?3 ^ T6 ]5 s% r
- #include <asm/hardware/edma.h>/ M- R7 y1 R6 d! e$ \' }0 u: ?
; u7 U# i2 n! t0 C6 ^% d1 `- #undef EDMA3_DEBUG
/ m! H1 y4 W% N) C' E" g. l9 T0 }8 z1 J - /*#define EDMA3_DEBUG*/% K+ |/ y5 R- f4 k
( @" ^, U8 O6 T5 j3 N9 L- #ifdef EDMA3_DEBUG
2 i1 B+ i5 F, R+ Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 P" C7 D% E r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' |; ^; g6 W0 Z: h. x( K; k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" ~! z. x1 x( e& H - #else
2 L/ M8 p- B! [ - #define DMA_PRINTK( x... )$ b- c g( d. U1 H+ d
- #define DMA_FN_IN& P7 l9 Y6 e* f" A
- #define DMA_FN_OUT! o3 z* ~+ V4 T& p
- #endif$ b+ ]& V& E: T2 p2 Z7 L3 q/ y
- 2 @& Z# l" ]9 s G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 w, w9 h7 f; {6 _5 h9 g5 m0 I - #define STATIC_SHIFT 3
. y! `% e3 v7 z% t2 ?% k2 G+ W - #define TCINTEN_SHIFT 20
% L+ h% ^0 Y$ C) G& R6 u - #define ITCINTEN_SHIFT 21$ O. z, `7 j% r% V# D. _/ n
- #define TCCHEN_SHIFT 226 {( Z6 E9 w3 Z6 g1 |1 D8 i& s/ j
- #define ITCCHEN_SHIFT 23
; B- G% Y: i' t0 o; r+ H4 P - $ @8 X7 u5 m6 z2 ^
- static volatile int irqraised1 = 0;
; P Q+ f+ h e" n. G - static volatile int irqraised2 = 0;
. M7 D. ~" `9 W" ?, o2 j5 h
* r$ r9 r# k5 ^2 n- G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ M! w- u' x5 R3 r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); E5 z' i* ?$ y& A+ ~9 s7 T. f4 a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y0 r' E2 R& U' a M# Y
' }; i+ E9 |! j- dma_addr_t dmaphyssrc1 = 0;
+ }8 n/ h( _" G3 Q: ]; M - dma_addr_t dmaphyssrc2 = 0;& x4 l6 E! {/ J2 E+ C: u7 N
- dma_addr_t dmaphysdest1 = 0;1 H' g. P; s% `: z* O
- dma_addr_t dmaphysdest2 = 0;; L0 E* j L9 ?1 U* A; @! D
- ( ^6 X" J# s. C$ j: K
- char *dmabufsrc1 = NULL;
. i; H @5 B! O6 Q2 w4 K6 r - char *dmabufsrc2 = NULL;# I5 w) O9 B+ a6 L
- char *dmabufdest1 = NULL;
$ b$ X& m& f0 Y - char *dmabufdest2 = NULL;2 A1 @, O5 X: |/ }
% f+ T( y/ m0 c! P/ n7 t% f2 a: y- static int acnt = 512;
$ ~3 v- m5 u9 c( D( K# {; F - static int bcnt = 8;
) n; m* n, ~3 d+ ^" q1 X% N - static int ccnt = 8; W, _: x" v! T# O, k! }
3 Z' h- |7 C: B6 A' ^- module_param(acnt, int, S_IRUGO);
, d" O( \" p: s$ h3 X# e" P+ ?$ ] - module_param(bcnt, int, S_IRUGO);
# I0 ~- w4 h0 Q, F2 u. q1 D1 ` - module_param(ccnt, int, S_IRUGO);
复制代码 8 m/ _5 V' I; ~, j2 p" g$ o5 G
# n9 k$ Q' B& O; f% y, ~3 {. z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ D0 y+ Y: n: H0 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 Y B) E$ J6 p9 B/ Q' P' G- c 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& u, p" g! ?* y6 B; n7 S
0 y+ T$ y# q/ ~9 c7 h7 [. r6 F P) y+ ? X; H
|
|