|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . k5 N; w: I+ N9 |5 \& Q* t
- [code]EDMA sample test application- Q6 a; G! w: G; Y( g7 w, X" C
- /*
i, d: e. s* f3 }& W ^$ q5 M - * edma_test.c
* q% L0 ?% e3 D* c9 D' W2 i - *
$ a! M Z! V4 U0 W$ `3 @: q8 J - * brief EDMA3 Test Application
- }& |* H" ]7 ?' t) G4 [ - *
6 U2 o1 @: }; C2 J - * This file contains EDMA3 Test code.
" B- \5 b, }% j5 U5 | - *
- l5 i. _6 K4 A N' i3 I2 E, n - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) i% K; U2 h* N6 }9 [1 J, f* s
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ s& c* L1 A4 q; [* w( g
- * TO CHANGE.
! R& V2 {1 K( k - *; X; j$ Z1 X/ B) D9 V. W. X( }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) q: m5 T: c1 M- U( ], a1 v$ I$ _$ w
- *
9 M+ l2 j9 a/ V - * This program is free software; you can redistribute it and/or
9 I# Z' X; q8 u: ]+ T - * modify it under the terms of the GNU General Public License as
2 E1 ]* h! a" Q0 ]& { - * published by the Free Software Foundation version 2.
0 N/ ]1 Z$ r- | i1 ]8 S: s y% F - */ ~7 b* z7 n0 w5 p& O$ p
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ s! e& B5 ~5 v! A0 \" F: ? - * kind, whether express or implied; without even the implied warranty
/ O5 E: k( k9 p( ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. V) U2 u8 N4 w1 a6 m, \3 |% j
- * GNU General Public License for more details.
& s' Z$ _* s0 d1 b - */
* f- n6 H0 h5 Y3 S$ _
# ]! j2 u7 P4 E- #include <linux/module.h>
! w8 r0 M9 E, m - #include <linux/init.h>- p+ _" n" W6 y
- #include <linux/errno.h>
* j6 G4 J# X. Q8 ^ - #include <linux/types.h>
7 _7 {4 w1 K" M4 V! c. C - #include <linux/interrupt.h>5 y, |% W4 Y( I( X
- #include <asm/io.h>! i4 |2 C+ i9 ]+ e- m
- #include <linux/moduleparam.h>
' }' t! R/ s' v2 G6 ^ b - #include <linux/sysctl.h># @% Q% n) U6 {% e) n
- #include <linux/mm.h>* V) x- M" V7 b, k) P) i( R; o* L
- #include <linux/dma-mapping.h>5 i4 E: M0 V) K( B" j: R
- * x. P5 C% K5 R* Z6 o
- #include <mach/memory.h>
, g5 `2 F4 i; ^) l2 O - #include <mach/hardware.h>
! K- J. \! N# z G9 _ - #include <mach/irqs.h>
5 \* F* b8 H: u4 u% L, I - #include <asm/hardware/edma.h>6 h8 Y* m: n2 x& S" L4 X7 o
6 e x8 D* o' I) \- #undef EDMA3_DEBUG
( A9 _2 j* _5 }" u# ?) k1 c8 w - /*#define EDMA3_DEBUG*/( S2 k4 X) ]" i: V% ?
- 3 W) l" W' `. @* t ]( T" h2 w' H
- #ifdef EDMA3_DEBUG
5 a6 J h4 _+ L/ F" r5 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( H1 U2 W0 f$ F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- ~/ t7 v+ j) @ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& j% c" U4 t7 R, y& M3 f. p5 c. z - #else
! p, H' A) ?9 r7 s. v; l7 s - #define DMA_PRINTK( x... )
& m! h5 O# e! m' ^ - #define DMA_FN_IN( J, T9 \$ h- F/ x
- #define DMA_FN_OUT
3 A8 P2 a, B2 R: l5 H% a; i - #endif8 ?5 S( \3 m* W9 O v& d
- 8 h2 U% i* }1 V. L+ @% F
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 S t! Z9 y6 N4 l6 h5 C& u6 a- q - #define STATIC_SHIFT 38 e* p3 }' K9 i& V3 @5 G, i9 q3 u
- #define TCINTEN_SHIFT 20
$ S7 t% R1 u# @0 p8 c( s# a - #define ITCINTEN_SHIFT 21
+ l1 K* T5 x% O' @0 Y( m G" j6 @ - #define TCCHEN_SHIFT 22
4 v8 L. V" M: U( N% C6 d$ U: c - #define ITCCHEN_SHIFT 23
5 _' U. w" q! r2 a
1 h. z2 W- |* s9 F* r6 c7 _ J. c" T- static volatile int irqraised1 = 0;' ?0 e% L2 \$ |9 b) f/ v
- static volatile int irqraised2 = 0;
+ j; K) G7 @7 W2 |; I) w
. E; v- s; h6 l7 g5 q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Y+ s2 h' r. n1 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 d4 t. s3 m: R& S% Q' \ J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 t1 X) Y# D+ `
) u- ~" b1 L7 z: u: F& w6 y- dma_addr_t dmaphyssrc1 = 0;* r( P9 k4 c; K3 { r) P4 K9 |
- dma_addr_t dmaphyssrc2 = 0;
. Z0 v( u% }& `4 { - dma_addr_t dmaphysdest1 = 0;
; \( O8 \0 R" }8 Q - dma_addr_t dmaphysdest2 = 0;
* v3 G( Z) L1 ]& z. q9 Z - 5 y8 d5 _; L3 c! T8 c+ |9 b" Y
- char *dmabufsrc1 = NULL;
0 a% J3 Z! Z' O' ?6 H+ L" U5 g - char *dmabufsrc2 = NULL;+ K3 p) L5 K2 y$ G
- char *dmabufdest1 = NULL;
9 G4 G' o7 ]9 ~- f+ K, |. d - char *dmabufdest2 = NULL;
) P: O) w% b6 U% s, w
5 D* N8 A/ i2 }" j9 ~8 z+ p- static int acnt = 512;
1 d5 s9 N, j, R - static int bcnt = 8;
4 {* _; ?3 H' b9 A. ~ - static int ccnt = 8;* {/ W m2 @, n- C2 j
- / ]& R% k" n7 U5 I [6 T/ F" L
- module_param(acnt, int, S_IRUGO);- Q( k. F P7 d6 _! w
- module_param(bcnt, int, S_IRUGO);
; } g" [& c: u5 _) U& \ - module_param(ccnt, int, S_IRUGO);
复制代码
" F4 m, z% p9 ]5 B+ `; I5 n9 L ^* N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 ^7 U1 K6 \! r/ a5 n: e
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 s- Q; ? Z/ n9 V0 K6 ^. k5 f! n
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 M- P6 @- I" z% A, N: w3 F# P
! u# Y0 G1 { s
/ s; Z1 c; e% p4 {- \3 i
|
|