|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # B! F/ {* I* O A0 G
- [code]EDMA sample test application3 X3 I6 c6 m; N2 R
- /*3 q4 ^) [7 R0 \$ U6 d8 W6 c M
- * edma_test.c
( f8 Y. F) ^! {2 Q2 V2 H5 [ - *
2 b8 n! K7 G7 ] - * brief EDMA3 Test Application2 A' R' K' m* p' r9 M, ~$ ~
- *' B, J. Z' S* _% g
- * This file contains EDMA3 Test code.
6 b% t" U) e2 p0 r2 c* t - *) S3 j3 b2 A5 Z% M3 w8 e5 F/ l
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; }) F+ A' F D( { - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ s3 C/ V8 K. k, G - * TO CHANGE.3 O/ o7 c O4 |0 L0 {0 i$ d! K+ [5 D
- *" o2 _4 n* I- p6 C( o% L1 m% u
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ^8 {4 I* S2 c" m9 s* k1 C6 C* z
- *1 @3 n# {) {# {1 m7 K0 T
- * This program is free software; you can redistribute it and/or
, ~6 r" W% [, y. M' r0 W6 M+ E3 s! L - * modify it under the terms of the GNU General Public License as
+ u9 M( j0 k- L* Y, Q8 l - * published by the Free Software Foundation version 2.& ~# _$ ]! |& K$ L7 o3 S3 O" `" e
- *
2 }! e+ P& [% l, U5 N/ g - * This program is distributed "as is" WITHOUT ANY WARRANTY of any _3 k9 I6 d1 { { ^
- * kind, whether express or implied; without even the implied warranty' k' j! q4 e2 q! N/ Q, R& e5 i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& n& I% w/ G x! K. `
- * GNU General Public License for more details.6 {1 I3 l0 z# R b s) b0 q
- */
) V% L( G& r/ A: d$ z6 j - 1 E3 P6 x9 n, ^
- #include <linux/module.h>
- p7 `! k& @7 s m* A7 _& T - #include <linux/init.h>
& S* p; i3 ]0 O% j - #include <linux/errno.h>( L4 `* _4 R6 \+ r7 N
- #include <linux/types.h> ~ l) r( [3 D& [2 l
- #include <linux/interrupt.h>' j8 H+ W8 w. Z y8 W# V# H
- #include <asm/io.h>
% B4 k0 b0 S' h4 u - #include <linux/moduleparam.h>& _# a! v5 m5 @, k- A. ]' Z
- #include <linux/sysctl.h>& G1 g& y9 k8 N4 S; C4 j% f4 S/ d+ D
- #include <linux/mm.h>
+ _! U. Y1 s' | - #include <linux/dma-mapping.h>* k; F5 K: |+ v* i( K( v; y3 T
- # b1 U* G& F; L% o/ L
- #include <mach/memory.h>
, R( r* ~7 R! n0 i0 s% ]7 R1 Q& ?5 V - #include <mach/hardware.h>5 r3 J+ @* I3 f5 Y1 P
- #include <mach/irqs.h>
& m( s9 X6 ~8 i( I: t - #include <asm/hardware/edma.h>
, g+ s; E5 q& p+ |# o! p( q
) V; q- W) S& M- #undef EDMA3_DEBUG
3 t! a4 i+ _& T- F- S: A4 d4 k - /*#define EDMA3_DEBUG*/. a1 g# E" Z# ^5 |1 y9 }' z
- * A* P j z- T' {8 f
- #ifdef EDMA3_DEBUG
, G* v- C6 G, Q( h - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" n5 \3 u' P. ]5 p! M1 x - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q P2 |/ W+ |3 a
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& @3 B+ _- w" ~) [% H2 h - #else/ W) m( Z$ l0 a& `7 J
- #define DMA_PRINTK( x... )
c8 Z( }- P% J, b5 j - #define DMA_FN_IN8 P- Q& y7 L" l2 D
- #define DMA_FN_OUT
: O3 R7 h% `/ T/ r; H2 A& _1 m - #endif0 H2 Y* g1 ^) k
: n7 d% a. ~3 s# Z3 e- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
! V2 p5 R* p4 V8 m0 J% a - #define STATIC_SHIFT 3/ h+ ~' Q3 n! e# `
- #define TCINTEN_SHIFT 20
6 {/ u; d$ o) H7 w0 M2 b - #define ITCINTEN_SHIFT 21
( B3 R7 d7 x3 q' R9 q - #define TCCHEN_SHIFT 22
/ K% Z+ f! K: G0 m - #define ITCCHEN_SHIFT 231 D: _ v6 x. M- u6 m6 t( y) Y
S7 k4 c% p% j- {! G/ G# ?- static volatile int irqraised1 = 0;
3 c0 D, z* p3 p2 L5 d - static volatile int irqraised2 = 0;7 R# w H. [& ]1 g. ~
- 8 R' g- z: M% T H& K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |( j3 l! q5 p9 u/ ]" Y n
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ n- z. X9 b8 \' r
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \. Q9 f* z1 n. i
) c8 ~7 N- R/ i6 N, J3 A! v- N% ^- dma_addr_t dmaphyssrc1 = 0;
* k) ]7 e9 e4 i' ^% l - dma_addr_t dmaphyssrc2 = 0;
( c1 L& y3 m* G7 [( F - dma_addr_t dmaphysdest1 = 0;
- N- d/ z$ W# u* b& h - dma_addr_t dmaphysdest2 = 0;/ q8 L, F8 w3 |4 [
- * l; E0 U; A1 C' _; `& s$ o# {
- char *dmabufsrc1 = NULL;
+ s& r" s* i, [5 @8 s3 y4 K% x9 m - char *dmabufsrc2 = NULL;( k- D( q) P5 p9 k: z" f( w
- char *dmabufdest1 = NULL;
5 c6 m" a7 e+ Q7 Y% J - char *dmabufdest2 = NULL;
5 S& s! n' S5 K7 d$ t3 B - 9 x9 s+ }- A: }7 d# {
- static int acnt = 512;6 n! ^& p- P9 ? K* V# Z' H
- static int bcnt = 8;
5 J4 g; U- E- B" p0 p - static int ccnt = 8;
8 V9 C8 V: N9 W$ c - $ ]% d+ G* q* }" l
- module_param(acnt, int, S_IRUGO);8 y+ \" P' b) R6 w
- module_param(bcnt, int, S_IRUGO);! u; [3 {' A6 K
- module_param(ccnt, int, S_IRUGO);
复制代码
% K3 e, Y- j1 Z2 `$ B- \
3 l; I$ |9 R# n$ s' ^* W5 R 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ H( l, _& q2 D4 Q% W! J6 }. J7 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Y' ~) s ]& d9 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# t9 L3 Z7 M; z" J; e4 R0 l6 T9 T! x. Z
- N( z- g- l! c& H+ d; b. i* A |
|