|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 M' `! @! J6 d' U- F
- [code]EDMA sample test application! k, J% g& S* T; ]
- /*
+ w" f H/ F# T9 n; l3 d+ X - * edma_test.c
% y# C+ J. g" r& f; [ - *1 y( K* P S x$ q8 {9 a; b# f
- * brief EDMA3 Test Application+ X4 s: n+ R) @7 B
- *
. I& j* V" L7 X& G1 p - * This file contains EDMA3 Test code.- C" L! W& I" s m5 m5 y8 g" c2 S
- *$ G) `+ }( m4 G1 T# o+ f0 y) \# c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 `5 d% c" r7 d* D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. w2 ]4 G& T U) O
- * TO CHANGE.
! E( h% K2 H- q& f8 h9 L* M - *# P: p- g! `# _/ i! f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) {3 ~- P* T* j0 m9 Y' O$ C
- *
2 T5 V I6 c7 _/ S* K% | - * This program is free software; you can redistribute it and/or
) | C5 W" H, n" \" w& g, h, \ - * modify it under the terms of the GNU General Public License as
4 S- e" m$ Y/ g- U, y" J$ M' h - * published by the Free Software Foundation version 2.! t9 ]. J: e8 ~8 f+ D6 l$ }) z9 A1 D
- *0 u" F2 F0 P, n' r7 B
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any# t$ @9 k" R9 `% |. A8 i, b
- * kind, whether express or implied; without even the implied warranty
+ m0 o J/ v. h4 g* | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 g* I6 i( U3 r7 l% _" ` - * GNU General Public License for more details.' a& H0 h. r2 R# {5 z
- */
$ P1 u# E* n5 _ - 2 C1 ~. B1 @" S! O
- #include <linux/module.h>
- |4 a2 B9 t; i, n - #include <linux/init.h> c$ k- @4 i7 Y: q# m/ V
- #include <linux/errno.h>' p3 [. J8 r" J2 m
- #include <linux/types.h>5 c5 z/ g6 A& @- n% I( q* x: @
- #include <linux/interrupt.h>! j8 r/ s* L' ?3 ]1 v( i
- #include <asm/io.h>6 @: y! t: i! c
- #include <linux/moduleparam.h>. P' {/ v* K" Q
- #include <linux/sysctl.h>: u: ~# h# J& y
- #include <linux/mm.h># ?& @; M' T. W- Z5 S9 U
- #include <linux/dma-mapping.h>
4 G; _7 y3 t) ]2 Z1 z* s - 4 I) c2 X) Z! v( ` z
- #include <mach/memory.h>
2 b, c% ~5 `$ y) d8 [* L. A) `. ?, q - #include <mach/hardware.h>
# ?5 U4 T7 b( | {4 A - #include <mach/irqs.h>, k' g: L* [' D. B ~& }
- #include <asm/hardware/edma.h>
3 ]0 R2 E f3 D2 k - & a C/ a M! {3 L5 b
- #undef EDMA3_DEBUG$ P" } I! u- M9 B
- /*#define EDMA3_DEBUG*/2 T4 @! T; ?- K
. s0 T4 c! C; ^& j) z* B- #ifdef EDMA3_DEBUG
4 j Z/ }% X, Q4 R1 F- Z/ x ^# b# o; u - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* V S! z! C8 K) P, v! ?# ^
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ j( [" k0 _5 m& h/ T4 `" ~
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), d( c) \3 \7 g5 ?, G
- #else
: |7 K: X- x" v- W8 M* _ - #define DMA_PRINTK( x... )/ p k0 F7 @- H! K. T3 [" {
- #define DMA_FN_IN% }5 r$ ?+ O/ c8 H o8 B% A
- #define DMA_FN_OUT2 e! D1 ]; m. H! Y% D
- #endif' I7 K. q2 }' h$ S2 R
/ f/ j9 @: c7 @4 d6 S; M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)- v0 `" H8 `' w
- #define STATIC_SHIFT 3
! j% b8 j: L; M' B E+ m8 b8 d% C - #define TCINTEN_SHIFT 209 ^$ }- F$ G# T7 H# E: [! N) v& h$ y
- #define ITCINTEN_SHIFT 21
& p3 B8 E& l; L4 a+ y - #define TCCHEN_SHIFT 22
: g7 D$ K# Z0 I/ c9 O# i, D* G- [ - #define ITCCHEN_SHIFT 236 d* K$ O7 b# @( l) w8 M
- % C) p* F" v2 L+ H7 @8 H9 X
- static volatile int irqraised1 = 0;
2 L/ m3 k0 `. P* O- ~' y1 ? - static volatile int irqraised2 = 0;
; {6 {7 V5 X. @2 e- z% [6 ?
' K4 T8 P2 G7 M# j' p- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 Y" ]0 b. ?! \% N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w, _: i: _6 f2 i# R* _ z4 a1 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }* \- |; G& q) ~7 `
- # V" O7 [- E. T: Q
- dma_addr_t dmaphyssrc1 = 0;0 Y" d; ?) Y* A0 `( w7 ~; Q! a2 M. Q5 U
- dma_addr_t dmaphyssrc2 = 0;5 y5 I- E3 |' A' O, \' e- C5 p
- dma_addr_t dmaphysdest1 = 0;
! U& j/ u) h* o: q. W' m - dma_addr_t dmaphysdest2 = 0;- R: S6 D/ P6 H9 ]; {$ o, F
- ! y" h& @' w! J( F) ^
- char *dmabufsrc1 = NULL;9 ?$ {* L" n, C' d
- char *dmabufsrc2 = NULL;
4 _2 _% I+ ^/ d4 _' b3 P - char *dmabufdest1 = NULL;
( A' q3 y/ i) s0 q* f( T - char *dmabufdest2 = NULL;
6 }6 i, p. e! S# W5 d; A - : S5 s( j4 d2 Q1 N" m4 ]( A# ?
- static int acnt = 512;( z) _5 _5 @/ l" o$ q. l2 d' b+ C
- static int bcnt = 8;, _, ]/ I/ ~5 X( \# s0 q* q' N
- static int ccnt = 8;/ W; n8 }2 O- `
- . R/ R# f6 r9 y' |. B" `" t4 a
- module_param(acnt, int, S_IRUGO);2 c& s) `- b! ?
- module_param(bcnt, int, S_IRUGO);
: U, O4 \7 ~6 [" o- h, j - module_param(ccnt, int, S_IRUGO);
复制代码 * z. I) F H. L* b0 j3 l* L% X
4 t! ]2 U( u: g h1 s. k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Y3 W& P. f& A2 t/ I z+ Q8 |0 iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 ^- Q3 l9 n, ^% u8 C: Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ i) {6 f" b0 g
3 b& a/ @, n+ ~6 l" |- P& H: d1 P& O0 h( @& i+ I ]4 E
|
|