|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 ^: d* L+ y; T& J1 f
- [code]EDMA sample test application
# E ?6 z# U% V - /*
6 R7 z+ T: q% \ - * edma_test.c
( G' B. z4 f! c: Q - *. Y) W4 y) o# Q" y" N
- * brief EDMA3 Test Application$ ] S0 c& {! x2 n& x/ [1 G- C; v
- *
3 q# h& x) T7 P, X5 Y3 g8 E% w7 D( Z - * This file contains EDMA3 Test code.
0 U. V) ]* L% l1 s+ _, ] - *" g+ A6 [2 Y6 s: D3 T) v# U: A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
e. K, l/ }7 S! p* U5 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* z# e1 i6 F5 M, D0 W - * TO CHANGE.: s* t0 a) [: z0 J7 q
- *
7 y. O# K7 n% q6 \, u4 Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ [2 }3 b& b# V/ H" i& F" P: w
- *
! T6 a# R; f6 d - * This program is free software; you can redistribute it and/or2 `3 d) L' T& L
- * modify it under the terms of the GNU General Public License as/ D) \# V6 N) m. \6 s9 d2 K" Y5 r
- * published by the Free Software Foundation version 2.
3 a/ J7 [# |# m# s0 s) j - *
* p4 g! `8 u8 {0 L$ K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ H6 n; [6 d2 _1 ~; r+ ]
- * kind, whether express or implied; without even the implied warranty# E# x" X4 u* j: {" N4 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. {/ D: K7 } t8 z - * GNU General Public License for more details.
* m2 t+ ^$ w) O5 E2 P9 y - */+ p9 F! b/ p9 m/ N Z2 B) H
. { [" i7 p: d- #include <linux/module.h>$ w0 g9 K: f( Z# t7 T+ h
- #include <linux/init.h>! W+ u2 n* e' ^5 x# L
- #include <linux/errno.h>
5 L$ l% |- g' H l - #include <linux/types.h>- S3 Q( W/ p' u6 E' L
- #include <linux/interrupt.h>! v% B. T! H; p# k
- #include <asm/io.h>/ S* n8 R' _; b
- #include <linux/moduleparam.h># f0 h2 q0 n# u' |9 h3 ?# B% V( i
- #include <linux/sysctl.h>4 C. S) |% `: E; ~
- #include <linux/mm.h>* g& N' M. l2 @2 }
- #include <linux/dma-mapping.h>3 I9 o, B2 Y/ j) \" Z% G2 h+ y
- ; R; ]% {1 N# j+ \
- #include <mach/memory.h>6 n M* z4 ?& ^/ L- h1 M) ]
- #include <mach/hardware.h>7 j4 u1 c0 X: f& N# H. q; L
- #include <mach/irqs.h>+ ~" h6 ]3 S) R: d O
- #include <asm/hardware/edma.h>2 z& m8 t* [2 @) A0 s. |
- ; x+ p+ t6 N, q4 U" g5 t. C
- #undef EDMA3_DEBUG! i2 y0 v" S$ c" m/ C
- /*#define EDMA3_DEBUG*/
j. ]& [1 }( |1 o4 A3 P - : X) ^8 g b# B2 a3 e g
- #ifdef EDMA3_DEBUG: r( u! f- l0 [: N% y9 \* o
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 X* |8 E3 e, c% E1 Z& A B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& } W4 W# i6 k2 O6 t% ?4 S - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; H* ]3 A! {' Z% l: h" O - #else
6 d9 F+ l8 o# ?$ g4 M - #define DMA_PRINTK( x... )
3 Q8 C. H; @2 J6 f; g# o: ] - #define DMA_FN_IN+ g0 c O& P; A2 V2 ~
- #define DMA_FN_OUT) h( w: C5 w6 p. \+ F2 [5 N
- #endif }9 `- |, ^ K5 _9 i& A
- . [3 N6 H% M% c) x) p) k- {, e% P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' ]- _9 y' Z, d
- #define STATIC_SHIFT 3 n% A3 _& {- \1 Z
- #define TCINTEN_SHIFT 209 }& Q3 D# \4 D- E, T
- #define ITCINTEN_SHIFT 214 W7 J& Z" Z. K4 n% R7 k$ R
- #define TCCHEN_SHIFT 22
% `( @+ s+ p$ j: l f2 { - #define ITCCHEN_SHIFT 23
/ C" C; A5 G t* G( M - + a' i0 F8 B9 f. [& ~
- static volatile int irqraised1 = 0;
/ ]2 Q9 y' b {4 r6 s - static volatile int irqraised2 = 0;. L& |1 R# \3 H( }% Y1 _' C
1 V$ @% y/ ?+ k/ u$ h3 f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 X! I$ a9 x6 V1 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T: G( O5 E' U/ I. d
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ Y. T7 P6 U% v
9 V1 o6 J1 O. ?. E5 Q% E5 d- dma_addr_t dmaphyssrc1 = 0;
1 M! o4 f' s" G& G3 P& g+ E) B - dma_addr_t dmaphyssrc2 = 0;( G2 u# O3 f% I H! A4 U
- dma_addr_t dmaphysdest1 = 0;, L! c6 V: J! v3 p* o" k
- dma_addr_t dmaphysdest2 = 0;: J U$ `" x# V. A& D% |% u
- : E6 V1 _2 v0 c7 V1 g. }
- char *dmabufsrc1 = NULL;; G d% j( o9 _( l2 _/ @
- char *dmabufsrc2 = NULL;+ U; }3 q1 P. y0 s6 K9 @. T
- char *dmabufdest1 = NULL;
! R* u( ?1 h9 _9 Q( ~0 M9 h1 J - char *dmabufdest2 = NULL;$ k6 x1 ]# \2 X: R
( _1 B$ }; G5 X) }- static int acnt = 512;% F$ `7 ]- f4 p z, b1 w* G4 t' a' U
- static int bcnt = 8;* b. S! I. p4 _: u7 {9 v4 U
- static int ccnt = 8;
: B: ?% M& p9 d6 k - / V5 K; T3 d9 E( C% ~. n+ ]5 h
- module_param(acnt, int, S_IRUGO);
, v9 ^2 z" A& b5 V4 Z; _" Q - module_param(bcnt, int, S_IRUGO); ~& @% a+ U+ n/ H% X" d+ L. C
- module_param(ccnt, int, S_IRUGO);
复制代码
$ ^+ w9 z& @: q% f! [% [% F4 K: t8 S& f g; v$ Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& \3 t" j! i) c8 }0 d% \" X( i1 q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 ?& g! q" K: c5 ?" r8 }
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 k( e& m% f: s/ f% r* a2 i& H+ K6 h( `9 w. ?
# E1 B0 ^6 y1 x ?
|
|