|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ?) m) }, ?/ F- [code]EDMA sample test application
N1 j) T3 w* C$ D) Y6 g6 O4 ? - /*; z! X& b+ L8 l+ E4 b
- * edma_test.c7 l* c) \+ j+ f6 j3 {
- *- n/ M* Y# K8 C1 O8 Y: p
- * brief EDMA3 Test Application
3 G4 o. P7 C( f! T - *
r; d: t8 e/ o* B, m' ] - * This file contains EDMA3 Test code.0 e5 F% y4 j! l
- *! D) }% s) i2 O( S$ `; l$ q
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 I1 J+ S& D" Q7 p3 o+ |; R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT c. F3 }! V! a" N. ?; }
- * TO CHANGE.
' K4 j) O& y( T8 i" E - *. g; Q; ~! R. k- `+ Q8 d
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ ~0 c* r$ ^& W% e, ~ - *
8 ?% z' R: g# x: ` - * This program is free software; you can redistribute it and/or
% f/ Z1 \0 W o* z7 k% A, N( w- F - * modify it under the terms of the GNU General Public License as7 m- }& X* y: Q4 ` F6 F) d* r( P: Z
- * published by the Free Software Foundation version 2.
' J5 h- c# u! r5 A/ p, r5 @ - *
4 _% A* n) r0 P6 W0 l3 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any \2 C+ u$ i3 ?; A4 s4 j4 g: }, O
- * kind, whether express or implied; without even the implied warranty4 i+ [9 o& c. T+ i+ X8 F% U0 `
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ B9 y9 O) u3 r
- * GNU General Public License for more details.
9 Z6 w: L/ N$ X7 q/ k# c0 ~- P d- s - */2 d' n* X) f& X' X; X
# s$ n& Z# y8 s" i- #include <linux/module.h>; O' t& M6 X8 h5 Q5 p N
- #include <linux/init.h>( w; T% [4 L; N+ V% C) n. x
- #include <linux/errno.h>
2 C7 o/ R' \; J4 H- O2 B3 V7 ?5 I - #include <linux/types.h>+ Z! `/ `( e; V
- #include <linux/interrupt.h>% D. ?4 _3 d. `- Y* j. J4 L" u ]
- #include <asm/io.h>6 P t. R7 G4 }! S' [6 U- ]3 j
- #include <linux/moduleparam.h>
( @2 }9 }) v: m* A k8 a# E) m - #include <linux/sysctl.h>
; X' K6 X# f2 \- ^% c- u - #include <linux/mm.h>- T7 M7 |1 x& V& ?0 z& K2 ^ V5 R! i
- #include <linux/dma-mapping.h>4 C: c( {2 C- V7 e
7 n! @, C$ U7 _' {' I- #include <mach/memory.h>1 h: T/ Y% ]- L1 Z
- #include <mach/hardware.h>$ @- q, O, q j' m
- #include <mach/irqs.h>
" e& h% ?) ]9 e$ ^1 @7 P. i i - #include <asm/hardware/edma.h>
/ w" ]3 R' ^ O. n N* W8 M
; q$ d& ~5 P% l- H k( h- #undef EDMA3_DEBUG: l1 ~! L6 u1 f+ |1 h8 q
- /*#define EDMA3_DEBUG*/' o) a2 X# B2 }' c* `5 E! k( Q
+ z* Z* l( h* Q; e- #ifdef EDMA3_DEBUG
% Z$ }' v& R; d# e: E - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [6 [7 a$ W% w( W& @9 P6 e
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 d- o! h, x& [ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% H( i+ N( w; W& v& M, o
- #else
- ` s9 }6 I; l" r0 H - #define DMA_PRINTK( x... )
$ q. T4 a1 l) \7 e9 P - #define DMA_FN_IN- f: ]4 `. V% R' o3 l0 p4 {3 T
- #define DMA_FN_OUT
* l3 v6 L% I& w7 j - #endif
' c |2 A' u* b6 S, A. Y- ]& P3 J* p - 0 W$ \5 l- m9 [
- #define MAX_DMA_TRANSFER_IN_BYTES (32768), Z4 P P% x# H
- #define STATIC_SHIFT 3: [' Y, O8 g. ]* I. D- x
- #define TCINTEN_SHIFT 20
5 \0 R$ M5 I f: J) L6 | - #define ITCINTEN_SHIFT 21
: n, e$ Y# w+ K9 A - #define TCCHEN_SHIFT 22# U' I* t8 `. G6 x
- #define ITCCHEN_SHIFT 236 {6 V, C/ S$ S/ h7 [
- 7 l$ s2 @/ h& O& M( _& G" d9 L( g
- static volatile int irqraised1 = 0;) B# g: F, |+ I* J3 A' Q& g5 e
- static volatile int irqraised2 = 0;
, A2 m# U* g3 { - % o; n0 K+ t2 N- q1 X" _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 W3 X9 y$ }2 {( T$ g6 W( ^- |" S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q& o7 M9 Q8 Z* G: W c9 G
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( @+ w2 n) J: ] - 8 k9 d% a5 ]7 v0 f4 ~
- dma_addr_t dmaphyssrc1 = 0;! c# Q6 [/ Z7 L( K! u( q
- dma_addr_t dmaphyssrc2 = 0;/ }) B/ G8 E" m6 _
- dma_addr_t dmaphysdest1 = 0;) q( X+ \! X/ t% ?5 _+ X+ _( D
- dma_addr_t dmaphysdest2 = 0;
0 Z/ O% A: L/ ]7 g - 2 i; x$ L' a. x' H7 a7 q
- char *dmabufsrc1 = NULL;
+ c, i9 j. b. Y& H6 o - char *dmabufsrc2 = NULL;! h( i9 b3 G# w* K ^5 n- _( F, `1 j
- char *dmabufdest1 = NULL;
! o8 Y7 x7 M- D. W' V- Q5 s - char *dmabufdest2 = NULL;/ r" |4 c; O( E
- * J9 j/ i, q' f; A9 ~/ d4 q
- static int acnt = 512;
" |: e1 S/ k5 e/ J" }% |! S - static int bcnt = 8;- F B3 k1 j0 U8 k1 X* H
- static int ccnt = 8;# N/ W4 `/ W. W4 l
) F. c7 T' _! A" r7 E& v7 n- module_param(acnt, int, S_IRUGO);$ S8 v; }; ^" P& U. p
- module_param(bcnt, int, S_IRUGO);
0 ^/ ?# g3 w. I8 D8 Y - module_param(ccnt, int, S_IRUGO);
复制代码
* m) v# F- z: D- z s
, R: O2 }3 i" j1 `$ k 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- E; n# i* L5 p' j, yarm-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 X' x+ G5 I" B
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 {7 h2 t( f8 U' p; A/ {
+ R* P/ F# w( W0 F5 l% U; J, j
+ l7 K( m. E8 p6 ~) o; c |
|