|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" O7 B- ^9 j- }- [code]EDMA sample test application$ _( c+ j# Y; @( N' l+ E3 B8 z' A0 r
- /*
7 M" j! Q4 H' N6 i7 l" F7 W' Y - * edma_test.c
5 _* x( m( O: o- W3 }$ ^ - *2 [4 K$ c" d7 r) u/ B0 r( k
- * brief EDMA3 Test Application
! c, e2 y+ H1 u9 `$ f/ H - *
4 r# M/ f- v! q- j: U+ W - * This file contains EDMA3 Test code.2 b. J- Q! h) t3 ~
- *
$ Z9 K! w x1 m% U4 k: s9 w - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 H" _! C5 D, K7 e+ C3 G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
: {! l) ^$ F) _+ k2 ~6 H/ Q - * TO CHANGE.: N* p1 x; p w# p% O' T, K2 n
- *: O {$ z1 M- {9 _
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: Q+ R! Q* g$ t - *
& P( D( S- ~9 G - * This program is free software; you can redistribute it and/or% \- F& }3 @! @8 t2 @
- * modify it under the terms of the GNU General Public License as! T# _2 d+ k$ n L
- * published by the Free Software Foundation version 2.! T2 y9 v; ^3 w2 `
- *
4 B# |8 _; t3 y o - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 Y3 Y; b. ~. ~ - * kind, whether express or implied; without even the implied warranty6 t- Z) J" \- B* I8 C+ H
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" h/ X5 s: `0 H) M+ p
- * GNU General Public License for more details.
- X1 g' n- y+ e5 i6 \5 l+ O - */
# Z+ Y8 ^' x: u, k6 l: `$ C - ! |& {9 _$ x. H& A' f
- #include <linux/module.h>3 Y+ _( f. _% s$ M3 \5 g3 @
- #include <linux/init.h>
& k6 a( ?% o& V) @: ]3 p - #include <linux/errno.h>0 f S( K: a8 I+ j6 U/ O
- #include <linux/types.h>
, m* r: U) f s9 e5 A/ G - #include <linux/interrupt.h>
1 U6 ?+ f. B) a: l8 _& e, M - #include <asm/io.h>, C& ^3 W, u- ~1 d2 f
- #include <linux/moduleparam.h> d: S3 {* q9 a: P2 y3 t
- #include <linux/sysctl.h>
' K1 Z4 g# u3 I5 n3 N - #include <linux/mm.h>
4 p! R) g9 p4 E - #include <linux/dma-mapping.h>
/ y0 U( e" y* v+ |9 l - ' [, }0 N+ U; x* a2 v6 d& C
- #include <mach/memory.h>
' Y6 d" T8 K. x, P' |- C, ? - #include <mach/hardware.h>2 |7 a" O& X8 m J- ]0 t# R
- #include <mach/irqs.h>
2 V1 a' R2 w' f; v. e* e" H4 |0 q - #include <asm/hardware/edma.h>
( g' \8 W7 K/ u( d# i6 e5 H
4 D, A1 j N' P. N! G/ O' `! R4 J, F7 O6 w- #undef EDMA3_DEBUG
1 }( ?4 }3 M# Z( n5 i - /*#define EDMA3_DEBUG*/. E- v [- k2 `% V4 H- @) J
- $ ^% I" Q' M9 _4 u! A
- #ifdef EDMA3_DEBUG
0 d2 ^' w; P& o6 P' _) ] - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 i7 G: J6 b- V& \4 v/ |. f1 g8 | - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- [. x* c8 R* N6 [4 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): V x4 z% ~5 z! b4 X- S) M+ h% V
- #else
" h* |+ O) u* m* b* R1 C - #define DMA_PRINTK( x... ); N; B; W" }3 P$ n; O
- #define DMA_FN_IN
, Q. c) J) q" S6 }+ L - #define DMA_FN_OUT$ j) x9 m* p/ M4 A3 C
- #endif) p9 n5 T) K/ q
+ T5 n, Y8 m3 |( U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ @" q4 g! X9 w- i* n - #define STATIC_SHIFT 3
2 Q! B) U8 z5 s' n C7 V - #define TCINTEN_SHIFT 20
: O2 W8 U4 ?! y+ O8 t0 J4 {1 I { - #define ITCINTEN_SHIFT 218 k1 r. i; g& P5 m& }* L! Q. i* J
- #define TCCHEN_SHIFT 22
; z0 m; p! H2 p: y - #define ITCCHEN_SHIFT 231 [$ r( b8 @: e3 Y
- H/ x# ^& i0 P9 s- static volatile int irqraised1 = 0;
4 h9 X& X. q& _/ R7 s - static volatile int irqraised2 = 0;
: t: u( {6 J6 [5 t
- j+ `3 `/ [3 p% |% c# L- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: f! m2 C$ G- S4 X - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! M7 I; l2 p( B: H - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; N, V2 q {; z+ a
: I: }" b# M1 J; n- dma_addr_t dmaphyssrc1 = 0;
/ [/ B0 f* w: S2 v# ?& m - dma_addr_t dmaphyssrc2 = 0;
1 b) |4 o9 z* d& n' D! A; h' K9 A - dma_addr_t dmaphysdest1 = 0;
; O" T- ~ _! t6 L& }/ ~3 L - dma_addr_t dmaphysdest2 = 0;
! E5 z' H( P4 ^; i0 Z! f, b% B u& s2 T
+ l; c J4 i4 @9 V( M: @- char *dmabufsrc1 = NULL;( R& \& z1 X; [
- char *dmabufsrc2 = NULL;' g3 ?+ A" R2 D
- char *dmabufdest1 = NULL;6 z7 y% L. J( F$ M% j8 n* f
- char *dmabufdest2 = NULL;
5 w+ e. u6 E$ A
. d9 W+ ^$ W: C: W4 ~- static int acnt = 512;
7 P' r0 x& ]1 t# F. T" a: l0 @ - static int bcnt = 8;
0 e6 F& B. u( K4 w - static int ccnt = 8;
2 h2 I0 B5 W/ c5 d2 g+ f; }) ]
3 |) g1 B; W* Y6 i$ B0 X1 \) `% Z9 [- module_param(acnt, int, S_IRUGO);
7 H2 _4 W$ Q! c' C+ a - module_param(bcnt, int, S_IRUGO);
- J2 u- U7 @, J - module_param(ccnt, int, S_IRUGO);
复制代码
! x0 x0 ]/ E5 g Y; L4 ]& O2 d. f; a) F$ E5 I' K! ]
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 }+ K! i& B# l. N* @; [5 Z" q, \, ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, l8 `8 J4 C9 b3 l$ e# ~2 O
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! X8 b3 Y& y6 d3 p
" O3 W2 [6 L5 J9 u
8 Z* q& C, b( V: k l. U( Z4 K/ u
|
|