|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' i, D, R3 L) x4 J- K; a
- [code]EDMA sample test application8 R* Z& B2 g/ ~' m7 p: B
- /** ^/ V/ [/ ~& o) v. e0 a
- * edma_test.c: L- ^1 N, D- u
- *" `; W* }' W+ }) b. l% B
- * brief EDMA3 Test Application9 u8 @2 I- Y9 @3 s
- *
8 L2 X; \# @; w( o5 W - * This file contains EDMA3 Test code.
& {/ \! q: d7 T. J2 U( h$ ^ - *! p& Y3 R- U( m r+ j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, q Y0 v' I/ U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ j' C. F9 ^2 i9 k ?* D
- * TO CHANGE.
; g+ ]7 K% Y& Y9 j - *# f: l5 `2 j; B6 ]' F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v9 W- x# A) j: y/ \* n
- *
3 L( u5 F0 k+ t1 N% c$ _ - * This program is free software; you can redistribute it and/or
5 L' b' |0 U# d0 M( y - * modify it under the terms of the GNU General Public License as
+ p, Q' _: _8 f0 ` - * published by the Free Software Foundation version 2.
: {$ L+ b$ x; Q - */ z5 n* e1 m8 ?$ r& z6 k( v3 G1 i
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any k& ?: F/ O. @) I' t! x
- * kind, whether express or implied; without even the implied warranty" i+ V0 d) {& M! [
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the$ N9 o3 R9 P" ]* p4 Z, l1 i
- * GNU General Public License for more details.
; j, H F! p, {( @ - */6 `, P5 y/ u9 H/ a& E- L6 U
- ) s7 k3 g8 I, j5 ]8 I9 \5 L
- #include <linux/module.h>. H7 \$ @3 l0 o$ N4 F# i# ?
- #include <linux/init.h>+ L: g# c6 l/ y5 ]: o6 o& N& L8 b
- #include <linux/errno.h>/ ^6 x/ e& W9 e3 r
- #include <linux/types.h>
0 F) ?$ z6 E$ I* i! L4 l! ?$ h$ p. h - #include <linux/interrupt.h>
( d% x! w% ]8 N0 [# o2 r - #include <asm/io.h>
0 w9 m1 j8 K: T- { - #include <linux/moduleparam.h>9 m0 ]. t8 t/ D* ` p8 d) X: e+ } j
- #include <linux/sysctl.h>' g7 y0 |: u& W7 \
- #include <linux/mm.h>, x' g! N* s& s7 {
- #include <linux/dma-mapping.h>. C; M8 D v( X5 a: I9 j- L0 w- J
- 6 Y" K4 A) A: B- F- h4 e
- #include <mach/memory.h>9 m q1 N* ]8 F1 j( Q# U
- #include <mach/hardware.h>
) m% j0 K2 t% _8 p! `4 { - #include <mach/irqs.h>- @' r4 g1 V% j8 m. U; m
- #include <asm/hardware/edma.h>
8 {7 r; a- R6 D! Q: }" E
2 \7 a; `, u' U; G( n* H- #undef EDMA3_DEBUG
+ ? w7 w0 s. W/ n, C% k8 B - /*#define EDMA3_DEBUG*/
' f$ f4 ~4 W3 W2 h: u+ z$ S F
4 {6 j+ J- G+ m" }2 X/ q: }+ W3 C- #ifdef EDMA3_DEBUG
% v% V+ R& G. Z: V - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) _- |) e# N, `% o+ n4 m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 E4 j" u1 z2 I - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): l e# {, R) s; w
- #else
2 j8 \$ k1 v& Y) h5 L: Z0 @ - #define DMA_PRINTK( x... )- `! L8 N+ I0 t' i9 v5 r
- #define DMA_FN_IN4 t8 r# R9 R( ~0 Z$ e
- #define DMA_FN_OUT
/ v6 g/ x8 T$ | - #endif) r# M# S7 j5 p8 o1 z! y2 y
* Z* V8 i9 c0 C# x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 i3 z1 L( B2 R9 S5 E - #define STATIC_SHIFT 36 _9 z' ~; ^1 u$ s0 d5 V
- #define TCINTEN_SHIFT 20, z) s8 r6 H8 U( ?
- #define ITCINTEN_SHIFT 21
& z1 D. l; e# ^ - #define TCCHEN_SHIFT 22
) u0 f* r# Q r3 Q. _' m/ g0 S- {( P - #define ITCCHEN_SHIFT 23, y! U3 B6 q$ I; {: P( D3 F; s m( V- V
- 7 O2 f: M& G% I9 `8 f
- static volatile int irqraised1 = 0;0 m7 a2 M* ?# k; f& F
- static volatile int irqraised2 = 0;
$ u# d3 E0 c+ D - 7 ~/ C+ e+ g- u: b+ ^
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 ]8 c* Z! [8 e6 S5 z r - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# f8 @% T* i% A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E4 i8 c9 j! j$ q
$ E# p7 [- D% A8 V+ l R6 A2 w. m- dma_addr_t dmaphyssrc1 = 0;# e- W+ \& r' N6 E
- dma_addr_t dmaphyssrc2 = 0;8 L: {6 K9 k6 E
- dma_addr_t dmaphysdest1 = 0;. f" {( E- V5 N/ T) E: y
- dma_addr_t dmaphysdest2 = 0;; a9 U2 e Y8 n5 `
- # ` U+ j, A7 X9 M4 H5 w
- char *dmabufsrc1 = NULL;
" y7 |: A; v# D* Z% N/ u& [& i - char *dmabufsrc2 = NULL;2 \$ N s }% C- a' N
- char *dmabufdest1 = NULL;
" p* ^0 o3 P( ^8 V6 I - char *dmabufdest2 = NULL;1 U& L% ?* F7 L% |! P8 B) ^
- ) u' l- y. T5 R( g) F" i
- static int acnt = 512;7 p/ ~2 D8 f1 }+ \- h$ |
- static int bcnt = 8;1 c# E/ ?2 @) g! M9 e7 r5 R9 r
- static int ccnt = 8;
P) T2 _% d* w1 c8 A
J# ]" S# h& J( c6 ]; n- module_param(acnt, int, S_IRUGO);$ H, X2 i g: r
- module_param(bcnt, int, S_IRUGO);
$ s: q# t2 O: ]( x0 j) c - module_param(ccnt, int, S_IRUGO);
复制代码 : _/ z0 A, G' @' s: p6 L
6 n0 [0 I, t$ i- ^- M! ~ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 R1 q5 Z8 Q- T7 O' C: q/ l' Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# A% ], n) E/ E4 w/ X& E9 D( S* K
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ f, e) z- S8 u
1 ?( z5 l- G s; n1 l7 _4 u/ [2 o9 B
|
|