|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& \% _) E9 }" |7 _( N- [code]EDMA sample test application
6 p" r% ~# c% x* Y3 C - /*
- z: X6 G; c- _6 D3 u0 `$ F0 p - * edma_test.c1 d! L2 v- H7 D8 f
- *
6 e6 D- c3 W2 M4 l4 c - * brief EDMA3 Test Application* O8 X5 S! [* I
- *
6 n8 u g5 ]1 u0 Q - * This file contains EDMA3 Test code.6 @0 g5 o3 x4 G6 }$ [
- *" S# E/ t3 H7 H( G' [
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* u# H$ s9 v) n* w0 j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% q& o/ _" r/ N; w& Y' t& [ - * TO CHANGE.
; N( {0 r; M+ h. I" G8 Y: T - *3 f% A( V# ~2 H% f) J z# ~8 g4 ~
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ A8 T# ?" j7 B6 o# Z. D( v3 m - *
& Q9 F& I; x) W - * This program is free software; you can redistribute it and/or/ N4 h2 [' O3 _* h. J/ S+ {$ \
- * modify it under the terms of the GNU General Public License as
; j2 X e2 A r/ F - * published by the Free Software Foundation version 2.
4 U5 k$ F$ W/ N* T - *% x8 p6 P0 m, T6 y9 d) o/ ~; I8 A* R
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ~9 j! j0 C# V
- * kind, whether express or implied; without even the implied warranty
5 w7 l8 B$ {3 ^9 J: [. _. S# S$ I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the4 j! N8 }+ [! F1 P, d5 ?
- * GNU General Public License for more details.
& g! L$ u8 c( z4 B% V, K; T0 w - */$ z+ g* e$ w1 }) Y
* t) ~7 E: S. v6 M1 Z) ]5 |. y- #include <linux/module.h>: [+ C/ t1 h4 X2 Z0 e7 U0 A7 b" u
- #include <linux/init.h>
. R: x2 o C) X! E - #include <linux/errno.h>" W4 l" d# l3 Y+ m' n4 A8 k/ ]$ ~
- #include <linux/types.h>
4 j+ P0 [. r) Z2 q$ r7 i: u: [- B - #include <linux/interrupt.h>5 j. S& p* u3 b* S4 t7 p
- #include <asm/io.h>
% A% H3 R" f. O8 p2 J - #include <linux/moduleparam.h>
' @, C! v! Y6 }5 S. C - #include <linux/sysctl.h>
x6 Q7 X# h5 O8 G! ] - #include <linux/mm.h>
) `0 C d" [3 R6 t. Q - #include <linux/dma-mapping.h>
6 t! R9 P5 f* B$ l - * f! f$ \/ S1 r
- #include <mach/memory.h>' u( N, b" Q( T P0 q, A6 U
- #include <mach/hardware.h>
) d* x# U I/ ^* [$ s - #include <mach/irqs.h>4 p, c E: u. ~1 {* r6 T
- #include <asm/hardware/edma.h>
! G1 _, [: x$ W$ v1 i) O0 n) f0 | - 0 k. D1 h+ A. B" v$ s. O6 r! C
- #undef EDMA3_DEBUG
! I1 u8 L; H3 C& I: E% H# ~6 M - /*#define EDMA3_DEBUG*/
3 d/ W: w/ P- h, p5 s$ h* i: R. _
8 T$ S" Z" j: l- O! @4 v- #ifdef EDMA3_DEBUG
$ M) P0 W$ H' E! r8 n# M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' Z9 L4 |6 L1 k& W2 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- g* Y3 u+ B4 e' t% j7 K! s - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" b4 Z, {& P# l
- #else
4 w2 t# y: q4 Z - #define DMA_PRINTK( x... )
) ^# d) Q2 M1 i3 N' g* G - #define DMA_FN_IN1 E6 t" T0 S6 {: d1 a
- #define DMA_FN_OUT% e2 ]2 N: j& X J7 z
- #endif+ k0 ~' |4 `( \# R% u ?
- 9 y5 N, o# Z% w! K0 a5 b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768). ?) o. v% l8 G% V# u I O" Z" b+ s
- #define STATIC_SHIFT 3' g9 d$ N' p. a1 G
- #define TCINTEN_SHIFT 20- ~2 y9 j# s7 Z& r( K
- #define ITCINTEN_SHIFT 218 e: f; ]! Z5 @/ K, @! N- l
- #define TCCHEN_SHIFT 22
5 d ]& T; t" d- U9 V1 H - #define ITCCHEN_SHIFT 23) k" y: C: w3 ]6 Z
6 C7 ?- w, D# t$ C0 ^- static volatile int irqraised1 = 0;* w' \4 Q5 t1 Y. L7 U
- static volatile int irqraised2 = 0;+ }7 p% t, c" D; c
5 q$ F/ F% k4 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 O) ]% Y! \. Y( `
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- U+ b( l$ Z. J1 B) i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 p1 a8 w+ L3 }2 P
- s% g8 a7 G; e6 \. J8 Z$ @- dma_addr_t dmaphyssrc1 = 0;
9 e$ ^& W$ E) `2 ^ p - dma_addr_t dmaphyssrc2 = 0;
; a! H8 A* b1 W' Y3 z' w; S - dma_addr_t dmaphysdest1 = 0;; a6 Z( G8 h& h
- dma_addr_t dmaphysdest2 = 0;
3 D1 y. j# W, h; S% Z B, B
( }6 B7 i3 R- A1 ]( C, r" I0 V+ d- char *dmabufsrc1 = NULL;
) F" r: Q' ?+ y$ u3 Y! d - char *dmabufsrc2 = NULL;" J$ f4 o7 z- l6 `/ h n. K
- char *dmabufdest1 = NULL;5 S$ b4 i6 N& `- W \& T0 Z
- char *dmabufdest2 = NULL;
, b* O( [6 v% B
7 n2 B# q$ w% x2 ^- static int acnt = 512;. {' L/ ]% D( ~3 h2 W" f5 A( Y
- static int bcnt = 8;
9 ^8 T$ ~4 L7 h - static int ccnt = 8;1 I) ^% _+ M! |
, r7 u( s) O) d: q9 D; G) b- module_param(acnt, int, S_IRUGO);
# N, ~" p" d0 b! [8 r - module_param(bcnt, int, S_IRUGO);
( S. |, [& D& ? - module_param(ccnt, int, S_IRUGO);
复制代码 , k0 {- C7 K/ q# _% e
1 u! Y: t$ k0 u) X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 H7 v, D8 p+ N; s0 W7 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& |+ ^! Y" B/ N% n$ m 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. p# r% l0 m8 Q( t8 V% t+ @! d q5 W$ u- B# N
: g6 z6 U" u+ G8 e
|
|