|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# S& q* y( z5 v9 ?- M- [code]EDMA sample test application
7 d6 M6 d9 ?3 P, E# E4 C9 ~ - /*
8 a6 r4 ~7 N0 v g - * edma_test.c8 F9 J; s' s! z2 G5 v! p
- *
. g# j& c r' X2 Q0 } - * brief EDMA3 Test Application, R% m2 ?2 |( C) u' K
- *
: Y x2 e+ T+ U% c# A - * This file contains EDMA3 Test code.
, Y* c4 [. w% g0 }+ ^8 K. ^! h0 P - *2 {; c/ y* A# c- x% F: i: B
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
) [ A8 h, x2 i, V0 X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
2 m4 n7 @' S1 ]' n+ T: x - * TO CHANGE.
H" s% A( i' B - *1 c& E* p3 Q8 r6 N: @
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
! z/ H1 L0 w' A# E' ? - *8 C# y+ K9 J4 Q( G9 p
- * This program is free software; you can redistribute it and/or; A0 Z6 _$ I, K0 ~
- * modify it under the terms of the GNU General Public License as
( f0 k7 E( n% i2 T X - * published by the Free Software Foundation version 2." `2 w# P. j- c( G9 u l4 y7 H& u
- *
* A" H! x. t6 _4 ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& X2 w0 \% s9 g1 I# t
- * kind, whether express or implied; without even the implied warranty* T2 q" F6 v' i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( w" p1 F# n1 u# w
- * GNU General Public License for more details.# i1 v4 ^' T3 B/ A' H! c3 c
- */
; o. y0 J5 R8 p0 T6 ^# C7 G - 6 F# m5 I, y# z
- #include <linux/module.h>; s9 I- b' o7 s5 U
- #include <linux/init.h>- x7 F. H& l, w; `$ o8 f+ `
- #include <linux/errno.h>
. Y2 }7 \8 k1 a' P+ S9 r0 z - #include <linux/types.h>
% ?/ k/ O0 ]* c7 H/ ~1 ` - #include <linux/interrupt.h>
# p6 \/ l9 o u! I8 }$ X& J - #include <asm/io.h>
8 V# W: X1 ^2 X7 x2 T! x - #include <linux/moduleparam.h>
; Y0 A" K x0 I5 J. G( C/ o - #include <linux/sysctl.h>, ^% C3 ?5 M& D: N# V; @7 L' _# X; u
- #include <linux/mm.h>
0 |1 B: H7 ?* U3 h( f3 f - #include <linux/dma-mapping.h>8 \, ]) D* Z% v# R
- 4 Y" O. s3 G( B( K! D
- #include <mach/memory.h>
' ^/ p% F4 U" p; y5 u3 E" u - #include <mach/hardware.h>3 @! w6 Q' E) t2 m0 H b
- #include <mach/irqs.h>; L4 s8 a7 ]) k+ R& [
- #include <asm/hardware/edma.h>
0 o; @8 b7 A( O* b - 4 a V7 F/ b m
- #undef EDMA3_DEBUG: ~( N0 j4 E) w$ P& G9 p: J
- /*#define EDMA3_DEBUG*/6 c: \2 o9 T4 q: d r
- . `9 N; m9 Y! |; i: |
- #ifdef EDMA3_DEBUG
( N/ b- W) \. |. V8 k4 C8 U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
+ h1 ~& Y5 f. I5 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) ]6 p Y' t1 [. y5 K - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
! z! E" r' O+ h' X# i - #else
h- w t6 Q6 A- b* G7 T4 t& e - #define DMA_PRINTK( x... )
* p7 ^! _- _: C - #define DMA_FN_IN
5 ]' k; B3 w8 Z9 y: _ - #define DMA_FN_OUT# C7 k# [5 F& X2 v# m
- #endif
# L" W' B f' c, k7 q1 f) @* ?9 q - : I4 P9 F) I9 r# k* S/ Q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- R1 w* s: ^, y* ]5 A - #define STATIC_SHIFT 3 _* a( A) [5 J- }9 y+ p: `
- #define TCINTEN_SHIFT 20- I1 b5 t, C k% X$ r
- #define ITCINTEN_SHIFT 21. J* Z" M" A3 |, t
- #define TCCHEN_SHIFT 22
7 S8 t, P# m6 [+ c" y$ b - #define ITCCHEN_SHIFT 23
* A7 D" g3 q b$ Z2 ? - $ }0 N7 f! t6 n
- static volatile int irqraised1 = 0;) o b( j1 }7 [9 M5 f! i
- static volatile int irqraised2 = 0;/ Q8 o$ b/ Y/ {: @: l
- 5 e) A; | q* Z) g3 A$ _
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* e) k# w0 w8 ?, x$ s: k9 Q7 V4 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) {2 e' j$ c5 f
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ q% W+ c- b0 ^& ]) j
6 H$ k: {% |! h6 }+ _8 R- dma_addr_t dmaphyssrc1 = 0;0 `7 {9 t5 k& W- c; S+ X
- dma_addr_t dmaphyssrc2 = 0;1 C0 j8 z# ~& L6 i3 A
- dma_addr_t dmaphysdest1 = 0;5 d& W) h- X& O* m. _
- dma_addr_t dmaphysdest2 = 0;1 u q$ o h" ]8 U9 {: Y: `2 p
6 }1 o8 U* e" D. `6 g& @- char *dmabufsrc1 = NULL;
! F+ J4 n. A) b( U* W - char *dmabufsrc2 = NULL;( K* A# ~1 P7 D5 q
- char *dmabufdest1 = NULL;
2 z5 c5 [9 p9 k! X! i- {* j - char *dmabufdest2 = NULL;
( y* h. K% Q" K4 t! Q
! {/ w9 F o o" U* q T- static int acnt = 512;+ a8 E+ @7 n0 Z8 ?# K$ _% I
- static int bcnt = 8;
8 I0 u# \6 [" @ X! |/ O - static int ccnt = 8;
3 V; X5 V6 s5 J$ C- g% x
; j4 }# T8 W( D9 _* k! R- module_param(acnt, int, S_IRUGO);
! s/ b: h! X- N1 S3 r) w4 q- w - module_param(bcnt, int, S_IRUGO);
P0 b2 V3 y# f) h; [+ s - module_param(ccnt, int, S_IRUGO);
复制代码 8 I# W { n9 k' ~; H9 A
: G4 ]3 j! u& n' H7 C. E
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ ?1 P6 [4 T. e4 W3 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- K# g1 q. y9 w- t. n3 J 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 i0 v& s7 j$ Z: x8 ]+ ]
8 w1 _" M/ B5 v- I( K' j$ p
2 z2 f% [3 Q8 _3 m |
|