|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' H; Z- _+ u- S) B
- [code]EDMA sample test application
8 @6 X1 c0 g0 W7 P - /*/ w& H3 B5 O/ y) w$ m. E
- * edma_test.c
7 |6 y2 J. |0 u+ m* l) L - *
, C) Z( U6 W3 E0 t5 m1 L - * brief EDMA3 Test Application
- \$ f5 _% j- b8 k+ O - *
8 k' C/ R$ x: a* r* O- A - * This file contains EDMA3 Test code.( x) c$ ]' Y, C
- *, b9 Q: A, J7 g, P6 ~ d0 J2 N! h' z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" J' V2 r/ B6 _3 b/ W ` j& o9 m) Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% U* }) W5 K! Y* ~" A4 R
- * TO CHANGE.6 T4 G/ [8 i# J
- *- l# t7 L1 U6 g* @* x C5 y( |
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
3 R) p& ^. m4 K4 q) e- q, x - *
& W; y0 C: J( ~ - * This program is free software; you can redistribute it and/or
$ A2 w- R& m4 ~8 o3 W& Y - * modify it under the terms of the GNU General Public License as) x( \: b7 n' G) |8 `
- * published by the Free Software Foundation version 2.
0 \, e% e( e i+ ] s+ O% K$ J - *
/ }5 t2 o1 X. @ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# `( j8 n. c) u6 H* N \- n
- * kind, whether express or implied; without even the implied warranty3 a: H& x( B. Y5 t1 Y% ^9 ?5 a& c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) I$ k4 k4 @& Z$ K
- * GNU General Public License for more details.
1 |) g* D5 l0 C6 I - */3 R1 Q' @( @4 ^* q- N4 ]
# `6 ^3 [, `3 v% C- O/ C3 I- #include <linux/module.h>' a5 c4 a; P8 N' g$ z
- #include <linux/init.h>( R: A6 j0 v. S# y- |, I: u6 a2 |
- #include <linux/errno.h>
) {2 w7 q; P9 T- L8 e7 E - #include <linux/types.h>! A) t) x' a# p$ _* ]; v* c) `$ Y
- #include <linux/interrupt.h>8 S6 O9 w; }+ E7 o: m; X: x# V+ n
- #include <asm/io.h>
o% K ^3 X4 [/ k# d6 i - #include <linux/moduleparam.h>
, k. @6 w2 e, }+ ]2 ] - #include <linux/sysctl.h>
- z$ ^6 X, z; _( m - #include <linux/mm.h>
) {5 Q7 M5 Y2 {( V - #include <linux/dma-mapping.h>
3 k; A1 o+ D# I6 f0 k3 k - ! i/ I: X- R8 d- s; ~- R( K
- #include <mach/memory.h>% b3 N9 w1 f3 X! u9 k
- #include <mach/hardware.h>. t( a6 R) _; C$ q* \' |7 E
- #include <mach/irqs.h>
5 J# y' X/ z4 ~! i: e) d - #include <asm/hardware/edma.h>" W( o" E, K( D8 @6 f2 d" }
- & W0 G$ i. Z3 G6 _, `+ g
- #undef EDMA3_DEBUG
% o) ^6 Q0 H7 X; i9 U+ @' f$ c - /*#define EDMA3_DEBUG*/
" D. Q3 }" L( H# q( x) S7 {$ M U
5 o! l! r+ g% G( i! H/ E- p- #ifdef EDMA3_DEBUG
3 o: R" F/ @, f) U" H! T, ? - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* V7 y, U6 U5 e, W1 b5 ?1 E
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h$ Z2 U* o! a' X# |7 a r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 n+ Y& ?% k8 B( c4 J - #else; F- P( ] u+ n
- #define DMA_PRINTK( x... )( u4 v) o0 d, f
- #define DMA_FN_IN
! q/ B: H' A! W! t* { b$ y2 L- V - #define DMA_FN_OUT
$ M s [+ J* l+ H! U& D - #endif, v; w: y. N' m3 H; s9 |
# h" c; w9 [; E$ P$ N6 F! }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 A F4 f) x( p7 C3 f$ Q, x" l
- #define STATIC_SHIFT 3+ ?( p, P4 \& k# r1 u1 \
- #define TCINTEN_SHIFT 20: Y6 ~4 }. G" V, p( z H8 l4 ]
- #define ITCINTEN_SHIFT 210 P+ o; _& h6 M" \# [3 D
- #define TCCHEN_SHIFT 22& N6 v# E' V# _9 [- J
- #define ITCCHEN_SHIFT 23; E) K7 i R9 P, P
- / _1 Y5 m( n5 |2 T: k6 P' C
- static volatile int irqraised1 = 0;
7 h/ y$ Z, V/ q8 L - static volatile int irqraised2 = 0;
) m& O) Y: f" q% \: Z# E - ! ?; m+ c9 S) J, L5 |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- l) z3 E% h, M3 x) x
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 a7 h! H0 `' |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& X: W4 T) [" Z4 c4 O% Y7 L) B
* ]& g6 F+ ?) k- T- dma_addr_t dmaphyssrc1 = 0;# ~: ]8 l3 n$ D; R& L8 B) @2 b
- dma_addr_t dmaphyssrc2 = 0;: u/ M, Z& {& S2 i1 m1 T8 }
- dma_addr_t dmaphysdest1 = 0;
- Q7 R+ w A, {* L7 [% _ - dma_addr_t dmaphysdest2 = 0;
* {* w" ^/ Z! \ - , G5 c# e( \5 @9 |8 g1 K4 G
- char *dmabufsrc1 = NULL;
' K. T! }: \7 g E# m$ d( d4 U: U - char *dmabufsrc2 = NULL;
; T$ b' j& W5 Z; i# N J/ {: A - char *dmabufdest1 = NULL;
' [' ~/ H, J2 ~! O; G X' E - char *dmabufdest2 = NULL;
1 k" T( p* M$ a - 8 T. ]3 x$ _2 y- P$ y& E5 ?3 p
- static int acnt = 512;5 f! [( s% U- M& c7 h. \
- static int bcnt = 8;
2 e# d. E, @# S; b: m" A - static int ccnt = 8;& M+ M6 C1 g8 l
z& m) h/ \* u2 c- n% d5 t; Z- module_param(acnt, int, S_IRUGO);$ |- v. K- x, I3 a! |4 w) C
- module_param(bcnt, int, S_IRUGO);
/ z, H W: z$ f0 q - module_param(ccnt, int, S_IRUGO);
复制代码 4 u: w' y- _" Z8 \# v) U }
* j. X) S& ]) M7 G1 W) k0 V% k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 I1 f( d* L7 W( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! t# x! L& `$ ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [0 i; A2 C) N5 n; u; v# @! t9 q
! c: k2 y1 q- B+ t* m
+ w# R7 ?, d3 T' d L5 ~ |
|