|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " q" U& x8 R+ \/ K! r3 o5 y0 Q
- [code]EDMA sample test application
& c# s2 q: h+ j8 l; f% [" f+ z/ H - /** |! G1 F9 \# R, J: k6 k. D7 R
- * edma_test.c
& A4 M& R7 k) q, L9 d! R9 ^ - *
- Z7 ^0 ~2 `0 y - * brief EDMA3 Test Application
+ u& ~# X4 U* Y/ @/ [, A' B! |+ { - *1 t9 J* z5 M* y, H6 U$ h/ U- S6 M
- * This file contains EDMA3 Test code.$ H: k, z) T1 p
- *! Y* f# Z2 [0 n" }/ i; L
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" r! p+ [8 `& k; V - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 O7 z$ T0 ~4 P - * TO CHANGE.- p. t9 g/ S; \) e/ g
- *" |7 i, Q5 e7 o- d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u9 z$ w! b9 o6 d! S4 E9 m5 v) ?2 F
- ** r+ y9 \6 s0 V4 t$ T/ b, ]4 v
- * This program is free software; you can redistribute it and/or
9 j4 ?+ U1 a3 y! Z) k8 U" t% ` - * modify it under the terms of the GNU General Public License as+ D A" t L4 s& H+ Z4 M) s' \
- * published by the Free Software Foundation version 2.
/ O+ b& C e3 j. ?1 r - *
* T) {8 I6 ^# V" K - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ `, m& |/ h3 q$ u) \
- * kind, whether express or implied; without even the implied warranty
7 W+ T) S1 k5 a: {! Y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 H& X J/ y% t% U5 N6 q - * GNU General Public License for more details.
' ^- m* L) t6 H; l& W( F/ P - */
5 }8 ]( K, h P3 ]9 `" v - \0 B4 c2 j* d) h# c6 G: I
- #include <linux/module.h>
7 j0 x5 L- [' K0 t, c1 [$ d - #include <linux/init.h>
3 \5 @, X& ]& t9 D - #include <linux/errno.h>
8 G& g7 b, ~3 {- C - #include <linux/types.h>( e: S& D5 U/ t+ F# B5 w0 T
- #include <linux/interrupt.h>
9 u4 A7 w- S8 W/ |7 p: p9 \: U; u - #include <asm/io.h>9 @6 d) N: A# ~7 F2 v8 w6 |! t
- #include <linux/moduleparam.h>9 |7 Q- x, d) Q* C0 i& i
- #include <linux/sysctl.h>
; g! V9 o# a+ M: t - #include <linux/mm.h>- w) E( A" P- o/ A8 h
- #include <linux/dma-mapping.h>
. u: } D S5 j ?8 M% x1 |- z - * L5 w5 ]% C3 P
- #include <mach/memory.h>3 y$ l$ o J; _; Q- O, a7 z# l
- #include <mach/hardware.h>
5 F7 S% W+ X2 H. l, y) r - #include <mach/irqs.h>
( L5 {+ E E. h/ _ - #include <asm/hardware/edma.h>2 i/ n0 V5 p, O6 G, J W
- 2 v% [4 }7 ]7 ~$ Z) D
- #undef EDMA3_DEBUG/ o5 D1 m4 G( a, M/ P+ ^: y- k
- /*#define EDMA3_DEBUG*/
- z9 |1 ?) l5 J( u0 `) @3 B
2 R/ \$ |: ~9 H8 r; L* l- #ifdef EDMA3_DEBUG
?* i; f6 ]- G2 q - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% t" A3 J! s$ {/ N8 \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) V( I7 x, v' k+ ?: Y8 ~* Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 e% z' M6 T0 ?3 U& D5 O6 ?
- #else
! ~* G: \% B9 | - #define DMA_PRINTK( x... )
3 a7 P2 E, F" X# p. m, R - #define DMA_FN_IN
3 v% [+ y1 ^' c9 L5 Q9 W9 o( i7 A - #define DMA_FN_OUT
5 E; x, \! v1 b( S - #endif S+ k% E: |* G: u3 D( S+ ^" I
- 2 q! H7 j- _, s: N* d# W8 L8 d7 ]
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) w6 y3 N4 r. H/ e, q$ t$ F! R" F$ m
- #define STATIC_SHIFT 3
0 S+ j9 V& V3 F( f$ b1 F - #define TCINTEN_SHIFT 20; |1 V5 s! w4 C* G, E
- #define ITCINTEN_SHIFT 21
; }/ y$ Z- z# R C6 _3 h - #define TCCHEN_SHIFT 22
% }2 g0 h' c, }. i! ~9 M/ _ - #define ITCCHEN_SHIFT 23
8 d) O. A0 H: p) `& O# E8 a0 s+ d - ) _* ]$ x- f. b+ |' S0 f5 O& Q
- static volatile int irqraised1 = 0;
, L E+ j7 u0 ]* p# D( X - static volatile int irqraised2 = 0;
5 c% @0 k" |. {" u( B0 a& z8 T, h& n
% H1 Z% g1 b( [* q7 _& s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 m) M9 Y: p0 }' D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# D1 t, w0 O: @& \) ? - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! I; Z! ?6 X& D& m8 n0 y/ l7 Z) O- a
- 9 ^: _% g. C% p' `5 E* m" @1 a
- dma_addr_t dmaphyssrc1 = 0;6 `( H3 q' L- y9 m( {7 t
- dma_addr_t dmaphyssrc2 = 0;( k) |0 P' i L+ A: _
- dma_addr_t dmaphysdest1 = 0;
3 E5 M+ u" ]9 Y G - dma_addr_t dmaphysdest2 = 0;/ Q$ o( o, s7 y
- 7 j3 s6 a+ T7 e6 b+ F0 g$ K% q
- char *dmabufsrc1 = NULL;: u9 N% |5 ~9 i4 X1 \
- char *dmabufsrc2 = NULL;
' _- z1 [& c& H& K - char *dmabufdest1 = NULL;
$ W/ C5 z' U/ W - char *dmabufdest2 = NULL;
- D' L, O4 \% G8 [# K. y6 h
7 c0 r3 l0 E: k+ q- static int acnt = 512;4 Y6 o& y: w4 ~( j
- static int bcnt = 8;
3 P+ _/ i+ ?! ~9 X8 L) u - static int ccnt = 8;( g' Q! r, C# i8 ^- H" Z& e0 T
7 [' [( }: Q+ C- X: Y- module_param(acnt, int, S_IRUGO);
$ R8 P d- J+ h6 k* q1 n0 X - module_param(bcnt, int, S_IRUGO);
) {9 `) x( w' r - module_param(ccnt, int, S_IRUGO);
复制代码 ; n9 ]$ I, n W1 r
+ Q& U2 O w" J* ^* d& Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# e" K8 K3 a4 N8 _; @4 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 s* k9 W+ k0 D: L' Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。 c- w. z6 \7 w
" E1 o Z+ E0 J# E
3 X* C W x j0 w, h$ A& R% \, c
|
|