|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 H4 P* _2 C; O$ u
- [code]EDMA sample test application8 Q' f1 T+ w% C* H) r; l; N
- /*/ A; r8 f- G, a6 @
- * edma_test.c( d9 `; T5 |4 q# C" Z
- *
4 X- D9 R. `" s - * brief EDMA3 Test Application
8 F1 ]8 R0 T$ G, N9 I3 k# { - *
& _2 v* P& }- B- F" J8 D: q - * This file contains EDMA3 Test code.
: E; k+ p, `3 o0 d. ~! ]/ r( q) f - * H: Z! l( L9 ?8 a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: z( ~! D4 {. c: L' H2 _
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% c/ O: E; e a1 B5 e
- * TO CHANGE.
+ @* L/ H+ q- {% L& S2 S - *7 W3 G! f3 ]1 s; P- A' P* v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 W4 I, z3 | p O6 Z
- *
2 X! {, R* ^ t - * This program is free software; you can redistribute it and/or3 F) e7 |% E6 C1 u$ ~7 R
- * modify it under the terms of the GNU General Public License as+ ]2 n7 }8 Q ?! l) @/ N
- * published by the Free Software Foundation version 2./ d; K( p; N3 i0 F( E" B4 d
- *
4 `! m0 `1 u! o2 b1 B - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. j* t8 f% f1 a+ w! K6 r - * kind, whether express or implied; without even the implied warranty A. `0 |2 B& R5 x$ W" S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9 A5 W! S: @ i1 l; |) m7 Q
- * GNU General Public License for more details.
7 }2 P- S+ ~ ~9 G, I4 X4 M - */' a7 N# a5 \* ]
- - U8 y1 `1 c# n( Z: h+ L/ j
- #include <linux/module.h>
+ ?2 x9 X3 B& F; [ - #include <linux/init.h>+ ^) h7 V" X; V5 v* \3 \, J& M
- #include <linux/errno.h>' k! j. N, w2 @# D x4 K* b# m( d
- #include <linux/types.h>
" h% K8 F% |" o6 l* A - #include <linux/interrupt.h>
. S% S) O9 e5 W) ]* w/ _' k - #include <asm/io.h>
* [7 Z! E0 S, B7 E, T - #include <linux/moduleparam.h>
6 f. V8 ]. @4 `, D% l - #include <linux/sysctl.h>& K) l b5 d- X5 [& Y: z6 u
- #include <linux/mm.h>
; P0 C! ?2 m+ Q3 G - #include <linux/dma-mapping.h>* q E6 A1 o* C; f$ |$ `5 p
( l! ]1 Y! j- e1 ]2 [2 z- #include <mach/memory.h>) `7 ^! S; T t$ [/ t4 ]
- #include <mach/hardware.h>0 C7 U+ w3 ?( ~
- #include <mach/irqs.h>
7 A& |( \' z5 F0 ^9 e - #include <asm/hardware/edma.h>
* d& g7 E+ U5 D$ H& T* s/ U4 ? - 9 v0 y9 j2 c- _' w
- #undef EDMA3_DEBUG: A0 R& h' h1 }! Z0 Z# F3 J0 @
- /*#define EDMA3_DEBUG*/5 Z& o8 A! d$ Q4 A# x
& ?( l, |: }' g& z! V; w- #ifdef EDMA3_DEBUG; z, \- d+ p1 h: w/ l6 F: w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 {- o) }, `; _$ p# V) @- n, g
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! x. n$ b1 z- n: `" M8 E, _! h
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( s1 D0 k- r) \% {/ l - #else4 o& u# [! ^/ X3 @: Q7 {# t
- #define DMA_PRINTK( x... )4 }+ Y( W- i. J# B
- #define DMA_FN_IN! z* T5 L' _3 Z' s$ N2 Q
- #define DMA_FN_OUT
9 u9 d! t+ h7 |4 y4 X$ E - #endif9 I5 ~% D( m. R7 J! f5 |/ j( l* r% A
- : j3 c% W% a$ L0 F/ p
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)' S0 S( o, x& r* K& ^
- #define STATIC_SHIFT 3
$ i. G4 j" K7 b& g; n. k - #define TCINTEN_SHIFT 20- g$ F& R' R3 L% j7 N& z% ?% O
- #define ITCINTEN_SHIFT 21
+ V, k! l7 ^) P- p - #define TCCHEN_SHIFT 225 e" ?/ [9 }# j; m7 B- e
- #define ITCCHEN_SHIFT 23
; \* L. |- s4 o7 I# Y F& u - . d7 U/ B' w. u% k' a
- static volatile int irqraised1 = 0;( H7 A) M# L/ D& W2 j6 I; j8 f
- static volatile int irqraised2 = 0;: Z$ Z. g, o @
2 l- x* \4 k9 x- N& q2 S. c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: I( Q- y: J% m - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q# d8 D' b8 P) `; a/ [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& Q9 k9 B' j- I! Z
# ~) e% m2 U8 r- m- dma_addr_t dmaphyssrc1 = 0;# v. j N B) I2 d- E
- dma_addr_t dmaphyssrc2 = 0;6 Q7 [1 L* m: V" `% R8 L$ s; }" l0 O
- dma_addr_t dmaphysdest1 = 0;
* { f/ ?3 Y' @! _; y7 q3 g! [$ ? - dma_addr_t dmaphysdest2 = 0;
! K6 t! Q- ^0 }( T+ n5 R4 t7 {* l
- D1 t1 q) |4 b' h9 g- char *dmabufsrc1 = NULL;
# X( t/ X: t- E! F4 m - char *dmabufsrc2 = NULL;
: ^# E5 X4 V& b4 I: @/ v! ~ - char *dmabufdest1 = NULL;( @: \* h! x8 ]# Y- n
- char *dmabufdest2 = NULL;
% I u0 d1 v. {7 W) w; l }6 K
2 O$ B6 i$ @+ S' O( e- static int acnt = 512;
U, _+ D+ {5 Y9 o- a - static int bcnt = 8;8 A% t! |0 Z0 J" [6 Q, P
- static int ccnt = 8;
2 r* ~" r1 U/ h+ w) i" [3 q
2 b$ ?7 ]' i% w- k7 _! k- module_param(acnt, int, S_IRUGO);
/ o% T7 W" R5 l f: N* } - module_param(bcnt, int, S_IRUGO);) v Z0 F. U- [4 c5 A# X
- module_param(ccnt, int, S_IRUGO);
复制代码 $ a1 {5 |, X/ N5 o: N) j* v
; C6 W! C8 \3 B \4 [9 z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) w5 R0 R/ x* z2 |% Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' Z5 Q6 e t6 {0 p0 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# u# b3 N: T7 x+ `$ g
$ D& c6 s! f2 ^; Q/ x2 G# D8 k4 y3 K6 J& `/ M$ ]% G
|
|