|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + v: F: ?! j5 t) @
- [code]EDMA sample test application
8 d. A4 I! o; B, y& T0 m - /*" K: m4 I! @4 Z& H; x# @( y
- * edma_test.c
# z. K& F. t$ L6 R' q; W+ n - *5 g3 A7 G* Q' p9 i" Y' S) {9 P
- * brief EDMA3 Test Application6 |1 m5 N" P* R! k: }2 R) ]
- *
; Y) N1 |2 P( B1 e7 c - * This file contains EDMA3 Test code.
o8 W8 P& m& d* d' \ - *
7 p) T$ P9 C8 H) u6 n3 N; v" N7 f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ y$ b) a8 k2 a, N$ v% ^. {# z7 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* n( w, ^7 c0 K0 @7 v7 K
- * TO CHANGE.
- }1 V: I0 P9 k( {8 y* f5 Y - *7 W {7 w% k ^$ _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 o3 l$ V+ E: e* a/ ]
- *
. i$ e9 ^. Q# ~1 u - * This program is free software; you can redistribute it and/or
2 K8 @5 y" X, k) e, t5 N, J L - * modify it under the terms of the GNU General Public License as
. y7 n% ^+ ?& Q9 B L. r - * published by the Free Software Foundation version 2.
# ]% F0 c9 Q0 ^7 m - *" _9 y5 P5 d# S+ l Y& {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, O' r$ ~ j8 x% z/ Z% }* k - * kind, whether express or implied; without even the implied warranty
7 P4 A4 |4 G! b3 C5 Z! F - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% g; _7 s( ?1 Q. Z. }, Y - * GNU General Public License for more details.$ T8 i! A* J9 ?* Q, h; `
- */
* R7 n! T3 y8 S+ O! X- Y* Z - 4 s1 l( D0 L& t' X: Y1 k
- #include <linux/module.h>8 E0 m" W& }, E
- #include <linux/init.h>
/ b! t7 S& B7 |5 \+ J, p* A - #include <linux/errno.h>
' j6 c, _9 u* K* G - #include <linux/types.h>' V, t7 w- j M* i
- #include <linux/interrupt.h>, j6 I, U3 d% N L- i. G. y
- #include <asm/io.h>, v( ~' U2 ^" B
- #include <linux/moduleparam.h>
' _. M* _4 }5 H) T4 @! q* [ - #include <linux/sysctl.h>
' i6 \( |4 e R - #include <linux/mm.h>
! ?4 z4 A( | n1 ^9 v - #include <linux/dma-mapping.h>
8 h' ?5 w4 _- g8 @2 k* X: k/ d3 G
) }8 J) A6 i. K6 m" A5 P# m1 D- #include <mach/memory.h>
# {6 t1 P2 \) p" s7 y. l+ g/ q - #include <mach/hardware.h>* Q9 _+ T o% [2 J+ K
- #include <mach/irqs.h>: q o3 ^& K r# p, `1 t, b- |
- #include <asm/hardware/edma.h>
+ n# J- h, _, e4 g* k- \- B% a - 6 Y! W7 ?7 S0 Y
- #undef EDMA3_DEBUG- j$ q) {6 D. q! ]5 J
- /*#define EDMA3_DEBUG*/; l/ g! I. K: B' v" r
5 C" F: m/ {) S; B7 x' L9 i# E- #ifdef EDMA3_DEBUG
2 v5 m& N$ o: L5 x* i- J - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 Q' r; k- C4 {6 y1 K O
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) D1 c0 e5 V$ O) G+ e0 X9 d- Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- W' k% ^% F ^8 r' ^
- #else
' ^/ f* v- J2 o5 h- J- e - #define DMA_PRINTK( x... )
- @5 Z; \% C, K9 V! s9 W - #define DMA_FN_IN
. _% z4 y" _" P' u) h - #define DMA_FN_OUT
/ h1 D& q: J$ U$ A( {8 }; u - #endif6 L0 N& j2 z! F; O" S9 R: [ X2 Q
- - F; c; [+ q1 R+ Z0 ]* G0 @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" n' O/ H- }9 c% T& U
- #define STATIC_SHIFT 34 I9 R! c D7 g7 s# v( |/ K1 ^
- #define TCINTEN_SHIFT 20
. u; S" [# I6 g% n3 l# f1 v | - #define ITCINTEN_SHIFT 21
w. A+ r! `& _: [ - #define TCCHEN_SHIFT 227 t( L* \2 K, z2 Q) {; x
- #define ITCCHEN_SHIFT 23' x/ R+ j) G D# \; X5 x' G
6 k* b5 u6 ]8 i5 ^" x) [/ u( s# B- static volatile int irqraised1 = 0;
7 x J8 J! O B5 C( ^% I& d ?8 l. t - static volatile int irqraised2 = 0;
7 h$ f5 Z0 d: y! U - : ]5 M) m4 {" l
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% h* K+ X8 p1 B3 l* k/ d; F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 B8 c8 f6 w. a7 Y' a
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 n. J+ D4 F- L+ ]5 { - 5 T& p4 ~* r& m
- dma_addr_t dmaphyssrc1 = 0;
3 H$ v6 v: \& H8 K - dma_addr_t dmaphyssrc2 = 0;! r$ _6 L% b( y; S
- dma_addr_t dmaphysdest1 = 0;3 A7 {# {- y4 c! b6 O+ O
- dma_addr_t dmaphysdest2 = 0;
6 R0 p& V: X" @ A) a; j4 b' x9 T) g9 C
9 @" }, ~. X, O" e2 j* V8 f- char *dmabufsrc1 = NULL;: c* x& ]* m$ W2 E9 h
- char *dmabufsrc2 = NULL;# i4 j7 J0 t5 q/ P$ q4 ?" S
- char *dmabufdest1 = NULL;9 }" t: r6 r% g
- char *dmabufdest2 = NULL;
+ M9 V. z1 w- B3 t
) N' t1 ^3 E# x- static int acnt = 512;( z# X& `& J' O
- static int bcnt = 8;7 x* ?, R" q+ s/ q9 N( m, i; M
- static int ccnt = 8;7 l$ T" q/ R3 a- K4 j: q
- T6 w5 A8 C' \0 N3 z' z
- module_param(acnt, int, S_IRUGO);1 w, m7 K+ O8 ?9 B8 r4 r5 W$ h
- module_param(bcnt, int, S_IRUGO);
& R$ m/ a! Z( z6 ? - module_param(ccnt, int, S_IRUGO);
复制代码
$ ? }; O7 A1 B% S0 r( F' k" F6 Q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J( }' C! K6 R3 F$ U" ?; @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 R, X& O7 M1 V; b" U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ?, A: }% l# A* e' s
D! A: F- a8 _( k! @( i
7 u \: v: z" [8 B |
|