|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! I( z8 I7 J6 E, ^; i! y- [code]EDMA sample test application6 ]5 |" E; N2 d5 B
- /*) T) k# _# W" k( [- z0 t1 m: q
- * edma_test.c! n' ^1 X5 J3 ` J; z: V
- *$ d& @, e. {- T( H; U1 u4 m
- * brief EDMA3 Test Application9 J7 G) ~# y' N4 m3 J, x W; X e9 N
- *, H$ y: L4 Y, T# a
- * This file contains EDMA3 Test code.
( |) o1 L% J6 U! W' z4 S/ v - *+ R: Q4 T8 ]% d9 H% y! r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Z+ ^8 w( a8 I) B, }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 b0 d' \. A0 s! _% J1 E7 |
- * TO CHANGE.9 @* ^4 R! }5 [) [
- *
' J7 H- R+ u8 D) ~/ z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* [% F3 Q# q2 Y! Y
- *: ?% g7 n+ @. V% a: s
- * This program is free software; you can redistribute it and/or3 v3 i" n( I: [
- * modify it under the terms of the GNU General Public License as& ?1 }! t. `; x
- * published by the Free Software Foundation version 2.' V' q% X1 a- K6 ?, _4 [
- *6 {" M6 H/ G' t
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; i" h4 @# W! R# M1 e2 J
- * kind, whether express or implied; without even the implied warranty
7 [4 L" S/ Z5 h# e - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6 m0 I9 S, `7 F; i* B - * GNU General Public License for more details./ N+ M _: G! R3 G
- */
: b. H5 D1 H; \; U - 1 L0 L5 K% |/ d! y5 k% Z" B
- #include <linux/module.h>+ w+ M" e" q0 M- p- O$ f7 P$ J
- #include <linux/init.h>
6 D" R2 m4 m6 C& j - #include <linux/errno.h>
9 _+ i0 V( d; S6 e; O6 X: H - #include <linux/types.h>
2 j7 g7 y* m4 H/ a. ] - #include <linux/interrupt.h>
* Y! {) N- g4 ^, z& }. [ - #include <asm/io.h>
; O2 e- m% j; K X - #include <linux/moduleparam.h>
) R0 O/ M5 \8 k" u* k - #include <linux/sysctl.h>
$ L# G. j% H+ `2 m+ F8 @ - #include <linux/mm.h>
+ w) Z1 l7 E1 _9 N2 n - #include <linux/dma-mapping.h>, h2 J+ I# |3 a# F8 E7 `
- , {3 X1 z' ~# G
- #include <mach/memory.h>& d) i1 G, s' m2 @; [4 \, m
- #include <mach/hardware.h>
% J+ I4 o7 G. l, B) Q6 o - #include <mach/irqs.h>
" T+ U7 }# S& r, ? - #include <asm/hardware/edma.h>
8 B! n+ T" w" a. I& N8 A# Y& @ - " S% g0 b+ j2 r$ J" k% O$ `9 i
- #undef EDMA3_DEBUG$ e. l9 j" m1 e# F, b2 c! B& N
- /*#define EDMA3_DEBUG*/% n) D W! G6 U: @2 d! m8 b
- 8 y9 }/ y- h, o% x- a* s- U
- #ifdef EDMA3_DEBUG$ ]2 d: H- X1 c
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ o# Y' X, N& c
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 L3 S" O$ K6 R9 f1 I1 ?% V - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 p( @8 u4 M2 y6 {8 g5 i5 [: K
- #else0 \9 r, y0 x! z2 h. ]
- #define DMA_PRINTK( x... )
$ t5 G! y/ V0 h1 b3 _& n - #define DMA_FN_IN4 s+ X8 F/ K) O9 Z* @( y
- #define DMA_FN_OUT
( ?" e& M, T5 x$ G - #endif. k# E& B$ e/ B) f* T. k: d
3 S% q R, Z8 @% X. ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
$ k7 H6 g! \2 t& F9 ` - #define STATIC_SHIFT 3! s! P" e# S- O5 v* R! H9 ?4 H
- #define TCINTEN_SHIFT 20( x/ D6 R3 R% l" u
- #define ITCINTEN_SHIFT 21/ s: b3 E7 o: `: L: Y
- #define TCCHEN_SHIFT 22+ @7 X- g$ V8 C& ^0 E
- #define ITCCHEN_SHIFT 23
/ S* B, f( _2 o - , ], l+ T9 U2 t
- static volatile int irqraised1 = 0;
' B* c8 L1 s v- b) ] - static volatile int irqraised2 = 0;
& j$ Y; K% A; r% s5 U - . `$ L. L$ ^9 C1 c4 A: x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) {7 }* K Q2 p) v' {, k - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 a9 t" g- p0 |5 `7 R - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- S+ m3 @6 R7 O2 Z
; D6 | F& q* h- dma_addr_t dmaphyssrc1 = 0;3 q3 ~6 }, `. Q' K" L/ x
- dma_addr_t dmaphyssrc2 = 0;
6 V. B1 q# `2 z3 n - dma_addr_t dmaphysdest1 = 0;
0 d, ~9 J3 x- f( q( [* B) x - dma_addr_t dmaphysdest2 = 0;
& m, D9 X# C( G* P- _1 k0 H
( Q! X& b/ G U6 C5 x5 l9 V4 M- char *dmabufsrc1 = NULL;
& R q5 t0 g: V1 D4 A - char *dmabufsrc2 = NULL;, ?" W X8 `, B L. S7 v
- char *dmabufdest1 = NULL;
# ~+ z7 ]. q0 e4 e" J: X - char *dmabufdest2 = NULL;9 F! c9 M/ T, \: P3 E7 o5 c( l
' g# p9 {; v9 ]1 {( f5 _- static int acnt = 512;
7 L U' ^; O9 H! K - static int bcnt = 8;
) a% ` o0 f- t* l- t - static int ccnt = 8; W% T& N3 J5 U7 b9 i5 h3 t2 N
- + T6 M1 `( ]6 U! `9 _
- module_param(acnt, int, S_IRUGO);
/ |8 k3 e* P1 X: W - module_param(bcnt, int, S_IRUGO);9 O! Q# L3 m& Z" I: i
- module_param(ccnt, int, S_IRUGO);
复制代码
; i/ R$ g" W6 ]+ \8 @2 @0 v# W1 n
* s$ m+ T$ Y: u+ d1 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 P, Q- v" D% T; darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" m2 J: v0 `# c, O' z, J4 `4 E- t U
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 q& n* h6 F4 O9 C1 @; ]
w6 v- j$ b! Q! ^$ K: ^' I U
+ Z+ v3 J: D0 o( j* L |
|