|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ [3 [, e, y" _( G- ~" \$ V3 A2 Q- [code]EDMA sample test application
: f" o8 h) U! t9 d5 c - /*2 x" t! U. @1 Y. [5 p! y3 v1 Q
- * edma_test.c) t' k; y" G4 |( @! U
- *# |5 v- N/ ~0 I6 F( F6 p: u
- * brief EDMA3 Test Application
* w% S$ T' n8 _& W9 q - *
8 Y1 W& C0 a1 A# r. T3 a" f - * This file contains EDMA3 Test code.5 j1 o1 ]+ _2 @" w8 u5 u1 q. i1 H) l
- *8 h1 o9 T9 T4 n G" p+ c, k
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, }# K" y$ \3 s# M7 {6 ]# F0 i; Q - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 r7 R* K4 n2 a! d/ a
- * TO CHANGE.
1 Z. D- \& Y* V - *6 G5 A" p: S2 h9 F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 O9 y9 b" E' Z9 t
- *
+ b, X, v) B2 j/ `# j - * This program is free software; you can redistribute it and/or2 w# ?+ H/ @6 j: f( M8 C# ~" ], _
- * modify it under the terms of the GNU General Public License as" i5 d" u r( |: h" T4 B
- * published by the Free Software Foundation version 2.) Q# t. p5 e8 ^
- *' C5 U! a; `( l" t5 e$ ~5 N
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ c3 Q' @: ~% t/ Q$ D7 X
- * kind, whether express or implied; without even the implied warranty. O1 _* {, a' f' W7 [/ D% `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
T7 ~; Q D$ q _" o7 K - * GNU General Public License for more details.6 u7 X$ } J, s- C M* d4 [
- */
5 C! n4 _/ ]0 ]
+ o3 [4 A5 y6 I; E- #include <linux/module.h>
2 @/ E6 C" y" G7 u. ]5 }( O6 P2 f - #include <linux/init.h>: P) [( f* t9 J' k; ^
- #include <linux/errno.h>- ~/ H- g9 S) x) M
- #include <linux/types.h>
0 U+ f: P, Q# {! r7 p2 [, S* S - #include <linux/interrupt.h>
; K4 P Y0 e9 Y4 W% c5 R& y' F - #include <asm/io.h>$ z1 B y- j. [/ ?
- #include <linux/moduleparam.h>$ T: l# E e/ [2 c
- #include <linux/sysctl.h>
0 ]# t4 F8 M4 I0 w8 d - #include <linux/mm.h>
+ o3 ]4 p6 |2 U+ | - #include <linux/dma-mapping.h>$ d8 ?% S+ a! h
' T1 W! x2 o2 E# R; w% D- #include <mach/memory.h>4 z E; M3 p9 l X( b- w+ ~ F
- #include <mach/hardware.h># b( v. X7 K; ?/ W) K% s
- #include <mach/irqs.h>
2 a3 e! V) N8 E) _ - #include <asm/hardware/edma.h>
: F1 R/ v. |+ G7 f0 J0 E4 C/ t
6 e" n4 H6 j8 e. _, e9 Q9 c- #undef EDMA3_DEBUG& _# ?5 w) a. w3 o/ j, B% P1 W
- /*#define EDMA3_DEBUG*/* h( ]; ^/ s0 j
3 `8 _/ p6 s; z8 L: E7 [0 e- #ifdef EDMA3_DEBUG
2 d+ d4 A; _) ?- r3 a6 o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& X& L0 t- [/ F( X5 z0 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 X" c) q3 q, K8 }# K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ V- z& C+ V9 B$ T% f$ C - #else# b3 L5 _6 `& y" V
- #define DMA_PRINTK( x... )
2 n6 F3 I) k, ~+ t/ u* \ - #define DMA_FN_IN
4 ?- O J# ?3 O" ~# o - #define DMA_FN_OUT2 ^ B5 K& W+ W) _) [; t
- #endif
& y5 E7 x0 Y# @" O# d - 3 P& O% ^; w8 H# ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; u2 }9 o A N6 J5 |/ e - #define STATIC_SHIFT 39 Q: G" W) k7 A8 n2 M! q8 X3 _3 F
- #define TCINTEN_SHIFT 20
8 ~* @ J7 f9 ?: Y1 j7 _/ ^0 e/ b - #define ITCINTEN_SHIFT 21
. c: Z1 {& u4 X3 N0 G - #define TCCHEN_SHIFT 22
7 I( F1 K, E0 s% Q7 A# v - #define ITCCHEN_SHIFT 23
- l4 s# r0 W( H - ) [4 E; i2 x- Q7 G8 E! g
- static volatile int irqraised1 = 0;
9 ^9 h1 z8 o" Y% W8 E+ A( T, Z, A - static volatile int irqraised2 = 0;7 @* W4 a& _/ c2 n
1 n5 v( ` D& f, x1 N7 o1 S1 s( d6 G- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 I/ K ]8 n2 T5 r4 T" x& o
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c! b, k/ O, l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 i% h7 S! z+ @+ \% k- w- F
/ ~* C, P6 i; t+ z/ r t! e- dma_addr_t dmaphyssrc1 = 0;/ Q6 s8 l' w9 s, a( H/ @
- dma_addr_t dmaphyssrc2 = 0;
- Z, h6 \: x$ Y" S - dma_addr_t dmaphysdest1 = 0;! M( Q" L. q7 h3 Z4 L" }0 y9 b
- dma_addr_t dmaphysdest2 = 0;5 e/ |3 U2 Y4 u
- 1 E! ^6 F# X* V: v4 y
- char *dmabufsrc1 = NULL;% G# c9 X+ ?: K9 W3 L
- char *dmabufsrc2 = NULL; u; s2 U7 ^5 ~
- char *dmabufdest1 = NULL;
( n' w6 f8 \; W5 D8 @9 A4 r - char *dmabufdest2 = NULL;
9 M" s& c: m4 F! v! b; M
) A+ n0 M Y& E l- static int acnt = 512;5 O4 ]( X, n2 ?
- static int bcnt = 8;
1 j2 H* Q, f0 Y1 A6 V1 ] ?& Z' A - static int ccnt = 8;# Y1 ]. e- F/ M# O, l$ T7 m
9 i$ r2 C: T8 \' M- module_param(acnt, int, S_IRUGO);! `2 d- l: E6 ?0 Z0 i1 \, y" K
- module_param(bcnt, int, S_IRUGO);4 \8 t4 r) k j4 ^" F
- module_param(ccnt, int, S_IRUGO);
复制代码
) x# P U U* F* [$ s6 k, q8 l7 G' a. I1 f( ^ `2 \" r
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 r( i. o& d/ garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 [- @, x0 J1 ~. K+ g
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 G" Y/ y6 m7 |; s, J, [- T
n; i* c6 A* ^: z6 g. [/ P+ g, j4 D1 | J) B1 ], U
|
|