|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I |+ |2 k5 j- i, N
- [code]EDMA sample test application$ t+ _3 f( q6 n f4 X R. g
- /*
& a6 i8 O" e: L# v8 G3 G: ] - * edma_test.c
. F" @0 J4 q7 e8 v - *
/ t, @; X1 [- d - * brief EDMA3 Test Application
6 b5 d* Q& Y$ ^; s+ j% w) s8 Y7 d( k - *
! w- S- r8 u: N: ~# b G! T7 [ - * This file contains EDMA3 Test code.; O9 Z6 Y. g0 U
- *6 s" m4 T# }, B F8 `$ A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- q' {" M% ]/ o, f - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 U% N2 t0 ?' p: v! O$ ^) ] - * TO CHANGE.: k' d2 @! [9 o8 S) I
- *& T' [$ P4 L; b6 M# {- N+ B5 g6 l
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( D, v, E) _: N6 u% l
- *; s( t `8 O) p0 H5 |3 O$ z4 L+ s
- * This program is free software; you can redistribute it and/or1 @. M3 n- H$ w5 `
- * modify it under the terms of the GNU General Public License as ]% [2 A) _/ k7 U. |
- * published by the Free Software Foundation version 2.9 g1 T; D" ^+ ^
- *
' P" B3 k0 k/ h* I+ S1 I - * This program is distributed "as is" WITHOUT ANY WARRANTY of any a x. E* N9 T' q2 E1 l! C5 W
- * kind, whether express or implied; without even the implied warranty
; H: `# b6 m) B. i! E1 Q - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- k, L7 v5 O, E0 p8 T; d1 J0 {
- * GNU General Public License for more details.- i: L1 F/ M3 _- I
- */
! A2 r0 Z, U" Q: ]" A - % |7 p- _- c/ D; A
- #include <linux/module.h>
3 O' w, ?+ c$ `/ A1 U" d3 ?0 @ - #include <linux/init.h>
- R8 d( V F) {7 t/ R0 p0 L! @& y - #include <linux/errno.h>" B; k" X& e' y" @
- #include <linux/types.h>, T" L; E+ S4 l1 }- A, F$ R8 F# f
- #include <linux/interrupt.h>
: n" V% i: t4 k, C% J; [3 W - #include <asm/io.h>; s, p C) R' T/ N7 v6 a
- #include <linux/moduleparam.h>
" m/ ]5 }+ B; f+ E" _1 P9 [ - #include <linux/sysctl.h>7 U6 ~6 T# [3 Z! B
- #include <linux/mm.h>
G$ e' w$ R$ N - #include <linux/dma-mapping.h>
" K: X% U, N' g1 a
2 I; F3 w5 j9 f) C- c s9 v- #include <mach/memory.h>
/ a% R# c7 c: P; Q* ~7 E& r0 {0 B - #include <mach/hardware.h>
) b" s6 k4 a- Y4 d4 M - #include <mach/irqs.h>
6 i5 z S! ^* F; n2 o$ u - #include <asm/hardware/edma.h>$ U# C1 j. U: ?
- @$ o$ i$ V" ?, W+ e. P- #undef EDMA3_DEBUG
( Z; V7 \8 Y' ] m% V - /*#define EDMA3_DEBUG*/
' P5 p: |1 k" c; i% o; |* F
% i& |4 D' c9 L3 _5 [2 b- #ifdef EDMA3_DEBUG2 i, x3 B4 t: U. I; L, R0 D" L! u
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) A' M9 r4 e2 A2 K, D+ }& j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g* }" b. t! L. Y& F ^ k* N: F4 p
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {1 @8 v5 m4 }7 V7 S; a3 u
- #else. e8 B" i* Q. j& I( {; g
- #define DMA_PRINTK( x... ). t7 u3 @) W! o$ E) g. s% V% e
- #define DMA_FN_IN5 I/ s" v4 B. P+ X6 m$ c
- #define DMA_FN_OUT
9 F. ~' g6 y) r9 x' J1 ?4 e6 r. n6 F - #endif
0 K# S: j& n v4 i% k - & H+ s" ~9 j# y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ E6 t+ h/ E+ ^5 X) U - #define STATIC_SHIFT 35 G% d9 N8 B, }6 {. d0 p" c( n
- #define TCINTEN_SHIFT 20
3 z3 t; B" K% ^7 L5 \. c# O - #define ITCINTEN_SHIFT 21
4 o1 l" S8 ^, E* k: C: W3 h. t - #define TCCHEN_SHIFT 222 q9 R) @2 [% z A
- #define ITCCHEN_SHIFT 231 a' Z( U. F8 h1 q6 n. l- D% d
( a7 p$ X* W3 U1 y) Q- static volatile int irqraised1 = 0; W. m8 h# |* p$ _5 s4 v9 @% Y
- static volatile int irqraised2 = 0;1 r, K: a6 V' q
- 7 D" g5 O/ k: t4 \$ g; b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, Y7 _* O5 [6 K9 l; a6 Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 B. H. O$ i1 T: w - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Z3 Y. I; \- V. [* ]. i
7 @! u) H$ E2 p5 ^8 }- y& H7 E- dma_addr_t dmaphyssrc1 = 0;7 y O7 w% R1 k. q( G9 U
- dma_addr_t dmaphyssrc2 = 0;
, Z9 R% b' y2 z# C- ~3 t - dma_addr_t dmaphysdest1 = 0;0 ^- Z" x2 w7 D0 L) w6 V
- dma_addr_t dmaphysdest2 = 0;
6 k" b! k( x) N) U' ]+ W2 W
5 `# Q2 u# B5 [- char *dmabufsrc1 = NULL;$ v& {/ Y8 p' N. h7 ~3 f
- char *dmabufsrc2 = NULL;' A3 P, ~$ q# E2 h8 e1 p5 f, A) s
- char *dmabufdest1 = NULL;( V5 c0 E; q4 _9 K9 B7 G" v3 N
- char *dmabufdest2 = NULL;
. |: m6 O1 S5 c0 @2 c4 \ - 7 s; W6 \8 _$ D. y: K9 E
- static int acnt = 512;" O( w s! I5 b h9 X
- static int bcnt = 8;0 s$ ]$ k& ~: X5 ` t
- static int ccnt = 8;3 w A7 l1 |9 d* S( |. q- N
7 O3 r1 T! C% M1 d! C% y- module_param(acnt, int, S_IRUGO);4 b( ?& t7 r0 |: E0 W
- module_param(bcnt, int, S_IRUGO);. v9 q2 C! X! L4 N9 F7 Z
- module_param(ccnt, int, S_IRUGO);
复制代码 ! ?: T2 U, r% W* j
6 l/ P1 P* v4 A" L* J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& \' z, m2 U8 b% K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 C7 @* E; f: U2 U 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# \; D# x7 y' U8 l! A; k7 \
1 h3 W% s( S! L/ N) Z: g# o/ {# r5 ?
3 F' ]: f6 T) w+ e1 y! A |
|