|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 u$ p. w: k0 O) E; i- @
- [code]EDMA sample test application- ^1 A! D/ [* I y: m* j7 T7 V
- /** M b& ~( {' R) D m4 h P4 D& x; }
- * edma_test.c+ |% \8 X$ S6 B$ Q$ \3 H
- *5 q; T$ K# e) U" Z) Y3 U
- * brief EDMA3 Test Application$ e- U6 O: [3 Q- \" j) g8 B! m
- *
* X7 D" U2 {1 m - * This file contains EDMA3 Test code.3 M2 c, f7 s& i
- *
+ x; o! O8 [' G: `! o - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 A! M/ J7 v6 Q; m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 j4 ^' S& q: t) d$ j1 ?% k- F - * TO CHANGE.6 r: X+ m: a4 |- r7 S9 G
- *. N& }% {9 {' j* g: W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ @4 r' z0 r6 P6 e H2 f$ h; X
- *! N% h2 \9 o, A0 w# q
- * This program is free software; you can redistribute it and/or1 \, d; z$ s+ R. e; u" d
- * modify it under the terms of the GNU General Public License as/ t, |4 L" J. V: ^* R6 x" z
- * published by the Free Software Foundation version 2.: b/ s, c' V2 Z) `/ S/ v) `& j
- *! N- n8 x1 _! k7 J# e$ A& c+ Q! t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) x6 U+ D" {1 F0 r, | - * kind, whether express or implied; without even the implied warranty% f- m$ o1 c! ?4 ~; p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ n x- v$ d* f& J( Z - * GNU General Public License for more details.; [# n. _" k- k, B0 V: i9 B3 }
- */
+ y6 y+ \* ~5 @' p; d
2 k/ ?2 l5 G# ^9 q5 }/ t0 Y- #include <linux/module.h>
; v/ C' u9 i! p8 f; e - #include <linux/init.h>
- r+ N" F h O( R2 j! b' @ - #include <linux/errno.h>% }0 ]. q3 I! J' I7 j
- #include <linux/types.h>
& C j: l9 |) i - #include <linux/interrupt.h>! G2 u5 R6 I" ^% f) }4 T# V$ g
- #include <asm/io.h>
* ^- y) q! H3 { - #include <linux/moduleparam.h>
+ t* Z& a* ~9 g0 v8 R - #include <linux/sysctl.h>
/ ^! C6 r' H, @$ U; P/ i - #include <linux/mm.h>3 w) B4 C5 A' N8 H5 P
- #include <linux/dma-mapping.h>/ R& I( D1 o; q! R
- ' b+ `& Z: ?) J, A
- #include <mach/memory.h>
' ]# [3 M5 O/ p2 B; m - #include <mach/hardware.h>% n) {: v2 P! e
- #include <mach/irqs.h>3 R: t: J9 S4 b* _, N6 P" O
- #include <asm/hardware/edma.h>% R. L/ t. j, K% l- q+ J) A
. o0 n8 r6 G4 P3 {' L( ^- #undef EDMA3_DEBUG
$ N) Q* I: ^& D- {8 \: l - /*#define EDMA3_DEBUG*/
/ l, K+ q# G# J: K$ O' A) L b - + J2 M' t1 n) @, } ?% Q
- #ifdef EDMA3_DEBUG5 E# m. n1 o- P6 g! @6 q9 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, z4 ]" V) T1 E5 d4 a$ V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ l( P3 [4 B; e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ _5 q$ ]! X: f8 F+ g6 g - #else
: s% r- B* |; @ - #define DMA_PRINTK( x... )
2 a% l/ c6 x, p$ K. X% \1 w) j" x - #define DMA_FN_IN; F$ t% R- x) I. U+ `' G
- #define DMA_FN_OUT
; j- Q, d7 u% k1 _5 V& ? - #endif0 l7 y$ ?# m3 s9 V1 L% [
5 u4 x6 X' G0 M/ `- m1 x0 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 Y" h3 r% {2 P3 `
- #define STATIC_SHIFT 3
2 F0 [; b4 B1 Z# J" I! f - #define TCINTEN_SHIFT 20
* Q; |8 w; |( S" ~7 Z( ]+ | - #define ITCINTEN_SHIFT 21: O* C/ k. s# i- P4 `
- #define TCCHEN_SHIFT 22
1 j7 W- a: `6 R1 E3 [1 E - #define ITCCHEN_SHIFT 23
) H: o6 @7 D2 `4 T. t! W6 y
) k3 ~6 m. k, e: W- static volatile int irqraised1 = 0;
# @* [5 y& \$ d8 F5 a: C' c - static volatile int irqraised2 = 0;* L2 P, W* A. a: K5 J! U
- 0 p) z9 P3 ^8 B6 A2 [0 Q5 B
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! }2 e1 b' K6 L5 U
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" s2 p' P, C$ m5 i! M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! s/ w4 q/ n- ^5 f
- w9 z: N: k: u- U8 Z- dma_addr_t dmaphyssrc1 = 0;
9 e J) K( ?# G$ l0 f# Z - dma_addr_t dmaphyssrc2 = 0;4 w( M9 z- n2 H+ b& p% d
- dma_addr_t dmaphysdest1 = 0;4 Y8 ]5 `( C2 O/ r* a8 ]
- dma_addr_t dmaphysdest2 = 0;0 A" w+ m- l6 w9 L& V$ Q+ N* ^0 S
- 3 f" _1 e ]* k
- char *dmabufsrc1 = NULL;5 X- |# Z6 G7 K2 r: [" f' Q
- char *dmabufsrc2 = NULL;/ `8 `. h- y( N b* C2 d* ?. ]
- char *dmabufdest1 = NULL;
9 b% A$ a) R1 L* U$ u3 T8 @: E - char *dmabufdest2 = NULL;
# g! j- \$ w+ g0 s$ y8 J4 a( ? - ! ]1 H$ _/ h; X0 \$ K0 d' u% n
- static int acnt = 512;/ d0 }9 [+ q C/ ~# P4 ~
- static int bcnt = 8;
$ G! i* r5 P; D1 n: l3 E - static int ccnt = 8;
+ E, I9 i- L. o. Z$ S - 9 p6 y8 L$ Y0 H
- module_param(acnt, int, S_IRUGO);
/ T5 F. A* a4 }! G9 @9 L8 }. B - module_param(bcnt, int, S_IRUGO);
7 t0 J1 y$ V$ C/ W( E0 G) e0 ` - module_param(ccnt, int, S_IRUGO);
复制代码 ' x" z9 V: g8 H9 F2 q) b1 c
. e( @* G) P. Y7 K2 S, ?8 t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 D6 y0 V% C0 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* |+ S: ?3 I8 J/ i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# E+ o9 N0 S v( w1 }; J9 x. l( h: T D, }0 s9 \. V% [
! x2 r* a+ \# S8 k$ b; U8 T |
|