|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 S- _2 g7 }* e
- [code]EDMA sample test application3 D2 r+ o2 ?0 ?% V
- /*. a7 Q2 _4 L" L* k$ _1 Y( [
- * edma_test.c
3 a3 i" Z3 q/ i, k) g - *+ Y* X N5 Z. @9 L+ U
- * brief EDMA3 Test Application! s p9 E9 |; g4 c
- *
% w' d7 ~, x' `& _& q - * This file contains EDMA3 Test code.$ h; H0 h7 r3 t* Z A' z* ^) `7 \# f
- *& C9 L* I, u5 m5 b7 m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
+ J- c7 v* ?5 U) O9 `1 v1 K - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 i$ l& b1 Q7 v$ w W8 s - * TO CHANGE.8 f! Q) `9 Z1 R' l- P2 M4 L' l
- * G# }" P, q5 z+ o- k
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! K( A0 E$ @. T" R' H1 Q s/ S
- *0 K/ G" `6 b1 c* e: ^! H
- * This program is free software; you can redistribute it and/or6 i6 P, y0 M- K' X' F; A
- * modify it under the terms of the GNU General Public License as
9 S. `/ p* `- M: X+ W3 o - * published by the Free Software Foundation version 2.
6 P- M6 l8 K' e, d" q$ z- R( S% N - *
+ C, k; d- E* X f; S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 r4 f ~7 Q9 d/ N3 H/ z - * kind, whether express or implied; without even the implied warranty- ]. w( o1 H' M* n* s" x
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. v3 B" z' \; }4 I* v+ | - * GNU General Public License for more details.
2 n. r% Q( U1 ^' Y5 c, Y! I* U - */( z2 b! J: {0 K% h0 c
- * X5 V" P2 K5 A# Y0 ~
- #include <linux/module.h>! z3 E" A; G: C- x) u
- #include <linux/init.h>
' k8 g. @1 p- n1 N R2 t& O - #include <linux/errno.h>
, s; j: r+ p% Z; x2 [' j - #include <linux/types.h>2 e, h& _/ U3 q0 T3 L% \
- #include <linux/interrupt.h>
+ Z- {$ P, e5 q' I% ?9 n - #include <asm/io.h>
9 b7 f& _# V% z- F* p; c - #include <linux/moduleparam.h>0 a9 ~1 K, L" L
- #include <linux/sysctl.h>
/ a9 I, c* j ^# \. G - #include <linux/mm.h>8 Z& N3 ]; }0 |6 c
- #include <linux/dma-mapping.h>
J; t& v( w6 m- Q - " C7 x" S3 [; R; D8 |4 ~( j
- #include <mach/memory.h>
' ^. J$ ^2 H$ H - #include <mach/hardware.h>8 a; J$ H+ l- z9 a* T5 ^
- #include <mach/irqs.h>
, p0 d1 o n3 \# g$ j - #include <asm/hardware/edma.h>. W* D$ V, p% _
5 X* i8 P+ Y4 M: i+ `0 @) Y K- #undef EDMA3_DEBUG/ ^: w3 j9 o( u
- /*#define EDMA3_DEBUG*/1 T1 O; I0 o/ u: P
, S$ v% F: ?1 s3 D* |- #ifdef EDMA3_DEBUG
* E- }& X8 O* O0 q, c( z' B3 O" b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 W3 k; j9 K6 @' H5 T& r$ ?3 B - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); y) l1 h( j4 Q& J0 s- r
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) A/ f2 v. I0 D9 P# @% D. _: v) W2 W6 y
- #else
# [3 R! J) f) E - #define DMA_PRINTK( x... )3 ]( C$ ~+ g9 o" J, |
- #define DMA_FN_IN
: n- c- J- b5 u' A# o2 Y# x - #define DMA_FN_OUT
( `* W: w4 `9 q3 w# d - #endif' `) c# T+ Z; c" i# ?
- ' u+ G, k" W- R7 g$ ^
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& \% E" |$ ^9 y$ W - #define STATIC_SHIFT 3/ A3 G" ?$ M6 W: i
- #define TCINTEN_SHIFT 20
$ x1 p6 a% [3 q5 s0 u - #define ITCINTEN_SHIFT 211 v4 w1 J0 c W* q7 Z- ? `
- #define TCCHEN_SHIFT 22
; _* K- f) Z8 F# P1 Q9 | - #define ITCCHEN_SHIFT 23- c! I- E, G2 c8 K1 e
' ]* [. m5 f: e3 E W- static volatile int irqraised1 = 0;
3 E* z# U3 l! S2 e& ~ B# ` - static volatile int irqraised2 = 0;1 X& {/ r* ^- N; m1 p `- {! @2 @
% N2 V* e. x* C. Z8 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% N% N( S2 N/ Q7 k1 P6 f [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
h3 K6 Q/ U6 o; P, T( M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( d/ S3 d" ]1 d; ^( _& b! o
' _9 X' u/ M5 D/ k( Z9 q& V" ?$ ^- dma_addr_t dmaphyssrc1 = 0;4 n; m! a0 U$ v; M6 \7 c# J
- dma_addr_t dmaphyssrc2 = 0;( v" t r/ c3 [* H3 M
- dma_addr_t dmaphysdest1 = 0;% \0 |0 o# ` T" N& H
- dma_addr_t dmaphysdest2 = 0;
k$ n2 E4 `9 r, l0 g
Y+ k# b' b, }- char *dmabufsrc1 = NULL;
* N' B+ l* k- e" n; \5 s" ^9 A - char *dmabufsrc2 = NULL;
/ `8 h, _2 X2 N v6 n9 ~ - char *dmabufdest1 = NULL;
5 @% b3 S- O" X( a% l3 X - char *dmabufdest2 = NULL;: a; m3 `7 r9 w3 j* ^0 u. c9 R4 }
- 3 J3 A1 p- `0 I1 R( B9 I" G& |2 f
- static int acnt = 512;' s/ y2 T L* [* `) K3 F
- static int bcnt = 8;
1 B! m5 Y" d0 @ - static int ccnt = 8;
# f+ I( W2 O1 A( _9 l- D - 8 w$ l/ ]7 i. |+ u+ {$ x0 x; {1 x
- module_param(acnt, int, S_IRUGO);
1 c7 n0 a0 m( L* _) a# I, n4 H: e4 \ - module_param(bcnt, int, S_IRUGO);
6 O) O9 P6 e- Q' d! b - module_param(ccnt, int, S_IRUGO);
复制代码
$ @5 j1 b U, |! |8 k& X
6 q: v" C0 q) h1 _, n 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 V: Y6 | [9 E# @7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! g/ r* V1 \* @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Y# e7 @: j0 I4 b, d8 f
4 D, y% u r7 o
+ u( \& T- `( m+ H7 D" a+ m( l |
|