|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- T; |# Y) ^. Q1 n9 G8 Z- [code]EDMA sample test application
; j( ~$ e) v4 f, a" q& j+ U* f - /*
1 V, j6 r# s( F( T3 m2 F, [) } - * edma_test.c% h2 z' }$ ~# m
- *
' D9 t; K( X% k2 f: j - * brief EDMA3 Test Application' M. [. x; i! d4 n% n
- *
; H& {* ]& o2 y - * This file contains EDMA3 Test code.8 z9 @, j& R- o- P. m
- *0 H; e6 u* H6 G% ^' R3 h" P% L3 D" N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) e7 V4 j7 }, y8 s/ Z& ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( s: H; p1 o1 `; w
- * TO CHANGE.7 U7 d7 |4 e5 l* x$ g- }, ]: Z, e
- *
: ~+ e5 R x$ e+ B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, w8 |1 W2 t K) e1 |
- *
0 @1 _# D% u( H! Z; [ - * This program is free software; you can redistribute it and/or2 u4 R+ P7 r7 }5 E$ k, L1 |: \
- * modify it under the terms of the GNU General Public License as
( O: S$ U3 K$ t - * published by the Free Software Foundation version 2.
5 t8 @" ~- w) D/ ?$ v% k) p4 \, V* N - *
5 ` u9 {, ^4 b. n9 R+ |9 k$ U - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
) U! o; q. C6 C* q' ~ - * kind, whether express or implied; without even the implied warranty& D- M/ B- x- A- O
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: D( o* u6 j' c2 d/ n n* @
- * GNU General Public License for more details.6 [2 f; Q: o6 t! Z- `
- */
5 [( C: |- @0 j# N" C - ' c: \, E: R) |3 z
- #include <linux/module.h>
' M2 l1 b" s' h - #include <linux/init.h>
3 y8 M* e1 r' H. Y - #include <linux/errno.h>5 R- B& x$ I* i9 c
- #include <linux/types.h> S- d+ z$ `/ a5 _% K N
- #include <linux/interrupt.h>, @, ~- \* a3 V3 T9 d, D% z
- #include <asm/io.h>
8 _, q9 [1 e: a2 |+ `' B6 W5 W - #include <linux/moduleparam.h>7 l9 d3 s {/ J9 I$ I+ Q8 X1 J
- #include <linux/sysctl.h>
( u5 Y! w7 J8 ` - #include <linux/mm.h>
, Y0 ^: x4 h9 S& ^: | - #include <linux/dma-mapping.h>
5 w/ s! t& u0 T# G' [% F6 F - 1 e' [7 U; ]. I
- #include <mach/memory.h>$ H" Y8 c# o- \% D/ ?; x- W
- #include <mach/hardware.h>( j3 I8 Y9 j9 L9 ~' E' ^- ?3 |
- #include <mach/irqs.h>7 d* t% Y2 o9 {$ Y$ t- i. m: P
- #include <asm/hardware/edma.h>
2 c* T7 p$ G. M! Y7 j: z" z3 { - . c9 P) a" s! f+ |9 \+ P$ Y
- #undef EDMA3_DEBUG' v# z; s6 r$ c, J# q8 K
- /*#define EDMA3_DEBUG*/
9 d# i" {: Q$ t0 p - , S0 v! o, r9 F0 }0 ^3 ?$ A* q
- #ifdef EDMA3_DEBUG
. K5 `* ~4 C1 A" x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ y$ @0 x1 t' e K1 c - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 i8 J0 s y$ t1 x( S' a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 Y: `, V& X0 N' a2 ?
- #else0 F$ b# o; F! d: y
- #define DMA_PRINTK( x... )
/ ~3 p" T4 k d* G/ n3 i - #define DMA_FN_IN
( v% A8 G( \ a; j2 D( | - #define DMA_FN_OUT
. a8 t% `0 d2 u! [9 E2 o - #endif
9 ?4 q6 i% [' U8 r& ?* W% z" P
! P, t2 f# M! q7 F6 i2 `/ [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
2 W( X2 P. C- w1 S _. p& o - #define STATIC_SHIFT 3
# m2 b' n% l1 O+ [& f - #define TCINTEN_SHIFT 20
2 H8 S f u8 w& W - #define ITCINTEN_SHIFT 21
+ Z% ?3 O( F" F - #define TCCHEN_SHIFT 22
: Q7 R3 b- x. t: p - #define ITCCHEN_SHIFT 23
6 z/ a4 k1 V! K; T" t6 _. @' k - $ R( R- z, J( ]8 ^
- static volatile int irqraised1 = 0;
2 Y2 B4 X( q( @: E! h - static volatile int irqraised2 = 0;
) K2 A$ n' @* ]# i) v - 1 {: n7 T4 O a0 r) K7 Q- J$ W
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `2 H7 Q. @2 O( c0 O
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# d; r2 ?0 \* Z! n) i - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x# U9 g7 h, N& ~5 z1 n8 a* l
- / p2 p/ e) H# H7 i/ ^1 U. l9 B
- dma_addr_t dmaphyssrc1 = 0;
' z/ q X) F7 Z. }) ? - dma_addr_t dmaphyssrc2 = 0;
+ m! E" g. q. G+ t. Q* j* } - dma_addr_t dmaphysdest1 = 0;7 g( x' Z9 d+ ^$ \- a
- dma_addr_t dmaphysdest2 = 0;/ K. i2 d# G" a/ ^( r
- 7 c# i4 `; [ Q3 _: w, |) O
- char *dmabufsrc1 = NULL;- Y J |4 V- t- [9 Y1 {- i
- char *dmabufsrc2 = NULL;- e, W6 [! K# O0 `/ C& u) P
- char *dmabufdest1 = NULL;3 k8 y! ^# n" G$ R% z* H
- char *dmabufdest2 = NULL;7 R5 b) j( n' f1 X+ V% a7 T; M; }
- # {' A, m9 n4 D
- static int acnt = 512;
, |, M5 C- ^& g& u4 e$ V - static int bcnt = 8;
, r9 q, y; L2 p3 k/ N/ p% M" q - static int ccnt = 8;
5 l. ?7 ?4 k% C. F- V+ L" t1 R& D
2 d( S+ R2 I8 z5 {5 i) y4 C- module_param(acnt, int, S_IRUGO);
* J* ]' l+ e( T$ l6 S) P" [ - module_param(bcnt, int, S_IRUGO);5 t* w0 g# F1 ]8 B/ j+ O
- module_param(ccnt, int, S_IRUGO);
复制代码
* F! o; G6 ?( G) A5 c- V8 {: n+ b
" i g* ^7 O. g7 r; G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 Y9 C+ y% O0 g0 S" O( farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& v. h/ n: X( g: ?$ H# M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 g( w; h4 y- T$ F& ~4 L! h* Z- @! Z6 p
' X! p- R9 P) Z
4 T/ D, w: R6 ?7 A [/ J/ C4 A$ G |
|