|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ _% ?6 r" k1 Q3 Y
- [code]EDMA sample test application) X! N# I% p1 h+ |7 ]$ v
- /*( v: }1 F2 ?8 C1 _& Q+ S0 _
- * edma_test.c
6 P q8 @2 g6 n3 \7 r; x7 M: f - *
7 s2 t1 \; f& `; a - * brief EDMA3 Test Application: ]1 O# u" Y3 r0 O
- *
) x3 t: _! d4 a( m - * This file contains EDMA3 Test code.4 ^3 \% M7 H# v! m2 G" ~8 f3 C- g
- *
4 B; u4 Y1 C6 r; { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 @6 S6 M% K6 J( l - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 W' l! o7 d9 L) m ^2 H - * TO CHANGE.
4 F$ I1 l8 |& \1 J/ ^0 I7 { - *& Z0 O" M l4 e
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// g& Y8 _5 F4 N9 O# X5 {! K
- *5 O2 G: u8 G% }" `) y9 y
- * This program is free software; you can redistribute it and/or
1 |! s1 z' O/ x4 G: r. I& w- C5 [' i - * modify it under the terms of the GNU General Public License as6 M! g+ p# T k; | g
- * published by the Free Software Foundation version 2.: U' d* t6 W" b, |. Q# ]6 w
- *7 ~2 g+ k3 D+ {) n
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. }. X* l( x9 m- [0 t+ E1 m - * kind, whether express or implied; without even the implied warranty
! M# n) V( w' M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 ^% z& ?4 f9 L+ w6 c
- * GNU General Public License for more details.
/ m$ T: O( V: }( x6 }, {& a - */8 V/ O9 o; _1 @9 U) s# X1 }
- " s, j1 Q D$ D0 M+ k" z+ J# }" l5 I
- #include <linux/module.h>6 u3 p5 d2 ^: e9 ~4 u& e
- #include <linux/init.h>
* ?9 n& J& \, X, n# \' U - #include <linux/errno.h>0 f( d1 h" q& @2 W
- #include <linux/types.h>2 v M$ X( J. h, \4 ~+ l k
- #include <linux/interrupt.h>, p) y: b- x0 [2 m+ `" ]
- #include <asm/io.h>
5 ~2 h+ t9 J5 ]# X3 G6 a3 D; o z - #include <linux/moduleparam.h>
* Y" T( q" x! L; [3 n - #include <linux/sysctl.h>
! t# [) R/ V2 i6 V( S4 s - #include <linux/mm.h>* b8 G5 y% {3 ^+ ]/ E
- #include <linux/dma-mapping.h># h A3 F% Y* a
- 1 v ~- q |3 p: M, F* w' F
- #include <mach/memory.h>
. C, q3 ]# `7 @ K( j' S8 P - #include <mach/hardware.h>
, b+ W, U6 g* S - #include <mach/irqs.h>4 |% X) T+ k3 X4 H5 ^5 `
- #include <asm/hardware/edma.h>9 W" r8 d5 R6 K
- ( g& l5 E* A) d, G, k
- #undef EDMA3_DEBUG' ]; f* s$ Y; c U4 }7 o9 b
- /*#define EDMA3_DEBUG*/8 i0 ?, o! v# V7 s4 C0 d
& C0 L5 g8 u" N( F0 `6 [- #ifdef EDMA3_DEBUG
0 K$ g" ?3 U2 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( I0 B- B; G( k$ B$ _9 m/ r
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 |/ S, e1 l+ |( B) n - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
, z, [ h9 m3 a$ o - #else
+ e- g# z$ ~/ D' Q0 d - #define DMA_PRINTK( x... )
; J7 _3 o# h4 w4 F( z - #define DMA_FN_IN
5 `5 t8 m( G2 g& ]8 X5 K) G - #define DMA_FN_OUT2 t/ r% ?9 K, X% F4 C# {3 Y& p! z
- #endif8 ]& D1 o& w! K; j0 J' A: Y. S* y
- " v' ]1 G4 `6 _! f3 B7 u" z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)8 H* e; _ S( e5 z. W
- #define STATIC_SHIFT 3: G- I$ J! f; M7 V4 p" w& F
- #define TCINTEN_SHIFT 20
# F7 y" c8 C! D: `% h - #define ITCINTEN_SHIFT 21
! L8 ?# I) O- v1 { - #define TCCHEN_SHIFT 22* m7 A+ N _4 U. K8 \
- #define ITCCHEN_SHIFT 23
1 |7 g R% h5 l) z. R. l/ ]: I
% k- F5 u2 }0 X- static volatile int irqraised1 = 0;
5 ~' c( ^ \' ?) B. c- Q - static volatile int irqraised2 = 0;/ _" |3 J, i# m) I
1 ^. R- v5 g2 m1 @& C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); g! L; Z# E" `% t% ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. {( H* z7 \ |' e+ e( u! g - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 I8 m, {+ ~$ T% ]3 U8 ~
" ~9 ?% D9 ^5 z* P8 B7 w6 r- dma_addr_t dmaphyssrc1 = 0;2 c" n+ b3 o. l/ p" @
- dma_addr_t dmaphyssrc2 = 0;
0 _( w1 j1 J* {% k3 B- w - dma_addr_t dmaphysdest1 = 0;
/ w2 O& ?. W7 |* L" a5 T - dma_addr_t dmaphysdest2 = 0;" v3 y( a9 c- H( c
* m) s ]0 T0 r- char *dmabufsrc1 = NULL;6 d& \7 t: @6 C& _. X: g3 H. B$ X7 z
- char *dmabufsrc2 = NULL;
! H8 W' ~9 e$ \& e( e - char *dmabufdest1 = NULL;, y! P- E6 Z% z# c
- char *dmabufdest2 = NULL;
C& h7 k( j/ @! Q* ^
6 ^# p( L, }9 p) \. U. p* b9 D d9 W- static int acnt = 512;* c& V- h o* a) Q& k
- static int bcnt = 8;
$ ]! F! ^/ D5 n7 o - static int ccnt = 8;
# n: G& T K. Q3 H9 u - $ r. _* {8 `, K" n$ I$ j
- module_param(acnt, int, S_IRUGO); k% C7 s: M( C: U3 J8 `4 h2 R
- module_param(bcnt, int, S_IRUGO);* a5 Z" x( \" g k; \( C+ T, n! N
- module_param(ccnt, int, S_IRUGO);
复制代码 . m: u+ s! D4 r9 o
$ Z. m o7 u V4 B9 |# N# C# G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |$ B6 t( r2 A* W$ Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 a$ ?! C: Y* B" i1 x; t 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: Q# J- q U- P* U3 G
6 D4 U# D$ M6 M
( w) V2 Q) N# z6 e |
|