|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' H" {3 n; l) s7 T3 H0 i- h( K- [code]EDMA sample test application
4 C7 s1 ?3 T; n( W - /*
9 k2 F) l0 X0 b - * edma_test.c
/ Y& n6 X& G$ { - *
; a9 m3 c$ \ e" S: q - * brief EDMA3 Test Application+ [9 B3 H2 X- t+ d- L/ c# q( J1 v2 t
- *
" s) {9 `$ u" ~; } - * This file contains EDMA3 Test code.' q% Z8 L( ?' f( T! u
- *
d+ _9 J: A$ v, @ - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 e9 i2 q m) z" r+ i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 y# L& y( N3 j
- * TO CHANGE.% f4 |$ ?! I% K, K) F' g8 x
- *! |9 ]0 x9 n/ L2 N
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
7 U1 A2 n. e- R - *
) |9 x9 E- P) v5 V - * This program is free software; you can redistribute it and/or# c8 H3 ^: R8 T5 ?, M
- * modify it under the terms of the GNU General Public License as
! [8 S: q7 X& i3 q6 R' n4 C - * published by the Free Software Foundation version 2.
2 w1 t& G8 \1 D" H0 L" i - *# c! z) h" V- N/ e% H" ?0 R* y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! I% K( B! l! u - * kind, whether express or implied; without even the implied warranty
3 I T) w/ O( K+ n - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 g T' w* Z4 J( g - * GNU General Public License for more details.' @/ a; F1 Y, t% b
- */
1 [$ [6 ?. ?; l: F. o4 K$ Z: \* } - ) h& J% \, `. g; e8 {- }# ^6 A5 j
- #include <linux/module.h>! }/ d5 G S# N6 X8 F9 _/ ^
- #include <linux/init.h>
$ W/ P1 X8 @6 [( M& M' d. K8 G - #include <linux/errno.h>
8 n- i; P! N* N& k Q0 X x$ r- y8 e - #include <linux/types.h>3 ^1 @9 B& [& p r
- #include <linux/interrupt.h>8 X$ Y# z3 Y- j% i
- #include <asm/io.h>4 f1 v J8 d6 t3 } O
- #include <linux/moduleparam.h>' t$ H9 F& n8 N; I4 n+ U
- #include <linux/sysctl.h>" `& i8 A$ X' H K( ?* w
- #include <linux/mm.h>" i$ l% J5 d8 y1 I. k0 m
- #include <linux/dma-mapping.h>8 `1 ~$ V) z0 ~1 R% a
- M; T) X0 k2 @8 {- #include <mach/memory.h>1 |, n, X" L, U+ x+ {6 l& E
- #include <mach/hardware.h>5 J7 Y) x+ Q4 J3 ?- T
- #include <mach/irqs.h>* }. x4 ^/ c7 ~1 E& `
- #include <asm/hardware/edma.h>
# W& I y: T& F2 A - % |3 E$ z* \% i
- #undef EDMA3_DEBUG
i P- j8 ?3 g/ t$ M0 J - /*#define EDMA3_DEBUG*/
* L- k% ?" s+ M+ N7 S* n: U! N - $ ]% F7 w- l6 q
- #ifdef EDMA3_DEBUG
3 b2 P+ B3 @! I! N: o+ | - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: ^7 R6 d6 G; ?% k6 s - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( O" i' H$ K7 |1 U, R* A
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 I/ _# L7 d5 {( R0 Q' x
- #else
8 B6 X+ `/ W5 N" x* i# d! y4 B - #define DMA_PRINTK( x... )
+ \( r' c2 O- y7 Z/ b% b1 ~ - #define DMA_FN_IN
8 C- u _0 Y+ m7 M' N - #define DMA_FN_OUT
( r- |4 q( Z7 i9 n: J5 W1 w - #endif# J$ B7 w( D8 B. H% J8 O+ \" U* h
- 2 u) ~! n$ U( `, T/ C: b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 f" A1 N# d3 L& O$ S
- #define STATIC_SHIFT 33 b1 y% s0 x1 R/ p+ S% }7 j
- #define TCINTEN_SHIFT 20% r1 T, }9 r" Y* ?5 w2 s
- #define ITCINTEN_SHIFT 21; S/ H( T6 }3 M
- #define TCCHEN_SHIFT 22
* ~+ @6 g" ?4 S( u" V8 j! B - #define ITCCHEN_SHIFT 23( u: L7 A4 E( {2 f+ Z6 P5 r
- 0 X3 A, G& D: \
- static volatile int irqraised1 = 0;- X! a% z; h8 Y% g6 B* \. S
- static volatile int irqraised2 = 0;4 Z% X& @0 o: O5 Q8 \# Z# @
. l6 x) M1 y4 J% N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 E4 l2 {7 _: u( Z. ?$ g0 f% v$ T - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 l7 ~. W6 N; f( K7 W - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); o, A# a$ N. Q# J# A; ^& W. V
- # ?& @8 X/ N N1 [
- dma_addr_t dmaphyssrc1 = 0;* g$ v4 _7 q% E# F
- dma_addr_t dmaphyssrc2 = 0;
# L6 I; e+ U8 R' t1 w' J" T - dma_addr_t dmaphysdest1 = 0;
2 j7 S1 h/ k: x! ~) X1 f - dma_addr_t dmaphysdest2 = 0;
/ H" K: Z. ]3 r) K9 q4 e - ; ?& `; c" O2 d$ H, ~
- char *dmabufsrc1 = NULL;
2 `* ~/ b& D4 @ Q1 _- l+ Z# q - char *dmabufsrc2 = NULL;
! h! G. {+ i! D2 L - char *dmabufdest1 = NULL;
$ U, H- ?. A8 u% z* p - char *dmabufdest2 = NULL;% m/ v# E% m0 P5 p
- 1 c5 r# }! p; v/ W
- static int acnt = 512;- m$ q, W7 t* y8 M2 r7 K5 e1 ~, t
- static int bcnt = 8;
/ w) `" R2 H( } D% u: v1 t - static int ccnt = 8;
g# \$ v+ \* X, M9 E
/ o5 j1 a2 n" Z4 |- module_param(acnt, int, S_IRUGO);
/ s @9 D: c/ q" b, W - module_param(bcnt, int, S_IRUGO);
* M* j, ?" R O5 K2 U6 V: W, y8 R - module_param(ccnt, int, S_IRUGO);
复制代码 2 ^5 F6 @3 R: ^* M1 C& K
' V0 S( G P7 V- u9 o$ g, U2 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 u; d" {; e9 W" V4 | d5 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 V+ } m/ M% `; } 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ^) c3 u p% [9 l' ^( T* ]: i
1 k+ `5 ]: _, r o
9 C2 W0 q' d B
|
|