|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; Q- j: ]; g- t- `+ Q; m- [code]EDMA sample test application
, M) v, g' i- r - /*2 L4 a* y9 j$ B
- * edma_test.c! z( O7 Y: k1 j+ v) F0 W9 A# r
- *
- z/ _9 I. o& B! F8 z4 p - * brief EDMA3 Test Application
7 k1 r. t0 w! E0 F, N+ h; _ - *
6 U1 H, a) ]" j) o - * This file contains EDMA3 Test code.8 [; p2 E$ {# N0 R1 R
- *( X$ u/ T0 X2 `* w+ `0 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- b5 K" `) Y* k# J, p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' ]+ _( I- Q+ B& G" s6 z; \" A) ` - * TO CHANGE.
/ h% \, \0 D) v; x - *" B6 T' {% v2 C! q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( w0 E# k& {6 X+ l2 Q/ v0 e
- *
# l7 m7 @/ y+ Q! @; y - * This program is free software; you can redistribute it and/or4 L# L" S D. }9 {2 _* J' I
- * modify it under the terms of the GNU General Public License as
8 \ k6 e6 F$ f/ l# m - * published by the Free Software Foundation version 2.
5 P5 L2 ^- ]3 W( J - *3 j# {* n8 M: G1 j+ n+ S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
4 w( B' |$ M( w - * kind, whether express or implied; without even the implied warranty3 G9 n* r8 O& @3 M+ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. g* {7 S9 Q5 m- z
- * GNU General Public License for more details.
+ X% Q B9 A0 X1 j& G% c9 w( M - */; J; H" r @/ ~! V% r
' S1 |- ~* }" {4 Y& J8 i/ K- #include <linux/module.h>
6 b$ ^2 |+ Y3 d - #include <linux/init.h>
- v, |3 o6 L9 _9 z- R - #include <linux/errno.h>7 I, B! A, z: r! y6 u
- #include <linux/types.h>; m E z3 f3 R3 v0 F
- #include <linux/interrupt.h>
* B; }0 [4 q# W2 r3 } - #include <asm/io.h>
7 J" A+ o% U; f* X - #include <linux/moduleparam.h>
! f8 m( S, e Y& C$ t. W) | - #include <linux/sysctl.h>
5 V$ @, C7 Y; Q6 w( u: q( V - #include <linux/mm.h>8 t) i8 l% A5 r1 C" _, I. }
- #include <linux/dma-mapping.h>: A. n: K1 F5 n, E( I i
- 4 x9 p" ]- s; V8 K, H1 I6 p
- #include <mach/memory.h>; J9 X% A- v0 d6 u" X# h! b
- #include <mach/hardware.h>" X, M* A8 z2 x7 Y
- #include <mach/irqs.h>
8 `% I5 e4 f% _+ ^4 Y2 V - #include <asm/hardware/edma.h>
; Z+ s' t' d! ~& f* i, A% Y
5 n# r3 f5 ^7 J+ _' F" S* ~3 Z- #undef EDMA3_DEBUG: a7 A+ }" v7 m. I
- /*#define EDMA3_DEBUG*/
4 Q, r9 m* X5 F7 Y+ ` - 5 Y# E! R% \/ d
- #ifdef EDMA3_DEBUG2 n2 V! a7 c3 F2 T) x3 B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! r6 \( K6 C/ L3 d0 W9 g6 O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ i! r. D V2 n) |2 a8 n- ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& z; t8 K2 j& k( }
- #else4 Z, O8 S; v! k% ~3 c: l
- #define DMA_PRINTK( x... )0 \ P( @& N) b4 U
- #define DMA_FN_IN
/ n9 R! F( e8 i9 _1 C! l1 E6 r) S1 b q - #define DMA_FN_OUT/ f' u9 N, w; a5 @; d, G, M
- #endif% r$ L) U' X2 U) d
# k& S8 |4 _! q, T- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ F1 }, j& c" }8 h% R
- #define STATIC_SHIFT 3, D L: \) E, F" c1 m- h: B/ c
- #define TCINTEN_SHIFT 206 n3 O/ \# B5 }4 ?6 Z9 R
- #define ITCINTEN_SHIFT 21
4 l% t4 B* q! H( p, N! v - #define TCCHEN_SHIFT 224 g) z, V+ Y# `* L3 P
- #define ITCCHEN_SHIFT 23
& {2 o9 c# X8 S1 \, s, T5 q - 7 ~) _$ s, y" e ]% `; M/ S8 S+ O
- static volatile int irqraised1 = 0;% q+ ]. ?1 q9 y4 l" e& }) ^
- static volatile int irqraised2 = 0;
- j, a: M& v2 J( M9 ] - 9 g F- ?. H2 L$ a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. v5 [. H( w9 I# Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Z/ J0 K; |3 u4 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% c" O5 s$ Y) x& r/ c
) l! r+ M4 j A6 p1 X* ^ Q, X- dma_addr_t dmaphyssrc1 = 0;7 b, ] H7 x6 l' G9 c
- dma_addr_t dmaphyssrc2 = 0;1 ^& I9 x+ B9 X" h( Q% v
- dma_addr_t dmaphysdest1 = 0;" q u U: S; g. k2 F! {8 N2 n
- dma_addr_t dmaphysdest2 = 0;* ~; }& m: b0 S9 G6 ^# L, X7 X! v
- 0 I# K; K! `1 c, U* M0 Y: o
- char *dmabufsrc1 = NULL;
. [5 ~% v3 D* G) I U - char *dmabufsrc2 = NULL;1 x2 g- J0 `, O: l
- char *dmabufdest1 = NULL;
5 j& A: R& S# q! x" k1 M - char *dmabufdest2 = NULL;) x9 i! J' w |1 O; C
- L1 s; m/ m( J" w- static int acnt = 512;" S6 p: J* W% R
- static int bcnt = 8;. A0 V' P% W& e/ U" S; h
- static int ccnt = 8;
+ z. a; d0 F# x8 X
6 D4 X3 B' F2 S7 ?- module_param(acnt, int, S_IRUGO);
, N+ Y+ f- f' H3 ~ - module_param(bcnt, int, S_IRUGO);9 a7 S! _1 y3 e9 u# y7 Q4 E: V0 y
- module_param(ccnt, int, S_IRUGO);
复制代码 6 r' |4 u" j0 D5 x3 @0 A ?
( }* f; G; d4 B3 a1 n1 y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: i7 A* n) L* B9 F: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' v) Q: I$ e' ?
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 f6 c8 D: t9 {" O" Q! _
; k, K1 t9 X' T7 |
+ ?' @( B7 V% m: n |
|