|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 y( O/ _" ^" e9 q6 \) ]% J7 ]
- [code]EDMA sample test application7 \1 i# U( M8 P" s/ |, C
- /*% G8 j4 D" d8 x! C+ Z
- * edma_test.c
% X% C& f9 w- K9 n - *& b& \# V5 I; H& ^- j
- * brief EDMA3 Test Application4 \; B, G/ [, r( ~. B
- *3 k( } `( W/ k! q
- * This file contains EDMA3 Test code.
, y( d- @7 Q! s8 X: ^ - *5 x2 P' ]* v( m! d2 T% V
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 f: x k% `$ w; n! k1 ]6 S
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 \( Q! p, {# @& a! }! _8 l - * TO CHANGE.
5 N1 I) U- p. H - *
% |7 h: O% H- {8 U2 U5 t) ~2 M8 p- r0 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ x( E6 q- a+ o6 R
- *; n6 i1 E2 O* j1 p
- * This program is free software; you can redistribute it and/or
& b+ ^: M. b4 V0 \# o - * modify it under the terms of the GNU General Public License as8 p/ O5 U7 H/ R, n) h9 c
- * published by the Free Software Foundation version 2.
2 y3 m5 K. R- g4 Y9 [ - *0 \- t4 A' Q- v
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! P& [9 I0 E3 ?, _& r - * kind, whether express or implied; without even the implied warranty/ s0 L. g0 \; S2 w* m s
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 r* U! Y+ G( v( m M& m - * GNU General Public License for more details.' x+ h, l2 e2 p1 j' K+ t, N/ L; Q. v# ?
- */
: F2 m% X! c7 t - 6 ] o" k! X; M# ?
- #include <linux/module.h>1 L+ ^4 N$ f% U4 k% E3 j
- #include <linux/init.h>
7 _/ H3 R- g: r - #include <linux/errno.h>5 M1 y5 q' [2 S' n" a* Y* T
- #include <linux/types.h>& R% B7 v8 c2 d6 d; S6 Q
- #include <linux/interrupt.h>
- F- Z7 `* T! A3 \6 u _0 Q - #include <asm/io.h>
1 j- [; e0 v( [! w; h; L) Q% r - #include <linux/moduleparam.h>* b6 K2 m5 i5 d+ p8 f1 `. \* m0 L" Z
- #include <linux/sysctl.h>( \8 a/ X* m5 J" \$ k# Q
- #include <linux/mm.h># `7 H- t2 o! y/ z3 s* I% r [
- #include <linux/dma-mapping.h>
: `3 T' O$ `5 _3 S0 h& t4 c
# u N4 p7 o6 o% l/ s- #include <mach/memory.h># T6 J7 _7 s5 U: x
- #include <mach/hardware.h>+ V' G% n/ ~3 l+ y$ z9 F
- #include <mach/irqs.h>
- m+ N' K0 `: r0 Y' L - #include <asm/hardware/edma.h>9 V( y5 ?3 d( A. V5 Z3 g* O
7 A0 k4 ^9 _+ t) ?/ f- #undef EDMA3_DEBUG. G, U; I+ O- Y5 E
- /*#define EDMA3_DEBUG*/4 _" ^0 g: [0 S0 t- J- B8 Y: w
- % v: B8 R- Y# Q3 s4 j- W5 [
- #ifdef EDMA3_DEBUG8 |& s! ? L& e" j c& x
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). S% d4 M U3 A4 U8 [- l3 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" ~) g+ T) N. k. }+ M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
8 h4 Z' `8 J+ N6 B - #else
5 m% O, g$ p( }' I' ~& F- ], q4 _' E - #define DMA_PRINTK( x... )
7 R- g/ _; A$ b - #define DMA_FN_IN4 I5 `1 Y% `8 S
- #define DMA_FN_OUT. t4 d3 c" L% U* B2 O
- #endif, i; a2 x; X/ x. }8 y( D, k% P
- * |+ j4 m" F9 ~9 x7 m# H
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ v( t: W5 X2 e8 k- D! h* @ ]
- #define STATIC_SHIFT 3) R2 [% R+ v/ z2 a8 J4 U' C( [; U
- #define TCINTEN_SHIFT 20
! Z, y4 k g+ j2 D9 j2 r4 ~ - #define ITCINTEN_SHIFT 21) S0 E/ @! E- v0 |
- #define TCCHEN_SHIFT 222 U; h6 \! U3 ?
- #define ITCCHEN_SHIFT 231 K. s& q( W1 i0 a, h9 e' u& Q
: s) N: u% B& g6 Y- static volatile int irqraised1 = 0;# x1 a) o$ @* u2 O" G! @* T; j% V6 A
- static volatile int irqraised2 = 0;+ f1 _5 Z/ ^. D. x
- ! i7 M" h7 u3 n2 X' \
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G' I- _4 P( Z+ M( M
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: n' F: N0 A) p% n+ z4 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J. B" d9 ^/ C& ?3 H9 Y7 H( s- J
2 u3 Y' K3 E9 ]& @. a* N- dma_addr_t dmaphyssrc1 = 0;: H& S) X4 v# N1 ^8 g
- dma_addr_t dmaphyssrc2 = 0;
! t3 B1 @5 Y( j6 } - dma_addr_t dmaphysdest1 = 0;
7 L/ v3 g7 |0 v; K/ T$ w) c) W - dma_addr_t dmaphysdest2 = 0;1 H1 x% F. g5 n
* \6 V. K d0 P. e7 z- char *dmabufsrc1 = NULL;, ^7 M( e( P5 L- c2 a L$ S
- char *dmabufsrc2 = NULL;9 W* u! u( j* m' E) i0 w% K
- char *dmabufdest1 = NULL;/ |9 h8 v/ h, ]. t9 H9 ]2 b
- char *dmabufdest2 = NULL;
2 V' W$ \6 P$ H( @1 `
% ~# \+ ^* F+ R- static int acnt = 512;+ r) k' l5 A0 ?% U1 \2 K$ g4 p
- static int bcnt = 8;
6 R3 ]+ Z& u9 L, Q2 Y - static int ccnt = 8;
2 z p+ r P+ i
. o( ?! V* r* u; }3 N+ G6 f- module_param(acnt, int, S_IRUGO);
, \7 {* h6 n( W# i# {4 y2 d4 G - module_param(bcnt, int, S_IRUGO);
c K( E! a. M% ^" I - module_param(ccnt, int, S_IRUGO);
复制代码
+ r$ V- |. a, B j+ S3 i+ b; X( b) f- E# D1 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P0 T' U) a8 i9 \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 w! B& n5 T* r6 l$ S- L; x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 P9 N8 a* }, {7 c0 q2 _" ~- l
* B+ }+ B; C0 Z$ a6 ^- O+ I) I! F6 Q1 R
|
|