|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 y* P2 l9 l- Z5 @
- [code]EDMA sample test application9 w+ V v" I4 k' H4 \
- /*
- u& h- q/ J/ T9 t" f# Q - * edma_test.c
( C0 v0 I8 H2 J7 n' | - *! J5 o6 g$ D8 W9 ?8 c
- * brief EDMA3 Test Application- Q/ Q a0 F& d& ]" |; Q* z/ N, O
- * Q! t8 S- n" B! x, `; ~
- * This file contains EDMA3 Test code.# p `; i B& ~; z5 Z6 [0 s
- *
! u z$ G: @/ u' l0 @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
$ `6 N) f* M" ~ G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 r& t) o3 S! ?' z2 x! J; I) o" Y - * TO CHANGE.
8 O) ?- c! p' B1 t1 F# z, \7 F - *
# |9 }/ p5 K7 E" S - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* e* |/ O( M# v/ l
- *
5 c6 `: Z8 E- Q6 q - * This program is free software; you can redistribute it and/or, O: V* ]2 N3 ~: G P
- * modify it under the terms of the GNU General Public License as- E% m( o+ c6 j: P8 I3 _( r
- * published by the Free Software Foundation version 2.6 b- [. n6 K6 W
- *2 Z8 k3 A' M# R2 I2 {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
& @/ g5 I) ]3 R; T- m1 g) N5 ?0 i - * kind, whether express or implied; without even the implied warranty
( h+ }9 X0 y" X \# X9 r - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( {; [$ Z' Q) R* {0 \. R" T# d - * GNU General Public License for more details.( _5 V2 D7 t3 X1 A
- */7 t* M" z- a: M! m5 z7 k) P2 Y8 ~
- ) T& O0 A- s: C0 b
- #include <linux/module.h>
4 Z* ?) j4 O' E4 E - #include <linux/init.h>" ^4 \; L0 @" F' s3 q
- #include <linux/errno.h>
- X& j R E1 l2 y. I$ R6 t - #include <linux/types.h>
" _, g. ^5 a T) C- l& _ - #include <linux/interrupt.h>1 O, Y, z' @- {' V4 S$ r2 I
- #include <asm/io.h>" x# A2 O* [* e
- #include <linux/moduleparam.h>
, k1 {$ R6 Q, K# n$ a1 _ - #include <linux/sysctl.h>
$ O; X4 R* t* X2 F" I$ [3 r - #include <linux/mm.h>, D' R2 T3 d7 o- E) c2 a' s
- #include <linux/dma-mapping.h>+ P; n) ?. U& X! H% b
- : x' G3 }0 _( |3 H! q0 }, f% ~
- #include <mach/memory.h>
; r: u# r$ Z& L. `8 |! J( @. S - #include <mach/hardware.h>, S2 G {2 u j! F- t( {9 y: i
- #include <mach/irqs.h>
2 \/ s/ }* F4 M% q- W- p - #include <asm/hardware/edma.h>
; F) u* x6 }0 S( G, a4 z& g# \5 l - : b: D, K( V9 q/ L
- #undef EDMA3_DEBUG$ Z( N/ M' D3 D% @: @# L- a0 u
- /*#define EDMA3_DEBUG*/- P1 P) ]) k; |0 z/ b
& |% }0 g2 D, r8 K q, b/ ]+ k- #ifdef EDMA3_DEBUG; b9 a$ w) N& [# f* B- _$ M/ Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
a6 s, w! D8 v* d) q0 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), b6 e2 {' _# ], K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) i$ R$ T% |& m - #else
# Y, r* s- {$ r# R8 O0 i - #define DMA_PRINTK( x... )+ C8 i5 ^. ^8 T% Q( i }4 ~
- #define DMA_FN_IN {$ F# L' y8 C7 X" p8 s8 x
- #define DMA_FN_OUT+ Y6 }, l- i' l! C0 a$ }
- #endif
1 d2 U) |6 ?' ?/ p& f" B - o& B1 f: N/ w+ C$ i1 N. X2 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768): R& x( |& b, s, N- k
- #define STATIC_SHIFT 3* B( E1 R& \5 n
- #define TCINTEN_SHIFT 20
& n, s# I5 N7 C2 d5 Q! E9 ? - #define ITCINTEN_SHIFT 21
! X+ `) P9 b* g2 s% r6 ?) I - #define TCCHEN_SHIFT 222 z& y! k( h7 f0 V+ j
- #define ITCCHEN_SHIFT 237 f5 U$ q# ?: \1 c& h9 d: M
- g; ]8 Q$ B+ Z1 A3 e
- static volatile int irqraised1 = 0;/ ]4 O8 }# R( {# n1 n, ?
- static volatile int irqraised2 = 0;
. Q: {2 M. A/ v! f0 x* V7 s: E - % Y$ t9 Q* {) y% G/ z3 R) R8 y- c
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% g: x, s- Y; a# Q5 q! Q2 L - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 H' @* { }0 Y$ W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% k! L8 `* u, \( G1 X v# J! Z
- I$ y8 C' l; e l6 y' Z: _ p
- dma_addr_t dmaphyssrc1 = 0;
6 a- N# E$ q/ }2 P! m( H) O! m3 I' E - dma_addr_t dmaphyssrc2 = 0;
* ~" M7 T3 z1 L - dma_addr_t dmaphysdest1 = 0;
/ j4 n( F w. S4 Z1 b - dma_addr_t dmaphysdest2 = 0;
: `% A! t. _2 m
: y8 B& V; p$ t# u- char *dmabufsrc1 = NULL;
+ \1 N, R4 C7 I2 F) k - char *dmabufsrc2 = NULL;1 I1 I, Z+ v- P7 @
- char *dmabufdest1 = NULL;
- C7 ?8 t% w$ U' ]* G - char *dmabufdest2 = NULL;4 u3 S+ n- E3 X: ?5 w
( f5 F3 {9 M6 ?6 m* A- static int acnt = 512;% o. h$ \' J3 ~2 }$ j, A9 Y
- static int bcnt = 8;3 E( \7 G5 b' I* {3 g
- static int ccnt = 8;# f& k$ w4 ]! J O# C6 M$ a
E1 H! Z6 `- p* S6 R- module_param(acnt, int, S_IRUGO);: w3 g5 _) M& q: s+ U! s
- module_param(bcnt, int, S_IRUGO);
# D' _2 ?. \+ P" _+ ?2 {6 r8 c - module_param(ccnt, int, S_IRUGO);
复制代码
: g- [! u* e' O+ }
1 j+ ?; x E9 c$ j 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# h: ^, O- B5 L# U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ C; s4 s$ f2 U( ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( l5 ^% V" ?. @, a2 S- j
% Z2 b9 O$ g3 j( Q8 q+ H5 K2 h/ W1 b4 a3 U2 `' a; Z
|
|