|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 S0 m9 h! T7 O' f- [code]EDMA sample test application
- k7 Z; z/ W# {; u# Z3 y - /*5 R E' [" C' c& j. O T
- * edma_test.c
% [5 v& Y4 f! _ - *- u9 V9 F, r) Z6 n8 Q7 d5 E C
- * brief EDMA3 Test Application
6 z$ v3 [& U) ]" F - *9 |& J' h- x! j) n' ~
- * This file contains EDMA3 Test code.& H7 Q0 r0 b" S! T0 l# S5 a, I# Q
- *. d% O+ c$ k; L0 A) l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 |: K' C: `5 N/ f* }& h
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) c; |: ~9 z* t4 z( ?
- * TO CHANGE.. m$ q4 a }& A' J* W
- *
5 I8 x6 `1 r: L0 f1 e% W) S( c - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) Z; B3 Q, A; C# c# Z - *
- L* w9 M+ C) W2 g5 v - * This program is free software; you can redistribute it and/or
" ^' t0 a( {" G7 o0 V4 h - * modify it under the terms of the GNU General Public License as
: ~! o2 G8 X2 F+ P; n - * published by the Free Software Foundation version 2.- g- i/ ~' _: A
- *' n: `6 d. d7 |: x, v: r* a* H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
3 M( F w% d$ K6 ]- Q3 J - * kind, whether express or implied; without even the implied warranty# Z1 X( ]4 P7 ~& W2 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' Z. R4 _) f! m8 `0 v8 M+ _
- * GNU General Public License for more details.
; T: o) _! }& P8 l- w - */! A" {! X8 ` b' s8 \
- * h% a% z$ l# g4 @7 n1 n' a$ ^
- #include <linux/module.h>
& |" D+ S D5 r. u5 D - #include <linux/init.h> v7 p# H2 P) p( r2 g) B1 I
- #include <linux/errno.h>
4 E5 }& d h/ B( C# H - #include <linux/types.h>/ ~5 k7 V; j. y: Q* ?/ q! W6 K
- #include <linux/interrupt.h>
7 w7 r( S7 d" ?2 r+ {, {( G/ X - #include <asm/io.h>
7 g, h9 D3 i. D! k: l: Z8 n - #include <linux/moduleparam.h>
5 B8 u: q1 B% r/ |3 S1 z" X - #include <linux/sysctl.h>
# {+ ]0 T2 v' I4 B/ Q) p) H# E" x, Z - #include <linux/mm.h>2 w/ Q/ K, R9 ^5 |/ [
- #include <linux/dma-mapping.h>3 x1 B" |5 G2 x! t5 o% G/ w) U
* I' f, @$ d1 [ B6 Y/ V2 k- n2 r- #include <mach/memory.h># X5 E3 q% r: `! F! F3 K8 `/ n& s
- #include <mach/hardware.h>
; `4 A0 o9 m% o/ g - #include <mach/irqs.h>
1 q( I: g6 T. W6 l' J3 Q' q - #include <asm/hardware/edma.h>
. r5 n0 _( q3 } - ) \2 o, |# N5 n
- #undef EDMA3_DEBUG
1 u. D# H0 C( I: M$ W7 C a* g8 r% ] - /*#define EDMA3_DEBUG*/
4 }0 w0 e. k# d' }. n* C! Q - 7 S& f5 b& j% x R( B& X" p) u
- #ifdef EDMA3_DEBUG
" ?( J9 ~% c# R1 q) ]" R - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' [4 \+ H' y" M" N - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ M% V8 n% L% L+ B2 s9 q- ]" @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 n, [- t! J- s/ C# p! a' w
- #else
! G' p+ M% C8 l - #define DMA_PRINTK( x... )
T6 u2 N$ q$ i+ x+ ]9 m7 \5 M" l - #define DMA_FN_IN/ `8 v, c/ P+ t5 t3 m, m4 @: B# L
- #define DMA_FN_OUT
& r( M3 J/ R. h/ S" V& O - #endif
# i$ |; `# `) \: i* v1 F - 7 i7 d: j! h* O Q- Y% t$ s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 H; W3 n h; _9 Y - #define STATIC_SHIFT 3
4 U4 \3 J/ _7 G( O - #define TCINTEN_SHIFT 20& i, E+ h+ l* G& d8 ^/ a( m3 {: D
- #define ITCINTEN_SHIFT 21
7 A& d9 V$ c K; {7 G; L - #define TCCHEN_SHIFT 22) ?5 v+ K$ o! G, G, i* N
- #define ITCCHEN_SHIFT 23* n& s: d0 D& H# {
- 8 V& `2 f' Y! j: C4 @3 c# \ i
- static volatile int irqraised1 = 0;2 l/ `. i' C6 t
- static volatile int irqraised2 = 0;: C9 o2 |& Z# ~7 V( }
- : k6 P3 s8 }7 Z- w3 z1 n0 S- V- \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I! K5 x6 g; |: Q; \7 e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- m) F* T& Z+ u - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 t% y' {: b1 Q; F
_' N7 I5 D$ x, M9 c {- dma_addr_t dmaphyssrc1 = 0;) K9 r% r3 i% T7 M0 [+ w, a
- dma_addr_t dmaphyssrc2 = 0;
8 V7 M7 o' d5 l. N/ M# S - dma_addr_t dmaphysdest1 = 0;
8 B8 C3 q, J$ p - dma_addr_t dmaphysdest2 = 0;# s: O X) G% @( t0 t9 X' X
- 8 s; v$ X# w7 G" p( O, g
- char *dmabufsrc1 = NULL;' b5 M7 w; |; r1 c# o/ y- k
- char *dmabufsrc2 = NULL;
* A( V; B3 X- N - char *dmabufdest1 = NULL;% |3 h/ ~7 Q, U9 g, N2 [: K
- char *dmabufdest2 = NULL;
% G: [+ _1 ]6 M" E
( M" m2 O, q& S6 W- static int acnt = 512;! N6 }: b7 s9 r/ k$ m; `
- static int bcnt = 8;
4 ~/ W/ {9 B3 [% M$ g - static int ccnt = 8;- m$ z/ C( X, e- S! X- v, s s
- - t. _9 e3 F0 H1 A, P! Y
- module_param(acnt, int, S_IRUGO);& Y7 ~9 W) u& D* ]
- module_param(bcnt, int, S_IRUGO);
1 [0 ?0 f, s ~) N - module_param(ccnt, int, S_IRUGO);
复制代码
' c. s; x+ i1 @6 b! M* J, C; n- B
4 T0 |! U( W1 g) I! N9 u1 a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ A: T0 T- U3 A, }, V4 }/ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 \0 a2 X# j7 J7 n$ ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ r9 }$ M9 }( x$ ^& v* `
8 L2 [- X1 K& ?& l* }: p3 c S6 k5 x3 v# d7 m
|
|