|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( {3 j3 x* }# s3 G; c& x- @ L0 N- [code]EDMA sample test application! r: P9 S9 n# G& {/ v# y
- /*' s4 F$ j: ~; z/ r2 m
- * edma_test.c. P/ V3 d7 C6 ?4 p0 C
- *
2 }) H* Y |4 ~+ w1 Q+ E2 t* u - * brief EDMA3 Test Application& v; f# ? ?$ j, V8 @2 N
- *4 S6 a1 i" `) S. t6 G& B9 Y e
- * This file contains EDMA3 Test code.5 ]- O$ A' F. P* m
- *
+ ~5 P3 ~% e1 ^& ]9 v/ u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 J2 w' ?* U1 R( g/ u4 I7 J# n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 b) {- f8 x3 f* O O$ b - * TO CHANGE." C3 u! e% P5 d9 i0 E
- *% ~: a* E, r4 L5 d- g6 ? g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) f- ?. x0 e+ T( _" l1 f. Z - *
0 a: x# G5 K% Y) J8 l9 W5 o- x - * This program is free software; you can redistribute it and/or
$ |* x4 ^- `9 f, o - * modify it under the terms of the GNU General Public License as
9 {- b" O% M: X; [- h( p8 O- j" w6 K - * published by the Free Software Foundation version 2.
: f# {$ {- i+ l - *3 V1 A% X; U8 i4 U. L
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any, k8 N" Z4 Y- ~& C" v* w
- * kind, whether express or implied; without even the implied warranty( d3 q3 ?, {1 V& T/ x& d
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ d4 k' w, D. |$ T- @. B' M
- * GNU General Public License for more details.
' }: U& `$ j. T6 {7 b7 W$ h5 f - */) _! \) ^& [1 M9 p6 ?, G/ Z
$ Z5 d9 `* \: m( t8 c9 x- #include <linux/module.h>
3 E& T# g: O2 L( [; w+ x/ G - #include <linux/init.h>
& y5 L3 @4 h; B1 v7 v0 P! L - #include <linux/errno.h>. I) h) h+ M \7 V9 |3 F+ H! i: n
- #include <linux/types.h>
% q2 Z0 d. D: ]3 v S: W( u - #include <linux/interrupt.h>& k' }9 {2 s8 d8 q0 B
- #include <asm/io.h>$ O$ a. }1 Q1 C! ^9 B% c( }4 Z
- #include <linux/moduleparam.h>6 @/ e4 |4 A! ^% N2 Q) Y' M! ?
- #include <linux/sysctl.h>
, `: x2 O. Y% n% ?6 T - #include <linux/mm.h>
7 z0 w. h4 _2 `: ~1 N4 w - #include <linux/dma-mapping.h>
- h z8 P" w7 t" B4 T/ W2 H - ( G/ n% r1 i3 H& H5 F
- #include <mach/memory.h>
5 h+ c, K4 ~. W8 x; Y - #include <mach/hardware.h>
/ t( a4 c4 ]& W- G# Z - #include <mach/irqs.h>
. E# i9 z' K) a. d. L5 A; c - #include <asm/hardware/edma.h>! M+ K6 c3 ^3 b" f2 y4 C
- % h$ S+ {9 V! U2 q2 E
- #undef EDMA3_DEBUG
- c! g2 ?# Q- Y5 M9 b" V5 N) e - /*#define EDMA3_DEBUG*/
, F5 g# d( K! e5 Z0 w% f1 N/ y: P - ) T2 d# }2 Q6 f1 z$ t# q- M# A
- #ifdef EDMA3_DEBUG# U" D, `; a8 b a2 w" P' v4 C5 h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 P- h: D# a( ?! ^7 u- p$ y$ N( F
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 A) O6 L" Y7 W' F/ p5 y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 z+ ~! I0 Y5 u5 u3 ] - #else
|; J3 e6 |& H$ \6 [1 ?7 G - #define DMA_PRINTK( x... )
: l- E0 U0 n! M2 {. c0 X' J; w; d9 A - #define DMA_FN_IN
+ `% a! U0 E7 V ` q - #define DMA_FN_OUT
1 K- B* V) l0 o% X' H) P0 L7 r3 G - #endif
+ ~( r9 W7 s2 t5 s0 {) _' f - . D$ e: f' |$ c/ a$ M
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. B- `& p, n0 |4 D6 R, u - #define STATIC_SHIFT 3
$ @& [5 o- X" R. M! x8 c - #define TCINTEN_SHIFT 207 ^+ X" H+ d, G6 j; T$ }
- #define ITCINTEN_SHIFT 21
2 u3 u/ d) a6 E2 D# B' |2 W. M9 `0 Y* b - #define TCCHEN_SHIFT 22- o. A1 w0 f- z. i7 Y; S
- #define ITCCHEN_SHIFT 23# `' S: |0 e$ x' w4 Y
% O/ k+ k! T G2 B3 U1 ^; a1 v- static volatile int irqraised1 = 0;
) A4 n! [. a0 `) v8 V - static volatile int irqraised2 = 0;
1 e: B% |0 x6 T+ h/ K9 c
" H6 ?1 G9 ]; _2 _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ a- a( x3 w$ M$ k+ X' B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: B9 Q- M& Y, Z+ J9 D - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z# v! z% d3 m9 Y9 `, l
# m9 C! d! V8 k, l9 ]/ q- dma_addr_t dmaphyssrc1 = 0;
5 B/ E4 {7 ? x( e0 o7 I - dma_addr_t dmaphyssrc2 = 0;: k X; c4 e g) i
- dma_addr_t dmaphysdest1 = 0;
* K" {7 h+ S7 @( \ - dma_addr_t dmaphysdest2 = 0;% s; j& Y" b5 Z1 B4 L& g U& D4 k
- % j: C2 {7 ^/ A8 R
- char *dmabufsrc1 = NULL;
7 t9 m) c1 K" M" x* u - char *dmabufsrc2 = NULL;
. p0 h- U8 f5 t1 y9 w - char *dmabufdest1 = NULL;
5 z' P/ q9 [ Y$ D& w - char *dmabufdest2 = NULL;
5 u0 k7 g' t P- ] - 1 v4 e8 i8 o) _% b& J
- static int acnt = 512;) a. M5 U- r8 _9 e# g
- static int bcnt = 8;
% h$ J5 d# t) M5 o- V9 L5 l - static int ccnt = 8;+ d. j) s2 n) F& f5 n3 }
- 8 \! m* z0 w- T" k( L
- module_param(acnt, int, S_IRUGO);
; _& Z. V8 v- b( D( U# n - module_param(bcnt, int, S_IRUGO);
, j! d9 L) U& b6 X2 P5 u, h v - module_param(ccnt, int, S_IRUGO);
复制代码
/ y! I5 |" U/ L: `2 P& j# F
$ d* q: K6 x3 z; e) ? 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Y# e6 ^) L$ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 H% \8 H: v5 _& u' f" J# P% d 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; k# u6 K9 y# f8 k
# u" G! F# \1 {2 R
; T5 w: K- M5 r4 \ w7 T
|
|