|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # g5 D5 C* O: u( Y. h8 `" m
- [code]EDMA sample test application
' p* O; l2 W7 n! } - /*! `' i; ]: y1 o" m& I
- * edma_test.c; S/ q0 k; s8 w- j
- *
1 q8 e. ]9 H7 I- w8 |( X - * brief EDMA3 Test Application
" K! F5 H0 s+ `7 j, a2 q- k: y' @ - *2 k6 e# i7 D, b- J: R. d$ e
- * This file contains EDMA3 Test code.
" N1 V* w, k! `* @4 d - *
" A; T) r+ d& t/ Q: ~* h - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
/ \- A- x# s% J8 B5 |% s - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
. l0 H; u; L3 m$ k# t. y1 X4 N - * TO CHANGE.
$ {5 d7 {+ j# y$ H* m - *
& _& `6 t7 ]# t* n# v% e1 ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, S$ O5 v$ n2 _2 ] - *
; t3 t2 _- L2 l - * This program is free software; you can redistribute it and/or
m$ N2 r2 {, S+ W7 T" w - * modify it under the terms of the GNU General Public License as
$ o6 A) X5 `2 d' S1 q - * published by the Free Software Foundation version 2.
! z% v0 c5 E, d2 \+ x; y - *
7 H/ o, t1 ?( p' C- `* ^2 M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 e0 d7 I- P% j; @( l: U
- * kind, whether express or implied; without even the implied warranty* Q: b, h7 t$ i5 B4 t; ^. F# S
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 X8 M1 f! K/ l- | - * GNU General Public License for more details./ G- k& [9 g9 ~" W" o
- */
2 Q, n- Y6 T4 I% [& [# V: h( C1 l - / a: t3 E- T. H0 E2 t" P
- #include <linux/module.h>
+ W7 p5 f* W8 K5 } - #include <linux/init.h>6 h8 o- N) x- x4 L7 d3 y
- #include <linux/errno.h>
o0 p( ?7 [* Y3 z - #include <linux/types.h>$ @" U( G8 H& Z0 o- I E
- #include <linux/interrupt.h>
" B) b8 o+ f, b% Q H8 _4 K3 F - #include <asm/io.h>
- v$ d6 c, p/ H* h - #include <linux/moduleparam.h>
5 P+ l! D" N" j) W6 n8 t - #include <linux/sysctl.h>
8 H# j) n) P, ` b+ h- o - #include <linux/mm.h>' G0 C: K4 P0 }7 z- |) d$ n
- #include <linux/dma-mapping.h>
\% E4 [; e! w+ W9 O - & t w) O6 @' Z
- #include <mach/memory.h>
. e% z7 F. X7 J( ~) `# k - #include <mach/hardware.h># K* |1 y8 b; K8 w+ s- B' Q
- #include <mach/irqs.h>8 {' S! N: q* w1 o0 S2 [
- #include <asm/hardware/edma.h>
F# z: c5 |+ X" ^1 I6 r3 ]
* z L3 ? m4 ]+ f( i v- #undef EDMA3_DEBUG
. N" `3 K; Q% @/ n) | - /*#define EDMA3_DEBUG*/+ \/ Y# N# i. `& [8 c* M9 l
- ; T* O( E: G6 M
- #ifdef EDMA3_DEBUG
: v: s4 J6 Y( \* [* g4 ^0 B" b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
. Q, b! Q# e1 k+ l0 C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 C) U# p& G+ y3 f% R
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 y1 {/ [7 U( e
- #else5 ~% {. k2 E3 E& I8 N1 t5 Y
- #define DMA_PRINTK( x... )4 u/ }" t/ g, r3 K
- #define DMA_FN_IN' ]- q2 r6 i" o: W- G* R! W
- #define DMA_FN_OUT0 \3 j8 w' {! s- a u& R
- #endif
- E' r7 Q6 E5 y: p8 V% ]
9 A' }( P1 i" m' }# e- #define MAX_DMA_TRANSFER_IN_BYTES (32768). W/ k, [' k" W: F+ X. F
- #define STATIC_SHIFT 3
: c& n8 C7 i8 g" g8 F. \ - #define TCINTEN_SHIFT 20
5 G! M4 k% ^6 w. C+ E) @( s' O9 a - #define ITCINTEN_SHIFT 21* u6 X; ?5 j2 o
- #define TCCHEN_SHIFT 22
5 p0 y6 [1 r2 A' w5 v - #define ITCCHEN_SHIFT 233 d( ]' p5 G, ?1 z
3 y1 o7 W/ P* ^1 l) H- static volatile int irqraised1 = 0;
6 ^) U4 k; s! L x2 Q( R* W; [( K - static volatile int irqraised2 = 0;: T6 F$ {7 {6 _
- T. ]6 S9 ^. f. z8 l( J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 q; E( `- |% ~ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# y( F% W: r# Y V( | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. V) z: B4 m! f" u% _9 W
- H2 h1 C3 }- E9 s! f- dma_addr_t dmaphyssrc1 = 0;
0 T' e/ C9 g2 r: g6 x. |8 G. W - dma_addr_t dmaphyssrc2 = 0;
. R8 @/ `8 j! M3 E( h. m* {! ] - dma_addr_t dmaphysdest1 = 0;- y/ y. l: y6 b+ ?' t" Q
- dma_addr_t dmaphysdest2 = 0;7 K! {. r$ k# W; ^6 {
, [! s+ m8 I! d& c, h- char *dmabufsrc1 = NULL;
$ U0 C! a+ `/ b$ g8 \5 V - char *dmabufsrc2 = NULL;
' Q* [3 O: H0 a7 [5 A) |$ a% F; C1 q - char *dmabufdest1 = NULL;
3 H3 r6 W6 n: r, I& U - char *dmabufdest2 = NULL;, I, J A# m* h( x$ I
- 2 P' A3 X9 d! @, g0 U4 _
- static int acnt = 512;
0 O$ j e! x+ c% h+ g4 q& y* e - static int bcnt = 8;5 s. N8 Q/ K9 v g
- static int ccnt = 8;
4 V: @+ l8 ~$ J% \: n0 G
; Y8 V" t! H/ {; `/ W- module_param(acnt, int, S_IRUGO);( U/ k6 ^# j" R: {2 r
- module_param(bcnt, int, S_IRUGO);5 m, ?. l8 K. [+ y: w. U
- module_param(ccnt, int, S_IRUGO);
复制代码
8 d: Q1 _7 U$ J5 J" ^
8 H, z t. A$ c 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W4 a/ S: g, ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 W- {5 A2 S6 o" B 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# n! D3 A+ v$ t3 ^( P& a- U7 e# k/ ?. m% T9 P/ W
( w: z8 Q7 B9 ^6 b( E
|
|