|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 g" P. ?: ]# y) \- [code]EDMA sample test application
' \$ s% f" C0 [; k" ?" D' \2 `- I/ _ - /*& E2 O/ V/ k; L: g
- * edma_test.c
, N n( q2 \" s# J/ [: P. p9 k - *
! H- \! x5 B3 `; }. n - * brief EDMA3 Test Application
7 g C, C2 e7 b, Q9 ]+ T6 n; Y T - *" n8 z9 f* `8 F5 F7 D* [* o
- * This file contains EDMA3 Test code.
2 ?' w8 n! h/ t8 S - *
6 p4 T9 ^6 e2 S6 b6 ` - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- F: F! [% S# ?+ P$ Z- h8 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, S0 O/ g5 t/ l; j7 |
- * TO CHANGE.
, \& e( M! Z; N+ Y' F I - *' f: s& a, J8 ~% Q3 H; F+ |5 h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 W3 h7 K6 y% `6 M X1 C
- *& `: o8 f) j+ q
- * This program is free software; you can redistribute it and/or6 H7 A+ ^' j2 h) J' O; b
- * modify it under the terms of the GNU General Public License as
. X; C: B7 {/ _. q - * published by the Free Software Foundation version 2.
2 K) s7 } }5 C1 M& y - *
- Z/ b) I' b' u5 C" h! a) o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 S' E: I( W! o" ~" j - * kind, whether express or implied; without even the implied warranty
2 L. I, `0 w( E8 u$ d4 Q% ~ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% q2 a8 }, i9 |9 t/ e - * GNU General Public License for more details.
" j* ~. }5 @1 {) s) R/ m - */
9 R: t. Y' V ^, c - + D# v0 Z$ j+ s4 B1 F! U- m
- #include <linux/module.h>3 ?4 z& z% d0 m) h
- #include <linux/init.h>
7 _' y( H# G4 V" ]4 G - #include <linux/errno.h>% O0 f, P& `, g1 L4 }( v
- #include <linux/types.h>9 @. X) e3 e6 c1 x0 A* G5 E8 G
- #include <linux/interrupt.h>" r! b0 h3 M( b) m
- #include <asm/io.h>9 L, M* C4 h: z& e3 u
- #include <linux/moduleparam.h>
9 j* y D7 u9 \* w7 o - #include <linux/sysctl.h>
5 a4 V2 d; |9 J* T" D7 I - #include <linux/mm.h>
{; x S$ j( ^$ D5 e. D9 v - #include <linux/dma-mapping.h>% z( D& w; \1 ]
( o" k4 p- h: E) E6 }. ~+ Z1 g- #include <mach/memory.h>8 J2 g, R* M1 v& T* E3 ?( E
- #include <mach/hardware.h>
" ?* \0 a4 \1 ]9 `6 e, O7 t3 A0 m - #include <mach/irqs.h>
/ _5 ]& j" p6 R$ N: q& k - #include <asm/hardware/edma.h>
5 K1 j, j y. N" ~- n - N9 A* g) L, Z! q( Y
- #undef EDMA3_DEBUG
0 \+ P. p! K/ K" m, l' b - /*#define EDMA3_DEBUG*/
$ L: o9 x( j( l" r% O# Y3 d - + ?3 ?/ ~ j+ s3 x; F
- #ifdef EDMA3_DEBUG
% h2 i/ h( ?6 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: d: D, H: W& Y/ Z. a) @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ Z! S9 ?! H# E( Z+ x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 j" j7 k2 Y& n2 c
- #else
- Y K! w4 ?+ S& j6 M( ]4 J B - #define DMA_PRINTK( x... )
1 w3 ?% ?7 l3 d - #define DMA_FN_IN
- R+ O# V, q1 b# \ - #define DMA_FN_OUT
- s: m- |* C j3 k' } - #endif
/ {. Q/ N% b: }+ L p; w0 t
/ T* j1 P6 w I9 N- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' \8 ]' D& b& X8 i2 Y+ o - #define STATIC_SHIFT 3; R- I. g$ R5 R7 Q0 o# `6 W) o
- #define TCINTEN_SHIFT 20) F8 [: X" H0 N# m) }& R
- #define ITCINTEN_SHIFT 217 M$ K% q$ f) }. ^& d1 ]
- #define TCCHEN_SHIFT 22# B- T4 Z1 R$ ]+ L6 \% Z3 O! d
- #define ITCCHEN_SHIFT 23
`6 K, L8 c' ?2 ]/ ~9 V - - ^$ Y+ S; f7 x$ z8 ^6 j
- static volatile int irqraised1 = 0;* Q. h( o0 `0 m! c( `$ V/ o' L
- static volatile int irqraised2 = 0;: `4 ]. X7 [- b/ a0 A, S; p
- 0 x) M. v! Z5 n- b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ p% ^; R7 t1 ?6 `- B: i: l! Q* C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& w' G4 E1 o- W3 N" y& S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a+ R, x7 K* K
- - Y/ ]7 R( r( U
- dma_addr_t dmaphyssrc1 = 0;
5 a/ B3 i9 I) I; T - dma_addr_t dmaphyssrc2 = 0;+ p. n3 Z0 L5 G/ h) y8 W
- dma_addr_t dmaphysdest1 = 0;5 [# D- J2 V, R1 q
- dma_addr_t dmaphysdest2 = 0;
/ V6 V; K# r1 _" X; _( u
) M4 P- v4 t8 g: H# i- char *dmabufsrc1 = NULL;5 i* a3 D) Z+ K7 D6 E
- char *dmabufsrc2 = NULL;
- a9 Z; O( O* Q1 S+ u5 v - char *dmabufdest1 = NULL;
& @/ g# |* f* O& a/ X* f, P - char *dmabufdest2 = NULL;0 f2 m4 E5 W8 m: |( X6 @ [
- 3 K, s* `/ D$ Z" Y# L) t- I; v
- static int acnt = 512;9 t4 @& h3 f Q# g" Q4 @
- static int bcnt = 8;
. B# z" z7 h( }" f - static int ccnt = 8;
$ l; z. @6 v( `, i: v - $ k) L' }# v; w2 F$ j
- module_param(acnt, int, S_IRUGO);
. Z/ J' x) T7 b - module_param(bcnt, int, S_IRUGO);
2 U9 [' D- [" s/ r - module_param(ccnt, int, S_IRUGO);
复制代码
* B+ b4 a/ J1 b7 O
. U. z- z# `3 k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; D6 C& o* x" t% I. K# _% parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. |' r/ O6 b0 [! H
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ^& f l G# s' |7 `' N& B: T* c1 d* W: ]* d5 M$ _ j9 \
) c9 C$ p. y+ h' V4 B1 ]
|
|