|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : u) U+ P" C! }7 l7 \( P
- [code]EDMA sample test application; G/ Q9 P' d: W" V& q
- /*, E, I7 W* \" L6 f) D0 f
- * edma_test.c) F1 M2 ~* y3 Q2 p) [" L
- *
( Y9 d. p8 b1 ~' {0 R. h - * brief EDMA3 Test Application
, l4 u; \% t9 G" _+ s2 N3 Y- a& b6 P - *
8 M2 e/ |$ n4 y* G; V+ }* Q3 @' ?( ?9 b7 ` - * This file contains EDMA3 Test code.
- O) E( `7 V+ M0 \8 y1 a - *
# {& n8 V1 F. c" R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 I8 s6 ^" @3 v. Q: A0 z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 l6 Z' ~& i/ ?+ p/ D$ z, r
- * TO CHANGE.
3 J1 H, R0 b r- _ - *
) _" @! e% C7 o. ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
6 E$ z1 N8 N5 F; m6 o - *' N ^( a" h5 j: c$ K& v
- * This program is free software; you can redistribute it and/or
9 W7 O( b9 V' D5 A2 s5 K# E - * modify it under the terms of the GNU General Public License as7 V) G9 O1 \4 k1 i
- * published by the Free Software Foundation version 2.
6 F/ w. y: m7 @$ l7 C) r Z/ Y - *
' l1 ]& x9 p. ~. ~ - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
8 B ]! U' T# T# S8 f - * kind, whether express or implied; without even the implied warranty. F+ W- K" Y& j$ F, T, _, L+ f' U
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) _! h" S8 x4 O. X
- * GNU General Public License for more details.7 x' a, a: X0 Y1 q R/ [' W5 `
- */
- S; u, N1 `: Z$ s
8 d! A/ c8 x: O4 x$ a- #include <linux/module.h>: ]* Y* [) i) A: H# Y/ `* e
- #include <linux/init.h>
* ]+ N: h, r8 h; R, x! b - #include <linux/errno.h>
' R7 ^9 F# y6 m/ i7 y$ b. ?9 o - #include <linux/types.h>, S5 b" n/ E& @0 r/ X0 {
- #include <linux/interrupt.h>$ z4 P5 k/ k. T# z0 O( I/ ?( A
- #include <asm/io.h>
. R% D& C& K$ u- i( `) d6 \3 ` - #include <linux/moduleparam.h>3 Z' ?: g6 u) D7 [* q
- #include <linux/sysctl.h>
' ^3 d" z6 M3 i; u% b7 E2 W - #include <linux/mm.h># e: ?/ s% J. R' o* Z: }
- #include <linux/dma-mapping.h>! b( L$ U4 I/ i4 i% j6 \0 K
# i6 F ], i1 F$ Q- #include <mach/memory.h>
) S$ E' y9 y5 D3 a0 c* v7 X9 t: l4 ? - #include <mach/hardware.h>" J" Y1 O; S0 ]: h
- #include <mach/irqs.h>
L& b3 e) l& }/ e7 l, W/ W; f+ b - #include <asm/hardware/edma.h>3 Y9 _. `0 d# z5 h3 q! B
6 w: z5 t6 ~+ i. U6 A5 c. f/ g- #undef EDMA3_DEBUG
" J! w" }; \# A% j/ {0 I( U - /*#define EDMA3_DEBUG*/
/ P% f# l* m! l, W( f9 k
2 u! z! N2 c$ u' F# ^ l V- #ifdef EDMA3_DEBUG' u4 y4 f; m6 z& w' e
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 V5 r# q& m! u3 x: R$ f. ^+ y2 U* b' u - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
; b" ]8 n9 O* k) e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; v( S& Z* ^+ b4 v) X4 \" Z - #else9 P* ~0 X# G* o5 n
- #define DMA_PRINTK( x... )
* c' q7 ?2 f- E Z$ t8 f - #define DMA_FN_IN
# U& d0 O0 t W- v2 N - #define DMA_FN_OUT
g5 G5 E8 ^+ {/ [$ ^ - #endif+ E, i" d9 s, m- A- @. Y
- c1 E! M: T- {& n* N, V. E$ |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)/ o: c* @: h8 k( F& ?
- #define STATIC_SHIFT 3
* J" L# k ~! f" G8 T' C - #define TCINTEN_SHIFT 20
8 _0 }$ e9 a p. b; i0 Y8 X6 m& } - #define ITCINTEN_SHIFT 210 e$ |5 K; g6 y" ~
- #define TCCHEN_SHIFT 227 k! {5 K1 W$ C
- #define ITCCHEN_SHIFT 234 B9 D0 }6 c8 D3 k' M! ], V
- 1 |& G% C1 I1 }2 Q! b
- static volatile int irqraised1 = 0;- v. k' `/ A: x8 I% U2 E" P# n
- static volatile int irqraised2 = 0;
: k1 N* j! o# a \ - : E" E. Y( Z) t l7 ? g- ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 V. ^- P) A* C$ {+ T" l - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e0 v, c% Z4 b, t" f2 k8 a( |
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' h5 Z- r: W! j
9 U. _8 Y9 @# p" E- dma_addr_t dmaphyssrc1 = 0;+ c' t$ r# O9 @9 n* e/ _5 K" f! z2 N
- dma_addr_t dmaphyssrc2 = 0;
% L# {0 F, G+ V - dma_addr_t dmaphysdest1 = 0;
$ Z; ~# Y2 G" c+ X! I0 P - dma_addr_t dmaphysdest2 = 0;
) w" n" O4 H( |) u - 2 p7 x2 ~ U& @
- char *dmabufsrc1 = NULL;& n: R% l8 f* U2 R. r# X$ d9 V4 b
- char *dmabufsrc2 = NULL;! t {1 r# k7 |6 W& p9 B3 k( }& Y
- char *dmabufdest1 = NULL;
* O. l3 I |; @. e - char *dmabufdest2 = NULL;
. P8 K0 e& v& d1 p2 h
8 n" l. E# F% X L( K2 W/ U- static int acnt = 512;- j: N: n0 n( V; m
- static int bcnt = 8;1 F. c6 ^, O# u J5 O
- static int ccnt = 8;/ M" H- F. E# ^' F' u. h0 T- ^
5 F2 Z" S) n7 q" B: p3 U, S- module_param(acnt, int, S_IRUGO);
) V+ v; P0 t# ^ - module_param(bcnt, int, S_IRUGO);
- z. ^. i; l6 r$ F; D - module_param(ccnt, int, S_IRUGO);
复制代码 6 J4 a( s. r& Y; I& ^% w
1 j% I9 P5 T" M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! K/ d7 c% I3 R0 [$ t _8 g4 M. ]( {8 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- P2 ^3 n$ V- ~) ]- V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' H# t+ a/ ^$ {
. |2 o9 f; j: G8 ~
& d+ E) ?8 o) \8 S/ k1 q3 ?9 T+ M |
|