|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B- D" ]/ A" ~, }5 B2 e+ T! k- [code]EDMA sample test application
* d+ K: \- Y# i# ^8 e - /*. X) V8 [- G$ r
- * edma_test.c, R/ D |' m- _
- *" z$ N% j$ I8 B! ~1 _
- * brief EDMA3 Test Application
( ~5 C2 Z s9 v9 F - *
9 q0 D- X: Y& z/ W1 |, [8 {9 }( K. ^ - * This file contains EDMA3 Test code.. K' X: K1 _! I4 i6 h2 v8 Z
- *
7 {) ~) ^- c, _ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 M) d0 n4 J1 l* h8 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 L/ ?5 B* ~) X8 L* C
- * TO CHANGE.
" b; I, _& ~( f* _. s - *
* ~) A0 ?( Q; Q! l - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 m+ f7 h: p3 q5 F/ m7 x2 g# u - *+ n& u" N7 {; F; }; C8 f k
- * This program is free software; you can redistribute it and/or
! j3 ~# S. z/ o- Q" W - * modify it under the terms of the GNU General Public License as- s- f8 ^+ }7 d* j' `
- * published by the Free Software Foundation version 2.# n' u x- }$ g
- *
. L" s: [3 @0 y7 }" }, w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& Q+ q1 Y4 ]# M& p/ g, T
- * kind, whether express or implied; without even the implied warranty. l$ } c5 v6 h1 ?; {, l
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 ~" h* s& c8 F' L& w+ P) I5 l - * GNU General Public License for more details.
7 ^- b1 g, d9 y8 n2 W - */
^6 |- o' r7 c$ b& e; ]( q
: ]; |! v Y9 L7 M( S- #include <linux/module.h>: P% g w# x$ A/ v
- #include <linux/init.h>
7 r3 t: {& t i+ H4 [& A- {* v - #include <linux/errno.h>
. p2 i) H4 F6 P- C9 b0 v5 h% a9 t+ T4 ` - #include <linux/types.h>0 ?+ B: @9 |" U
- #include <linux/interrupt.h>% x( R- Y* H# _. K8 h3 S) z( T. ?3 M
- #include <asm/io.h>, W" C4 P; r4 P8 q: t1 _. X( n7 H
- #include <linux/moduleparam.h>+ k& K" h$ x3 M# m
- #include <linux/sysctl.h>
9 O0 g" |. I/ {5 ]9 l6 G' U. q - #include <linux/mm.h>8 C3 Z8 S# g! h/ T
- #include <linux/dma-mapping.h>
" n3 i, T" x- M& c/ ]
5 `1 K) A5 F& s' X3 d- #include <mach/memory.h>" N& c5 V3 i3 i P( f5 Z/ i3 U
- #include <mach/hardware.h>: Z0 F, R# @+ S* ~
- #include <mach/irqs.h>
8 W7 e: w$ P) J# L - #include <asm/hardware/edma.h>
8 h6 k' ~6 V5 H: Q- r. D# ^8 Z
% a( B' h$ E3 F9 s, A2 S3 w5 v- #undef EDMA3_DEBUG7 k1 I1 d2 T( g* F
- /*#define EDMA3_DEBUG*/- C/ j" K3 O$ {" S# I5 f
- / p! v2 P; u! c$ B
- #ifdef EDMA3_DEBUG
; l5 Q% u; n. w: e# o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 f% Y* Z$ t$ _. j0 b3 U - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) e j; m- W, e. [* x) h" s' [% J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
- w( ]- W3 j. ^; s$ H - #else
: x* M+ E. Q9 f3 ]* ^: q2 V - #define DMA_PRINTK( x... )4 A8 L# ^0 H" x0 D
- #define DMA_FN_IN
1 J( Z/ J; E. k; B - #define DMA_FN_OUT8 A* R) _; D) k- X2 R# ^1 t6 v
- #endif
: Y( Y, c* R- K. B* f2 F: `* [6 j - ! v3 v& _$ g1 A5 g: m$ E
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
}+ w) V* X Q/ y - #define STATIC_SHIFT 36 T& J+ [ m: a& s
- #define TCINTEN_SHIFT 206 \3 f% _: j& X! w: S+ O( [
- #define ITCINTEN_SHIFT 21
5 C q& J+ Y% t6 G) T - #define TCCHEN_SHIFT 227 r1 Z# O1 n p+ y5 D- z; K9 ?
- #define ITCCHEN_SHIFT 23
3 j" J2 t5 |2 S2 z* J
0 {9 V% U }, @0 C- static volatile int irqraised1 = 0;
- V6 L2 g8 B- y - static volatile int irqraised2 = 0;( e% u/ ?% l8 e1 P# n' @* b
- ) m! v% E2 ]) G
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* r4 x. V5 @4 g5 W
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Y+ B9 I3 d8 T" v) F, ?) u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ~% ?% @- {0 @) B: w
- ! g3 F5 X7 i+ H. L0 B
- dma_addr_t dmaphyssrc1 = 0;+ u: C0 E, u5 h" Z* R: f
- dma_addr_t dmaphyssrc2 = 0;
( j$ u! b W/ \# s0 }' a - dma_addr_t dmaphysdest1 = 0;
' ?" V1 G- K; O5 H4 J - dma_addr_t dmaphysdest2 = 0;, q# R( x9 N0 O
- u7 l3 J0 B/ c! q/ U0 O
- char *dmabufsrc1 = NULL;
& U! M9 b8 Q/ t. ^% @" | - char *dmabufsrc2 = NULL;2 j# G& ^( D9 r: p l# [
- char *dmabufdest1 = NULL;/ O; @0 |4 I) B1 Z8 L2 _, U1 \0 @
- char *dmabufdest2 = NULL;
# x$ W& T# m: R( G0 z# A; n - : |' p. O, o; w) d0 }# Q3 ]
- static int acnt = 512;/ F; ^3 a! X# e$ d6 B1 A4 i
- static int bcnt = 8;
& |3 o2 Y5 `! Q5 @8 u% p - static int ccnt = 8;3 k; b' p I2 K" ~# q6 y' u
- ( z9 ~5 _( }' [+ ^6 M$ w& ?
- module_param(acnt, int, S_IRUGO);3 T, d, A! d" J
- module_param(bcnt, int, S_IRUGO);
: y9 s+ ]1 M7 M1 z - module_param(ccnt, int, S_IRUGO);
复制代码
, ^8 L/ @4 z1 p6 I1 R. F( u$ k
! R; M( }% U4 g+ o" ]' b g; M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 f. x! u! T; h; N
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 [5 f( l) u 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 m3 |8 S7 H; ]" ^3 ?
' k( G2 L9 N' Y u7 {+ [! f) d/ ?6 z6 ]7 F* Y
|
|