|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ^" q0 p+ E: Z: @: ?, z) q- [code]EDMA sample test application
2 b- G3 o: ^& b. c0 u - /*
; x, j! S4 Q$ b - * edma_test.c6 v9 F9 H; Y% H1 i6 {: h* q* Q8 n
- *, ?4 b4 l8 t: M) n, e0 x: W
- * brief EDMA3 Test Application% \, q% {, d) Z* Q
- *. H' a9 a6 x: k* c4 B, l, k7 i- `
- * This file contains EDMA3 Test code.
* K/ n* q' s) \0 q - * [$ q9 c5 F' \1 o2 o6 P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 `& k/ n3 u( D: G) M! b
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! J& `. Y7 S: d: e" ~% H - * TO CHANGE.5 D, q) }: T* A" ?$ w
- *
m! k/ W+ @1 `/ ] - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 p7 ]& L6 g) d( c: P5 Y4 N
- *, J7 ~$ ~9 m+ P2 e" t
- * This program is free software; you can redistribute it and/or
4 b+ P+ i, f2 b, S7 R. ?" ^: S - * modify it under the terms of the GNU General Public License as
' z7 W4 O; O" R, L! x - * published by the Free Software Foundation version 2.
& r% n" Y, ?9 h" S. k2 O* Y - *
# P! k: |$ O) p8 E! J4 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! o. L) `, e0 ^* V3 k# G; k - * kind, whether express or implied; without even the implied warranty
' l* V: v# w+ E& h! z2 A1 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the R( ?( W N Y2 c
- * GNU General Public License for more details.3 v+ X- e0 @5 b3 K* I4 ~
- */
' P. O9 v! h" ^( p, i7 E - + n1 l! m: P- Q! G
- #include <linux/module.h>
4 {7 l7 b6 Y* Q- V% X - #include <linux/init.h>
$ \, d" L; N7 o7 G" @2 p- s! j) G6 n - #include <linux/errno.h>
2 R1 g: U: W7 i- ^9 u6 b" z - #include <linux/types.h>
2 a3 ^0 p9 Z# B, q9 Y( q. n - #include <linux/interrupt.h>
3 p) q2 w: u: n( Z - #include <asm/io.h>
' L4 S/ g, l+ n; j) d' o3 i, L - #include <linux/moduleparam.h>
1 i7 Q0 K9 g; y6 r5 m - #include <linux/sysctl.h> E, U ^& B$ @# v
- #include <linux/mm.h>
5 [0 H4 g2 n+ y0 j& b/ G/ F - #include <linux/dma-mapping.h>' } @/ r5 G4 v8 k8 g
- - M) {2 p' s1 O g9 d' ^
- #include <mach/memory.h>2 Y, O' j; p; C6 v
- #include <mach/hardware.h>
! ~/ ?% G5 U" o6 k, B) Y$ Z9 f: H - #include <mach/irqs.h>( M1 u$ m/ q- X% M5 @
- #include <asm/hardware/edma.h>; U5 W2 j% t3 t' q. r
- , L2 J) f: h; G0 Z- R& v% j
- #undef EDMA3_DEBUG
* F1 K7 R/ p6 T& u* [( F4 J3 W - /*#define EDMA3_DEBUG*/
. \: N9 W' w7 e& x. ^4 c) }3 s
9 J7 R; K2 x+ S3 g& ~+ y& r- #ifdef EDMA3_DEBUG; x0 V3 H& A& @( I+ B5 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 O2 q0 }) ]; N' v9 h4 i - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 U* f# A* t9 x, `$ |) W9 q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); K/ B; M/ I: T1 A! j- e3 h9 \
- #else
, Z3 T$ {! Q+ w0 X- O+ ^* m - #define DMA_PRINTK( x... )% s i$ u, p0 s. I
- #define DMA_FN_IN
3 |" T4 l+ M6 S+ S! y# c) r - #define DMA_FN_OUT; Q. C5 N6 b: I4 [- Z' C2 l
- #endif0 Z" [% {, A- x$ H* t
- ' T. E4 s% T3 G: v7 Y! Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% g# G; L- N- b/ {* [1 e - #define STATIC_SHIFT 3% J* k9 s" q, r+ c" g
- #define TCINTEN_SHIFT 20
/ z# a1 c& | [; J, y - #define ITCINTEN_SHIFT 21& G7 B7 {0 P2 A, f7 J8 T
- #define TCCHEN_SHIFT 22
4 u+ D6 J" Z& L1 K5 @; a - #define ITCCHEN_SHIFT 23
0 x+ m7 X& j# C5 H2 g1 m Z% ?
] y( Y" U W1 }; [8 T, J- static volatile int irqraised1 = 0;! t/ w6 n% u6 z9 F; p2 V
- static volatile int irqraised2 = 0;* }; m" h, M$ {- l$ Y# y& L, C
- # t7 X' n# h) I$ I$ T
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) w) c* Q4 y3 N/ A% }
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ v& Q. b; n P( X7 `
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: G/ U) ? |3 ^9 A9 H( H0 h2 T
# A# M3 p. }3 ?0 d `- dma_addr_t dmaphyssrc1 = 0;, }2 l4 J; [2 f5 x) R2 S
- dma_addr_t dmaphyssrc2 = 0;
1 d+ B! ~, p. V - dma_addr_t dmaphysdest1 = 0;
" o- e4 P# `& n# T: j; W - dma_addr_t dmaphysdest2 = 0;7 h; Y0 y5 y% Q! \8 X1 F4 v
- \- _- Y* a8 h) m6 m) _- char *dmabufsrc1 = NULL;
$ H$ P$ {) {1 R1 m# v - char *dmabufsrc2 = NULL;
, g& ^1 x5 g6 ^: u* ^! W1 l( n - char *dmabufdest1 = NULL;9 K/ s& r! p& `( q0 Q
- char *dmabufdest2 = NULL;5 R# M1 C/ o; t, t/ J
. o3 A5 M$ o* P+ ~# E+ G! e! v- static int acnt = 512;& g& X# T6 A' i: P$ f) X5 c
- static int bcnt = 8;4 C3 ^7 [6 x/ T6 [- j. X
- static int ccnt = 8;0 f! F- o H% g3 B
* b6 } L; o/ R6 }* x/ W/ ?7 p- module_param(acnt, int, S_IRUGO);# c0 }! C. T* F) @7 \# N3 z
- module_param(bcnt, int, S_IRUGO);
- G$ J& h, v6 k1 O L - module_param(ccnt, int, S_IRUGO);
复制代码
* M& p/ X2 {0 A% z8 N# @6 g- O) F; E1 w2 p0 W8 U
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' J5 m! g Z6 A( a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, W$ O- ^; i) E7 ]% R2 p8 v 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ { Z9 v! F- c
5 B7 Q8 `4 U$ o5 J0 }, U P" r: d- U3 Y+ _+ X6 {
|
|