|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . e/ u0 l, r5 \, P
- [code]EDMA sample test application7 _' W7 s% W0 \- l$ C; e2 S
- /*9 ^+ o5 ]! n( b9 u8 l0 ?, m2 B
- * edma_test.c: }6 |) E" X+ j u* u) c' J
- *
" T" l8 K) h( Y! `* k/ P0 @6 U* Z' R, J - * brief EDMA3 Test Application
9 X- r7 f$ L. g" K# W - *& M$ `9 k( s$ t( ^, @
- * This file contains EDMA3 Test code.
1 k2 s$ {7 k4 J: `; K3 H! k9 U9 J, ]" P - *
' V: \3 t/ Z% W - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
& P9 P) d! g0 ?: J9 K/ T, g, V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 w* z& B& v! [- I: p: Y0 x! E
- * TO CHANGE.8 J" V5 q: B. W9 z. ]' d% P
- *
& @! |) L- u% z; m- U- ]1 a- g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' ?1 o1 I: l0 P$ o/ \ - *
* H6 K% Z8 P* Y! N! l- c9 `" P - * This program is free software; you can redistribute it and/or4 F" |% v& q8 p) G# x
- * modify it under the terms of the GNU General Public License as: u' L- ?" f& G# B
- * published by the Free Software Foundation version 2.
; i8 `/ D# ~: z! x5 H r1 e - *, T9 l+ a9 M" I* \+ ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 x3 W5 s( q+ ^5 W7 R* i
- * kind, whether express or implied; without even the implied warranty
" \5 H" k- A6 G- O1 Q* A6 c% g2 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. M |. `# g! E6 a6 W' {
- * GNU General Public License for more details.
" D7 Z: G q7 k7 R& Y - */
6 y- C" r. Q) e2 y$ F
5 D c' Z" E# U6 v$ f5 |- #include <linux/module.h>8 ~! g* r# j1 Q L# h
- #include <linux/init.h>
& f, G8 H- [. f8 o - #include <linux/errno.h>) m. Z6 P% J" f( c
- #include <linux/types.h>
6 W' w! G7 z7 m8 j - #include <linux/interrupt.h>
5 `1 T& T4 u9 ^2 H2 B" X - #include <asm/io.h>5 S% u) K6 v: V) |9 S R5 Y
- #include <linux/moduleparam.h>
; U" u4 G6 z$ V D$ E - #include <linux/sysctl.h>* b" Z! T; h/ Y; \; ?
- #include <linux/mm.h># d0 H+ u& A. d: B9 Y
- #include <linux/dma-mapping.h>
4 f# _$ r, y$ B( J - + J. k3 T- V- ~
- #include <mach/memory.h>9 P z- o5 {: i( L7 g6 D7 _7 I
- #include <mach/hardware.h> Z& [& n8 p$ {+ K* ]+ Z: J
- #include <mach/irqs.h>" W' E( {6 E5 x+ N2 c4 S
- #include <asm/hardware/edma.h>* v2 s3 \2 D2 r# { v. i! ]% G( S
- # K$ M( C" Z2 G
- #undef EDMA3_DEBUG' G, n! ~ x/ ^/ G6 k! t) L. I
- /*#define EDMA3_DEBUG*/. F9 K( S% M c* h+ C
- ' g# a5 ?. |6 }+ l b
- #ifdef EDMA3_DEBUG. S8 I7 |8 ~1 ]2 ?
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; ^$ o- d1 E* j. Y5 F! Y% t3 R% E* }) a - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! e+ [& }9 N: U& |4 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 b# ~/ P1 p& B' b; N* O' L' v - #else0 B, h4 f8 N) S/ v" J/ K3 Z) A5 ?1 r
- #define DMA_PRINTK( x... )" P0 @, Q* i7 L! |
- #define DMA_FN_IN) _( C+ A3 ?1 e# x% W' }
- #define DMA_FN_OUT- T A1 m2 |8 [
- #endif/ p( I( R6 J. v6 G" u
4 i9 T2 q" M1 N( K- P0 y8 a- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% H$ h; K. i. R
- #define STATIC_SHIFT 3. E0 ~3 Z. M- D5 _* C* T5 k
- #define TCINTEN_SHIFT 20
$ ?( Q6 D7 z D/ o - #define ITCINTEN_SHIFT 214 w, A: {4 Q, }
- #define TCCHEN_SHIFT 22; s. Q! Y7 z, W5 f# s- k
- #define ITCCHEN_SHIFT 23
+ s6 p* p1 f' u, T, y! G! L
9 R) d' k$ j) |0 _- static volatile int irqraised1 = 0;1 x6 n& O- _! g( \
- static volatile int irqraised2 = 0;: |3 M3 R9 v3 t
' X9 E$ h1 w5 _# }! s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Q/ [/ ]) I2 u' ]0 O. l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! F) X; K5 T3 K) ] - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 R$ m& f- \$ d$ r: O( f3 s - / u) @3 H* Y5 f9 a, N
- dma_addr_t dmaphyssrc1 = 0;% V, C, u& X' |& D
- dma_addr_t dmaphyssrc2 = 0;/ f8 X# y* F3 v' r. [4 C% w* B6 e" W2 Y
- dma_addr_t dmaphysdest1 = 0;
: W5 P" n! I% u: b - dma_addr_t dmaphysdest2 = 0;
9 n. G! ] D8 s$ |: W; s" y9 H
) t/ F/ g5 Q9 f( i3 W( i- char *dmabufsrc1 = NULL;/ x( R. M8 k5 r% J
- char *dmabufsrc2 = NULL;
" ?9 L, y& i ]5 q4 I( l1 B - char *dmabufdest1 = NULL;3 g7 e& E, B1 J2 K3 s K% F
- char *dmabufdest2 = NULL;
8 D3 i. x- \3 H( w3 L - / t" g/ ^7 d7 K1 C- r4 J
- static int acnt = 512;
0 \% v" x4 l _; K$ Z! B9 g6 ? - static int bcnt = 8;/ J& J: [! \ e
- static int ccnt = 8;
) X) n# M( u7 B4 m# t
" |3 N7 {* m' n5 l- module_param(acnt, int, S_IRUGO);
7 P" E! {2 V. [ - module_param(bcnt, int, S_IRUGO);
, ^; i7 Z* Z% y: M - module_param(ccnt, int, S_IRUGO);
复制代码 * `- @ X, |1 N) M* D! ?) m
( B2 S* S- k0 k5 V! p. ^' l" k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" b2 T7 s# z4 P) Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ V1 z: z* H$ \* N) G/ P# M+ i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) M3 a4 X. d C5 ^0 S/ T
0 {1 ^, x k! w
+ x5 H+ e g8 m1 }
|
|