|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - P0 l* M& Q9 \/ T1 c& f5 f
- [code]EDMA sample test application! k5 B* w6 J6 |
- /*
) \5 ?9 d |; }8 Q ~ - * edma_test.c
1 I! D& A$ n: b9 a) ]( n - *% j$ I7 w( @9 d t5 V
- * brief EDMA3 Test Application
5 t5 _ M1 L( s4 h3 X% T" Z - *0 Y9 Y) q+ p! x
- * This file contains EDMA3 Test code.
* J# h9 C3 |1 k: `8 ]$ t' y) w, j" g - */ l$ e6 G# P8 t1 g/ y
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: _! z5 p, E& E1 _: p1 `# a! z* T
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; y0 ]6 l& k% W$ O0 b7 N4 ~ - * TO CHANGE.
& a+ q8 _ X. Z" C - *8 [2 O1 a6 @- r2 x5 _' S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 r4 T3 m# {% A - *
7 H- Q. |9 j3 }# B7 I - * This program is free software; you can redistribute it and/or
8 M8 \9 w4 c: w/ h7 w2 R( a - * modify it under the terms of the GNU General Public License as
" {; a: f4 a" p; p - * published by the Free Software Foundation version 2.
' P# J0 G# o7 i; Y" M9 V8 h - ** }/ C; l3 V/ c4 H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 @* b$ B6 e6 J7 D
- * kind, whether express or implied; without even the implied warranty# @( X$ ?" W: L$ D! L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% x6 h$ Y M: F T2 w, d - * GNU General Public License for more details.' j% H- E8 T, b2 ]: {
- */
8 h& \# d$ H( y+ n- E! H
% ?, B! r) P( X1 [& N0 ^5 T- #include <linux/module.h>& R3 d2 O' H2 e$ }! F% T. b
- #include <linux/init.h>2 q$ v* f& J4 Q# ^# S7 O
- #include <linux/errno.h>5 c) J2 u9 X. ^/ \/ P$ U
- #include <linux/types.h>
$ _2 e7 S, T% G3 y( h; `" p - #include <linux/interrupt.h>: X& s/ a- w V
- #include <asm/io.h>( u; a( g' s# {* z
- #include <linux/moduleparam.h>9 E+ F8 n: u5 P" X4 F: D
- #include <linux/sysctl.h>+ L# ~' s }8 F9 N6 ?1 T
- #include <linux/mm.h>
9 D" l# H5 U4 B. l6 I4 K2 l# q - #include <linux/dma-mapping.h>
& A9 M2 Y- D0 I" E7 X/ p; T - ! N2 O2 y! w+ T
- #include <mach/memory.h>
! A; G& X0 _* k: l9 T4 l k - #include <mach/hardware.h>
1 O, Z0 }/ U2 A( v - #include <mach/irqs.h>
6 \0 X$ `6 @' j8 d6 F1 j# ~( S, W - #include <asm/hardware/edma.h>
' J% N1 L2 R2 p% [ - 5 Q4 W4 T l, C' e# e' ~2 @9 S
- #undef EDMA3_DEBUG: `! h O/ |7 Z& a# D2 l3 s
- /*#define EDMA3_DEBUG*/
3 x! i% b# ` }. _) X& Y
0 c% d: O& v! s$ a' Q. n: U- #ifdef EDMA3_DEBUG
9 x8 y+ j6 P7 I" N! V% q7 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: i. u1 U5 C7 S7 e# _+ B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! a# D- F( i) C& k* @/ U/ ]8 T+ N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 C4 }. _, H( g! @0 `
- #else
2 ?, q4 ^1 y1 r1 T - #define DMA_PRINTK( x... ); I" f+ t% Y; S! u
- #define DMA_FN_IN
7 \: q8 O2 p' L8 L+ a3 A4 K - #define DMA_FN_OUT. D1 D! w" E( I! u1 n3 M- k! Y
- #endif1 W7 e! U( p& }; G, w* @
- % W, f5 H; H+ i0 O- Z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)$ y: j! l! b2 d8 m4 |
- #define STATIC_SHIFT 3
8 V |. O/ t+ j2 E" [; a7 Z - #define TCINTEN_SHIFT 20
+ ?+ G+ G6 Z6 |- w' H# O) ? h - #define ITCINTEN_SHIFT 21' r! ^/ y9 z6 L9 Z. x' v
- #define TCCHEN_SHIFT 22
/ H0 L7 L0 c5 H, z - #define ITCCHEN_SHIFT 23* N7 n; x0 y$ h* w5 v6 ~4 h
- " J$ x0 ^. C( l- P; h( S' r! N
- static volatile int irqraised1 = 0;
2 u% S/ @4 l' {1 K9 G - static volatile int irqraised2 = 0;
! t, p C, g4 t/ D4 ~
# B( W0 M' I$ {: ?- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& |) d$ W2 o4 s$ i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); ?5 X. c- ?3 c" H) c+ {( f7 Q7 h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O" ?+ o" C0 p
) H/ y8 `4 g# b$ s1 m; `% X- dma_addr_t dmaphyssrc1 = 0;# i, o6 f) c2 D) [. X
- dma_addr_t dmaphyssrc2 = 0;+ g% }+ E( W* \! s" \8 s
- dma_addr_t dmaphysdest1 = 0;' U) u+ V2 S& u
- dma_addr_t dmaphysdest2 = 0;
/ C1 i. c; t* q3 Y - 7 k ]! l V5 i G
- char *dmabufsrc1 = NULL;
; U5 E6 T3 }7 L: T1 d! I - char *dmabufsrc2 = NULL;
0 _- |6 U6 G$ x) l - char *dmabufdest1 = NULL; w& |" i; A, I$ ]3 O4 k0 h, \
- char *dmabufdest2 = NULL;
+ b" T E7 F' Q$ A' \, a
[1 X, s# h/ n6 s% D5 Z% v- static int acnt = 512;, S0 Z1 U" o; m% J/ \& ^! Q
- static int bcnt = 8;: b/ V4 N: _, C% ^
- static int ccnt = 8;% C" i. R* ?( G/ f5 y
" P" t2 l& d) R# P- module_param(acnt, int, S_IRUGO);
! _/ @9 }" g* [1 b - module_param(bcnt, int, S_IRUGO);
% u( {6 G, W) ?" q0 S1 Y7 W - module_param(ccnt, int, S_IRUGO);
复制代码 , Z- n' \) C/ S
! ?% B; p1 z! l5 x$ ?- v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 D8 G! s+ \- j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Q3 Z" {' E' E p4 Y: ?3 b, ^
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 W7 f9 n# w8 J
1 A( Z/ G0 u* B
/ O2 R$ z" E8 |9 s |
|