|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 r3 l; j. j1 q* B
- [code]EDMA sample test application
6 A0 k; w0 W/ F) f4 V - /*$ I" t( |5 G6 |+ K! j' f
- * edma_test.c
" U4 q b. Q% L% |1 }/ R1 L0 \ - *9 A, a$ M) A3 v# V+ _
- * brief EDMA3 Test Application
6 a* c2 W; Z) m; a0 ]- F( m4 Q' D - *
5 i U8 M3 G- n2 {0 A0 g5 b - * This file contains EDMA3 Test code.
$ S3 S4 D& o$ [) M+ k: \, D& H | - * a `0 a: ]/ d( N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 I# @/ \. a8 ^& f @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 F, J5 X! K4 g, k
- * TO CHANGE.
; v3 Q8 n7 x3 m( @% T - *6 \% H6 h) }9 ~/ ^, q. Y, g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
5 m, m: s: O+ C8 X% k/ v' l+ t - *
5 U; p( {$ Z- I- O - * This program is free software; you can redistribute it and/or
' L3 H/ _ C9 t! A5 e- c% @' y - * modify it under the terms of the GNU General Public License as
* v5 @* s5 D5 @, V( s - * published by the Free Software Foundation version 2.6 C" i& ~1 |. @: ~
- *
" [# [- @9 w! f6 |8 L - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 E3 F) e. [9 F - * kind, whether express or implied; without even the implied warranty5 ]! Y9 P3 ?: u6 a# ^
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the; M4 S: m% Z2 o1 A3 \
- * GNU General Public License for more details.
& ]2 f0 }* r! a# q* M - */" [/ O1 y1 [1 M: z
$ W' g# c% J$ o5 q2 c$ P8 A8 P- #include <linux/module.h>2 y: ^1 x2 x2 x
- #include <linux/init.h>+ z- d* L9 w2 x) H! ^
- #include <linux/errno.h>- _9 U' S! g0 q6 E8 H
- #include <linux/types.h>
o8 q! w }) Q3 I - #include <linux/interrupt.h>3 B+ M) a! m# L- u8 _( Q4 |
- #include <asm/io.h>, L' t( u) h6 j
- #include <linux/moduleparam.h>
( u+ c; N9 S% X: @: R7 L3 F" O - #include <linux/sysctl.h>
. } {* T9 ?, t; p1 j" A: j. ]/ | - #include <linux/mm.h>
% G! x8 `3 n- p0 O5 ?5 p" D4 w - #include <linux/dma-mapping.h>' a6 ? L& [- i, }* K- K
- % s2 Q, E" P% m' e2 |
- #include <mach/memory.h>$ r2 ~% d0 O$ @& f
- #include <mach/hardware.h>
: u8 K1 t* W! `& ~- k: ]4 x: ]5 [ - #include <mach/irqs.h>1 C0 J7 z. M2 r7 C3 e {
- #include <asm/hardware/edma.h>
/ }9 i- W0 k2 i& q; q& c( f j+ J - " }3 @" |9 c8 f" u0 K' A) p( h
- #undef EDMA3_DEBUG
' X' W# ]- Z* p! C% H8 K6 K - /*#define EDMA3_DEBUG*/
! x# m8 B$ O; B: q, j - & e. U7 H$ j' r2 L. q( ]1 I3 k y
- #ifdef EDMA3_DEBUG8 B1 V& z1 B5 N1 p7 k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 u' L6 p0 P6 y# n) w - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Y2 f! n% k1 O
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ P- f! N9 j! V) X - #else, l9 U' u* a- \% o+ M4 @" \, L- u
- #define DMA_PRINTK( x... )) s; ^5 k# m z* a% |; r1 [0 s
- #define DMA_FN_IN
4 |7 F. N# M8 F - #define DMA_FN_OUT
& _& [' Z' w+ X. M& y# k - #endif; `+ V* [) l }) {8 B* ^0 ]$ v
& W. G; ^; |% H% [2 W8 c3 N# y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
: m; i5 b) ]3 N: U" I - #define STATIC_SHIFT 3
# S2 [8 u( z8 P+ h - #define TCINTEN_SHIFT 20
* r: f/ z9 j# _4 O G" z0 u! E- B - #define ITCINTEN_SHIFT 21
2 W: T. U6 _' p) e( G - #define TCCHEN_SHIFT 22% r- h1 B j, o- B
- #define ITCCHEN_SHIFT 23
! @$ C0 _. R* x2 P0 g; D - 4 `; E, Q# K* f( K0 x
- static volatile int irqraised1 = 0;4 p+ B) B* B$ s! e
- static volatile int irqraised2 = 0;
9 V5 k: n* Y) C) i- N- @ H) V/ Y - ; B. f. m4 e f* p
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; {, v1 O4 q) q3 l6 {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" p; y- K; @4 P3 A+ p( f - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j; `; b- J4 W' }, o9 {" m+ M
5 L4 Z4 e, }: a' E3 Y+ V$ n6 E, [- dma_addr_t dmaphyssrc1 = 0;# N- f1 l, {) J; B
- dma_addr_t dmaphyssrc2 = 0;
5 G4 n2 U8 f3 N Z - dma_addr_t dmaphysdest1 = 0;
8 ?* ?0 l2 J% o5 `4 Q7 c - dma_addr_t dmaphysdest2 = 0;. W8 h7 a3 S+ C9 f
% b) _" U( Q3 B% R- char *dmabufsrc1 = NULL;
* D( F9 b! P, K - char *dmabufsrc2 = NULL;& ?/ A# {8 O/ N* g z
- char *dmabufdest1 = NULL;
# d+ T# F7 }$ u! {! O" @ - char *dmabufdest2 = NULL;
- C4 Y. h7 k0 J \$ q* S
3 i, K3 _% {% g5 b- static int acnt = 512;' ~. e7 h& v4 B
- static int bcnt = 8;* `. v$ ~& h0 R, e8 B* D0 P
- static int ccnt = 8;& `+ g8 _: b0 F1 I! `7 z* [
4 {% G( ?( ^6 f. X2 }: \+ L- module_param(acnt, int, S_IRUGO);
: [% J9 q6 t4 D - module_param(bcnt, int, S_IRUGO);
8 F, p: X0 L+ @: c& K+ |: @: g: H* y - module_param(ccnt, int, S_IRUGO);
复制代码
1 a4 u( o! w5 s; o; p W
' u) j# r* ?5 Q' P" Q+ r9 ^( X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 U9 X2 d* U, O0 g+ }! {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ J' m7 q$ X N5 F$ d5 j4 j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 G" ]9 x- Y6 c: }7 x. u3 _: |$ {- h+ E9 O" @" n) O
L3 l" K! f P2 B. l
|
|