|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; {1 H2 o: T- h/ k+ o; |- [code]EDMA sample test application3 J: u! m/ A$ ?$ i( h
- /*
5 D! D i( L; L* A/ ] X - * edma_test.c
! T5 M: G! r. J" N' F/ c, l! C9 h - *
. P( K4 f" e7 [/ S/ @7 t4 F. U! n - * brief EDMA3 Test Application$ A# D+ c4 V8 B# |9 M
- *8 t: n$ o. l( C! T
- * This file contains EDMA3 Test code.
; e n* ~5 g2 I0 b2 P! @4 h" m# @5 ^) t - *& E2 A7 `. _% o1 |, `+ n# G2 f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
! P6 k: P, }9 `9 G: U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 [* m3 l+ t D) m6 S2 X: ]
- * TO CHANGE.* j2 g& l* q5 _( _" ~1 }% L
- *
' F5 t2 q+ f' o) `3 ~* z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 Z1 U! v+ P! i( Q
- *# B3 y, {( {8 i! T
- * This program is free software; you can redistribute it and/or
/ d! E+ |4 i' Y - * modify it under the terms of the GNU General Public License as
9 ^! m4 h; C( ^ - * published by the Free Software Foundation version 2./ _8 I# j3 S4 e# x* p& J9 l
- *8 z( L5 [- a, F, O
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
# y6 B& L! _- r: f# Y; M/ V( P6 D - * kind, whether express or implied; without even the implied warranty
+ X2 | e" ^4 [2 u0 P$ k - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 z1 i$ e0 Y! f! x9 ~4 d
- * GNU General Public License for more details.
+ G% B- Y$ c- d) C# y3 X' d8 l - */
7 M T3 K& I( T* e; N" Z
6 ^( U$ r* }) V4 X7 \* u# q, G. a- #include <linux/module.h>% W/ t8 h, T2 ^+ U
- #include <linux/init.h> l( i( F7 O# m& k* `) r; Q
- #include <linux/errno.h>9 d, u: Q H% m+ B! \! r
- #include <linux/types.h>
' V( m# z' C/ L - #include <linux/interrupt.h>* d& N! Y9 `7 w6 }4 c) @
- #include <asm/io.h>
9 w- Q9 V2 X2 g. h D2 _6 A; z - #include <linux/moduleparam.h>2 @ I7 a1 f7 ^) z$ g
- #include <linux/sysctl.h>
& I, v3 w. A! ^5 a) [: z - #include <linux/mm.h>
$ V0 E, I- A) Z! A% x" U5 F' f9 O - #include <linux/dma-mapping.h>
6 R- K5 k3 e3 I8 D6 Y. Z
. k9 o) h5 Z* y; H% i/ q- #include <mach/memory.h>! v' N3 W+ c: D) G$ `! W
- #include <mach/hardware.h>4 _. c" g+ V2 ^9 o6 G) r1 j0 v- A& t
- #include <mach/irqs.h>
& |; G" u- c, O: R2 l5 O - #include <asm/hardware/edma.h>
" s p' a `; `6 W
% q$ P0 k: r v( X" y- #undef EDMA3_DEBUG
5 f+ F2 ^' O9 \" S* a0 F6 m - /*#define EDMA3_DEBUG*/% ^) I( i8 @# P0 p0 |6 o5 ~
. D; z$ l. h# g: T" T% w. l" |- #ifdef EDMA3_DEBUG
4 S/ P, h" Q, m* ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- z# ^ W5 l( U* g3 c) j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ a" J! H T+ U1 Z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
5 Q1 M. H/ \, q p% u - #else
, e+ M% X U7 i: {; g# l. j - #define DMA_PRINTK( x... )0 K6 S/ E) o& M" h$ P
- #define DMA_FN_IN$ v9 n) j8 q0 q/ V
- #define DMA_FN_OUT8 V. G; _1 G& f8 ^- m
- #endif; l! ?7 |- j# O9 h6 m# V
- ( S% s) V ~" a) F3 A5 [2 g9 s
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
' O4 R) ~9 G1 G, c* Z* Y: k" g - #define STATIC_SHIFT 38 t- _# s; c+ n: m" q
- #define TCINTEN_SHIFT 202 Q! ^4 e. p" x) ^; ]; ^
- #define ITCINTEN_SHIFT 210 a& R$ J4 Y6 ]7 c+ N' T
- #define TCCHEN_SHIFT 22" e0 J5 ]: Z: a8 O+ U+ S
- #define ITCCHEN_SHIFT 23
$ t# f+ J0 c& S9 O9 q) W7 Z
6 c+ S$ L1 ?3 _2 g- static volatile int irqraised1 = 0;0 {. H3 U* z* l) ?1 C
- static volatile int irqraised2 = 0;
' D6 [. {) k6 @4 @9 C& M& ^1 F - . [- k0 K } X7 N( d3 E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ Q: K& p% w1 q; }8 d# _ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M# ^" H, j: q' `! y# P l
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" l8 D2 Y! p) y
* E5 \$ n+ G# j+ a0 Y1 ]. L9 j- dma_addr_t dmaphyssrc1 = 0;6 p" o+ e% V. [6 P2 v
- dma_addr_t dmaphyssrc2 = 0;# f4 Y8 u1 e& v; m
- dma_addr_t dmaphysdest1 = 0;' A/ B3 F/ h8 `9 E. p" u* K
- dma_addr_t dmaphysdest2 = 0;
+ k/ P7 s9 r' {6 R5 ^/ G" ^. ? - 6 m V7 i5 @8 v$ a7 V' G. Y
- char *dmabufsrc1 = NULL;
4 M& ^" @7 ?1 N2 N. @ - char *dmabufsrc2 = NULL;- k) f1 R$ a8 i H3 e
- char *dmabufdest1 = NULL;& P. {: a3 E0 B
- char *dmabufdest2 = NULL;
( c5 H+ r& |: u) @+ [! D
* Y" b4 w+ `7 E1 J8 t" Z- static int acnt = 512;- T b3 e, N# N* {# \2 p8 q. [/ T
- static int bcnt = 8;
" n. f; @7 }5 R# e* B2 y& S6 ?% d+ V - static int ccnt = 8;& w$ Y! X$ d1 J/ c$ h0 ]. ?& Y
- : {/ x: X4 W H. h; W4 p
- module_param(acnt, int, S_IRUGO);
% Y- F) n( S+ ]) m$ t( V- ?5 @5 A - module_param(bcnt, int, S_IRUGO);5 p) P' B; e% e4 f9 e7 i
- module_param(ccnt, int, S_IRUGO);
复制代码
# {9 @& Z( r/ x3 _# m( Z
3 X: x, Y: b! B w6 j! l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& P3 U2 a9 c. K7 Narm-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/ p% ~9 d! P( ^) t0 i2 [+ L* F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" ^* E3 W+ m4 G' t
. W- e- C# t2 C' H2 k% Y7 r e' u. u6 z8 S6 E! L p
|
|