|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # Y9 O4 r3 u/ r8 Y# e0 P
- [code]EDMA sample test application
1 [$ R" A: V" V7 w9 Y - /*5 W7 |' e5 M1 Q! E7 _
- * edma_test.c* g1 b3 q$ M4 R$ Q6 K
- *
! E/ a* z5 S" S- c6 O5 c* C% u5 h - * brief EDMA3 Test Application/ v7 `, x$ d5 q0 h
- *
# v3 [$ p/ K% q5 A( r - * This file contains EDMA3 Test code.9 `, m3 K" t" V* _- B' U
- *' V9 e8 C! o2 J9 A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ^' f9 H6 f7 S5 i9 I. w7 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) o* g! E" i7 a, P3 ~0 S - * TO CHANGE.
2 f5 P' q5 S) `) j5 w& s) v O# I% O - *% q6 i* A# g+ z$ [& d( n3 ` W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' }. E6 [+ F) k. V' @
- *
% z- Z( c) b7 x1 a b7 A8 \ - * This program is free software; you can redistribute it and/or
. N- J" u6 \" m8 ^ - * modify it under the terms of the GNU General Public License as
4 V, K# M' y: z( a* N' Z5 N5 f - * published by the Free Software Foundation version 2.5 a" j* f$ \. G
- *4 w7 `7 p+ p5 G7 c9 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& f$ F8 q4 `4 g0 p% z - * kind, whether express or implied; without even the implied warranty+ d4 |4 G, r! i0 W
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 H9 ~: q; C' H
- * GNU General Public License for more details.
9 U' @7 ^' j5 E" K - */
! l8 ?$ R1 S+ m: z- ~0 b9 P! ? - ; N3 i( D. j( O, C* z; t* J
- #include <linux/module.h>! t6 i/ Z3 w, Z# Q) S$ s$ v6 _! [( s" S
- #include <linux/init.h> y& G: o! i9 ?8 O8 f7 s
- #include <linux/errno.h>1 v8 t7 ?; m0 S/ `5 C
- #include <linux/types.h>
. \# c6 @2 Y! G; x8 X) U* Y: r0 Y - #include <linux/interrupt.h>
2 g% h: \; Z- ^7 ]$ w - #include <asm/io.h>
Z$ B$ p2 v0 a" I& V0 H3 l - #include <linux/moduleparam.h>
; V9 R( v o+ Q7 N8 W; Y; h* F - #include <linux/sysctl.h>
4 O! A$ B: R5 r! S5 x @; r - #include <linux/mm.h>) b: K. U7 Y: k* W" \( z
- #include <linux/dma-mapping.h>
* K9 S! M, y+ _ - * d: H3 P3 _; \; D, h
- #include <mach/memory.h>
2 h) Y/ O) v' H/ V% @0 D! a - #include <mach/hardware.h>% r( Z2 R+ C% c+ x1 h; o# N9 ?
- #include <mach/irqs.h>" {! b( h' q7 b) }
- #include <asm/hardware/edma.h>
7 R! J" Q" ?8 u) v& y2 N( Q: Z - # z i! e/ h3 D
- #undef EDMA3_DEBUG
5 p4 | N5 v* s9 n k% e. Q/ H8 u - /*#define EDMA3_DEBUG*/1 H8 F+ A/ Y7 i2 Z. M
8 M! r2 m% b; L7 ?! X- #ifdef EDMA3_DEBUG' T# g2 N# q) q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' N% O& p1 E, @+ A7 O, E - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 a9 U7 Q6 Q( G( J - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ D3 L( z( T5 @
- #else0 v' e- V* C# d \
- #define DMA_PRINTK( x... )
7 H6 z' C* r4 w - #define DMA_FN_IN
/ V$ z0 | i' U V! Z L5 y! t7 P+ Z - #define DMA_FN_OUT' \& k7 X, a' b& L- h8 v
- #endif/ V: ^/ N, Z% t/ A4 A) v! T
. S+ @% y+ d- d- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# J, ]$ Q7 A, K - #define STATIC_SHIFT 31 M. z( K4 [9 k' h" M
- #define TCINTEN_SHIFT 20! a# h' d. M: H% {9 Z
- #define ITCINTEN_SHIFT 21
" s2 B6 {% h7 d% X) V7 t - #define TCCHEN_SHIFT 222 R- v2 {3 Z7 D9 M& Q5 o
- #define ITCCHEN_SHIFT 23
1 {% r! r5 j1 [3 [' G2 u' [& W
+ v. ]! J7 r( U' B; Y- static volatile int irqraised1 = 0;, o1 C0 n3 t! L _( k
- static volatile int irqraised2 = 0;$ W2 c* {8 y$ [
W8 ^7 p! t# H5 h- n+ h, n- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 D! k* j$ X/ Q) ^; L4 w - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# A7 Q; j( z0 @4 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! C, d- ~9 {% U
- # J. P6 {0 Y c: S, n0 n9 S
- dma_addr_t dmaphyssrc1 = 0;
! b8 A5 u0 z( U z" X9 t - dma_addr_t dmaphyssrc2 = 0;
5 J; O4 ?- i' n. D3 c2 A* g7 n - dma_addr_t dmaphysdest1 = 0;
2 E9 T& i2 R7 t# @ - dma_addr_t dmaphysdest2 = 0;
4 i! O* n( v2 @3 a& a3 | - 9 O1 e1 v" r, F) x/ W
- char *dmabufsrc1 = NULL;" |/ s7 S, b( G) S8 i. h1 ^
- char *dmabufsrc2 = NULL;1 d" H( Z" A3 ]/ Z/ O
- char *dmabufdest1 = NULL;
0 `0 a- [6 E* [' K# \: z - char *dmabufdest2 = NULL;7 I b' H7 l2 ^) \
W; t; k9 C& @# Q! R& q- static int acnt = 512;# Y9 g! U! M% X
- static int bcnt = 8;& E- L1 `3 r! F6 x+ l- p* q
- static int ccnt = 8;( K4 Z! R7 C8 `& h
- d7 g# {- ]3 |3 Q% w6 j5 f% T
- module_param(acnt, int, S_IRUGO);
! |2 z# i! d4 E/ J" h1 N - module_param(bcnt, int, S_IRUGO);2 U! o3 P# F/ V8 u! m/ T
- module_param(ccnt, int, S_IRUGO);
复制代码
0 s( q- X: c9 k$ \- x( Y0 D$ l* ]) p; C$ n3 n0 B! i
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* g$ P; j8 p, T
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 o" i0 l- W: V; p2 X0 f 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) i5 r) a9 V' c W" v$ U
; k! B; r/ y9 r) W0 p. w3 Y# c$ s( Q* _0 {) T; X
|
|