|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \+ O Q3 w3 _4 B
- [code]EDMA sample test application
$ `* E! B0 L8 Q# H9 \ - /*+ C9 o [& h; E! ]5 N, ~3 L
- * edma_test.c7 o5 T; k" Y3 @) Y- w& U9 s1 F
- *
$ X0 G1 s- H5 M - * brief EDMA3 Test Application; o4 H: X' ^. u% o+ O# z
- *
2 l/ Q) X k* j - * This file contains EDMA3 Test code.7 z6 p; B+ ?3 }# V; B4 M
- *1 t% W7 ?! H: Y4 J& j) I% J3 q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 `" Z3 X- q! @" r/ v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 b- F2 T0 z( i% i1 Q; `
- * TO CHANGE.
8 B' y% i& w! {5 k% ^ n* X - *
3 f. K4 |) R( S9 L - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( a/ I5 M0 e' H; m
- *6 @; I/ h. e P( Q
- * This program is free software; you can redistribute it and/or5 f6 ]. Q3 R' a
- * modify it under the terms of the GNU General Public License as1 p O4 Y- |. [) Z& h n) w' D( {! u
- * published by the Free Software Foundation version 2.
' {0 v: q# v5 |- W( ?- k - *
# \: {* Y) E u9 ` O B' x; v - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 z. ` ~, h Z: D - * kind, whether express or implied; without even the implied warranty, i E: f" o* f- l! c
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* ~8 K* ^0 m5 }% } - * GNU General Public License for more details.
. p" q1 [& Z# O6 R% S/ `8 r - */
; S y: n C: ]* P3 |
# G6 p6 M6 V7 e- #include <linux/module.h>7 b- u! b! \) q. r* o. }9 I
- #include <linux/init.h>9 h/ X u+ h% Y* x' n; }8 y
- #include <linux/errno.h> r- A3 `# ~- K
- #include <linux/types.h>1 b: y( L3 E P8 b# J2 H
- #include <linux/interrupt.h>
7 D: c: T# O* R) ]" Z; B - #include <asm/io.h>7 U. _, V; D; H: m" B
- #include <linux/moduleparam.h>4 A* Q% L/ {1 y, P$ d8 A5 F! y1 R
- #include <linux/sysctl.h>+ a9 S' q+ ~6 N
- #include <linux/mm.h>
" ~9 ]4 N5 H4 N0 B% d* `" x& ` - #include <linux/dma-mapping.h>
D8 z O' o* t N - 1 f2 U: D8 T" `$ H
- #include <mach/memory.h>
7 F( w3 K/ o( R- } - #include <mach/hardware.h>2 W/ C1 K, J8 h' r) M
- #include <mach/irqs.h>& n2 e, ^& F+ ]7 H9 C y
- #include <asm/hardware/edma.h>" o4 R9 O" p/ z8 ]/ a
/ g+ c# d3 X% m6 W D% d3 f- #undef EDMA3_DEBUG' B$ L. s7 \3 w s
- /*#define EDMA3_DEBUG*/
* g$ l9 Y0 c* [- r) I - + q6 n4 C: n- x1 \. N/ I
- #ifdef EDMA3_DEBUG
- {# q& [$ _1 G9 n& W6 ]9 { - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, y$ e2 m: \% i9 v- G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ G ?0 w# E+ B1 L; Y4 b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 Q- S* U+ q! M( c W: H, b
- #else0 f. G7 z7 E' u3 m/ |4 a
- #define DMA_PRINTK( x... )0 c( l3 M' m3 h% K0 C5 e3 |. K
- #define DMA_FN_IN
" K7 m& l2 ~1 r* R. G5 h - #define DMA_FN_OUT
& t: l( Y" I% @$ t. s N2 a% }0 d n - #endif
; O. U! l! ~+ f9 O0 _) F% H6 n - ( ?3 A" n1 l7 i2 y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 d3 U+ T r. B2 a+ y% ^7 m
- #define STATIC_SHIFT 3
% _# S" X c9 |5 V1 n+ D - #define TCINTEN_SHIFT 20
0 |# D2 P" K! t- c* ]; m/ h - #define ITCINTEN_SHIFT 21
( U" V$ `; u [+ S4 r* {- r% ]! s - #define TCCHEN_SHIFT 22
! n; c! Q' W: q" w% @/ j, M - #define ITCCHEN_SHIFT 23
: E9 a) w' h# q$ h0 Y J1 z
7 Y8 K% ^0 p$ P7 L- static volatile int irqraised1 = 0;
/ W" T2 q& J& [ e& _ - static volatile int irqraised2 = 0;
4 ?" g$ _9 U4 T
* y$ ^! N0 O& E0 x7 g- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! b- I. o; n# ^8 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* {+ z$ w- h( d9 ~5 [ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H! M. |, T9 g, M. k
- 4 Q$ }+ x% a( X- X; Z, {! I
- dma_addr_t dmaphyssrc1 = 0;7 y7 R( U" h+ J: `) g6 `/ x8 Z, p: Z: w
- dma_addr_t dmaphyssrc2 = 0;8 j# x+ k+ \/ s5 A( \# U i
- dma_addr_t dmaphysdest1 = 0;
6 h/ N2 K" J0 f- K1 p7 @8 [% n - dma_addr_t dmaphysdest2 = 0;5 E6 P- q6 D# Y& |
- v+ V1 X) Q1 S+ G) Y6 z- char *dmabufsrc1 = NULL;! ?( T4 e5 d- D) f
- char *dmabufsrc2 = NULL;
- _2 m7 O8 p1 t- R! [6 t8 Q. | - char *dmabufdest1 = NULL;% T/ i& O `0 F. o9 E( B2 Q
- char *dmabufdest2 = NULL;3 R; Y# Z5 k+ B
- : I; a4 F' ]' {# o4 H
- static int acnt = 512;
$ w9 {: g" @* h( P. ]! U( @ - static int bcnt = 8;
( @- G: {% D- H' ]& K9 B - static int ccnt = 8;
1 ]5 u) n8 w: p; S+ U" r - . E$ k3 c1 K6 n/ N9 t ~# A5 x
- module_param(acnt, int, S_IRUGO);. J t4 @# \' c. K1 g" [
- module_param(bcnt, int, S_IRUGO);
! Z0 b& W, _5 ]& N5 c) C - module_param(ccnt, int, S_IRUGO);
复制代码 2 Q( l1 J: I7 Z/ Y9 x7 ~
& R- h$ {/ u: S6 r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, D8 L: F9 p4 p, Z) oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' F8 U5 j. R, \7 L 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 Z \2 W6 v0 e5 T% h" c F. x; j2 C
7 ]; [1 W4 `1 y2 T9 x% R. G1 j- k" R3 r0 E$ j
|
|