|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, `* r, b. B! @% [% C- [code]EDMA sample test application2 r9 Q A* |! k Q# ~$ G( c
- /*
3 [. B0 n! X2 m0 t - * edma_test.c
$ V) P! n" Y4 v9 P. @ - *
q0 H% }% b2 T9 P1 u - * brief EDMA3 Test Application
( Y" s2 m' U: f7 @5 ?! I - *
+ `; w$ r5 Y) `- O6 \4 A9 c2 y4 U* ] - * This file contains EDMA3 Test code.& ~6 P/ Z- ?5 B6 W
- *- t3 l6 R( G, d# e! I. S! }
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' b8 e0 ^$ q8 C# E1 p - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A3 a8 B: H+ u
- * TO CHANGE.
6 N3 G8 T _5 {5 n7 O" k c* n - *( z3 f( F$ f; n5 _. V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 O8 q( g) O5 ~; F
- *- Q3 g1 V0 H, s$ b0 y& s
- * This program is free software; you can redistribute it and/or$ m F+ d: X4 b2 e2 }( T
- * modify it under the terms of the GNU General Public License as$ `; O0 X: G8 F3 z% m, S
- * published by the Free Software Foundation version 2.
' z. R/ L' L9 |/ D - *$ W0 t0 m# R2 g! d; j2 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any" _& R4 E. N Y/ }, X* B8 P
- * kind, whether express or implied; without even the implied warranty) b2 n' z6 _0 C1 C5 V
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 ^, P9 ^; O6 c# s - * GNU General Public License for more details./ J1 h5 [/ o6 | [
- */3 f) k, ? z0 I5 u& o
- X& J+ O+ t; p: k* G2 v' Z2 A
- #include <linux/module.h>3 o1 R& U+ ^4 b
- #include <linux/init.h>
% c# ^. G- G0 v7 z - #include <linux/errno.h>$ {- \% O5 X X1 `8 p% h
- #include <linux/types.h>) f8 z5 p& c* B+ N
- #include <linux/interrupt.h> p" E2 o" f; e# o. m
- #include <asm/io.h>) a8 a0 y2 J1 y8 {
- #include <linux/moduleparam.h>
, H1 K) ?2 G/ i! e8 } - #include <linux/sysctl.h>% b! u9 d' b [* P4 w5 L9 i
- #include <linux/mm.h>
5 a9 c/ n* C6 L3 X9 d - #include <linux/dma-mapping.h>
8 `, M* _& @7 c/ d7 r3 f: B6 v6 M - 1 a& r- e! g" i! L
- #include <mach/memory.h>! V4 [3 c& [' K# t7 ]/ Q! p, p
- #include <mach/hardware.h>
% d1 o6 l. b' R - #include <mach/irqs.h>
8 G. h- N* r4 ~) A- s; C! E - #include <asm/hardware/edma.h>: b. M! ^* X* d; J; p* G9 l
- j7 O1 I `* Q# |- #undef EDMA3_DEBUG( u& u) O9 E9 `: N N$ T" S& ~
- /*#define EDMA3_DEBUG*/
# h1 U& f: I# o - 9 \& F+ G. U- w
- #ifdef EDMA3_DEBUG& _' F. J# q/ Q7 d. b2 }
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 n: b+ o4 H6 Y0 b1 }3 _ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* d( L) H" R4 ^; `3 n/ s
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
7 j6 p/ c @9 o8 u - #else5 h6 ?% g2 a$ K3 p
- #define DMA_PRINTK( x... )' f* p8 Q0 y* Q, A1 u0 ~7 E7 t
- #define DMA_FN_IN
- S$ n- |7 w% ~4 }2 A: M - #define DMA_FN_OUT9 ?8 j7 X5 T% |
- #endif
9 N' d5 x) L3 ~" }0 |$ j: { ?3 a - ! ]: T. z, \% T0 a! B4 z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). l" C9 z# J3 ` q9 t
- #define STATIC_SHIFT 3# o& N) ?' F4 A6 i5 ], r
- #define TCINTEN_SHIFT 20' p# [4 ?6 A6 W' g1 ^
- #define ITCINTEN_SHIFT 21
& D5 L! M, Y6 }% I0 J - #define TCCHEN_SHIFT 22
" b4 g; {: N8 N5 V - #define ITCCHEN_SHIFT 23# w |+ [9 R9 b! z2 a
+ K. k' E0 a, h& ~, o! f: K- static volatile int irqraised1 = 0;
8 E H* H" p* Y - static volatile int irqraised2 = 0;( ^- Y8 ?# r+ L- u
1 s% d! b; i; p5 Z v7 S+ }3 X- x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 G, _/ u: s& r* q% R
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \& e9 B& o! K& \. {) ]2 N0 J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 x5 B1 s+ E. p L+ L% d - 3 q9 r9 w9 ]6 g1 K, q, }& F3 E4 v# E
- dma_addr_t dmaphyssrc1 = 0;2 Q7 b" R: q) b) q8 K
- dma_addr_t dmaphyssrc2 = 0;* t8 ]* ` `( t! j; a
- dma_addr_t dmaphysdest1 = 0;* Y" t1 k7 m& y2 b
- dma_addr_t dmaphysdest2 = 0;
2 A; Y2 x6 e4 |2 L4 n/ [4 } - + |9 }* H6 z' v7 Y% K
- char *dmabufsrc1 = NULL;
- k& U8 Q/ S. p' y" d5 n0 A - char *dmabufsrc2 = NULL;1 S7 ]: @ p& }' V$ z8 f
- char *dmabufdest1 = NULL;
5 T2 C% S6 f5 w4 l1 x) t Q - char *dmabufdest2 = NULL;: ]' ^# D) A, O- `4 n% Q1 y* J
3 f6 [: C _2 s7 p+ e" |- static int acnt = 512;
8 Y! R3 U" t) Y5 s4 J - static int bcnt = 8;
# K2 X' O i9 x1 t - static int ccnt = 8;
5 Q/ L7 r% F3 t - 4 s/ u& a0 ^+ D! ~- C: I
- module_param(acnt, int, S_IRUGO);: |6 w, r: g, `; Q
- module_param(bcnt, int, S_IRUGO);! M3 F. N4 s6 ? E
- module_param(ccnt, int, S_IRUGO);
复制代码
7 [8 u; e1 |, K/ ~# H! p4 T* W1 i; ^+ |1 Q/ Y+ p y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) s" R2 o6 Y- c; U4 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. \0 |1 F/ g6 s; j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" `3 e2 ]4 w& d1 b) [+ D/ ^
. r. I/ {/ e; T ]! b- G
/ Y! p8 h) D& O$ b. @% V- W6 @
|
|