|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 r; T+ [7 Q6 b7 b" j0 b5 b
- [code]EDMA sample test application1 l# Y5 ~3 u9 G) }9 h- ]
- /*
3 k6 b) C- U& b - * edma_test.c
T6 ^: T3 J- q- [ - *6 \/ z" b# s2 G5 Z9 M0 ^
- * brief EDMA3 Test Application
+ a4 D5 U7 y1 y5 e/ g1 N - *; ?7 b* p' F4 v4 T
- * This file contains EDMA3 Test code.
1 ^% v( u* Y, H$ @8 S( H# ~7 { - *& r: U+ _8 u& T4 s0 _
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& i+ H( a# l, V1 u2 r
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: M7 |* O; \0 s( R9 u! Y
- * TO CHANGE.: V) ^' i3 F1 g/ R; ~, e: m9 a
- *( {/ E3 @, \& a! S K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ m5 P ^! {# }0 p" ?
- *6 E" D* t' C) R0 Y |* o
- * This program is free software; you can redistribute it and/or' a$ ^8 b( L: o A, A
- * modify it under the terms of the GNU General Public License as* X: w2 u% v0 f8 c8 m. x# E
- * published by the Free Software Foundation version 2.
4 B! R- G) ?* g: y1 r - *& p7 x% G5 s) S3 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 j+ n v, h. g* v - * kind, whether express or implied; without even the implied warranty; Y9 p# L t7 \: b( Y1 g9 g- x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 \5 Z+ R3 a) Y
- * GNU General Public License for more details.9 ]0 e0 ?3 ]1 N/ t% s
- */2 y' d( C# q, O1 W8 ]
- U) }# |* [! G2 A- #include <linux/module.h>/ v3 ^3 d' C5 @, h: D$ m
- #include <linux/init.h>7 \" J( s1 [0 a8 H. C0 B/ m9 v
- #include <linux/errno.h>
! b9 m7 S" r5 S- N. ?' U - #include <linux/types.h>8 {4 u' ] v7 n) n4 Q, u! X& B- S
- #include <linux/interrupt.h>
& y0 Z$ ]/ M' N( p6 I - #include <asm/io.h>
, A5 M# j, c0 T7 I f0 a% M" r& n- K - #include <linux/moduleparam.h>, D2 R8 {+ B0 `/ O
- #include <linux/sysctl.h>
0 A5 l& h! P* ]- B& k - #include <linux/mm.h>
- B3 [' J! a& q. u7 L - #include <linux/dma-mapping.h>% d* ^5 y3 I, y7 G# H
6 y" _- J& W% ?4 o' U3 Y2 C- #include <mach/memory.h>0 l; Z6 P9 z" S7 w* ?: {
- #include <mach/hardware.h>
- h4 k8 _# I0 m: g+ t2 F - #include <mach/irqs.h>
; y" D! {5 w. [4 q# q - #include <asm/hardware/edma.h>) G- o- t3 r7 v$ x7 K, W
- , n0 }) O0 c) `- z
- #undef EDMA3_DEBUG
. Q5 C/ S' j, R2 I2 g0 j9 `, T - /*#define EDMA3_DEBUG*/ J3 ^' e, E7 F. t
- " F; U+ m3 c' d6 J
- #ifdef EDMA3_DEBUG3 p; O0 ~/ Q( o$ M2 J0 j
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 M* f) {* U) t/ S3 m* w
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- T9 H6 u) o; z( _$ T
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 f; ^8 h( p! X; h/ u' W - #else
. a& j2 S& p# S" z1 T - #define DMA_PRINTK( x... )! c! T& p- e% W; R3 A
- #define DMA_FN_IN
9 G* ^' D7 b$ u5 M# D" n - #define DMA_FN_OUT
% P: P( b6 ^; b- b3 k - #endif
$ u8 B. ? g' ^3 c: U$ N - 8 P! O, m8 X) @- ]; P( ~! a% e
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' ^( \2 Y) |* H, J8 `' O" w - #define STATIC_SHIFT 35 k! _; e( X `- H
- #define TCINTEN_SHIFT 20& M3 ?% F0 O. Q( [. g
- #define ITCINTEN_SHIFT 21
& F" Q, U! O& q: j, a4 W; p @ - #define TCCHEN_SHIFT 22
! j' P& h5 B, Q - #define ITCCHEN_SHIFT 233 p4 m0 R! O$ Q& \6 U5 G
- 0 I4 T' Y2 ~+ e
- static volatile int irqraised1 = 0;4 n6 Z; b6 V+ W1 Z) K3 @. |5 B
- static volatile int irqraised2 = 0;3 z6 A7 {! _0 B8 P3 r( T( I4 H; H
! v3 A& z: w" e* s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( e$ i4 _9 I; i. Z9 n1 y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 P9 z9 t. m; F, ~; a% c4 ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X" g ~# v1 C: p. N3 Q. O
- 8 ^' W: b0 m3 n* v# o0 c+ C& j
- dma_addr_t dmaphyssrc1 = 0;
- j2 T$ T; V$ e3 P8 _4 h( `3 |% _ - dma_addr_t dmaphyssrc2 = 0;
1 T2 F* K9 Q7 l r1 F - dma_addr_t dmaphysdest1 = 0;
5 {2 z$ D4 L* U6 d, e0 T - dma_addr_t dmaphysdest2 = 0; S" K/ s c! N' t
- . p2 v* x* n7 Z! d7 p' n
- char *dmabufsrc1 = NULL;% W% s, G3 N# O6 q9 _8 O
- char *dmabufsrc2 = NULL;! ?, t+ i# t- O/ @8 E4 E" t
- char *dmabufdest1 = NULL;
' Y8 u% r1 l1 v( p( Q - char *dmabufdest2 = NULL;
4 p$ e7 e" s2 H6 K. f' T
, m k: }5 @; c0 p! k; L, K1 t6 o- static int acnt = 512;
0 k7 g1 l( C: o4 C2 H7 J9 E0 Q - static int bcnt = 8;: s0 ~. {. h6 w/ {, Q1 }; I8 V8 a! \
- static int ccnt = 8;) Q7 W, T" D8 [7 c; j* C8 J7 m
- : d4 U* D; ?9 }4 z
- module_param(acnt, int, S_IRUGO);
0 \% j$ Q. y% r% R7 y: |! O - module_param(bcnt, int, S_IRUGO);
- D9 k- c5 ^9 N' y4 G - module_param(ccnt, int, S_IRUGO);
复制代码 7 o* [. l, g( B9 P% V
4 [% W, Q7 M* Y P, {! u1 c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 f: k4 L8 S7 F9 [3 j1 x; u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 }6 L% a u: T x5 c
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 r3 H. }* f. B/ _% s
" u: Q% ] O( M' n7 K; w7 D) j! T4 Z6 n0 A/ k& c' @
|
|