|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 ~, J* w$ \" @- [code]EDMA sample test application
. n' K4 {# G- w0 P - /*- X. b+ e; F7 {6 {* C4 R
- * edma_test.c
/ Q& R2 O0 b. x# i6 Z: f - *
6 ?! o, I7 X$ [ - * brief EDMA3 Test Application
9 y+ M; C1 j7 A' m - *6 W/ m" i. Q& k, S8 o) _
- * This file contains EDMA3 Test code. r3 R( N/ L% ^: g0 ~1 l3 W2 e* s" E
- *# P' x" {. P" Y: f. D* x9 B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 P- p1 g) y+ k! D2 G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 S4 R+ H+ S9 }
- * TO CHANGE." V% ~. e& i* Z! }0 y- i& T
- *! \. ^# U* } ^+ j8 `! t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; }. Q9 X9 U# t( o& ^6 Y+ | - *: ~2 s, \7 I/ x# u
- * This program is free software; you can redistribute it and/or; h' i* {$ W M Z. r/ ]
- * modify it under the terms of the GNU General Public License as
. p! u7 o7 r: l# { - * published by the Free Software Foundation version 2.4 r7 Y8 j: p" N; p& z
- *
7 u0 ~0 |/ D" i1 r, T - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 r. I7 q; [- G1 P, B) i: h - * kind, whether express or implied; without even the implied warranty" h N, G: n2 N% u; z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the5 |" |* [% _8 o- [
- * GNU General Public License for more details.; X' P1 V/ u; P/ r' J R% @8 x
- */
7 @3 b+ |; r; i$ w/ ^' a5 C' P* [ - / i7 ^0 ~+ o' B4 F! |* v1 q
- #include <linux/module.h>2 }9 K% I* P) {
- #include <linux/init.h>$ M4 f/ f$ u" X5 C) V% w
- #include <linux/errno.h>
4 z3 A0 [7 i' t4 L' m \ - #include <linux/types.h>/ Z+ D/ |& w" b# j4 k3 Y P
- #include <linux/interrupt.h>
# D- a# p6 H# H - #include <asm/io.h>
7 M p L7 [ Q7 N q# W - #include <linux/moduleparam.h>
! b# l: b2 f# Q$ Y* y - #include <linux/sysctl.h>* l2 N2 B7 {! t5 G% I; L
- #include <linux/mm.h>! i' S, I% x- @) |# m2 O. V
- #include <linux/dma-mapping.h>
- H: {& W: m1 s* @4 `4 P) E - 9 p/ G2 o$ i g2 e
- #include <mach/memory.h>
% Q/ F( [) y+ R( _7 s, I7 Q - #include <mach/hardware.h>2 w6 L0 B9 e. X; I; l" h
- #include <mach/irqs.h>
( I6 A8 T, \% p* Z4 s - #include <asm/hardware/edma.h>4 u+ w1 `* d* ?9 l) Z# }
: b7 J9 H8 q2 U- k$ s! J* G+ {8 [- #undef EDMA3_DEBUG+ k0 I4 ?0 {9 N }
- /*#define EDMA3_DEBUG*/; @+ |, Y: y! G. r+ A
- 6 u8 G6 c6 u7 K5 L& W6 g, _
- #ifdef EDMA3_DEBUG% z9 z7 `1 H4 m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ ^6 R- O: ]6 X/ E p& i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 k7 s4 {1 i2 K9 T( ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: L- d. X2 g7 c6 M5 ^- K - #else
" g/ T/ l( R* R+ }1 \ - #define DMA_PRINTK( x... )0 D2 Q5 F3 }& w9 c
- #define DMA_FN_IN
" j- `6 n6 W' F$ }) k9 w9 `" N - #define DMA_FN_OUT* r! C/ ^+ Y8 t3 G: u3 l
- #endif' E7 i' e b; F0 u# r. ]
% E; `" R5 r$ T8 L% o$ I9 m }) b9 }7 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" |) h0 N1 N( i - #define STATIC_SHIFT 3
* q& ^9 q0 j& j - #define TCINTEN_SHIFT 20
# p& @+ T) ?: J1 J - #define ITCINTEN_SHIFT 21
1 n+ R% Z9 l& O* N; ]+ G, o7 e/ @ - #define TCCHEN_SHIFT 22
. K R! j V8 u7 w _, B% U - #define ITCCHEN_SHIFT 23
$ S9 O8 Q- h; N+ t3 `- _ - / ^8 E% K6 w D7 L0 |
- static volatile int irqraised1 = 0;! l& {7 n& E) Z* \9 p: o' v1 \
- static volatile int irqraised2 = 0;
; K/ Y5 p i; V7 }; P - & i, g0 K; T% a2 w* Z2 `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% d- E( `1 a. e( v( Q, y7 v- c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y) T5 K8 a! Y* F" o) r) L7 r9 O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) e z+ _( g6 a - ! L1 g9 Q- ~. E) W7 O
- dma_addr_t dmaphyssrc1 = 0;
, C2 q$ L& f6 j; N - dma_addr_t dmaphyssrc2 = 0;
* r) p3 v @0 C/ ^ - dma_addr_t dmaphysdest1 = 0;
6 s3 t" \3 ~6 h9 K - dma_addr_t dmaphysdest2 = 0;+ i- ~" K: u# Z3 M& r
- # ?9 O M' y6 A$ d3 x% b
- char *dmabufsrc1 = NULL;9 h6 W4 E h" k. R8 Q8 t) ^
- char *dmabufsrc2 = NULL;
+ P( H' P# K6 f. M& v - char *dmabufdest1 = NULL;
( Y0 k/ g0 B/ T - char *dmabufdest2 = NULL;
# v( c- J; O* q1 I' U8 P, L% O - , K) U% p k6 @
- static int acnt = 512;& N1 d2 T6 a! u" t, x4 W) F0 @5 n e
- static int bcnt = 8;# Q1 d4 i" n; \ p s7 {
- static int ccnt = 8;
& h: O. |( F i4 G
0 X% E5 K; @( N( b- module_param(acnt, int, S_IRUGO);! q' K2 i: P2 ~; M0 H- x$ \; g
- module_param(bcnt, int, S_IRUGO);7 `. H7 `5 @( V. v8 g8 }
- module_param(ccnt, int, S_IRUGO);
复制代码 ' R7 n3 h+ s- H. S$ z
& ?% u& e& a1 g: b$ w% o 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 P0 ]7 ^5 W4 h2 y5 I. C: h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- N" P/ F+ x0 h* Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
X' G9 B( t: d7 @2 c5 ~8 j1 k. n2 J w3 m. @
" D; i: s- m8 d, [) g+ `, f7 R |
|