|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 s c* Q- Y# M% H+ W2 G
- [code]EDMA sample test application3 ^; l" L! G! O* b0 ]
- /*
6 C, |) R- x' R' u9 Z: R5 E - * edma_test.c
/ G9 ]1 U5 i* x" ? - *+ s! T b& l' z) ]- A( u3 w$ g
- * brief EDMA3 Test Application
0 y" i! J6 b" R- h7 A - *1 {9 H/ [6 U: X' J t! J
- * This file contains EDMA3 Test code.
: o5 L) g/ @0 c! A/ G$ h9 w - *" f7 T7 h7 \ i" f7 O+ P
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ i7 ^! K, s% |6 P
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 l% C( j& Q* w1 F& ], v& i
- * TO CHANGE. K2 o* h9 x! C. S' d# [6 X/ m& R
- *3 n- w& x; t0 a
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 B3 X: P& Y3 J. R% @, B4 _
- *
2 B0 L$ y3 B) T. c - * This program is free software; you can redistribute it and/or
1 V0 c# D3 z) z% i0 D - * modify it under the terms of the GNU General Public License as
0 W5 t- A* a$ H6 r- X - * published by the Free Software Foundation version 2.
! |% R9 I4 M, ]1 W - *! j! B4 }+ K) j5 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( J$ Z, q9 b/ @! y - * kind, whether express or implied; without even the implied warranty
+ [2 s2 @+ k+ d5 i. G" k: w: U' ` - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 w$ d: R9 a0 O0 H. i( E& } - * GNU General Public License for more details.! |0 j6 i4 k, w5 L8 u2 y: n# u: m
- */3 q7 Q" M% s' C2 e0 i( ]9 u6 z9 ~
- ( L' _7 J0 u' ~2 D& p% \5 V* C( [/ I
- #include <linux/module.h>1 z0 [# n9 e! r* d, X
- #include <linux/init.h>+ a9 f) \: z6 P H
- #include <linux/errno.h>
6 w0 C6 D+ ]1 v8 T* p( G - #include <linux/types.h>
1 m, D+ x; q; s: r6 B2 _$ _ - #include <linux/interrupt.h>
w2 ~, U: j& z9 A+ p - #include <asm/io.h>: N! ]4 A6 ?: n. L8 _
- #include <linux/moduleparam.h>
& R+ H7 p& N9 x9 x& \/ _+ W6 e7 M - #include <linux/sysctl.h>
: P1 r7 A3 S) S1 j7 S' _ - #include <linux/mm.h>& X* o- k7 s, y
- #include <linux/dma-mapping.h>: }2 N; a: R3 ]- v' b. Z/ c* n+ E& T
/ k6 e% R7 r1 M! F- #include <mach/memory.h>) f! w' ]& Z' Y- T$ N) V
- #include <mach/hardware.h>
* l3 k9 H- a% k5 g - #include <mach/irqs.h>
. c2 Q5 y! g; ]( R" }; H0 @4 z - #include <asm/hardware/edma.h>
" Z7 ? ]2 N, K' I* o - 4 \4 B; }1 I% @4 q: J1 [
- #undef EDMA3_DEBUG
: Q, X" d8 r" i% Y3 D. _6 y - /*#define EDMA3_DEBUG*/& } Y2 [* _% {1 V# ^
- J7 j! {* l" J7 t- #ifdef EDMA3_DEBUG: w$ U H( t( s' W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r7 l1 ?9 H9 q t4 d, u9 i
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 R8 {( E; H9 j& [0 j - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
6 H8 G) V7 o% y - #else7 `0 C) Y% q1 q
- #define DMA_PRINTK( x... )
0 R1 p6 T I8 y# c$ W5 M, p$ Z - #define DMA_FN_IN
- f l0 s; F6 R. n - #define DMA_FN_OUT5 e1 `: Y$ l1 e2 z; X% }
- #endif4 v( ?* B: l* V: \% h
( o" I# Y: t3 {1 N( @' |/ F+ t- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% N& Q) v& k) I$ O: Y0 P% p' a3 c - #define STATIC_SHIFT 31 e- _; V$ j7 A- ]
- #define TCINTEN_SHIFT 20
6 c3 F3 f" `( [; }# N l9 f1 x6 e/ ]7 @ - #define ITCINTEN_SHIFT 21- u+ q6 ~( W! n B& Y, P- J6 t1 T
- #define TCCHEN_SHIFT 22
3 a6 j& c; F ?# c2 y1 {. x - #define ITCCHEN_SHIFT 23
/ o; V( S8 B4 R/ ^
0 Y6 C7 D9 T: k6 H' p- static volatile int irqraised1 = 0;3 ?' a9 ^6 D; ^) v: J: o) W
- static volatile int irqraised2 = 0;" d9 k3 D( F6 S( O# K
, z: |, v5 m& k C+ K5 W; G0 Q# ^- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a# B" d' H9 ~1 m9 j7 |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 j. ]- c H: Q8 x* \
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K$ |8 M7 l6 e+ ]$ h5 U& i
/ @9 i% @) f, ]- g4 p' P- dma_addr_t dmaphyssrc1 = 0;( q" [# M) ?6 ?( o
- dma_addr_t dmaphyssrc2 = 0;
% y! O4 \8 Q2 N* |* ]; Q+ u - dma_addr_t dmaphysdest1 = 0;
( i* i. k# \( K9 J H - dma_addr_t dmaphysdest2 = 0;
/ p5 o5 A( s9 |: U: V
. v/ u# c* S A, s/ r- char *dmabufsrc1 = NULL;* Q" o& O. ^$ m
- char *dmabufsrc2 = NULL;* ]0 j' r& ^6 @6 Z) J. ^# Q
- char *dmabufdest1 = NULL;1 [# b7 x) h! c5 d7 c4 q
- char *dmabufdest2 = NULL;
4 ^4 |/ F; V# X) e/ T9 Y - ' p" J; }$ x E7 o; h
- static int acnt = 512;
( b1 u# F h5 R3 s, L7 d4 _ - static int bcnt = 8;
' o8 {- p# o* B \; d$ ~ - static int ccnt = 8;
$ j L8 I) h5 I% e' b% P, E
, Z) J, s \0 Y- module_param(acnt, int, S_IRUGO);
) A, I6 u# g9 [- b8 m( U - module_param(bcnt, int, S_IRUGO);3 _& t- \, @- X1 m/ H
- module_param(ccnt, int, S_IRUGO);
复制代码 - C4 ^" G3 ^; c6 d4 N9 Z# x7 p
: ]: p& L- d% z% q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! _2 d! \5 K$ N
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: }2 @; V, U) s! c, J7 H/ i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# k' Z z" d" E' |2 [3 D- _
8 ^: Z; \2 r1 Q/ m5 f& U7 ]
; R0 u6 E( C8 f) s) f! j+ ] |
|