|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Z2 q9 R0 P+ D* u! ]8 k6 Y- [code]EDMA sample test application' k. n; F8 z" C$ z- {
- /*3 b/ U+ b$ w' ]- T1 q5 u; e
- * edma_test.c B5 T+ M/ J( n" ^. E$ a
- *. w8 f; S5 v% d& _7 @9 S
- * brief EDMA3 Test Application. k9 V- F! y. n0 o
- *# `' `$ \6 d9 p* ]6 H0 g
- * This file contains EDMA3 Test code.3 Y5 @, M8 w: U# P5 K! V
- *
6 n/ J' e+ @! N k6 c& M# h6 } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 K0 B" }# h0 l2 x2 F% I
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 }7 u9 A$ }8 x, n8 [% X
- * TO CHANGE.9 B6 R, d& h" a' k
- *9 j& V6 {: ~$ y
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 x3 y) k7 c' f. C5 N' V# ^1 P7 K3 ^+ P - *
3 _; N3 U l/ K: |" X/ g9 Y5 f - * This program is free software; you can redistribute it and/or8 ?" L' j9 [+ r. K1 R. p* k) [
- * modify it under the terms of the GNU General Public License as
6 Y2 Y2 W/ ]1 s - * published by the Free Software Foundation version 2.' j" v/ F/ U# F U
- *: H) S3 Q1 p1 V3 J! X
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# x3 [$ t4 n# A6 S) X }
- * kind, whether express or implied; without even the implied warranty- q) ~5 I7 l" I
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ I% G# v ? h9 S) d
- * GNU General Public License for more details.; v+ h _5 g! q$ b3 P, [
- */
2 k/ y3 a% C; r
* R$ w' ?4 s1 [( q2 [9 e- #include <linux/module.h>6 g9 ~. |4 v3 l; ]' w2 O( _
- #include <linux/init.h>: H! f z) S O6 D, j v
- #include <linux/errno.h>
8 M8 |8 K2 f. |& l8 x - #include <linux/types.h>' U6 F8 x D, N( f; {6 O
- #include <linux/interrupt.h>
6 o3 m+ ~6 `1 G( F - #include <asm/io.h>
0 h& t# ~' B+ i9 c9 u - #include <linux/moduleparam.h>7 b, }: A- C" ^. X- c) E
- #include <linux/sysctl.h>7 L1 k4 r, L d$ a
- #include <linux/mm.h>. Q7 U& ~% p& @- z
- #include <linux/dma-mapping.h>0 r/ M* }0 E) \. e0 b l
! W' }! m* u$ P1 g: W K- #include <mach/memory.h>5 o N2 i$ v: @
- #include <mach/hardware.h>/ ^9 i5 I2 ]6 I" x: i) e
- #include <mach/irqs.h>
3 X5 c# R Y) p; a& G8 I+ Q - #include <asm/hardware/edma.h>
9 ?" w$ A+ }- d2 c% L - & G$ S4 S3 W1 z0 f; e$ H
- #undef EDMA3_DEBUG
- M2 S: f5 z+ s. ]% H! ^" j - /*#define EDMA3_DEBUG*/
2 E7 O% N" K+ `+ w; M7 s
3 q7 ~# D0 A5 N8 f3 J$ _. H- #ifdef EDMA3_DEBUG- |: [% M( o5 p8 {0 V# r6 a0 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ ]5 k8 V$ {2 D* g1 F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
@) A$ e) s$ u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' l5 w g( k# C
- #else
2 \6 z% Q# A2 V# ` h - #define DMA_PRINTK( x... )
* L: t( h e( {1 {6 f) | - #define DMA_FN_IN3 A; ^/ @ ]7 i+ w" u/ b" _: Q J" _
- #define DMA_FN_OUT) s; W4 e, p2 @# U' n
- #endif
* L5 y. W. z6 e
+ k, i* W+ j4 g+ \9 `/ y2 T9 z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) n8 s" u$ ^% I. F% n* ?" u - #define STATIC_SHIFT 3, ^% o) j0 F( |2 {4 J J
- #define TCINTEN_SHIFT 20
' }0 w/ H5 k$ C0 r; U; a- n - #define ITCINTEN_SHIFT 21
7 }0 v& I% j8 d) Y, w - #define TCCHEN_SHIFT 22; d- G7 W( Z) |; [6 X
- #define ITCCHEN_SHIFT 23
1 n! }' u( f2 f. j1 `! X
2 E' f9 O6 t/ y. _- static volatile int irqraised1 = 0;
# i/ C8 [2 K! F* k2 A* T& L* n4 v - static volatile int irqraised2 = 0;
$ [# x/ F9 d4 p' s* h( F
1 w8 P6 s% ~# ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 |9 L2 \0 s7 S* `, }- O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 @; _4 S( h# f# ?' x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: _: e+ w8 B% O6 D/ ~8 |2 {
7 m4 a3 c5 r4 Y" D! ?- dma_addr_t dmaphyssrc1 = 0;
& X5 E7 c- i6 K% o, Z. N - dma_addr_t dmaphyssrc2 = 0;
: x3 r/ ^2 j8 i - dma_addr_t dmaphysdest1 = 0;
2 h; `6 Z' W6 {7 {3 J - dma_addr_t dmaphysdest2 = 0;4 @$ B" C" u* n
- 9 \$ E/ i- i% G+ A$ R. C
- char *dmabufsrc1 = NULL;4 _6 V6 l# i' V, X( E! v
- char *dmabufsrc2 = NULL;
' w# z& @. E) v7 Q - char *dmabufdest1 = NULL;9 q4 ?+ {$ N( M% |5 j
- char *dmabufdest2 = NULL;
8 W6 q0 h5 Z& j) U$ d" n* j% Z - / F) {2 ^( ]5 \
- static int acnt = 512;, q E) o0 ]( d2 \
- static int bcnt = 8;
& P- v3 Q3 x! [# T( j: z1 g6 ]! H8 [ P& u - static int ccnt = 8;
3 o& k1 D7 C8 L2 t8 x( p! c
0 A+ \/ P. F! C' Z! y9 i% Z# Y% f) P- module_param(acnt, int, S_IRUGO);$ U; V! p: \' M4 U
- module_param(bcnt, int, S_IRUGO);
- M% b' |# y5 c% [3 M S7 y6 t/ k - module_param(ccnt, int, S_IRUGO);
复制代码 ' Q/ K. \) a5 P. J p; i
, d+ o' g r3 h1 Q; D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 w) f+ X% X U' u5 o9 O: q carm-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* X) |4 `) k0 S' I9 B1 e9 q: k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& U! P: Q4 A4 {
1 K3 a# G7 W9 t* |+ {0 z
0 u+ {) Z( B- a' `" `
|
|