|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , j+ \2 f8 B7 ~ e; A& ` O
- [code]EDMA sample test application* u4 X0 W, G, @7 T9 g" \ y6 S
- /*5 l0 T, y2 x) s @+ P: ^
- * edma_test.c$ l* v- u1 b8 {/ ?
- *$ V9 z9 v& O6 U( Z+ q
- * brief EDMA3 Test Application
6 Y% U6 [ q$ c* b, B - *
b" k& }' b) A5 ] - * This file contains EDMA3 Test code.
% ?. l( Q+ o/ _ - *
; @- z J& U5 ?, M: B' O# R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ {' T2 F" M) ?5 K( x! |: b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 `9 c9 ?" l4 Y6 Q1 J, g
- * TO CHANGE.
! [, b8 b! W' s* d0 [! Y5 | - *
: b8 |) F: L/ t" Y+ F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, y0 o/ y$ C& x; i - *
( a0 a- Y t9 P - * This program is free software; you can redistribute it and/or5 I1 s* E K, `7 c* ^: L
- * modify it under the terms of the GNU General Public License as' w* d/ p/ W9 w. i3 a$ E
- * published by the Free Software Foundation version 2.8 e6 a$ `) C7 p2 ?2 T* Q% T. i# ^" y
- *
; k! D5 e" R* K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( G1 n4 ~* J1 W* v0 w
- * kind, whether express or implied; without even the implied warranty
; p( f. ~; F | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 w/ o5 y$ p' `3 s
- * GNU General Public License for more details.
7 }/ g3 e$ F0 b+ J - *// u$ b- K6 K( \' f; o4 ]
- ) [! w! e! l5 t: D: [
- #include <linux/module.h>
3 \4 B5 P$ E9 k6 d# o+ \% h - #include <linux/init.h>
# E1 t: ^ e- Y; T - #include <linux/errno.h>' ~" {$ N$ r( ]
- #include <linux/types.h>
3 p; E! F& a: J8 Y* L0 l& X' J8 u - #include <linux/interrupt.h>
+ d5 i& n6 T& ]6 T3 t' }8 q - #include <asm/io.h>
& J7 w: E. N2 ^4 j4 Y7 C: Y9 E6 @ - #include <linux/moduleparam.h>
) q b6 t. y* E: i' i9 o - #include <linux/sysctl.h># w7 l& S! p8 u1 [( X: Y" q2 X
- #include <linux/mm.h>
# P8 L& A- y8 @* R; J - #include <linux/dma-mapping.h>
- q: o7 }. P! K9 y; @9 p
/ h+ Z/ }' `+ t! q. C- #include <mach/memory.h>
6 \2 z) w( y- B5 r6 r - #include <mach/hardware.h>
6 m. }8 q! i; h, q0 s3 U4 a - #include <mach/irqs.h>2 F+ Q) d) I; \0 ^
- #include <asm/hardware/edma.h>
1 D4 R+ _4 o i+ V) Y9 v' |9 ]7 U - - y& ]2 U: c6 ?' H
- #undef EDMA3_DEBUG
. t! s6 ^, U! Y - /*#define EDMA3_DEBUG*/
# G* K) ~- J& \3 U; S, w% D- Q& g! x
/ `8 n8 v2 K P+ O& s: j- #ifdef EDMA3_DEBUG
; ]' ?) d# c5 E2 I9 {( l3 C5 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 r4 O* L0 p4 P/ C! b# h. i# ~" Z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 p3 N" [2 l/ S* \) e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ r( ^; t; s3 s. M) c2 y2 l8 ^
- #else! {6 G" n; \9 t; v: ]8 v3 U
- #define DMA_PRINTK( x... )7 Q; e- |: J4 H' E) [
- #define DMA_FN_IN
. i) n2 a, C2 q( `- m - #define DMA_FN_OUT' v9 n% \7 N# |* T; L) A& z; c# a7 f
- #endif9 I1 J! N8 r' |) d) [6 v7 m) ?( w& u
- $ V' I: y8 @2 v t
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, f9 o6 T' y5 ~% r A# ^ - #define STATIC_SHIFT 35 w& X0 U- u, z* A( s$ O
- #define TCINTEN_SHIFT 20; p* y$ s5 u: Y1 A) A
- #define ITCINTEN_SHIFT 21, G" [' ?2 T, i: ~
- #define TCCHEN_SHIFT 22$ k# O2 s8 m6 L1 F: [, ~7 E& T
- #define ITCCHEN_SHIFT 23
: S2 ^* J; n, o
; z3 i! \2 ?5 q4 C- static volatile int irqraised1 = 0;
8 b- C* X, _1 u1 A1 K - static volatile int irqraised2 = 0;0 E* q6 X( E% i
# e" ~3 F. J3 @( g$ x/ \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 P; N t5 L) K! H2 L) `& d4 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% R2 f. K3 g$ A2 t( } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 b3 M0 o, a# }. z B1 D
) {& J4 U: k7 n5 Z- dma_addr_t dmaphyssrc1 = 0;
8 X3 Q( r4 u/ P7 X; v! @% S( K - dma_addr_t dmaphyssrc2 = 0;
) B9 u0 W7 D1 A! u: g - dma_addr_t dmaphysdest1 = 0;# k u# @2 \$ B1 V" M/ l
- dma_addr_t dmaphysdest2 = 0;
% e! b' s' \* C+ O2 B
% o6 M: t% I3 e" R$ I, x6 Y9 ?6 n- char *dmabufsrc1 = NULL;
- Z* J, \" ^- b* K. {% y r" i5 b. J - char *dmabufsrc2 = NULL;& Z5 |/ v9 r& \! W% h; n
- char *dmabufdest1 = NULL;
3 ~2 p/ a& @- r7 |. [ - char *dmabufdest2 = NULL;. b: ?* P0 s8 n. a8 [9 Q4 @
+ ~ ]( d3 I) D7 C7 ]1 }' {6 x- static int acnt = 512;; \# x8 v$ O4 E; ]: v1 v. f$ }
- static int bcnt = 8; Q9 w5 |! v+ L8 [& U7 X
- static int ccnt = 8;7 k `& F3 F0 \
- # a8 [8 ? E9 H: ]
- module_param(acnt, int, S_IRUGO);
+ v$ [! ~$ }. ^% `# y; K4 N - module_param(bcnt, int, S_IRUGO);
6 w8 W& z6 r+ ?" q8 E4 Q2 C - module_param(ccnt, int, S_IRUGO);
复制代码 , l# T4 J |9 ~. ^4 b! }# |8 K
5 J. m0 }) J: A0 R( r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' Y! F) T& Z1 \" G7 @3 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& D$ c$ k2 O' P* J0 }/ Q4 l
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ G' c. L0 E, s# {1 v
, ]$ T: w& z f! ~' \1 T: I$ a9 w' l! h* r. d! V. a3 X
|
|