|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; ^; |9 N& q! U J% C$ z* x- [code]EDMA sample test application8 f' R- Q" W B' x) f" i: ~7 g
- /*. a) T9 @0 {! B9 d$ {
- * edma_test.c
' [6 F; l/ }7 m6 A; d" V; I - *( C6 }6 n# v$ j! [
- * brief EDMA3 Test Application
! n! G: C2 W4 L7 g% A- J' U - *
) w7 ?% m" v& e9 K6 n- o, i( g - * This file contains EDMA3 Test code.1 Z& D T1 Q" T1 S1 S
- ** w4 n1 L z6 E2 S0 L$ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ c( o" L1 f, B D2 q8 Z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 W2 |8 z: C& e5 @- A+ k5 a/ ^: H - * TO CHANGE.& n) y/ `: l6 _
- *
4 E- L0 U6 y k1 V$ G4 M% |- f - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' x. ~: |7 |7 Q% w' [" A! @5 [ - *
3 a# p, z0 F T; O - * This program is free software; you can redistribute it and/or
0 c, S) a9 E( | K - * modify it under the terms of the GNU General Public License as
+ {; z2 d& ~, p& t - * published by the Free Software Foundation version 2., ?/ O1 w8 e: |2 c
- *. j H5 k/ e$ t+ P* ]/ `
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 X9 O, H2 e+ c1 \8 F) ]+ ^0 D$ C
- * kind, whether express or implied; without even the implied warranty' q) x8 D A$ v1 }: o' i$ R
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
N9 @, Z' h& Z - * GNU General Public License for more details.& ]# _8 ~, T3 }9 r
- */
; c# x& L6 G4 X; H8 \- l) g$ u - ! E! u. @' a5 S+ G( \$ C
- #include <linux/module.h>
& i9 U* b1 ^0 l" Q4 Q; j$ h- w - #include <linux/init.h> i* Z5 `4 m% C9 Q7 E6 D+ g
- #include <linux/errno.h>- b0 j4 p: l6 Z9 j
- #include <linux/types.h>
3 O- T# [: |/ c9 a3 b' z, v5 ? - #include <linux/interrupt.h>8 a4 h5 D) [. M. r2 d; \
- #include <asm/io.h>
) x& k( t) c* ?7 Q - #include <linux/moduleparam.h>" _: s/ Q& W7 a2 G9 L
- #include <linux/sysctl.h>
2 y, U/ t: I# ^ q7 B: \& w/ d8 ~ - #include <linux/mm.h>& R: Z+ }- ]6 z) _3 t( b4 @
- #include <linux/dma-mapping.h>
( g/ [9 Q B# ~ - D, ^6 S7 b# H1 E: p
- #include <mach/memory.h>& \ [# W# f& f8 v, w
- #include <mach/hardware.h>* v& e: t% \8 [5 V4 U8 P" e8 M
- #include <mach/irqs.h>
3 J# ]3 `- d! p - #include <asm/hardware/edma.h>
! Q1 U s. D; a; j" ?- c' | - # k: ]4 V1 x3 _1 G
- #undef EDMA3_DEBUG/ ?5 s% H* c9 F# D
- /*#define EDMA3_DEBUG*/
' r: l1 p P' |4 A# {
8 o4 R4 G7 w2 }5 w$ f3 E- #ifdef EDMA3_DEBUG6 t1 [6 F" l: N) T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& N4 e0 k9 p4 V' ~) {2 g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). D/ b. m) S, L
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- i$ p0 I( t2 X; Z+ J8 z9 W
- #else% |4 H+ W$ t5 c
- #define DMA_PRINTK( x... )+ K& r$ a, h8 Y
- #define DMA_FN_IN. S- l: [6 u: m% R q
- #define DMA_FN_OUT
$ M! m, f7 Y N, r& W - #endif: w) z" N9 u( g+ U: e
! ^0 N0 p- _4 j: s& f0 \- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
p/ S. O {# j% _" i& E+ D - #define STATIC_SHIFT 3; H$ v j) J) A5 ~- p
- #define TCINTEN_SHIFT 20& w# n. k# ^. h4 v, d
- #define ITCINTEN_SHIFT 21
( X5 V3 o, q) W - #define TCCHEN_SHIFT 22( V3 ?- L' J' I
- #define ITCCHEN_SHIFT 23
/ x; ~, E# d" a. j" c8 H; m9 b
; v; J) r) `, U. D; X/ N1 h- static volatile int irqraised1 = 0;; S2 V" ? w( O' h3 O% V
- static volatile int irqraised2 = 0;2 Q2 F' Z7 W0 J2 F+ Q
v$ b2 l- u, P8 w7 l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 O4 I# ^5 W% v! v# X5 p& N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% S# w6 n, b ?2 T( D( Q5 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i( Y: J4 A. ?) n3 ^; Y7 B
- - p. C* j' x0 x. `
- dma_addr_t dmaphyssrc1 = 0;
7 \3 n! i6 Y _5 C - dma_addr_t dmaphyssrc2 = 0;" f2 {1 _0 O7 c$ P2 b
- dma_addr_t dmaphysdest1 = 0;6 {1 F) U& \# S
- dma_addr_t dmaphysdest2 = 0;, h0 b. P0 I M7 c' h: J
3 {) h4 l% s8 e4 E2 ^- char *dmabufsrc1 = NULL;2 H& R! [+ @ x% n
- char *dmabufsrc2 = NULL;
6 O* f( @/ B7 h1 C% U6 E - char *dmabufdest1 = NULL;
9 `6 ], j# m+ G0 ^ j - char *dmabufdest2 = NULL;
% n7 D# r1 @; I0 x( W
4 T% j9 m& i$ `- static int acnt = 512;6 k9 u; ]! _. Q u
- static int bcnt = 8;$ z% ]& s, e/ [. \
- static int ccnt = 8;- B6 P% z8 l0 Q
- 0 s$ B1 {3 ~$ V* ?& R8 y+ g/ m
- module_param(acnt, int, S_IRUGO);' I2 t( } M' Z" m* [' o/ M' ]
- module_param(bcnt, int, S_IRUGO);0 o7 Q+ J# J3 G; ?3 T5 A8 q
- module_param(ccnt, int, S_IRUGO);
复制代码 ' J# i3 `; q( b I( L
. Z1 [$ ^8 K: i) I) m' N
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: g* Z& o- A4 F, j& M8 Y8 ~# Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% l! S: k. n7 I( K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ a) i/ d Y8 [% Q2 k
/ i: @( T+ ]' e) s) M, U: ^& h' H4 q* s
|
|