|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
v3 `9 n. u# s/ Z- [code]EDMA sample test application* {# o: l8 E$ t, A1 w/ B
- /*8 H8 o: k- i0 |# K7 ]5 k
- * edma_test.c
% N1 K+ z5 Y/ T6 ]6 |+ u3 A - *
3 M3 b7 d' P3 K9 g1 w - * brief EDMA3 Test Application; J- p/ P2 b& N/ b' A6 R `
- *
9 N7 ~) c y! @. Q; [ - * This file contains EDMA3 Test code.
1 m- l" X8 {4 _. h* o9 P" o& ~ - *
( t+ A6 M9 k4 `% u7 D - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 F) w: j+ M4 T1 p, [) b4 d - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: L' i. E, w3 O5 m3 U2 B$ O9 L1 q
- * TO CHANGE.
5 g Q* v. j l0 w) G1 b0 k/ t - *
8 s8 @' ?9 p; ?" }1 O9 G - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 T6 Z/ O) {* k* f7 P3 Y( u
- *
i+ J" n4 E6 B6 U$ y F+ H - * This program is free software; you can redistribute it and/or7 Z5 q2 a2 }9 p& P
- * modify it under the terms of the GNU General Public License as) `" W O1 _, ?/ j# ?
- * published by the Free Software Foundation version 2.5 ]( c5 q' R$ B# ~# {* c$ }
- *! U- m# p$ S3 H8 W4 X' ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ^) O: L4 i; i" r
- * kind, whether express or implied; without even the implied warranty
3 |! R! ?7 I/ T$ X2 _4 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& q) W( S! t; s8 D! i - * GNU General Public License for more details.
0 P7 a: O& j* k - */
3 x3 ^6 B9 w8 q0 k' q - * d- W9 {$ j: I( q( {
- #include <linux/module.h>
# {# a N, f: j- \! R - #include <linux/init.h>. Q. X$ S' B! |# L' J g4 b
- #include <linux/errno.h>
6 Q7 ~. W' l f3 T& _ - #include <linux/types.h>1 B4 a2 N# q/ _( K+ P k- }. _
- #include <linux/interrupt.h>
% t2 { R* S; D1 S- M* A$ ~2 _# @5 I - #include <asm/io.h>) B0 P# I$ ]+ e4 r5 r+ V
- #include <linux/moduleparam.h>
" b/ ], _2 r6 b4 |. ~7 h - #include <linux/sysctl.h>' i# }) q/ B5 M) O
- #include <linux/mm.h>0 a5 L4 j0 a6 w2 |
- #include <linux/dma-mapping.h>4 B2 y) i! R- n: Y% j" v
: k. w- b' B7 w- #include <mach/memory.h>
; T R) \7 M5 k. z( t" ?# E - #include <mach/hardware.h>
$ d: b7 D C+ h4 F" |* z - #include <mach/irqs.h>3 v! A' c/ u9 T" l8 ^% s9 ~$ _
- #include <asm/hardware/edma.h>5 U e) p* N6 M# M! `
- - C4 X; Q; N, E& J& A, i
- #undef EDMA3_DEBUG
+ O+ \4 E1 {3 O* v& [& B - /*#define EDMA3_DEBUG*/6 b9 q4 Y% {& d4 F% D {
- ; l0 f* D% @- W/ y7 R
- #ifdef EDMA3_DEBUG
! @5 v8 }6 Z* M - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
: b. X& W* U" Q5 R% @- d6 `/ r - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 Z; q6 u. Z _# y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
; u! ^- ]+ W2 M# d$ P - #else& Q5 U, S# I- O" l2 f7 S
- #define DMA_PRINTK( x... )
y5 }) D% U* A - #define DMA_FN_IN
" V6 ]) ]/ e& d" o2 Q - #define DMA_FN_OUT& W4 q( b, Z& n( Z$ t
- #endif
1 @0 v9 p9 W" s# D - 3 \5 T' i6 t5 P4 m
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) l3 z# F5 L& E. M/ U/ F
- #define STATIC_SHIFT 3$ a3 g/ |$ [2 m: t5 r: W1 l% q5 W
- #define TCINTEN_SHIFT 20
- o9 l* B' V9 w0 D" _# a- i4 L q. I - #define ITCINTEN_SHIFT 21# \$ T0 Z1 N9 |
- #define TCCHEN_SHIFT 22
V) |$ f, J; h8 q - #define ITCCHEN_SHIFT 23, N2 Q! e2 B0 Y9 H5 U! y& K
- 0 w1 l* f, S, [2 Z, n! G
- static volatile int irqraised1 = 0;
# `2 D" l, w2 {2 e% Z {( j - static volatile int irqraised2 = 0;
7 S" o' S: u* B* S6 ]. ~ - 6 F0 R2 x3 U6 _* N0 s1 O% E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ b. ~* r6 J! `) R# f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& j- P! P. I' \" c. Q% j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 i; n8 x; r3 r9 q5 {8 o+ `1 } t
& f- d# |' g5 b) v3 O- dma_addr_t dmaphyssrc1 = 0;9 E- z& F2 Z6 J) x9 K$ O# M
- dma_addr_t dmaphyssrc2 = 0;! z' g* g- M+ j0 h7 n/ O
- dma_addr_t dmaphysdest1 = 0;
: s3 A/ ~, a M) ^, [ - dma_addr_t dmaphysdest2 = 0;
8 Q( t3 n8 }, V) X2 S - 9 T1 j! e8 K( k
- char *dmabufsrc1 = NULL;
( b* f5 V4 ?# U# \) C - char *dmabufsrc2 = NULL;
5 `/ z4 h. [2 F5 a" I& R( q8 O - char *dmabufdest1 = NULL;5 u( e, P& S* i3 R& f- P- l
- char *dmabufdest2 = NULL;" s& J3 b( x1 M7 C2 o4 }& l+ V" x
- ' Z& V' m# v* l5 H/ n9 v/ ?+ q, X
- static int acnt = 512;
! v, ]6 D( k8 _6 j6 d# r: K5 l$ z6 F) V - static int bcnt = 8;
( l' u% P3 p3 a9 r - static int ccnt = 8;& ^% V+ b$ L Z
- ~- m0 p; l1 y' L- module_param(acnt, int, S_IRUGO);) J/ f: P2 x: N6 n( ]5 `2 Y
- module_param(bcnt, int, S_IRUGO);( Y; s- E( k" h3 P) ~/ {( {
- module_param(ccnt, int, S_IRUGO);
复制代码
" J8 C* J% b6 b0 N" @% A& c" C; w- }- c- t
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" V% T# r5 K( } oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。 S% t3 ^! G8 r" I1 g8 |, ?9 a$ [
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 B( D/ d' ]# ^; J) l' V9 E: n5 V! g8 g3 `6 r$ t* b
' S' T& l( A* ` |
|