|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* p2 Y& q& Q8 Z' p" \; X- [code]EDMA sample test application9 _. S1 G, z& T
- /*# x# G$ K, r) t( `% k e$ o! H. B
- * edma_test.c
+ G0 h3 y) F* f+ S - *8 u9 X" P. o4 @2 o
- * brief EDMA3 Test Application4 c1 ]* v: S) F G o
- *
1 E; H% w2 ^ m3 f3 }* J) y0 L& E - * This file contains EDMA3 Test code.3 C, P+ R4 _$ V% T* x( ^
- *
% ~1 m! z+ s$ H3 |/ l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: J/ g, J8 `1 _# A) m0 v
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& @0 |! l2 E/ d4 o) h$ N- O( \
- * TO CHANGE.; J/ k. N3 d" U" a
- *
, m) y6 e6 L0 `* ]' X9 z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# p7 j% S7 O ~, X0 Q" i% @
- *
1 I# j% c! [3 L% L - * This program is free software; you can redistribute it and/or
' ~/ j# B" h7 P; O - * modify it under the terms of the GNU General Public License as" j7 p9 I* J) u" \8 u# I/ A# K- H
- * published by the Free Software Foundation version 2.6 I8 s4 w. o: I9 ]' I2 F4 M
- *2 E0 x- ?! e) b( V, a' o3 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
@* p- R, d/ F5 b3 J - * kind, whether express or implied; without even the implied warranty& |1 h7 T" j0 G2 J1 E9 ]$ u& ]
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 p' N7 N+ J; f4 d - * GNU General Public License for more details.
, x( ~1 B( p/ ?& P3 P$ m - */- l0 t3 y# U& a: d4 r, ?( P; Z
6 N7 {7 N! W; n6 v2 d- #include <linux/module.h>+ P& t5 f; z1 C' ^/ S( b, d; R) ]0 h, ?
- #include <linux/init.h>
- S& l+ \; ?$ k8 ^6 M/ z - #include <linux/errno.h>1 ~7 D' ~2 l$ Q) v; m; y" }
- #include <linux/types.h>
E) C0 h7 M0 [( Y* M K' e' n - #include <linux/interrupt.h>, z% b0 V4 c1 f; I
- #include <asm/io.h>) h( T- {9 n( N
- #include <linux/moduleparam.h>
4 B$ m8 ], d9 J2 ^8 W- J- W - #include <linux/sysctl.h>5 a' U) [9 Z0 Z3 o4 m3 U$ N
- #include <linux/mm.h>
' K& F* Q, t3 t8 m2 U' { - #include <linux/dma-mapping.h>! \' _7 ]& t: A. }1 H ^' |
- 1 P+ l: r& `9 S, U R
- #include <mach/memory.h>1 _/ o O' N8 r( l i2 L$ S/ F
- #include <mach/hardware.h>" v9 t$ O8 G2 F! `+ Z R3 y. e
- #include <mach/irqs.h>; v, K: Z, j- a- A* h
- #include <asm/hardware/edma.h>
8 [( |& I0 V9 A2 j, x. ? - - n {% t& [6 r# Y. K7 m" D! d
- #undef EDMA3_DEBUG% L" P) }- R. k5 L0 @
- /*#define EDMA3_DEBUG*/0 l( P8 H8 |3 [3 `1 b0 _& }8 w
- 4 H/ x' d, d5 c, `* }/ D" t
- #ifdef EDMA3_DEBUG
" g7 V% U" J; U* ~ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
& v& A) h$ E; \9 Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 n2 _/ E1 s; t - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): }' n* ~3 X6 o" w0 N
- #else# F! y4 N- T) D3 k) o* R
- #define DMA_PRINTK( x... )
+ s7 L8 @) M4 \ - #define DMA_FN_IN
% G- e. n- @2 l& L9 Z8 C8 k P - #define DMA_FN_OUT
/ x. R$ \- _/ i$ z! n5 c& T - #endif! S j/ v& i) l$ o# ?
: K. n2 V6 J& K; A/ t( c$ p3 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
4 C% H" x% Y+ Q- O - #define STATIC_SHIFT 3
7 ?. W7 o D! G% n+ Y& K - #define TCINTEN_SHIFT 20) U1 a s+ d% x7 E" I0 G" ~' O
- #define ITCINTEN_SHIFT 21
0 m. ?6 T5 I/ A/ s; T - #define TCCHEN_SHIFT 22
1 e5 ]( A. p; d9 o3 H7 l' ^& q - #define ITCCHEN_SHIFT 23
" \7 X( F4 c2 Q8 V6 i+ D
6 N7 }6 ^% h2 j! H, i8 S- static volatile int irqraised1 = 0;) l8 p: d U% V! y
- static volatile int irqraised2 = 0;( x/ \9 _ C# f# B9 d. }
- ' [( @# P* C$ U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 o6 t- I( k/ u C
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 n/ u4 Z% H3 J% v - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 g# K+ u9 D9 ~ - 3 k* B8 {8 f4 g+ W
- dma_addr_t dmaphyssrc1 = 0;
5 S# G6 w+ c+ A - dma_addr_t dmaphyssrc2 = 0;! u8 f4 i: ]+ ~; C1 e" Z* X
- dma_addr_t dmaphysdest1 = 0;- B1 n, P# w; i3 O
- dma_addr_t dmaphysdest2 = 0;
) x+ v, }! [+ Z r1 R% n0 O
9 U$ N3 f; S2 h! A' R+ k- char *dmabufsrc1 = NULL;
- O+ Y3 w. h+ [; P - char *dmabufsrc2 = NULL;
3 g* I- f' m. V; z - char *dmabufdest1 = NULL;. ]# [, ^$ D8 V' N. p% V$ h9 l
- char *dmabufdest2 = NULL;; W U2 U. n x9 w
! p0 m" H3 `, p) o0 w% f- static int acnt = 512;
4 D4 B* Z+ c9 q8 L- ?! _ - static int bcnt = 8;
! e9 o* V( q. D& h - static int ccnt = 8;
& A5 h, C/ b8 I8 ~6 Y! D, T - # g* E5 q: ~6 b4 V3 m4 y
- module_param(acnt, int, S_IRUGO);+ m4 p) e% \1 Z7 D
- module_param(bcnt, int, S_IRUGO);
6 n+ T( j4 }8 v4 K- c2 l - module_param(ccnt, int, S_IRUGO);
复制代码
5 U$ T5 s: e. Y5 a; A! W
6 N% D; J! l# K; T% ?$ |: v! C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 u- E; O8 P/ |$ B2 u
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 j, A7 _4 `& ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 I4 W8 P4 J4 M- d
; |$ n8 ?" W* f% N- U/ v' M+ C" i L: e* x3 l$ B. o, S' v3 {) Z
|
|