|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 _0 z5 q5 ~' n5 \" z
- [code]EDMA sample test application. l5 [1 z- L7 H! E* u
- /*
; [2 k9 L* h/ X# g4 q* O - * edma_test.c
5 U0 o7 ~; w, N) Z - *3 X% z3 j. }( i+ o% X
- * brief EDMA3 Test Application" c* A+ c S9 A4 J) ^
- *
2 d8 c% x, [8 t1 N3 n - * This file contains EDMA3 Test code.
' P _6 @3 ~5 [( I% | - *: L. a$ u N2 O% D# O
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; [$ Q) |$ c" l& l
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 J" G2 |& I+ m# ^* `
- * TO CHANGE.
: ~8 }$ }0 Z) H! G# J$ Q/ u - *' e4 q6 l+ t3 L( M7 p5 f8 R4 A( \7 K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! d1 ?" F2 o% r6 z2 d6 M+ ?& V
- *
# M) p- }' y. r" u& Y - * This program is free software; you can redistribute it and/or
& t: U. h" T+ {; O' p - * modify it under the terms of the GNU General Public License as. v- V& b! @$ t* {& |! j
- * published by the Free Software Foundation version 2.
3 F2 h9 J p7 F3 d; z - *) G2 h' l9 h- ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
! [1 d4 D4 x7 u5 H. \6 p - * kind, whether express or implied; without even the implied warranty
8 ~/ [$ E& R5 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 k8 r8 U2 J( C3 w- {3 z3 O
- * GNU General Public License for more details.' ^' a3 o8 V: G( n6 K. S
- */
- X' y2 f$ R9 y+ n - 9 d T1 u' U% F {
- #include <linux/module.h># w$ [1 w% Y- T5 _* D
- #include <linux/init.h>) Y+ d/ c0 I& x
- #include <linux/errno.h>
0 Z L! G! ]6 V' A0 c - #include <linux/types.h>
. D( @- ?7 n6 U% Q, P" x+ \. V$ z: W - #include <linux/interrupt.h>4 _! @7 t0 i0 I5 N# Z* T
- #include <asm/io.h># P; ]/ {4 W" k) s- i: d
- #include <linux/moduleparam.h>& p/ I# Y& C$ e% E0 u7 C1 q
- #include <linux/sysctl.h>
# p! O; O( B$ ^$ ^+ r - #include <linux/mm.h>
- A8 j% {4 G+ V W: h - #include <linux/dma-mapping.h> T) [! ?+ f0 I4 O
- 2 E ]+ i' P& C, y- h6 p' ~$ \2 I
- #include <mach/memory.h>
4 B) w. A' k, {1 z+ X5 h - #include <mach/hardware.h>- o& L* B/ U" [9 A/ o3 X! E
- #include <mach/irqs.h>5 q7 A i3 d; G
- #include <asm/hardware/edma.h># X' Z( L3 G* R; S4 p7 y+ U% w
/ p9 o7 B( b, f0 v0 \. |0 N) }2 _- #undef EDMA3_DEBUG% L6 b1 _' g# m
- /*#define EDMA3_DEBUG*/2 {- U3 Z+ ], y# {( l$ e
- 7 X' ]- `- d. j2 E
- #ifdef EDMA3_DEBUG
) x4 T2 E7 I1 E& H8 h6 D: x - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
- b: V4 J m+ P/ [ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! K, c7 a! @* v7 O2 k
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 t# R# X' e) E0 K; v6 b5 }8 J
- #else. Z/ [5 u& C) H, R6 O
- #define DMA_PRINTK( x... )
1 w; k8 D; U5 @: |) f - #define DMA_FN_IN
" ]' O0 M" p( f( d: x$ @: m X" N - #define DMA_FN_OUT, Y3 @/ g/ T; y$ o( ?6 J! {7 E
- #endif
7 q: B, _. r! f' Q3 ? E1 z
" y. f3 ]+ o2 p7 u9 N% ]# z5 Q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 n( q* X/ u- ^$ L
- #define STATIC_SHIFT 3* l6 l/ Y* V; T" v5 `& C X" l
- #define TCINTEN_SHIFT 20
& B \. V. Z3 z0 C - #define ITCINTEN_SHIFT 212 f* _3 N- n3 R Z1 f/ R
- #define TCCHEN_SHIFT 22& B: ]3 T( j$ o/ z4 ]2 z/ b# v
- #define ITCCHEN_SHIFT 233 b$ u- s5 A2 G! a7 Y( x5 R+ ~
- V$ _/ `$ v; N8 I5 H4 T- static volatile int irqraised1 = 0;* }# v" d8 y: ^- N
- static volatile int irqraised2 = 0;
& E# W& l' j+ k, T$ A
8 } U2 ?4 Y6 Q- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; z: m8 @6 c' y6 {" ]. | - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g8 {3 n* C8 \1 T
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 ^' S. [ E8 P$ S: [% t% e& D
8 d5 u8 i) }2 L+ z$ I# }* k/ |- dma_addr_t dmaphyssrc1 = 0;
1 N8 v$ l1 o5 g - dma_addr_t dmaphyssrc2 = 0; f- ^5 u. I# p Y, Z' E
- dma_addr_t dmaphysdest1 = 0;9 p* s# O2 I" l o
- dma_addr_t dmaphysdest2 = 0;4 r2 {. ~0 I/ ^, y7 V! i5 K* M
4 f; j. }/ }) T/ Q7 g! ]4 l. L- char *dmabufsrc1 = NULL;
7 g( M1 {$ a+ G# ] - char *dmabufsrc2 = NULL;
) m; H, J& O# V3 I4 n - char *dmabufdest1 = NULL;
+ o' R7 y& J% F - char *dmabufdest2 = NULL;
0 y' Q+ E& k! M; T - 0 {% i- x* C2 a3 P+ D7 c" k, Z8 }; P- @
- static int acnt = 512;3 F8 E5 O8 q$ \+ m" T
- static int bcnt = 8;1 q5 `! t" w* T; J
- static int ccnt = 8;
; }$ I6 E3 g" }) ~& E C - 1 A5 g# a0 r7 [8 ~/ H
- module_param(acnt, int, S_IRUGO);4 E& g* F h& F( |
- module_param(bcnt, int, S_IRUGO);1 Z7 `' I+ ?+ _2 `
- module_param(ccnt, int, S_IRUGO);
复制代码
$ O3 x2 g. D; Z6 Z* Z
`+ n- Q s7 a4 R( C9 s4 k- f8 V( X 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. {2 |% o1 R3 E4 n4 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 y& |1 d. q4 Y1 Z0 D2 p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ N. Q0 U3 k1 B! `' V, x
( v8 o; g- b) Z/ n8 R- D' Z- k" A" u+ N! K5 d
|
|