|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. z m3 h- c2 H, V( x* n7 h- [code]EDMA sample test application& r6 Z+ i/ u) _6 M$ D
- /*
+ x# k5 Z( u5 R$ q/ T7 r - * edma_test.c C& v& V* B3 w4 h- [2 a& U0 T
- *1 c/ }9 \1 u% ~. A! S1 f
- * brief EDMA3 Test Application4 G6 D/ I& K1 v8 q
- *
( I c8 Y# e) }" D% s0 ?- l6 n- F' r - * This file contains EDMA3 Test code.
. d! Q6 ~$ M m+ ?$ \ - *
\6 |4 H8 k0 a - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- t, g# R+ b! U7 A2 e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; Y: z" C1 e; R) p v# \ - * TO CHANGE.
3 N/ `& G7 a' S2 ] - *
( V! K( b& R. G. j) R - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& Z3 y" q' `* A; k# l. n
- *- a6 Q! R5 `- ^) L/ [7 B$ ^3 Q# N
- * This program is free software; you can redistribute it and/or
# z$ Q3 s" j/ E0 q6 V, `& a! ^ - * modify it under the terms of the GNU General Public License as1 Y8 ^, F5 l/ Y( V7 k
- * published by the Free Software Foundation version 2.
4 b6 ? \. \" p9 r - *# N* W( D, G/ z' g" w& V
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 o3 z+ ?' @4 @' }. R
- * kind, whether express or implied; without even the implied warranty
/ d9 J8 [" o9 i7 I/ N - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* {& z9 f: ?( p" }
- * GNU General Public License for more details.% |: b: @( U' B: R! B. B
- */
1 }/ X. l) I* o8 F4 I+ _ - 0 V' e/ O a$ R2 Q1 p) L( u1 U
- #include <linux/module.h>
0 N1 j4 d3 W1 R/ e - #include <linux/init.h>) W/ \3 R) |7 h$ s6 V; y
- #include <linux/errno.h># B/ F0 g& [8 a1 j! k" y9 s+ H- l
- #include <linux/types.h>% H1 m6 c; d8 H [. S
- #include <linux/interrupt.h>
' {- e! x& @0 J - #include <asm/io.h>
( b- v e0 D# u; D9 Z4 M3 a* o - #include <linux/moduleparam.h>
& \+ U" }# P" U9 U* b+ { - #include <linux/sysctl.h>
& ?& m3 w! H% T8 J - #include <linux/mm.h>
- N! O0 C- y" }( \ - #include <linux/dma-mapping.h>
# @/ ^% d( f5 {# L. ?; V: L
" ~9 ~4 g/ p: n" J- #include <mach/memory.h>; \8 W2 \7 q3 a: f( t( B" s N
- #include <mach/hardware.h>( O8 @" |9 R. M$ C& L
- #include <mach/irqs.h>1 ]0 |; C( v/ B l, S3 Y- b/ c& W
- #include <asm/hardware/edma.h>8 u8 u9 S3 r6 k o6 E: i, m
- - k6 g3 {( | r0 H9 D+ c ]3 |3 a
- #undef EDMA3_DEBUG
9 M1 p4 o1 D* C9 S - /*#define EDMA3_DEBUG*/" n; n# C7 D% _3 o+ w: M
& X" m2 Q& n# }- `4 B- #ifdef EDMA3_DEBUG3 @! M% h5 [4 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 X- h3 M6 P& e+ v* M$ t! k - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); y$ H. v! d# C
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); ^1 a. j, d' X7 o7 l
- #else: Y- d! E6 ~0 E+ ]
- #define DMA_PRINTK( x... )4 |* u" r3 j( K& \% H$ h; v/ x
- #define DMA_FN_IN8 P1 `2 j, d. D- X% E/ t
- #define DMA_FN_OUT
% V3 x, l2 O i - #endif0 f% v9 M8 x, q" g& R
t# p/ o6 B6 S7 P1 D6 b* p0 H5 P- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 W6 M, Q1 e3 l. d
- #define STATIC_SHIFT 3 v2 _; t9 z8 G2 i& Y) \6 Y* k. s
- #define TCINTEN_SHIFT 20) p& U/ d. Y& E/ K& G0 v
- #define ITCINTEN_SHIFT 21
# i" c' u( S. {1 ~# e, | - #define TCCHEN_SHIFT 22
$ i! c. [9 v% l8 q2 q# r$ U - #define ITCCHEN_SHIFT 23
w2 f" i$ |- S3 k
; E% y" U0 y+ y! G0 B1 V- static volatile int irqraised1 = 0;' Y$ }8 W& `% M$ v) }# c$ {9 I& ^1 G
- static volatile int irqraised2 = 0;
( X# I! v1 B( D2 N - : S. c" ? z# k( C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 e6 p' h3 }$ h5 Z3 o8 O6 z3 c - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ?' P z+ [) v' }) x# e0 N3 b% Y
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ O2 U! g& Y! A1 r; c( b
! d1 p e3 A* l2 m3 |0 D- dma_addr_t dmaphyssrc1 = 0;2 }/ s5 A- J1 Y, c
- dma_addr_t dmaphyssrc2 = 0;
+ X, ?& f% W" y - dma_addr_t dmaphysdest1 = 0;- R8 k6 A) @5 W# G0 P8 n
- dma_addr_t dmaphysdest2 = 0;
6 u: Q; F1 N! g( D. P
* l3 V2 B f7 B5 k: ~ A8 g- char *dmabufsrc1 = NULL;) M$ u& K2 x' n% L4 h
- char *dmabufsrc2 = NULL;2 u6 x3 H: \+ a: w2 {' y
- char *dmabufdest1 = NULL;& `1 w$ X3 G8 ~ h# k( P5 K
- char *dmabufdest2 = NULL;
5 u( Y0 d$ e( |8 w8 e9 S$ r! f; o - 2 ] @$ ^/ G9 {6 q( K
- static int acnt = 512; z; T% u N- A: j6 y! Q+ _
- static int bcnt = 8;4 a; q0 M. |/ Z# m9 D
- static int ccnt = 8;
" V, E. ?1 O! V* x; J9 E( L9 [ g- Y - 0 X0 S% k5 G# n% ^2 e
- module_param(acnt, int, S_IRUGO);/ \ K& g& l: T" @
- module_param(bcnt, int, S_IRUGO);8 R0 y: [+ B$ T$ A' U B
- module_param(ccnt, int, S_IRUGO);
复制代码
" g B m9 }4 K; Z& q5 {
, b$ E- q4 l; T. M4 y. C 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ F. e T; H! }) R( g0 xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Q* o" j3 [( w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! O8 G/ ?) k& j4 O$ L
7 Q z* E' ]0 b9 ?( w8 N
, y" v- k( c: T' @) L
|
|