|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! n2 w" d/ T: i$ d+ l
- [code]EDMA sample test application
9 K1 [) H( k: u8 G) v - /*4 R4 y" S3 F8 E. R" p
- * edma_test.c" E X: ]2 M7 H S
- *
; P$ S3 E/ a8 L% E3 l4 I/ Z - * brief EDMA3 Test Application
1 |* i9 H8 ]2 `) N- o" U' p - *
5 x+ i+ @/ O& v$ n! m - * This file contains EDMA3 Test code.
$ B8 W/ _4 K* j7 T - *
) Y; `% p- t3 t s* d+ I4 d7 Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g( B" C; w- S2 Z0 F/ e
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( k) d: T- G; X [
- * TO CHANGE. T3 @9 x% }; ~; m6 D* D
- *
$ K& K, D! ^8 N! ~$ ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( |4 G& @: h6 |0 a7 [ - *
- T* ]5 K0 w6 F2 }8 v# I' q& W* f - * This program is free software; you can redistribute it and/or
5 A; ]' o; H; |$ S - * modify it under the terms of the GNU General Public License as
5 x* J7 e" m2 i! V - * published by the Free Software Foundation version 2.$ A8 G ~0 o8 e& |2 g
- *
& Z8 ]8 a4 F* m3 N - * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Q" O+ Z n: u! Y' _; S/ n
- * kind, whether express or implied; without even the implied warranty
% s8 p* `9 d+ M: @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 {4 r* X1 m! V
- * GNU General Public License for more details.: x1 ]9 G2 o/ O! N
- */
1 |3 q* q/ I2 U5 e; M - 4 i- n8 E' t1 q6 r+ ^# o
- #include <linux/module.h># \$ w A; v V" t4 z% e4 i
- #include <linux/init.h>+ D% Z1 X' F" i1 H/ U
- #include <linux/errno.h>
1 B2 g5 l1 J& v$ U - #include <linux/types.h>
) D/ n9 n3 O) @% s2 O" O" ^ - #include <linux/interrupt.h>
$ Y) G* Y4 d5 x1 e9 b - #include <asm/io.h>
8 m5 T/ R: n% m6 p& v4 } - #include <linux/moduleparam.h>8 ], A; c) i3 n2 Y4 v/ p7 x1 b" F$ @
- #include <linux/sysctl.h>
+ q' g: U: \: l5 d - #include <linux/mm.h>
9 Q6 m% D# i* G, G% | - #include <linux/dma-mapping.h>
' i. _6 W) D0 ?- G - 5 F/ O6 t8 }$ b Y, {$ @9 v8 t( K
- #include <mach/memory.h>3 T5 K) s1 I: I: R
- #include <mach/hardware.h>+ \& ]( d+ A% E1 q! [
- #include <mach/irqs.h>, v2 ~6 y5 {9 c& ^
- #include <asm/hardware/edma.h>
/ a; _' n" I3 ]5 A b - + }$ g" x+ V+ J! I! a5 _
- #undef EDMA3_DEBUG
! ]5 u; s( S% |, Q0 S - /*#define EDMA3_DEBUG*/ U- H D% @+ g- r6 L
: }7 Q" [9 W, T% [3 M1 }- #ifdef EDMA3_DEBUG
( p5 a" {0 G; p# U7 I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 l) m6 g, V8 ^3 e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) [/ a) ~6 T+ U& p% r8 X' @& u
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) {; m% j) @: g; s4 j
- #else
" o6 T" [% D+ X P( E - #define DMA_PRINTK( x... )
1 m! t3 E! D5 c# |/ \# |, b - #define DMA_FN_IN) P7 o& H) ?3 a. C7 n/ O
- #define DMA_FN_OUT
) p- v" t* q& |/ U - #endif
% y: @5 H! U' O, R2 d# M
* p# G- W4 U! R1 J* y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ P) z! a. Z2 d0 b& E8 h9 t: K/ D0 k - #define STATIC_SHIFT 38 t! c) B- u' X
- #define TCINTEN_SHIFT 20
$ @: X& `# o' U/ f3 f( W - #define ITCINTEN_SHIFT 218 j3 ~+ u0 f: z1 U& j- g: {) {
- #define TCCHEN_SHIFT 228 |8 e" `7 J0 M1 p) o& u: Q7 B
- #define ITCCHEN_SHIFT 23
8 O& S) a. t& Q$ z
& [7 A& L; q/ e7 o+ Z( ]4 V! u- static volatile int irqraised1 = 0;
: o- U4 k( c; y( m6 G8 T8 y - static volatile int irqraised2 = 0;
" `/ ]9 d, @ f) m) ?
: Z6 Q5 ?$ w8 d% b* q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 p* M# `- f8 @& A - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ _: ~2 ^# d9 ?9 p8 V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: I" Q, I6 J* m5 r! k- Y - , g c+ ?' e7 e8 b8 v1 j
- dma_addr_t dmaphyssrc1 = 0;
: S( n) C4 R! [3 K - dma_addr_t dmaphyssrc2 = 0;
- V. n2 I0 t1 S& T - dma_addr_t dmaphysdest1 = 0;
* `8 Y" r4 M& F$ z - dma_addr_t dmaphysdest2 = 0;
( n, H3 R, F) K/ j, O) h' G
, I, R% M. C. {2 V% m) e- char *dmabufsrc1 = NULL;6 P6 @4 ?! c6 h; b1 o9 G
- char *dmabufsrc2 = NULL;, W C0 q1 R3 Y$ C0 q
- char *dmabufdest1 = NULL;
, B7 \' t' O) M" i P; I% \9 b2 p - char *dmabufdest2 = NULL;
0 E" Y7 K/ k* j, a( |( p& v - ' p/ h8 Y" H% c/ x4 J" C: l
- static int acnt = 512;
9 _, K* c6 A8 U& L8 ~( u - static int bcnt = 8;; \7 S* q2 g/ g8 z! b) j$ l
- static int ccnt = 8;
4 _6 S+ c* [ Y7 I9 m3 L
* `6 j4 ]6 T, \; M* y- module_param(acnt, int, S_IRUGO);
7 _+ o5 W' l% P5 o3 Z4 D1 @ - module_param(bcnt, int, S_IRUGO);
' c7 v" Z i3 d b- m6 D - module_param(ccnt, int, S_IRUGO);
复制代码
. {/ {9 p$ C$ x$ f9 V5 K2 B" e* ^4 a% `4 ^6 u
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- p% P9 f9 Z/ @! [8 f- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. r% _" z. b1 Z+ r& M- i' a
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& J2 m3 @+ K* C j# A" F' M) u: g# Q+ Z4 i; w) W- X4 K4 }0 i
& X/ Q% x S) R( W9 `5 i
|
|