|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" o5 Z" j, _8 ?( F- \/ u- [code]EDMA sample test application2 I) A5 O; t9 ?* q2 O1 s i
- /*& v1 C0 R. S5 x, g$ b7 u
- * edma_test.c) R' v: B6 p& \" u3 ?8 d9 M+ N
- *2 n% _" j# n6 R0 p9 }, n! x/ J0 Y
- * brief EDMA3 Test Application1 x5 s2 t. a0 l: L) a I+ n
- *
- [' q4 m2 ]+ a8 K3 u% | - * This file contains EDMA3 Test code.' A1 r0 Q/ Q: s$ j- ]% E
- *" d2 a/ o( \' g; C, m- u
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 l' H [( A7 j Z) M; L$ F6 v ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
, {+ L* e) ?6 h7 V - * TO CHANGE.3 T0 _- O# S7 r1 g
- *4 M$ }- y* i1 r
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 ~" P# S6 Q% l" I
- *
. Q0 N* @9 ~9 `6 C4 u9 r( | - * This program is free software; you can redistribute it and/or8 I5 E# k& D* k# k- X5 w
- * modify it under the terms of the GNU General Public License as
' l3 Z( O! R% u+ U& Q - * published by the Free Software Foundation version 2.
$ V+ R7 p* W i! o! G5 Y - *0 P7 n3 n. ^$ b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ?: ]4 y: `9 h7 a - * kind, whether express or implied; without even the implied warranty
' f. a. A$ `4 y5 N5 I/ `! e7 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 W+ {, X" X$ Q" D5 s - * GNU General Public License for more details.
; d, b- f& |$ W) r! B) Y - */) V8 w# k* N8 [; d
; O4 p1 q! U. ]2 \- #include <linux/module.h>7 A9 \! y) Z7 a
- #include <linux/init.h>- Y) \0 s3 n* l& r
- #include <linux/errno.h>
7 d" V, v- C1 Z - #include <linux/types.h>, W, J6 J: o$ w* C) a
- #include <linux/interrupt.h>
! B( Y- @, R9 O! a - #include <asm/io.h>! x# M- N% _0 U
- #include <linux/moduleparam.h>
. x, p1 x& {1 ~* V5 z - #include <linux/sysctl.h>
) }9 U5 ^1 V9 ?# @, B8 q5 S - #include <linux/mm.h>
. R9 Z0 z! z4 e n. I7 l! E - #include <linux/dma-mapping.h>
3 ^/ U& I0 p5 k1 X
7 H1 u, T7 c3 N# ^% H$ z- #include <mach/memory.h>! I, T9 `6 n& x) P# r
- #include <mach/hardware.h>
' @- B9 x' p; K - #include <mach/irqs.h>
0 [9 @0 w* B+ |* w* x - #include <asm/hardware/edma.h>! X1 O. b! L( p. o
- & C2 l9 b% [0 q. p# ]( M: k
- #undef EDMA3_DEBUG
2 o2 q' K) g: N, m) Z9 a$ a. R. S - /*#define EDMA3_DEBUG*/: \/ L) Q+ U4 J; \2 Q
- ! l4 v4 d% q" f' J( A& M* Y
- #ifdef EDMA3_DEBUG$ C5 v2 v) b- ~$ t; T6 H
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" d, W; a0 n* \7 S8 B! O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 N8 E% F% a" d: ~$ m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 b7 |4 \7 Z$ I - #else. | p( w2 t1 \6 z4 _! m! n
- #define DMA_PRINTK( x... )
" Z8 y5 V" T7 F/ f0 \4 {( V - #define DMA_FN_IN4 Q2 m6 g6 F% n% l; a- D
- #define DMA_FN_OUT
2 O) n) Q# m9 z3 `) f - #endif
5 F+ T( N% g4 T, L2 f1 k: A; A
* U2 q9 H j, J+ ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' g; K8 [) ?7 n2 }: @! M5 }. J - #define STATIC_SHIFT 3
- d* K" G8 A! v3 w- {8 Z - #define TCINTEN_SHIFT 200 l- N4 x, j0 r2 _7 k6 C
- #define ITCINTEN_SHIFT 21
) n5 V$ h0 F1 h, r& w - #define TCCHEN_SHIFT 22; m+ z2 V. ?# d) `
- #define ITCCHEN_SHIFT 23
0 p# d; }# w" p& T" k$ F* n8 S
* a/ @5 T: x# U- static volatile int irqraised1 = 0;' |' F# X- @" l) c# r8 Q
- static volatile int irqraised2 = 0;
3 s; p$ f; W7 t - 8 M$ B% f* ]5 e, @2 ^4 C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 r! O/ s# v+ j+ n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) J9 |: @( q0 \( ~. l' F# u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& E7 z ^! j% d2 E) X. w
6 N4 [7 Z- D" Q& ~/ n- dma_addr_t dmaphyssrc1 = 0;
$ H& i5 x$ U0 |# R/ R/ a3 z - dma_addr_t dmaphyssrc2 = 0;; G, h! _: J* S. Q, n9 d# A
- dma_addr_t dmaphysdest1 = 0;
. c) Y5 r, ]$ Z& U - dma_addr_t dmaphysdest2 = 0;+ P. }& t; @ {3 o: R
) j& C8 Z$ c! k- char *dmabufsrc1 = NULL;
; t! n: K: k* Y1 n* V1 s - char *dmabufsrc2 = NULL;5 V" v2 S/ U+ B2 y. N" ]; a
- char *dmabufdest1 = NULL;& V; a+ a1 @) {+ @" \! ]4 t
- char *dmabufdest2 = NULL;# f7 J/ ^! u. l, |, Z9 \
7 H. e K2 J/ ]4 ~% A7 @; `; y% `1 M7 B- static int acnt = 512;/ P1 Z4 D* @ |# w6 E2 O: f0 V
- static int bcnt = 8;% |' h) P4 Y, W2 ], [
- static int ccnt = 8;" Y9 \8 D) c+ H, {4 }' x, x* N
- 8 `. t1 J9 X4 l2 S# Z7 \: f# Q
- module_param(acnt, int, S_IRUGO);0 T9 q, z. ~" ^
- module_param(bcnt, int, S_IRUGO);
1 L2 t6 n5 _, y8 a# ^2 V - module_param(ccnt, int, S_IRUGO);
复制代码
* z( p! n0 ], V4 a
( Y, k( j5 M: c$ x8 ^3 n5 H+ h 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! V* F9 n/ Z, H5 C6 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 [+ ?' }, ^7 e' [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 l+ l# r+ @2 V5 i
8 j) C) f( e! W: c& \; I9 {
- O! i( _5 L8 F# V |
|