|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / b4 q. B" y3 J
- [code]EDMA sample test application
7 h3 K- t- P, Y5 P9 r/ v - /*
% I; ^- \; D+ v5 A - * edma_test.c7 M3 R+ ?; [- {9 V& A
- *& U3 e9 N: m" \. ^, d+ e, q
- * brief EDMA3 Test Application
9 ~/ F5 V, c& A& d7 o* t - *2 {% w" _- i! |
- * This file contains EDMA3 Test code.$ J" _# u T+ \' c$ J
- *
! m6 u4 o' y" }! l4 Q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' P' R+ @1 I% r5 [. k* [+ w9 d8 g
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% p/ S! t5 T6 Q; H3 U+ n& U - * TO CHANGE.
7 `3 a: D4 c1 U - ** u9 s6 X0 @0 d3 j) d* v
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 D' O0 ^6 T/ I- n4 y e, H
- *
2 I; Z$ ]4 ?1 X7 f6 { C" |8 o0 G - * This program is free software; you can redistribute it and/or) {9 e1 n, v' k5 D; l1 P7 X
- * modify it under the terms of the GNU General Public License as
- s8 `$ Y* y" I3 I - * published by the Free Software Foundation version 2.
) J0 e7 Q6 [( ]% q7 ~+ z) X3 H - * _. B4 S) E. b6 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 F6 e: A1 d6 Y/ ^8 c
- * kind, whether express or implied; without even the implied warranty3 j* C- Q4 S9 a
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ c! M$ ]) B0 Y
- * GNU General Public License for more details.% u! n6 f0 i/ @; k6 a$ a
- */! _7 n1 c# g# C( e8 S
* p" @1 ?/ V4 C0 g4 X; B! i- #include <linux/module.h>9 V9 k; I3 h* J1 g, k7 Z" @
- #include <linux/init.h>
4 K9 h( c. F4 f! b% H- \0 v- B - #include <linux/errno.h>3 W3 ]6 k0 c$ k( e* p6 y8 s
- #include <linux/types.h>
' H4 p5 b0 ]; Z: q - #include <linux/interrupt.h>+ B. I1 B4 V3 @: e+ \7 C; F0 r+ e
- #include <asm/io.h>; K! x8 O# ]: t6 p$ E6 Q" L
- #include <linux/moduleparam.h>/ ]8 U4 m1 R% j# v+ Y1 N2 A$ U
- #include <linux/sysctl.h>
. v2 g7 w$ `# T - #include <linux/mm.h> q9 |9 @9 m3 ]" G% f
- #include <linux/dma-mapping.h>
$ f' {0 q, ?* V: Z7 W% L" Z$ K9 l - # o6 w, V$ E, b9 u/ w) \6 Q6 x
- #include <mach/memory.h>5 H4 V. H9 ^# O% Z, f* r9 c
- #include <mach/hardware.h>
- i! u) R6 k% w - #include <mach/irqs.h>
( D/ d8 a7 L2 }4 i - #include <asm/hardware/edma.h>1 c& `5 E1 Y% u3 E
& a7 _: Z& q9 {0 i- #undef EDMA3_DEBUG, o: I% I. ]+ K$ i' r
- /*#define EDMA3_DEBUG*/
; m, a1 I- [5 s! `, S - 7 T' P" q9 r% M, H" _
- #ifdef EDMA3_DEBUG9 t4 B- N# V) G
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). r6 o C0 j [9 b/ F/ ?! n
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ N6 f3 j- i) o1 S
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; s- W+ _9 h5 t% Z! k6 l! w - #else
$ S% v: z" t! H7 `1 C5 z1 A$ j - #define DMA_PRINTK( x... )* B/ ~; N. W! J7 @- T8 R
- #define DMA_FN_IN
9 r: r: y& q k% L( ~ - #define DMA_FN_OUT
0 R E* X" m% P3 T! T7 i- j - #endif
- s* z5 A; P& n- E- s. c% g, M
: ]6 a; q" B& K0 j( }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 f) e6 \6 y: K- |& p3 Z
- #define STATIC_SHIFT 3
9 J. p r) s" |/ m' M - #define TCINTEN_SHIFT 20
. @" R' H- |5 k' C9 t. Y$ R - #define ITCINTEN_SHIFT 21
/ G. O" K- C- f$ m, y6 E - #define TCCHEN_SHIFT 22: q7 E: p2 f/ x' G: t
- #define ITCCHEN_SHIFT 23+ V; i1 x% b& S6 O# n! m! x5 \
5 ^* t, X. p; k7 J! H- static volatile int irqraised1 = 0;" @0 g/ `. J" |& S* g
- static volatile int irqraised2 = 0; y' v/ w. ? t
- 9 \% H3 o8 F" R5 r: X& }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! e) C4 ]0 \9 L$ S) s0 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f# S( K# W3 w! a v2 C" W
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
6 w; A7 @4 R/ Z8 ^/ j( c - 6 n A3 E8 m: g6 K' m
- dma_addr_t dmaphyssrc1 = 0;# i2 y+ w( p! \( S8 \6 _- g
- dma_addr_t dmaphyssrc2 = 0;9 @/ G3 u( u: T
- dma_addr_t dmaphysdest1 = 0;* N' ?. l6 I% w% U
- dma_addr_t dmaphysdest2 = 0;
3 C6 Z T' B% |
, \* K) F% F, Z+ ~0 _5 B+ q# {- char *dmabufsrc1 = NULL;- @& T; Q! Q- J* Y, f
- char *dmabufsrc2 = NULL;4 E- i# ~) ]2 G, z$ b1 d, U
- char *dmabufdest1 = NULL;
! c9 i1 i$ q9 u9 v3 ^ - char *dmabufdest2 = NULL;. m4 i/ d! f3 i2 I! L: G* c) o* I5 o) H
- 6 T) b9 d- a5 h% I% R* r
- static int acnt = 512;9 F. g6 Z4 Z( }' c" c
- static int bcnt = 8;
% D' e* w7 i4 s( L& b% \% g( Z - static int ccnt = 8;
2 S; T q( Z! \$ w1 ^ - # ~# I* a' j. j
- module_param(acnt, int, S_IRUGO);
, k9 M1 F& Z# s7 f; s- ~. H - module_param(bcnt, int, S_IRUGO);
/ ?- E1 J) l8 I) Y+ l2 p0 ]4 z h6 e - module_param(ccnt, int, S_IRUGO);
复制代码
6 f5 b5 o$ E" Z5 @; n
+ c* w7 U9 z- c- ]* n8 N( ` 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 ~6 H2 A% M3 [5 M$ ^6 D) K5 T( ^; n0 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" e( v/ q' X" ] 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ F4 o: _0 f0 L' J: I
+ c& @' F6 ^1 e( w5 E, u: y: A2 S- x% N2 y' s+ s3 C$ l/ L
|
|