|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # Z3 T7 t4 u" ^
- [code]EDMA sample test application# e7 ?! H0 I+ D: w4 f: M4 u
- /*4 J0 s1 c5 J4 E0 D4 j( }) X& |
- * edma_test.c- K' _* p2 C: [7 P( H- q
- *
3 H% ?+ F; {9 h& j& K' P- r& A. @" O - * brief EDMA3 Test Application" a6 B4 y2 l7 @: O( \; }- ]$ ?4 y
- *
1 v0 i' O/ S& _: h - * This file contains EDMA3 Test code.
( \( I$ O0 B" L) i - *
; V/ ]# k7 z2 m0 v# L, }7 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ }% X$ S c( K. G4 n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. H) s) |& o1 e2 O; ?! A. f - * TO CHANGE.8 o6 O7 i3 y+ H7 f7 Q
- *
8 h$ U! l8 y( I8 K* b6 w4 k& K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' w8 y- z8 Q' a3 H6 |6 b - *
+ [2 d3 ?1 G( B- s% R - * This program is free software; you can redistribute it and/or
+ H& L+ b, j/ J( s5 d% s; s1 m - * modify it under the terms of the GNU General Public License as7 [" m7 F! v( |
- * published by the Free Software Foundation version 2.
- E. K2 X$ P0 z- @" I - *& A9 k9 O' R% m5 ^2 E& a! N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any' Y& F* O1 X0 g% v4 y
- * kind, whether express or implied; without even the implied warranty8 |7 D o' }6 h! ?0 w
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the3 n; r5 F6 a4 Y2 w3 B
- * GNU General Public License for more details.
4 w0 p& E) b; y% d4 M - */0 ] H. k! v0 S( [# w z
. Q4 U- y- t7 m( f- #include <linux/module.h>" c" ~- j& `4 _; C5 a0 G
- #include <linux/init.h>, p* k; A( U( x" `! S2 y
- #include <linux/errno.h>
$ z" f+ ?7 `3 u, |/ G4 ^, R4 X! Q4 y - #include <linux/types.h>2 R- Y5 P5 D2 d( _5 g$ F Y
- #include <linux/interrupt.h>
' I3 T9 v, F0 O9 G4 h - #include <asm/io.h>3 u- f) j Z- u, ?2 G
- #include <linux/moduleparam.h>
/ s: e8 z3 \$ p% I5 c1 S - #include <linux/sysctl.h>
, y7 d# n6 x% m. R( n" `) [9 e - #include <linux/mm.h>
. H% G% W& d) p& H( F - #include <linux/dma-mapping.h>- c% @( V- Q5 z- z3 K
5 j1 c) i" y$ K: h- h) U9 R) @0 ~) d- #include <mach/memory.h>
1 j6 h, {- [! h! H. p+ ] - #include <mach/hardware.h>
6 @/ q/ P0 ~" c5 N+ \ - #include <mach/irqs.h>
2 ^/ i/ ]' I/ d( O: _5 e4 a - #include <asm/hardware/edma.h>: l8 }7 ?2 d+ r5 O! f6 g0 A
- # P9 b/ ?+ l- G9 J+ c Q
- #undef EDMA3_DEBUG- F8 l) P& [- d5 k2 X
- /*#define EDMA3_DEBUG*/
! A* S2 O+ P0 E# p3 P; K - ( R% Y, p; q" | {5 g* W
- #ifdef EDMA3_DEBUG
: {/ ? _7 G4 z) E9 l - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 G- ~/ w: e M0 } ` - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- n( o& H. V, m4 A/ I& m" z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
2 d9 k3 [, \- A+ _( U - #else
6 W/ Z0 m& k6 K; b - #define DMA_PRINTK( x... )% t( @! x5 X0 u0 n
- #define DMA_FN_IN
% D5 }" |4 E0 E7 |% w; P - #define DMA_FN_OUT F, Z8 D% ^% k" N
- #endif7 p. M- K6 T0 B$ x1 s8 A
- : Q# b; Z& \' }% B
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 w! V4 i( F7 O! ~6 c6 I4 k G1 \
- #define STATIC_SHIFT 3
" ?; j" ]' D% e- k; N4 u - #define TCINTEN_SHIFT 201 n4 Z$ l0 l9 ] I$ o
- #define ITCINTEN_SHIFT 21
5 s! `8 w! m" J4 y! O" @. A - #define TCCHEN_SHIFT 22& W: d1 L: k; w7 x
- #define ITCCHEN_SHIFT 23
5 C$ k4 n8 j( q8 r0 g
# o$ ]4 w- d! y9 ]9 w/ f! I- static volatile int irqraised1 = 0;
: R& r# j9 B$ Y( Z7 W - static volatile int irqraised2 = 0;# B* d' |8 {* T- |* ^7 G$ u
: e2 ^4 _+ O$ S4 U$ e: y& M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r( \2 ~" s8 m0 B. ?! n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 p# i0 @# R$ B4 Y0 X) a; M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ W+ q+ h& V! f! ]) e - ' a e6 ], E R+ G
- dma_addr_t dmaphyssrc1 = 0;
2 y% Q; s1 V* ~/ j - dma_addr_t dmaphyssrc2 = 0;
$ v( M/ X" j4 _8 i - dma_addr_t dmaphysdest1 = 0;3 `5 @6 n% @7 t/ |6 B7 g5 C
- dma_addr_t dmaphysdest2 = 0;
& a' ]; U2 K w: Q - 8 B; ^' {0 o; h
- char *dmabufsrc1 = NULL;
' b2 ^4 w5 p6 Z/ x+ D0 h; r# ~ - char *dmabufsrc2 = NULL;" j H: ]2 W1 h' H! U
- char *dmabufdest1 = NULL;
4 P0 G, ]: A( w/ A4 ]! r9 G - char *dmabufdest2 = NULL;5 A% z0 q+ b7 B% b% z
, t5 A" H3 G, }3 L7 V J+ d- static int acnt = 512;
+ d! y2 y2 V; c) g* j7 N* S+ I+ E - static int bcnt = 8;
5 M- W/ V+ s* r. f - static int ccnt = 8;
3 J4 f2 {. `1 H: h. J0 m' g
5 K# u0 }! q9 n4 |- module_param(acnt, int, S_IRUGO);- P4 k# `8 T" [& k
- module_param(bcnt, int, S_IRUGO);
+ v0 t0 h8 D) }+ y8 K" z3 { - module_param(ccnt, int, S_IRUGO);
复制代码 7 {1 f5 R+ d- c) @ ?
# P% C4 x7 [, h2 }8 W* ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p/ W1 b% j; a$ O4 T8 [6 D8 {- M7 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ K* r9 U- u# G& m8 {+ { 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) [( k3 J" u9 Q7 J# t; J- i8 W
0 c; f: H. c% H6 N! j: E1 @3 P3 f
' z& @" ]4 L+ P# s# ?1 B- j |
|