|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / U5 l, v! h+ u! g& |
- [code]EDMA sample test application5 C( E& a. _7 E' h0 O( ]) A7 {
- /*/ Y" Z' U4 a. e% Q
- * edma_test.c
% _2 j) s( | ~5 Z - *
7 I7 S! M" I4 N. T8 g* y - * brief EDMA3 Test Application
% g7 j, Z- Y& J2 y" T% E# U2 l9 z - *
( D; L( S3 h& b, R$ @- J- E - * This file contains EDMA3 Test code.
1 V! ]1 c( k8 X* Q: ]1 C - *
: W/ x' F3 k4 e: p4 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 @9 D ]' [% z! p% Y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 e' z$ s( t: H, p0 Z% b1 z - * TO CHANGE.
- o+ {) S h3 O; y - *
o3 a( t( h4 d/ r& ^, c7 ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ u8 o. s2 H, G. c6 _4 L' _$ Q - *( ^: y( R! O4 S! r( D& b
- * This program is free software; you can redistribute it and/or
* ?6 e6 W o5 C. m$ F" r - * modify it under the terms of the GNU General Public License as
1 V5 n3 f& P& Z8 g% h, E - * published by the Free Software Foundation version 2.
T- q. L+ t1 v3 c - */ i7 G% N' I# b/ ~0 j L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 n) G5 [' @) w& _, R' | - * kind, whether express or implied; without even the implied warranty% k% m1 G @/ o& @4 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* K' q8 a7 g4 e! S- ^& Z5 C
- * GNU General Public License for more details.
+ U! G: h$ t$ B! n, k0 \9 [ - */
8 ?1 T0 W2 D1 z( }: k; |- Y1 W
. H0 o# Z" g0 V, Q% z3 x" U- #include <linux/module.h>" x7 F" Z1 p$ v0 `& c- x
- #include <linux/init.h>
) g0 X9 U2 d4 a( X0 K - #include <linux/errno.h>6 N, k( a6 U% J; X! m; K8 W! J
- #include <linux/types.h> J$ t% A1 N# f4 r
- #include <linux/interrupt.h>7 y' Y8 \0 [1 p5 U
- #include <asm/io.h>
# m9 l: Q- [- t - #include <linux/moduleparam.h>
: r' Y4 F# Z3 w+ J9 q3 A - #include <linux/sysctl.h>
1 Y1 l# u2 W$ |# I! h - #include <linux/mm.h>
0 n$ V" a9 h6 J. q. L( ? - #include <linux/dma-mapping.h>. g$ [7 B" `: l9 L- s% D
- # W% c0 N% a4 j
- #include <mach/memory.h>
- }3 y/ x, g+ {. ]8 F; C& k, | - #include <mach/hardware.h>2 m* M i) H! g# |' D4 M# ~; @
- #include <mach/irqs.h>
& S9 W+ P. f0 @9 z% f - #include <asm/hardware/edma.h>8 j9 o, h5 O! S8 Q
- 5 r6 c- ]; C0 k' P7 k
- #undef EDMA3_DEBUG6 u9 ^3 D* @: K9 Y; X. ~4 C
- /*#define EDMA3_DEBUG*/
" r2 K) U3 H( j: W1 q - P( l# c( l, e- B- ~9 O+ I; s; Q# ]
- #ifdef EDMA3_DEBUG1 m$ e) z5 F3 S' y3 `$ z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& i m, a. d' x( E" \/ G - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
a& |1 I/ S' L1 W( a A& { - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* z: G' n. {+ f' d) Y/ v* | j - #else, \7 `6 a0 C" T' |0 O6 `
- #define DMA_PRINTK( x... )" j, |4 a G6 K/ r
- #define DMA_FN_IN: ?, }7 @; H$ F0 @
- #define DMA_FN_OUT
" {" @- x, u6 p* \: ^% q( ], M1 I - #endif
0 @% y$ G* J5 D1 H* e - ; L% e4 Q; h1 T8 b0 t4 f
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
0 A' e! B# H" R6 H# y0 `6 U - #define STATIC_SHIFT 3+ k6 z, {0 o7 f4 B+ Y B
- #define TCINTEN_SHIFT 20
u5 {# D1 k" z. h, y9 s - #define ITCINTEN_SHIFT 21
6 i2 b: B7 A1 a2 x; c7 G0 c - #define TCCHEN_SHIFT 221 d& w6 @ _2 @: |6 @+ n, O
- #define ITCCHEN_SHIFT 23% e7 `7 m) i i& G% M+ o
/ N8 N8 _4 _; d0 Y, ^1 p- static volatile int irqraised1 = 0;6 [% @( \& U3 G, ^
- static volatile int irqraised2 = 0;3 D9 F {! n( P9 B
" n, E; L- w/ j; K4 s+ }# l7 F7 b$ A- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 y) ~: `" L4 c2 ]1 B7 X+ O - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ D. _ T* V+ T2 x7 r7 O9 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 J% S2 \5 \/ m; o( V T5 N
W& [# z) ?' Z# l' M7 U- dma_addr_t dmaphyssrc1 = 0;
4 e/ E/ N" Z. V& r - dma_addr_t dmaphyssrc2 = 0;8 _& L* e) E# I$ z" S
- dma_addr_t dmaphysdest1 = 0;
. b- n& Z' n8 o& ` - dma_addr_t dmaphysdest2 = 0;: Z, F7 B/ O! v' _* M \1 Y
3 l5 W( ?9 C# T- char *dmabufsrc1 = NULL;
+ V/ H6 V4 x9 v' J% C4 F3 B - char *dmabufsrc2 = NULL;
& q& \# L8 w0 j7 B# G6 R8 ` - char *dmabufdest1 = NULL;6 p0 T5 \6 g, I8 Q
- char *dmabufdest2 = NULL;9 y, ?$ C: m7 V" `$ T0 l! Z# b3 a/ G" m
9 X% y7 r$ X4 }6 R: ~- static int acnt = 512;
) Y' z# ?( _' J! `: h4 m - static int bcnt = 8;% t3 F! G/ e8 ^
- static int ccnt = 8;
" {, f( g1 o' ?& L4 H) P - 2 K* W( _& D4 u. E( H" }
- module_param(acnt, int, S_IRUGO);( ~4 D: i: Q' C& y" b* q# U
- module_param(bcnt, int, S_IRUGO);
4 M( s7 s0 Q) N/ D. z ?( _ O - module_param(ccnt, int, S_IRUGO);
复制代码
! [$ Q0 s5 K7 ?" a* ]
6 L, I9 }* M) p* w0 v7 A& X9 k6 q+ \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Z6 n( a& y$ @4 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 t7 x- I- @' ]0 B _1 x 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% T# x0 i# G% h: D) R
+ T w, C, l- N+ {1 \
% ]7 g" X- W5 {6 k8 _" s# ^. l |
|