|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; Z8 c3 }- U6 k1 R' ?- [code]EDMA sample test application8 q2 ], C5 q8 n2 v- {
- /*5 V$ L# C( P1 p1 F
- * edma_test.c% h1 q8 B7 r* t1 N' D4 p
- *
4 a0 v& q) V* N9 i" R1 K5 ~/ Y7 u8 N - * brief EDMA3 Test Application; L5 h$ d; e# i1 ?, {- z ?- R/ x2 a! k
- *. j- ]) W, c2 B9 |$ g% s
- * This file contains EDMA3 Test code.
( N$ g0 U) S6 R; W2 Q& l - *1 d; Z4 \9 U2 F. ]! ~5 s ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' f, J9 H7 b$ Z+ p: P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ?# ~# }. Z7 m9 D- L* d; e O
- * TO CHANGE.! W) f- L& z" ^( ] b U
- * p I4 |' j P4 g& h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) I+ D4 b0 c5 G! {
- */ o% P( w: W& ~% P1 w1 L
- * This program is free software; you can redistribute it and/or
2 v" \+ F8 M& T5 h - * modify it under the terms of the GNU General Public License as
5 p, n+ R: S$ d6 o9 B, p- y - * published by the Free Software Foundation version 2.
" n* m; r- R4 p/ S - ** e, G* {7 M! w: Z$ @- o9 r$ e
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ V: @8 M# ~+ r- f1 o9 F+ n
- * kind, whether express or implied; without even the implied warranty, O; _/ V1 [( `, |1 J/ c9 j" r# t
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 A3 z% v; A) b1 w) z6 j+ ~
- * GNU General Public License for more details.
9 P) H; ]' ~% \4 D) P - */
: Q' O) ]1 Z' I. w8 T
# ]9 Z6 A0 n0 v/ G* @- #include <linux/module.h>' U# L! V3 n0 G7 }' T
- #include <linux/init.h>
& w% W" f6 S2 z$ _ - #include <linux/errno.h>/ `) R$ x% Z+ v* Q
- #include <linux/types.h>
! y* W& D: F' r$ A$ h - #include <linux/interrupt.h>9 K2 S: |; g; p9 x' n0 ]3 z
- #include <asm/io.h>4 L, s+ J" C7 O/ F- D
- #include <linux/moduleparam.h>; v2 q9 r! Z3 p, E
- #include <linux/sysctl.h>0 [, x7 i, e1 e
- #include <linux/mm.h>
: H4 g# I3 l6 E- y" W5 v/ w - #include <linux/dma-mapping.h>. \5 f2 [6 c9 _9 j1 R/ ]
9 D6 ^3 @5 _% l; z6 M1 `" M- #include <mach/memory.h>
( C4 [6 s+ j! Q - #include <mach/hardware.h>
: t6 i9 Z8 Y8 B& w - #include <mach/irqs.h>
' I* m( u4 q( H8 R - #include <asm/hardware/edma.h># P- s! g- S; s( `8 O
- ) T) O$ a0 C! u% x$ b0 h( x( a' z3 s" Z9 K
- #undef EDMA3_DEBUG( i, ~ ]- ]- Z9 L* r$ m. n
- /*#define EDMA3_DEBUG*/) E3 f' p( @: g
- : R9 s* Q W( M$ {& x
- #ifdef EDMA3_DEBUG
0 l& x8 T2 x( g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
# k f& _! N9 \4 \6 b" O/ H) ?( D* } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! z6 J6 |5 q4 u: C- ~8 Y6 ]( M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
. g5 n$ z/ }9 a2 h - #else' y- o: F9 S3 L% C. R/ |
- #define DMA_PRINTK( x... )
Z: u! W$ A5 K0 d% I! r7 e7 _ - #define DMA_FN_IN% |7 w) F0 w3 ]
- #define DMA_FN_OUT
~& \/ n5 G0 Z4 F, C - #endif% s: E3 m% h0 ]6 I& K
- 1 c' {$ {& {" @# h; l# g) U- T6 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! g* b6 B7 E3 [+ ]+ ~
- #define STATIC_SHIFT 31 p' w& u [& m' G
- #define TCINTEN_SHIFT 200 H( c7 D3 r; D& G/ G
- #define ITCINTEN_SHIFT 212 m5 F' p1 t" z( o, _) P
- #define TCCHEN_SHIFT 225 }; T* G& H& J2 N7 Q
- #define ITCCHEN_SHIFT 23* s. }' f: a5 F2 W) V+ B
& V+ e2 ~/ c. n) `" `$ w/ {- static volatile int irqraised1 = 0;
0 y6 a. t3 o0 q - static volatile int irqraised2 = 0;5 b4 P5 ~, H5 k. R! _" ^ ~' n
6 X6 n8 D1 v6 ]) M- s/ X: t' t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); B3 }; h- c/ |. s! U! M" I' F
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 s# t6 S2 l u; v7 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, {5 x3 I/ h. ~1 b/ r2 y2 d
7 h; }! Y8 ], ]2 g( V0 x# ~0 \- dma_addr_t dmaphyssrc1 = 0;
" b' w# l2 q, {4 n& Z* o+ ] - dma_addr_t dmaphyssrc2 = 0;: N+ s- r$ C3 X
- dma_addr_t dmaphysdest1 = 0;
+ N H" k; p( I, V/ |: h - dma_addr_t dmaphysdest2 = 0;7 S8 j; h: ?. _
- 4 f) ]5 u, w! @
- char *dmabufsrc1 = NULL;2 n- L+ P5 j# ]' W' X) a1 O- q
- char *dmabufsrc2 = NULL;: M3 Q) \" Q( l2 P+ |
- char *dmabufdest1 = NULL;
6 w1 s' ?0 m# Z | - char *dmabufdest2 = NULL;
+ G9 \! x* Q- X8 {( P+ m
, k( j" Z% b; L- static int acnt = 512;
- i+ l# G) |( D/ u4 u - static int bcnt = 8;# Y+ A6 D7 n0 _3 b1 L& |
- static int ccnt = 8;
' K! w# f6 h# F" w - . {6 G& e9 C9 J; E( W2 k/ L/ Y
- module_param(acnt, int, S_IRUGO);( |; P" Y% E- ^- y6 y
- module_param(bcnt, int, S_IRUGO);
- _+ r M6 V% @+ K+ j/ W5 U, }( g N - module_param(ccnt, int, S_IRUGO);
复制代码
5 C) n0 S8 i& k9 w5 s3 w1 Z
3 |6 ]$ I: f" w6 W 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 J( p: @$ T8 }* Y* j& yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: A4 N: _0 V5 m$ d' v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: y0 ]/ o3 s7 T/ B' P, |6 y
( w1 M- k- y5 D# i
' @% Q1 R" b5 P0 y1 o: C( R) _ |
|