|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 S) f& S) T; t2 y" @9 V
- [code]EDMA sample test application, q ]& a( C" O9 V0 q
- /*1 W4 z4 }% m1 j9 o) s& p
- * edma_test.c
7 Q/ F) m/ n/ }1 C$ m - *
: w7 p8 f. c; @9 R e% c - * brief EDMA3 Test Application
- [: \' E8 O% U9 t0 ?- Q - *- A* ]# Y% p7 j- R8 A
- * This file contains EDMA3 Test code.' F/ k# `1 o1 d% {8 C% H6 S
- *2 H0 T* {" \3 e! H1 P+ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! _7 C( O% e/ Q2 |/ q; ~' @6 m - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ W0 O# ~1 A" |0 ~( S- c h$ F o) r - * TO CHANGE.; P+ m& p3 H4 V2 r3 b
- *& q: m3 S, h) k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' Q8 V+ E, a; R( a/ V - *( y8 E2 _# o) s" p" \
- * This program is free software; you can redistribute it and/or
9 S6 E( `4 m7 B. l - * modify it under the terms of the GNU General Public License as
- O6 J0 K5 L- \' G2 ~# r- q/ X - * published by the Free Software Foundation version 2.
2 y( t4 z4 s) ]$ m$ [8 O - *2 k2 l, j+ W/ ^2 ?& E2 h1 |
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
' W& n( D" O) @: ]3 ~ - * kind, whether express or implied; without even the implied warranty
4 T9 Q1 Z! `2 \- @- ? - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( K0 r' q7 P4 o. e6 U. K+ y
- * GNU General Public License for more details.
! Q/ u9 q! A4 P7 c3 Z4 q - */
3 Y7 x" k' d7 X3 u: ^4 i
: r W' V) K: d3 @; K" `$ }- #include <linux/module.h>
2 f2 l6 u$ \) ] - #include <linux/init.h>0 ^' z3 {6 B$ o- q- V
- #include <linux/errno.h>7 T; ?- G. v& o' v6 h6 K
- #include <linux/types.h>
8 }) \, l0 e* w# p ~3 H4 F - #include <linux/interrupt.h>7 W t9 D# _, M
- #include <asm/io.h>" G" }7 Y3 T$ d: U
- #include <linux/moduleparam.h>
; Y x1 a8 u# x. o1 g - #include <linux/sysctl.h>) t/ |. t) p% ~9 r7 \ S b. N# z
- #include <linux/mm.h>/ p& j+ X3 M% D+ W* Z% n2 @* H9 u/ f3 k
- #include <linux/dma-mapping.h>
( o% {: Q. f" ~6 {, z - + X8 l! N. B) o3 b! t! v0 m
- #include <mach/memory.h>
1 {1 f) K. v* o- q( F - #include <mach/hardware.h># N# j. b+ g# `% i
- #include <mach/irqs.h>$ Z# x/ ]( L( \0 ]
- #include <asm/hardware/edma.h>2 l3 H6 E3 c: |. {2 Q* X# s
( B! d# O' h0 L E3 w- #undef EDMA3_DEBUG! s" L8 C$ h: n) s+ H2 ~
- /*#define EDMA3_DEBUG*/, q4 u/ @' z9 n! o
/ Y6 G- r& X2 g) N- #ifdef EDMA3_DEBUG
0 z* r) m3 e, A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 B! \" D2 I8 f* H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# W8 w, M' q0 i# e1 }5 ~ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% j9 Q7 W/ C( l; o; c- N# r" J1 D
- #else
1 ]! w) E2 z5 s$ I' [. T: v6 c - #define DMA_PRINTK( x... ): [1 H' Q3 |. d
- #define DMA_FN_IN
& x9 k2 R& u; @% x - #define DMA_FN_OUT) A w6 I, ~9 S
- #endif
4 c; v7 K* A( \ - & z8 b+ q" ?7 h# @
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
w+ P3 r, n4 g. J$ ^4 `" ] - #define STATIC_SHIFT 3
; K/ |/ @+ c9 ]+ N! @/ N9 y - #define TCINTEN_SHIFT 20
0 m* J, \ s! w7 I - #define ITCINTEN_SHIFT 21$ w s/ Y3 W) w; @/ W3 S6 v" c
- #define TCCHEN_SHIFT 22% q8 F/ v) T8 f+ w( h# _' G
- #define ITCCHEN_SHIFT 23
& s5 {- R$ w" k) D+ h1 t - : D* W- O r/ h- {& d2 c+ @
- static volatile int irqraised1 = 0;
) U6 X* e" T# o3 y - static volatile int irqraised2 = 0;# V5 K$ o/ Y6 ^2 r7 U4 E, P
- + g6 Z( g! D9 G+ y
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 y1 {& Q2 m1 L# n1 f& C7 [ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 ?- v9 r% ^# {4 R- d( i/ r - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( p2 u* x& m5 L" }+ M* Q9 L! q& r$ w
- " z" \' S6 P8 S; x
- dma_addr_t dmaphyssrc1 = 0;4 U& L7 n- T( A& {. A; l5 G( Z
- dma_addr_t dmaphyssrc2 = 0;) K S$ w, C9 V! y) m" t4 T* N
- dma_addr_t dmaphysdest1 = 0;
- C+ i1 T# ~( j E5 F1 ^ - dma_addr_t dmaphysdest2 = 0;
& O6 p) q, ?" N% W5 N! i
7 d7 Z2 W7 M+ ?+ F+ W% J) T- char *dmabufsrc1 = NULL;, u: h3 p* k: P7 @. M7 h& g* r+ o- O
- char *dmabufsrc2 = NULL;6 D5 k/ k0 h( n
- char *dmabufdest1 = NULL;3 q; g8 u9 {. \# c( ]
- char *dmabufdest2 = NULL;: e" B; R) ~6 z5 ~
& u$ d8 U. x" O9 e8 A- static int acnt = 512;
1 k0 F5 i! F2 B; u - static int bcnt = 8;
* J% ^9 ?3 g1 a% B: ]3 A - static int ccnt = 8;
9 r+ G6 K* d2 j+ K3 u - 3 r3 P6 G+ U" n3 x. Z3 Z! g+ b
- module_param(acnt, int, S_IRUGO);
' j8 B3 \8 W. n2 z# J' P - module_param(bcnt, int, S_IRUGO);" r5 I* J2 w* V
- module_param(ccnt, int, S_IRUGO);
复制代码
# z4 B9 ^. L. i5 v7 Q: o. Z( Y+ t3 k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ~' v; R% ]5 F7 _9 ^4 S5 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# G( i; B r" h- m7 T
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# Y: p7 ?8 M0 P8 f/ G0 F* l
' S: k% a. g6 Z# m" N d, @1 T' M( B) y0 T
|
|