|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- H8 m2 M% Z& w# `6 A- [code]EDMA sample test application' I4 F8 ^0 U. _0 b
- /*
# A- r4 C8 x0 c/ B - * edma_test.c3 L3 S; {* L* z# J) q' ?3 y
- *
, Z& u* {5 F: C - * brief EDMA3 Test Application
& w+ ~ t/ F' x+ n) X ?6 d - *
# D4 _. {$ i- s( l) {: D - * This file contains EDMA3 Test code.' M+ o y, {% q* T
- *& _3 E+ w1 W- v1 d( N, t% I- w
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ d5 |$ B: |* L* a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
' |0 z, Z, e: V+ U e/ o- b9 }) G - * TO CHANGE.2 z/ K- N5 V- \: c$ J' d: `: t6 f
- *
; H" n5 \5 F+ y4 n& E - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 w; j" L0 ?: ^* J* {& ~
- *
3 d8 M Z1 G1 ]8 b$ ^2 C+ Q9 c) @5 w - * This program is free software; you can redistribute it and/or" b% Q5 g$ {9 A& H
- * modify it under the terms of the GNU General Public License as
7 p) y& {5 l9 l& [( O - * published by the Free Software Foundation version 2.+ j4 t |2 O# u& J
- *
, M$ c( s* e3 e" l' F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 S2 O/ _* h7 T' n7 K0 {
- * kind, whether express or implied; without even the implied warranty Y3 b6 e8 w4 u0 T( L
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& J; p# N. Q0 `7 J- s% o0 S
- * GNU General Public License for more details.
( s; B8 e( f$ q - */6 b: a Z8 H* i( y8 w. Y4 d
5 s# \- j- S: M- #include <linux/module.h>+ G) _6 _) B# s
- #include <linux/init.h>& z; P( a( K8 \, ~4 C& }; n$ ?
- #include <linux/errno.h>
/ s/ J6 t g9 m1 G - #include <linux/types.h>; v" p( K' {8 ^ _4 Z" }8 k
- #include <linux/interrupt.h>
' K9 ]3 t! @* C. k# h! s - #include <asm/io.h>
3 L& s2 a9 U4 F6 Z - #include <linux/moduleparam.h>+ u4 E1 V& J7 @/ n! i: d# n
- #include <linux/sysctl.h>
, ?- I/ D' q) y' B' \" B - #include <linux/mm.h>
) N! w. @3 ?9 {& o- b3 e0 j# e: A - #include <linux/dma-mapping.h>; F( R; ?- t; W3 q4 _# v
- - K: h3 H5 }8 c% e/ i
- #include <mach/memory.h>
% ?5 F! t: r+ K6 r9 N( H' D* J - #include <mach/hardware.h>" [" F5 l- K T8 Q5 d, ]
- #include <mach/irqs.h>
% N. a4 h$ Z6 i6 S4 F, w$ P - #include <asm/hardware/edma.h>9 g' o+ N; G6 c4 B8 g* D
0 v$ }7 t9 ]- Z. E: s' o/ N+ W5 |- #undef EDMA3_DEBUG
& {! e$ k- u5 W" t7 D - /*#define EDMA3_DEBUG*/% K# g% g$ T$ N3 {3 v1 P& D* E
- . E; j- l. j ^* V6 h2 V( J0 c
- #ifdef EDMA3_DEBUG
# {$ v9 n0 I0 c. t - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 t: k6 X) ~, F2 W4 b0 x
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) Z7 F* F) v* B% d l; ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ]& F% A% c5 K. t. Q0 n6 R
- #else# P4 ]4 t, W7 V: M
- #define DMA_PRINTK( x... )
+ U! b- `. ?6 |: u* _ - #define DMA_FN_IN* a0 y \+ @1 v) c0 U$ ]6 g
- #define DMA_FN_OUT
* ?6 ?( `, b0 s4 }: O. ] - #endif
- m0 e# `& b3 M) Y% x v3 Z" ~ - ( x. R, N( V) t0 s I. {) S
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& ^1 f. L0 T0 v2 @3 r, ~, {( ]
- #define STATIC_SHIFT 3$ U1 x$ l$ g4 w" Z w* m
- #define TCINTEN_SHIFT 20# _) v: [1 Y; T
- #define ITCINTEN_SHIFT 21
+ H4 F1 A, Q) E! C2 l/ } - #define TCCHEN_SHIFT 22
# Q. _9 @4 D$ Q, x4 i6 r% I4 y - #define ITCCHEN_SHIFT 23
5 L) I1 ~2 s) R5 [$ i1 M - ( e7 N- i8 f6 x7 g
- static volatile int irqraised1 = 0;
% O& ?8 W) \5 W2 ?/ o+ u - static volatile int irqraised2 = 0;+ _8 d; Y& x2 s1 N1 ?
- 2 K% Q4 l0 y& F, S; K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( |: w! ]* v- `. J- c# ^6 V% K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% r$ k1 g" ^/ h* w- ]1 | - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 [. O5 z' _, `; D; Z6 f
- ' s: ]' S5 v, P+ c
- dma_addr_t dmaphyssrc1 = 0;' ~; s' b) \) ^ \
- dma_addr_t dmaphyssrc2 = 0;. K- U R' g( v
- dma_addr_t dmaphysdest1 = 0;- r& P. j6 i$ Z8 j
- dma_addr_t dmaphysdest2 = 0;. y% f' G; n9 M0 m! T+ y' x; M
- , ]+ I! H) Q, g: L
- char *dmabufsrc1 = NULL;6 s7 `7 t! |+ A5 d% y1 T1 K
- char *dmabufsrc2 = NULL;
" z, G: |; A7 A3 ^' V- I- W - char *dmabufdest1 = NULL;5 [; k0 S. C& D) I8 a P
- char *dmabufdest2 = NULL;6 D9 [( f( u5 Z, a) o# S- f
- 0 P0 X# O4 ~( | h- _/ Y
- static int acnt = 512;0 C0 [5 Y5 F1 D' ^
- static int bcnt = 8;
4 k' t# Q% Q6 T; x9 c* N# I - static int ccnt = 8;- M) i" Y: i/ c0 T8 \
o( b& K2 D$ t, C9 i8 F. s4 M- module_param(acnt, int, S_IRUGO);
& v, n1 \; w" J3 s/ Q8 F5 s - module_param(bcnt, int, S_IRUGO);/ n: {9 G: L4 D6 p4 X
- module_param(ccnt, int, S_IRUGO);
复制代码 2 {% A' ~- V7 d1 L' y$ a5 b
' B! U- K# o5 F" t8 W0 B% m
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# O* a' |4 d. V1 k1 f$ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 {! R% i' e8 H8 K& D
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( `" b. h* g/ @( G$ e
4 w" d5 C- C8 ?
; \+ w* N' F& m8 |0 W4 { |
|