|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ O- d: @; L& W& J) g. l- [code]EDMA sample test application8 O6 q2 V9 V. b2 K3 d) L- m
- /*
" Y4 Z, X6 X/ a$ |2 Z9 Y - * edma_test.c
8 i# O- w* Z- z - *- y* _1 C" C( d$ _/ U( ~
- * brief EDMA3 Test Application( Z+ a, V- B& A5 Q5 D. j
- *+ |9 I7 c( R8 x5 e/ w
- * This file contains EDMA3 Test code.
1 M- h/ x2 k& T7 S - *
9 s$ H/ y) d9 n9 m, t: ~8 p/ J - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ f$ Y) b9 z% b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 Q" V2 R v" a# E3 ^# m+ _
- * TO CHANGE.3 G& l8 M$ d* U, O5 m6 P; Z
- *
6 A2 V2 U" _4 a- m1 l# P' { - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
; L' g/ }9 ~7 L% B$ U" e - */ H# k$ q/ T+ R& E6 `2 m
- * This program is free software; you can redistribute it and/or; ?+ V5 f* a! U7 d
- * modify it under the terms of the GNU General Public License as( J8 X& f: k8 B) ^
- * published by the Free Software Foundation version 2.
( U4 {- b4 T, J y: B5 ` - *, _. }, \' U( X% j$ E7 n& Z7 h
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; k1 Z0 x) u- R' x$ _. | - * kind, whether express or implied; without even the implied warranty
. C. P" R% n1 N! {7 u, u" r8 W - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 f2 s ^: |7 q0 c% n+ K - * GNU General Public License for more details.
3 R) T6 ~( t; g: W2 x - */
" a( H% P0 j7 T7 w A, V/ G - * B( z5 o" `' r1 d* b! c
- #include <linux/module.h>
+ W( ~& j0 C2 U& l* E9 p - #include <linux/init.h>
% x2 \ J' o7 X0 y" B - #include <linux/errno.h>
* H0 A, ]/ ^3 }5 P$ |4 h. d8 q - #include <linux/types.h>
4 K) v$ g/ v& U, B$ v, X! E - #include <linux/interrupt.h>
( d) ]: R, F3 m. g; r - #include <asm/io.h>0 ~3 h; S( \9 b: I9 X5 b# S8 r9 f
- #include <linux/moduleparam.h>) n: r. Z' l0 T( f, u% S
- #include <linux/sysctl.h>
' w, Z4 v" z5 O& o4 O6 M - #include <linux/mm.h>1 o6 ]: y' [3 \
- #include <linux/dma-mapping.h>
/ R8 y1 U) T# _/ V) a1 _ - ' A$ q. j) \$ f5 o- _
- #include <mach/memory.h>
. i4 ]% ]9 F1 l - #include <mach/hardware.h>& ^, b" H: X U& @
- #include <mach/irqs.h>
# \7 ]4 p" a) H( B0 N9 F6 b - #include <asm/hardware/edma.h>
3 j# L$ O% P0 i3 W- Q9 p/ Q - 3 c0 O% s9 E& {( N3 ?: T
- #undef EDMA3_DEBUG* s8 A9 J) b+ ~ Y8 r
- /*#define EDMA3_DEBUG*/; h* W) `( ^( _" |
7 b0 p2 x5 K; d* e3 f# @- #ifdef EDMA3_DEBUG
7 i* a0 q ^& p" G: x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
5 B5 y: o: Q( |, y3 o5 m+ n0 z5 X - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 N2 @% ?& u" U# L, | - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 _4 n0 s7 m u" C5 ^ - #else
; f$ H- m7 X9 D' K& N: [ - #define DMA_PRINTK( x... )+ j8 ` F3 Z9 W6 _
- #define DMA_FN_IN# ?2 A" ~" ~! k7 g/ y
- #define DMA_FN_OUT
0 k2 h- P7 k V3 K: [. ?6 z - #endif6 X# t# S3 G! i& k, U. s
- % x$ l1 x! s7 }2 d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ m7 h! E& n% O2 D$ ] O - #define STATIC_SHIFT 3
+ j- Y3 M& o( F2 y - #define TCINTEN_SHIFT 20, t1 I5 C+ ?; R- z$ Q+ T/ |
- #define ITCINTEN_SHIFT 216 A8 w& Z. M7 Q# ]0 I
- #define TCCHEN_SHIFT 22( X Y. T8 t5 d4 d
- #define ITCCHEN_SHIFT 23' S* g$ v) Z3 N6 f, h; K" r" k
- # b4 ^' z4 ~1 S+ N0 |9 j
- static volatile int irqraised1 = 0;$ c4 N% Q/ J4 K+ P# e! s, Q
- static volatile int irqraised2 = 0;
7 j* m; Y1 \# F: ^ - / @7 z: i: R% ]9 K7 P
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Q# o6 ]( @ D" \0 p" m( ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) j6 K! L% H- c$ n0 \3 h7 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) v) P& i2 r* u
% u) a# S3 n4 q" Z/ Z) G, O# y- dma_addr_t dmaphyssrc1 = 0;: T J1 w! C7 Z
- dma_addr_t dmaphyssrc2 = 0;& f# `$ \7 n/ {; d
- dma_addr_t dmaphysdest1 = 0;, @4 i2 h/ X8 M* Q7 W
- dma_addr_t dmaphysdest2 = 0;% @/ s+ r* |3 _4 c( z! O
1 N/ w+ h: j2 H% d# x# f- char *dmabufsrc1 = NULL;; H0 ?- c" n" I* q$ u/ t; a
- char *dmabufsrc2 = NULL;$ l1 l" X. _, f+ Q4 q5 R
- char *dmabufdest1 = NULL;
8 u( I! \5 _' D - char *dmabufdest2 = NULL;
' S* l# C3 \6 x3 l - * B; J/ {. I$ Q4 p1 T
- static int acnt = 512;& U/ f& R" I# S1 M
- static int bcnt = 8;
, v) O3 e N9 {: F6 H - static int ccnt = 8;" _( k# @" {" d5 z/ t1 w
- 9 M& Q2 F& s" Y0 [% {% g j
- module_param(acnt, int, S_IRUGO);
& c" v8 T, C3 P9 g - module_param(bcnt, int, S_IRUGO);7 k) A3 u& m% V1 _3 O( |+ }+ X
- module_param(ccnt, int, S_IRUGO);
复制代码
) [+ U7 ?5 r* E$ T; r4 B+ H
0 S+ d& a1 |4 d0 A( R J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 Z: a" h I' F& T' O) u: S+ X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, {# u) c; p# Y4 Y( X, T( e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 r) ~; I% q2 w* Y# P: X s F3 c3 f r* R: }( t
( i# Q: D7 T3 E' e' P$ _, J
|
|