|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ c7 @$ L: o- z! I: s, r0 o0 l- [code]EDMA sample test application
0 |6 s1 S) W2 M0 Q7 ] - /*# s1 @5 t# j' t0 D6 A0 q
- * edma_test.c; L+ r- e" h! [2 U
- *
% \$ h* V" x X - * brief EDMA3 Test Application
4 L* t6 h; \4 i. X - *' H- |' g* o2 S$ O
- * This file contains EDMA3 Test code.8 f; p, Z5 y& a! k; N/ q
- *
; b! c; D+ F9 L/ d0 g2 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. q- F3 j9 q9 c# m) H3 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
7 c* g3 |* o' W) F% J - * TO CHANGE.
" N' n+ u6 z+ U$ E1 G2 ~( ? - *
. v1 K+ r5 e& h& R4 ^4 i* | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( M4 `8 s2 I% i* Q' [9 E3 C
- *
9 j! P& } ]0 p - * This program is free software; you can redistribute it and/or
0 H* H& @9 }5 k; F" i) Q - * modify it under the terms of the GNU General Public License as5 C* L/ `4 G9 @- c+ ~5 r
- * published by the Free Software Foundation version 2.
% R& z) Y1 ~0 U% o2 }! C! c - *
& d; A" z% \$ V+ r, o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 @: j# x/ {# b- {& f+ \ - * kind, whether express or implied; without even the implied warranty
0 V# q& ]( Z" _ c" R0 z5 {" a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 k1 W, ~/ [( T7 K
- * GNU General Public License for more details.
t, H% ~. W& C; i& ~ - */
1 L* Y% n- b% a( t
+ n2 r: b6 _+ u4 z4 ?% y1 P- #include <linux/module.h>
) b& [' l$ o' S$ x8 ~" d - #include <linux/init.h>
! T: ^. K4 {' t) Y6 G2 N - #include <linux/errno.h>
7 r7 h* U" [. ]( s' V' y - #include <linux/types.h>) y% Q2 R5 I) R, A3 d6 |
- #include <linux/interrupt.h>4 a5 l, `# j ^4 e6 a0 X
- #include <asm/io.h>5 a' i8 i% \, ~. \
- #include <linux/moduleparam.h>
. t# x' E% U; P9 Z, o - #include <linux/sysctl.h>0 ~/ |( s" E7 }( m( o7 }; o
- #include <linux/mm.h>
, V6 Q3 L. b* k# ~" {- h2 \: Z - #include <linux/dma-mapping.h>( }0 E2 n( @, v) d6 F) i d
- 6 Q! m9 F8 U4 x, C
- #include <mach/memory.h>/ h4 b2 b5 L/ B5 g
- #include <mach/hardware.h>
/ |7 B+ k' c$ j- N% W" p. L/ I - #include <mach/irqs.h>
: a/ U! X" ~# L5 m - #include <asm/hardware/edma.h>
) s$ ]) k2 |+ k0 e. z% y# g" k6 G
9 _4 u$ e; ]- Y1 r+ E" N8 L1 `- #undef EDMA3_DEBUG7 N4 f g; R6 C# p/ U
- /*#define EDMA3_DEBUG*/
7 k, U. S9 Q0 c1 @0 l+ i( u - * h2 ~' u" @. W& W* }3 H$ `7 J* r
- #ifdef EDMA3_DEBUG1 \2 P! {# e K% l) @
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# A+ I+ v- n! F' [+ ~
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ I6 a- j& a7 f ~5 r) V& L* `, w
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& E+ S$ X9 D; d2 z - #else) `1 T- ^. F8 @/ v* f5 l% h" _
- #define DMA_PRINTK( x... )# N# j8 v3 `9 g% \: v+ J. ^" B. T
- #define DMA_FN_IN, m. Q* P V9 |* o% q. E0 e
- #define DMA_FN_OUT k- P( G5 _. w7 E7 q
- #endif" i2 H2 @! e6 ~2 N9 \' E2 J
2 f, j' G a/ J/ S! D7 N! q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ o/ z# U9 x8 k7 |9 _( N' y( z
- #define STATIC_SHIFT 3
6 S4 i# h2 R: @' w; V- i y+ g! N& Y6 Q6 j - #define TCINTEN_SHIFT 20
. Q# ]& O% A2 \+ e; \& ` - #define ITCINTEN_SHIFT 212 P2 ^5 h+ y# [, S5 t
- #define TCCHEN_SHIFT 22
% x5 e* W7 e' u2 p$ C' H - #define ITCCHEN_SHIFT 235 u* Y# y7 @( [8 F' U
3 c- L, `4 O) c, u- static volatile int irqraised1 = 0;; ]1 U+ w) y# g" @( L" W. c
- static volatile int irqraised2 = 0;2 S' \" @; \! E) E0 D" c! {
- & N3 C' d: y' y7 d7 J
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! ]; r' g G2 s4 B c/ @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" m+ g/ `. J$ ]+ o6 h* J' f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 A: q7 a9 f f9 m( W - $ I5 A% y3 k9 S4 [, n& c' t; K! q; _
- dma_addr_t dmaphyssrc1 = 0;! \3 K% [3 o+ M+ N/ p0 ]8 y
- dma_addr_t dmaphyssrc2 = 0;
, n; [, Y$ b/ ~) L! T, I! r - dma_addr_t dmaphysdest1 = 0;! b0 N# b5 G; `* ]8 q9 w5 z
- dma_addr_t dmaphysdest2 = 0;
5 E# @4 `. y9 b' Q& S% A* \ - * e( F$ X2 T0 b- d
- char *dmabufsrc1 = NULL;, W8 ?1 ^& a. n+ ?' [. ~
- char *dmabufsrc2 = NULL;$ }4 a$ i, n( r. R6 l; z
- char *dmabufdest1 = NULL;7 u8 t- H! H% @/ T
- char *dmabufdest2 = NULL;
5 h! x0 G, {5 ^( Y - ' E& c9 j1 S" z. j- V. P
- static int acnt = 512;6 f2 U1 [* V8 `: b5 {
- static int bcnt = 8;
6 K/ O \* M, k1 m - static int ccnt = 8;
+ q1 a: ]; @- h" w7 [3 i - . N' e7 _( a3 Y' b
- module_param(acnt, int, S_IRUGO);
: f! A! j4 C/ C# _$ o3 A - module_param(bcnt, int, S_IRUGO);
( X$ r; z6 P3 m, ?7 P: E: X& k - module_param(ccnt, int, S_IRUGO);
复制代码
: { l7 H) F3 ?, ]* G4 l( S4 _$ a/ `
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! a6 r$ Y" @4 P- w; Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 \+ ~; L; ?, v; e- Q$ Z7 P3 M 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* c$ w9 n8 K: ]: ^, i! k! X3 I9 ^+ p! x
# ^2 c6 p+ r" Q3 x |
|