|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 I; j/ ` o% q- D6 A% g
- [code]EDMA sample test application$ Q$ ~0 _1 O- q* K- J
- /*4 r0 X* a5 E; h
- * edma_test.c
( L5 ~$ q B2 f+ I$ l - *
8 S6 }# A- ]9 U2 s9 t J4 K - * brief EDMA3 Test Application6 r: ?, U. c( ]$ M$ E5 s8 F2 w+ |+ Z
- *
5 _) t: A: n7 K) G1 I2 }- f - * This file contains EDMA3 Test code.
' W, b0 j& K9 R3 y. W - *) L* M6 M" q; ^
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ W8 }- J2 n( A" l! E/ J: ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d: I1 f+ W0 Y, U* q9 P' I8 e- }
- * TO CHANGE.
" \5 ?# B9 g& c% m ^/ L* G - *4 `: V" D6 Q" }) m$ V- t# i
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 i7 J5 E" `" y, o& Z. v8 w3 h1 I+ r - *' c2 ^+ z ]4 C1 D t
- * This program is free software; you can redistribute it and/or
: a1 S# L3 @# x$ O - * modify it under the terms of the GNU General Public License as
8 p- v* c3 x) r* P8 M7 b$ c - * published by the Free Software Foundation version 2.5 V7 @5 R/ _8 l: a
- *
1 x b" j4 e4 H5 w" e6 F( A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 S1 Q1 n) W0 q. T, S; X& P9 h1 h - * kind, whether express or implied; without even the implied warranty- n& D+ G, t* [# n$ F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the6 c4 k( @* w5 u6 K/ D
- * GNU General Public License for more details.
& k2 ~& j' K! t& t7 M2 W - */: G' I$ n# v- [/ O2 W% H7 ~; A
- 9 u0 W x# o1 y; S# k4 G1 S
- #include <linux/module.h>7 d+ E( D% \' x
- #include <linux/init.h>
8 r, h% f- R+ Z# t( T2 _ - #include <linux/errno.h>
+ R% F( M" W! q- I - #include <linux/types.h>+ }" V' G3 R! j. U
- #include <linux/interrupt.h>
I/ y* i ~8 ~7 Z. m% e7 p D4 d) E - #include <asm/io.h>
W0 M: }* O* B5 p - #include <linux/moduleparam.h>7 Q3 Y% r2 M! R2 @
- #include <linux/sysctl.h>
* P% J6 C* X- g1 A - #include <linux/mm.h>% c# H: x: ]/ i) `: |
- #include <linux/dma-mapping.h>& ]; [: w' I% m
- 8 r- ]+ \( e2 H& ~
- #include <mach/memory.h>
2 N3 d, p3 Q4 @% a% n - #include <mach/hardware.h>
" m3 l! Q3 W. u8 Z- P x% p, _8 V+ z - #include <mach/irqs.h> d s4 K$ y) b% A& J- `2 ^+ r
- #include <asm/hardware/edma.h>
; e) u) U+ }- U% z' O6 U; k
& w3 N/ i7 c3 N# m# e- #undef EDMA3_DEBUG ?. w! X8 O. r7 o i3 ~9 M8 z
- /*#define EDMA3_DEBUG*/
# `; x" ?" ]+ k+ J' u
$ ]* p& u& K& U" h$ S, B- #ifdef EDMA3_DEBUG
' f0 [: \; L/ e1 L2 g6 ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( ]' O2 W9 m8 n8 H! w' d1 P( k6 `9 h - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
g. Z5 \: g! s- d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 ]0 ?) A+ m$ B+ Y. Q
- #else& l J$ D' q3 J/ }
- #define DMA_PRINTK( x... )
' r% U$ q2 Q, e; \7 Z, H - #define DMA_FN_IN
* H* T% G$ ?! R- C5 T - #define DMA_FN_OUT6 f' O" `( P, m7 q+ G" w8 u
- #endif
B1 V V/ B+ J8 G3 f! h - 7 O9 a+ Z8 D8 L+ l$ I" w6 ~; X
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ v+ w' o. p6 s& _ - #define STATIC_SHIFT 3; @! a8 Y# Y$ q8 i* b: x* Q/ G- L
- #define TCINTEN_SHIFT 20
2 b' q7 U1 J8 c - #define ITCINTEN_SHIFT 21
* `4 i2 {- c1 N - #define TCCHEN_SHIFT 22
0 K: G! k0 S' v0 R - #define ITCCHEN_SHIFT 232 w; B2 i% g! V9 e& x
- - {% l2 d7 n* r9 @
- static volatile int irqraised1 = 0;
8 d3 q* A! G) p5 L5 R9 C - static volatile int irqraised2 = 0;
9 G6 d0 Z" P, R. }( w! q - 3 A' m8 s0 H+ f( w( i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; i4 B; U- c9 d1 X$ A8 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: h- z6 B9 u* Q# ?5 v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 E0 J8 Z! F( Y2 _ E0 j7 O - 6 |9 x: t- o( u7 h9 a5 `
- dma_addr_t dmaphyssrc1 = 0;4 t, x& Z/ j4 o0 p E! q, C, v+ L8 r
- dma_addr_t dmaphyssrc2 = 0;, Z" ^# C! [. n& t2 D5 k2 a
- dma_addr_t dmaphysdest1 = 0;
% E7 s. c. J% I2 p$ Z - dma_addr_t dmaphysdest2 = 0;
* b5 H$ u3 @$ \+ s$ Q+ m$ R - & K6 V' Z& o' h; X( g2 X
- char *dmabufsrc1 = NULL;
+ u5 R! \2 r4 X+ c7 g9 C0 | - char *dmabufsrc2 = NULL;
_ {) s' \6 p( O& w0 A- s - char *dmabufdest1 = NULL;
) ]8 s0 @+ j- c& { - char *dmabufdest2 = NULL;
8 U+ I5 [, ?) b4 A: N5 v7 o
, A6 N4 _$ @2 H+ k/ E8 g# w& ? y- static int acnt = 512;
1 k0 y1 G! T+ n3 A# P3 [( Z- R - static int bcnt = 8;
' W& P, x# H9 G# H1 \ - static int ccnt = 8;: s% q9 Z" P1 }2 }0 N1 X7 o
- 8 R5 i- V, O) j
- module_param(acnt, int, S_IRUGO);
) A& @% E3 A4 ~ - module_param(bcnt, int, S_IRUGO);
) H2 ]1 q! I, I- J5 V - module_param(ccnt, int, S_IRUGO);
复制代码
$ f6 q1 Z/ X6 T8 T9 t" G0 U o) ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 v# e: ~9 a7 c* r2 h9 h6 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 |7 n* V2 c8 c7 [! }+ \* k5 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R. `9 Q+ N. |; J/ d- T
2 b0 x* t% m, T- e0 V! H1 _5 q Z$ m0 {0 X& y
|
|