|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & y* g- l% H$ C5 B' z9 m5 @; u
- [code]EDMA sample test application3 R" I. j0 }$ _3 n7 |% H# V# S" g
- /*' y% C* x1 E4 c$ O: N, L( H
- * edma_test.c
0 m |$ W% |; k2 A7 M, y0 r - *
+ L: q) J" |4 V - * brief EDMA3 Test Application
. f) }4 o d7 q# J5 p - *
- O/ [2 |8 w$ W- P6 w1 E& N7 k - * This file contains EDMA3 Test code.
; V! Z3 H% d* _- L! C' g* M% s& q+ H - *
; I9 V+ J/ N0 n( s( r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( ~ m/ G; m2 V2 i. d( ^1 y - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 d5 x" r" h0 F. r - * TO CHANGE.1 @ Y Y9 P$ J" E/ m
- *& E6 O- a1 {, L, L( T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ K/ k/ a" j0 ~0 a% }2 J - *
5 p& t) K" W& R. j5 U - * This program is free software; you can redistribute it and/or
, k7 W9 L) A* ] - * modify it under the terms of the GNU General Public License as
& o; y2 ~4 m: Z/ B& u7 y, |% o/ _ - * published by the Free Software Foundation version 2.4 L# M$ L5 L* T4 _% g! Q3 h
- *
8 E* n4 t+ v' S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 z+ q& L1 t* q( n/ |5 d* `
- * kind, whether express or implied; without even the implied warranty
4 Y- G# ~. ?' x+ {0 Y+ b - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( e! F6 g x$ D0 [3 |8 m2 c - * GNU General Public License for more details.
6 ?5 l6 N9 p* S - */
. C% O1 R, c7 b q+ |8 `4 D
# c& A u4 x7 B+ I- #include <linux/module.h>
1 j1 b4 k5 Z. l! t5 w# r - #include <linux/init.h> B: c$ _3 n% t t% e1 {6 p
- #include <linux/errno.h>: }. ~% X1 o8 Y" E2 t4 H
- #include <linux/types.h>
! W; u8 h. W/ ^5 [4 {/ A# N - #include <linux/interrupt.h>
8 @" V/ N8 a! z8 `4 x - #include <asm/io.h>
0 ]8 Y: w2 G* c# [3 U - #include <linux/moduleparam.h>( f E; x; l) m6 e( W. V' U3 V
- #include <linux/sysctl.h>
- A6 t$ X y3 U* M6 k N/ g! J - #include <linux/mm.h>
$ c8 O' Z( X" T/ Y - #include <linux/dma-mapping.h>0 G2 C# `) H! f2 i" @
- 6 m3 t1 a( V( l/ A" ?$ j
- #include <mach/memory.h>
/ Q% t% d" C& j0 z2 T7 o - #include <mach/hardware.h>1 c/ r0 W* |" |4 y( ^
- #include <mach/irqs.h> k8 a2 [/ c" z* H# K
- #include <asm/hardware/edma.h>
0 i4 q- N9 h8 H' Y* x1 B6 { - " s2 F: T* c9 |' O; W e% @
- #undef EDMA3_DEBUG
, w7 X. ^8 I/ g# F% n - /*#define EDMA3_DEBUG*/
q7 Z4 S8 v- A% n - # z' } w0 M" Y& g( r
- #ifdef EDMA3_DEBUG
8 v/ S" \, k0 e$ m& {0 M0 D: M7 ?. b4 b4 g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 f( H+ H0 j3 T* c7 H - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ U5 y6 x3 V$ e; A4 ^) {* p: E - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) c/ q) d6 E8 O0 R* B$ H. I1 u, j
- #else/ \' E, F. ^$ x7 C
- #define DMA_PRINTK( x... )
7 c. E+ m, Q+ X5 h9 O+ y - #define DMA_FN_IN
% q2 q/ H% i( `3 T- I- _5 D+ X - #define DMA_FN_OUT, ~3 _9 h: @0 ^8 _6 D
- #endif* |7 ^; D7 h/ c5 ^6 I# m
- 0 B+ }# G: F( ?3 z2 u! g
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; w$ b$ |( A2 ^ - #define STATIC_SHIFT 3- l& ` N( D- n; E
- #define TCINTEN_SHIFT 207 d; M6 z* o6 v# {9 H0 f/ J d$ ?
- #define ITCINTEN_SHIFT 21
3 m; K$ X6 D; W( J - #define TCCHEN_SHIFT 22
+ ~( W) Y0 T, u0 ^" | - #define ITCCHEN_SHIFT 23
' O) n$ \% q' ~4 r- B; ^
3 \6 F, a3 K& \% N7 n- static volatile int irqraised1 = 0;
% j: W: Z6 F9 k; b3 H5 G; r! V3 Z* [ - static volatile int irqraised2 = 0;
0 `3 L* K/ P2 b [" { - 5 p6 g! j5 w: G2 O+ f9 A: @8 s6 V
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); l% W* q5 b+ E( P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# [6 i; z) I6 k0 N$ R& _0 X& b7 G$ ~# ]
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ R" f- y+ I# ]( m. f" G
2 {4 a: h, k- S# {$ [- dma_addr_t dmaphyssrc1 = 0;
8 n9 y3 K. w. W" Y# r* j- O0 ~ - dma_addr_t dmaphyssrc2 = 0;
1 q, ?* C% I7 p: m. w* R7 J - dma_addr_t dmaphysdest1 = 0;- }3 {, ?9 k( {2 w: G
- dma_addr_t dmaphysdest2 = 0;
! h- B) F }2 v9 ~; z) Y
; `( j. m: N0 ^/ w: k0 K. B# M- char *dmabufsrc1 = NULL;/ Z# M9 y! O& z- i1 B
- char *dmabufsrc2 = NULL;3 [( @- V( a$ s0 l
- char *dmabufdest1 = NULL;4 h X- N) R' o5 H; U; I: R
- char *dmabufdest2 = NULL;
2 t O5 D- b) W" [
- X; ~( v- `3 Y& e5 {! c- static int acnt = 512;
( R5 S' h# G' W; R4 P5 G3 J) n - static int bcnt = 8;/ I, G6 l) I- \6 o- h; i7 \3 O' D& V2 b
- static int ccnt = 8;1 M9 d. i' L6 k, U% {+ H$ D
: e5 q! C5 T. w- module_param(acnt, int, S_IRUGO);- _# J: k- p3 d" Q
- module_param(bcnt, int, S_IRUGO);8 o! B8 i ]- Q' @9 o. L+ C5 x6 `# ~
- module_param(ccnt, int, S_IRUGO);
复制代码 . T8 @5 ?' _6 e
. J& ]! e0 ?, g0 E$ i0 q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 `0 P& ]3 u) m+ V8 r' ]0 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" K9 w, S6 m: o! o& b1 J( G1 q4 s1 g 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 B6 j, y1 W6 [! T, `3 `( F$ o
* h! \! K3 R2 A( K! q
9 L- S& @' l! V' G# X |
|