|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 T) q6 ?& M0 u7 g" X$ D" R- k- [code]EDMA sample test application1 X; s" s' ]5 \) m
- /*1 v- p) \8 k' {. k
- * edma_test.c
# L5 A6 Z. Z8 U" \ - *
% l7 V5 h( i8 @) M, b% C/ o - * brief EDMA3 Test Application: T: P' y3 j3 K1 s# J- m. ^# x6 W2 p" a
- *
2 k, t8 l4 c. F - * This file contains EDMA3 Test code.
2 A7 e: p9 n! C5 a4 N. a - *! i# [! j! x8 z, G8 K$ @/ \, a
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 Y/ a! c0 S' {) z% f. j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* z2 b2 f0 o6 c0 H6 d$ I
- * TO CHANGE.
+ d0 j- @. Z% e4 T/ f - *
; V( ]7 O! ^: W- Q8 l% D' K - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! @2 T' l# r; N2 W, ?) q - *9 R" i6 x; y3 T( X! H7 U
- * This program is free software; you can redistribute it and/or
2 [: f3 R5 D+ q5 v0 ? - * modify it under the terms of the GNU General Public License as- g" U; N- s+ ` @
- * published by the Free Software Foundation version 2.! H: A8 c, \. X
- *0 U1 E) u- A. w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# p6 i, H4 H7 s3 P& ?! ] - * kind, whether express or implied; without even the implied warranty
# A8 q7 ~& h: w5 ~- C7 M - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% j! C8 ^. u R3 T% j5 \% A
- * GNU General Public License for more details.
( d$ _- @% E8 o Z7 U1 f* n9 K4 X+ m - */8 z- H( X# t A3 J. x3 ~
' R2 g- p/ H- o2 A, x: p) ]3 x- #include <linux/module.h>
! Y; s) x: N- E8 H- ~: |) M - #include <linux/init.h>1 K$ L8 S3 r1 u( _# M
- #include <linux/errno.h>
+ `3 q5 `& v% C F; {( B: j+ o - #include <linux/types.h>
% K5 e9 ?1 h, [3 y: M* u - #include <linux/interrupt.h>
6 Y* ~/ Z& r# f8 G1 s; ?0 Q - #include <asm/io.h>3 ~" M6 r6 T4 F& b! }
- #include <linux/moduleparam.h>
7 W6 K1 L" x ^3 z$ y# [! q! ` - #include <linux/sysctl.h>
1 W# k) x5 e$ {& |, b - #include <linux/mm.h>6 Q" Y. N: |/ C4 {
- #include <linux/dma-mapping.h>5 n# \% t" y5 A% u$ a
7 Q! Y! x1 n6 E8 [- #include <mach/memory.h>
" J% a' C9 C# {' Z9 J/ n - #include <mach/hardware.h>
+ B) C ?% ^" O/ S9 v1 [ - #include <mach/irqs.h>
( ~& L* f h: V - #include <asm/hardware/edma.h>
% K5 |- e: ]6 ?# l3 J+ V - ' H @! F' y+ Z/ ~! a& r
- #undef EDMA3_DEBUG
( `% G" t! q% U5 y+ U$ d0 V3 V2 j - /*#define EDMA3_DEBUG*/
. d, t- [+ \4 R2 D W - ! P- G" i! A' `9 F5 k) c$ c7 m$ R
- #ifdef EDMA3_DEBUG
* A( U5 q5 A( I( d# h% s - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' r# c1 _* Y, A4 ]: T" R! Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' G+ m" |$ S$ q4 v8 _ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 [' L* _8 M0 q0 i - #else5 @9 J" z7 `6 `6 Z1 d
- #define DMA_PRINTK( x... ); q( v$ x2 i0 G+ z8 m8 U4 Z1 z
- #define DMA_FN_IN
+ j+ J( o, B! W' d% [6 u/ K& m& f - #define DMA_FN_OUT
% f! `7 C. B2 T/ u# a2 u - #endif9 P- \5 X7 |; z# \# Q
$ p: q$ O, W2 o8 i) ~0 {2 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 r: D9 o E { - #define STATIC_SHIFT 3
8 U o" Q# K |& S - #define TCINTEN_SHIFT 206 l$ B: ^7 L# f
- #define ITCINTEN_SHIFT 210 f, \+ x B1 D4 r" n5 e7 w9 z' r: K& _
- #define TCCHEN_SHIFT 225 t/ i' t2 ?) [ V' C7 _7 P) A
- #define ITCCHEN_SHIFT 23: V( x) T C! `2 L
& v! M5 Z9 Z; U" d5 I- static volatile int irqraised1 = 0;
! }, M- j0 k- c - static volatile int irqraised2 = 0;9 n9 g" w2 `1 V L* j
& Q, A) J' O- H' J( a) D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R! s$ s" P* J
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j# T+ Y/ R2 r# K
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A9 c0 E8 z8 x5 E - / P/ N L7 [; ~4 ?; ^
- dma_addr_t dmaphyssrc1 = 0;
Q6 S9 h9 V! D! r# b - dma_addr_t dmaphyssrc2 = 0;
9 Z( w( m! p, r7 U( N - dma_addr_t dmaphysdest1 = 0;
; k* }; B* x) Q! }) z' f& T! q - dma_addr_t dmaphysdest2 = 0;
6 S7 N* l! `+ l. }/ h
3 F/ }5 o; z0 A+ d9 @: K& h# J- char *dmabufsrc1 = NULL;7 ]2 s; s) R ]! U* ?9 z2 W
- char *dmabufsrc2 = NULL;
4 B& c2 G. L8 n6 E8 [ - char *dmabufdest1 = NULL;! r1 n7 O* B/ A( a
- char *dmabufdest2 = NULL;3 e" e+ P2 v2 O+ G, [* b- H
& C: V# r/ t, Y- static int acnt = 512;' K) u5 k) {2 Y5 z5 @2 {
- static int bcnt = 8;2 h. _" N# H- D8 i& l# f% V) ~! d
- static int ccnt = 8;
1 {4 p; G( g9 {4 V& P$ s1 K" B - 3 W, y. s; }$ q3 q5 c0 l8 G R) G' s
- module_param(acnt, int, S_IRUGO);
0 O- B& Q, {& G - module_param(bcnt, int, S_IRUGO);
5 a0 s+ q* t. B6 M/ ^; u6 A) p - module_param(ccnt, int, S_IRUGO);
复制代码
. Q" z; Z) g. ]% D9 q0 y& ~& o) C: C+ m$ T* @( x$ s
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& W. f) ?0 Z, T, 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 ]: ?& S0 _, i
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i$ X( }2 Y9 w- A' `4 z* [5 J+ J
6 v/ E* J$ j3 V8 e6 \# D( Y y
, T2 [6 X1 d6 y6 C& l
|
|