|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 n: F: Z# K. f3 n" m- [code]EDMA sample test application
( P( a3 z. y/ T8 `( x - /*$ k% {% r! i& L/ z$ a7 t. a
- * edma_test.c1 G# E3 i4 C) S4 L* n& | N
- *& j4 z0 [- v/ W3 D; Y4 V2 K
- * brief EDMA3 Test Application0 a z( S3 z9 o* K- c7 @
- *
$ A' U. Q, [: Y - * This file contains EDMA3 Test code.) Z" Q$ r* F/ q5 a- g
- *
9 W$ T7 ^8 z ~3 E( n: r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 e, h( q, F* A ~2 Q+ q, o
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; D9 _& `8 b* u+ }6 r - * TO CHANGE.+ q0 f0 z& @7 V1 X6 g/ N. t
- *1 Y! M k# j( Q t
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' y2 Q3 l/ K0 n2 b+ q Y
- *; }+ {% I3 U/ w3 F1 X/ K
- * This program is free software; you can redistribute it and/or4 m" T2 D6 }* A, Y" [
- * modify it under the terms of the GNU General Public License as
; R3 z, U) ?* X - * published by the Free Software Foundation version 2. N8 N- i4 q6 H+ ~0 }+ |6 `4 e
- *4 {+ N. g6 D8 {/ k+ k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ L" L9 ]( T) z - * kind, whether express or implied; without even the implied warranty
1 R9 c# H7 k$ H* r+ ~ d4 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: n9 u8 B. n. R+ x - * GNU General Public License for more details.% Q' P9 T* B$ W7 h+ W* f
- */
* }) A2 B0 D+ _6 |( V - ( u. J7 J3 g& `" L, p0 B
- #include <linux/module.h>& J* _1 q( k U& N. E1 s
- #include <linux/init.h>
/ K' u4 O ^! J6 V' i% L4 C$ P+ Z - #include <linux/errno.h>
9 s/ D4 \' Z+ g9 n& @0 T/ b7 [ - #include <linux/types.h>
+ g, S/ n0 C4 K. j" j& r$ t" o - #include <linux/interrupt.h>
* g- {3 D( k& S+ h" {6 f8 s - #include <asm/io.h>$ K4 h+ x) ^ |
- #include <linux/moduleparam.h>' t5 ^* S. O1 N* m
- #include <linux/sysctl.h>) N* z1 K$ o( M f' m
- #include <linux/mm.h>
4 ?( [. p1 _4 f6 K - #include <linux/dma-mapping.h>- }+ x7 z. h/ R) X) P
! M1 n& i( {0 |* _6 {2 I- #include <mach/memory.h>' H( Q9 V$ J- ^( o- P' n5 H
- #include <mach/hardware.h>4 S9 j6 J* L! m; Q8 G' g6 G2 z$ c
- #include <mach/irqs.h>- _; p) B! |) k/ t* ]% e
- #include <asm/hardware/edma.h>* Q8 o( _) a& z; \
- & A3 H' f% g( j$ V- t4 i" Y- k% r
- #undef EDMA3_DEBUG
" j/ Y# }* e# ^: i+ @ - /*#define EDMA3_DEBUG*/
; d+ y1 h" Z' v - ! \- B0 r: N' B2 L) I
- #ifdef EDMA3_DEBUG& S i5 \; k j+ s* f3 l
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). K5 F; F1 R8 X! r( n; X
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 U( c% _! F3 |& [% s! Y+ y5 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) e' t: C6 D# z
- #else
+ W; f7 f" [0 i5 b* I' R. i - #define DMA_PRINTK( x... )
( s* q# l1 S! i9 v+ P2 I7 g - #define DMA_FN_IN
% ?- ~7 @: n: R% I) n - #define DMA_FN_OUT
+ @# e) W% F: Q5 c: s d" q9 A - #endif) c3 o* W- I# G$ U
8 F, S( U h6 V1 T+ F- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& D) _4 Z( L' Z. _
- #define STATIC_SHIFT 3
. x( c7 f) y A1 o; w$ t - #define TCINTEN_SHIFT 20. X0 _! O# H8 ^' t
- #define ITCINTEN_SHIFT 21
! F" x3 a5 \- _( r3 z - #define TCCHEN_SHIFT 224 X7 |9 x1 C9 f3 J) x
- #define ITCCHEN_SHIFT 23! ^+ J( u0 N0 _5 n9 f- }* x
; v: C; p0 E) f/ D' d9 n; B0 _- static volatile int irqraised1 = 0;2 S' P1 s6 I. z4 `+ ]
- static volatile int irqraised2 = 0;
* m: @* r+ e1 a+ B - 3 E* |1 n3 ? E- N" Q* Y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" R1 o7 e, Q; p! C9 M - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 A3 t' g3 G' m& x6 } T: D8 b - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# H4 o/ `4 E, k( S) v/ m
" ^0 h4 q) w L- ]- dma_addr_t dmaphyssrc1 = 0;
/ `! d# R4 C0 ^) q8 D, H - dma_addr_t dmaphyssrc2 = 0;
$ k" Q8 L$ I* t5 H4 C: g- C F3 o - dma_addr_t dmaphysdest1 = 0;, n- X1 F0 X+ F
- dma_addr_t dmaphysdest2 = 0;
; Z& y( I- C& P& n4 ~ - , I2 I1 U) y, K2 m7 C) W2 a
- char *dmabufsrc1 = NULL;: E4 Q* V1 y9 f0 E; L9 n
- char *dmabufsrc2 = NULL;
E& m% ?) E4 z0 _ - char *dmabufdest1 = NULL;
) t N8 F; ] ? - char *dmabufdest2 = NULL;/ x9 M2 P N; G9 A; h' _. ^
- 9 m, f) X9 B! d8 g! a& a: i
- static int acnt = 512;
# N4 b0 C6 }, a+ S' i. z - static int bcnt = 8;
/ {& k- G3 u8 Y/ a - static int ccnt = 8;
* q, ~0 k. M6 o. A - - ~; B, H2 e9 L- ^& N/ T: l
- module_param(acnt, int, S_IRUGO);9 M. @, V: X2 }: T. {, P& g9 s+ V
- module_param(bcnt, int, S_IRUGO);& q, G2 p. r8 O' Q" Z- q5 m
- module_param(ccnt, int, S_IRUGO);
复制代码
, r, p" n/ s7 n3 i; y. b+ [' Y: a. z7 ^2 n( I0 p' @+ j
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; ^! C- \- |% t1 ~/ {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 G% X+ _; Y1 t3 j0 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' b( w+ E8 Q0 _6 @! M& K% `( a' s' z3 @; o- H; J) @
% `& Y( G+ T4 g! R; w, M6 n |
|