|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 _# v# `: v) h8 z6 x) `# N7 W
- [code]EDMA sample test application
2 D0 z1 ~: ?: R' R5 z" x: O6 a2 N( l - /*
& z9 d1 v1 N& {$ b3 w( h - * edma_test.c" E5 p! H- i c# h5 B9 J
- *( X2 O q. L" G7 V
- * brief EDMA3 Test Application
* z5 [9 q p4 O2 c' T - *0 O$ S. R: o, u+ ^2 i
- * This file contains EDMA3 Test code.
: |/ q: ?* ~- z$ M4 S& F: A - *
* `. K' Z- p5 Z4 _. a7 F3 F+ V - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 u" Z! K5 M- w4 c) \1 C2 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
; i x8 f$ k7 X: v - * TO CHANGE.4 U6 Q2 i% \0 u
- *
' Q9 J- w1 C, x5 F; }! i - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 ]" [; L5 Y! Z. ~4 h5 K% I/ J
- *& b1 W- c' l' r
- * This program is free software; you can redistribute it and/or" f; h4 {; ]8 H }! {9 V4 p' u8 R
- * modify it under the terms of the GNU General Public License as
* S" V* e z0 o% w# C) W; u - * published by the Free Software Foundation version 2.
+ w! H+ Y2 ^; F9 f7 T0 h6 ^; `" M - */ [& ^& `2 R" T( c6 }
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. V! ~, U2 B- s7 F# s - * kind, whether express or implied; without even the implied warranty
- E! f) f- o* d) W3 U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 u6 @2 F2 t4 j/ b+ X. v& n0 q - * GNU General Public License for more details.2 P7 Z1 S% b% V/ @
- */
3 @, A' ]) a, y8 u" ?! ] - , O0 V2 \: c6 \* g' x# z3 ] \) s f
- #include <linux/module.h># b- `/ Q' Z, c9 T
- #include <linux/init.h>
$ Q& A1 K P t5 }1 Z3 U/ U - #include <linux/errno.h>
# B2 f1 L' `# \2 s2 Q5 @ - #include <linux/types.h> ~1 @ U& h# G, O" \, y; e$ u
- #include <linux/interrupt.h>3 k# [) H! q, c/ H
- #include <asm/io.h>
" s- K8 _1 E. u) v& D' H0 h - #include <linux/moduleparam.h>& K6 S* L+ I' }+ D! ?7 [3 f
- #include <linux/sysctl.h>
& E9 f( g0 a$ ^' ~2 o$ S - #include <linux/mm.h>1 h/ O; C' U" {
- #include <linux/dma-mapping.h>4 u$ j2 ~1 ?8 f- n
- ~; g' V) k: @0 t) h6 z3 W
- #include <mach/memory.h>
* r; P. p5 a$ ^1 |: a+ q, a# n0 e1 k - #include <mach/hardware.h>: ^& I# ^& E* N
- #include <mach/irqs.h>
# h. L2 ^- ~. i# X0 \5 B' V. ~! k - #include <asm/hardware/edma.h>
7 B; ^( s! n3 D1 F0 a
' K1 e" r; {; t3 r4 h% N0 K9 @- #undef EDMA3_DEBUG' _0 O$ }6 q( d% R/ j" r
- /*#define EDMA3_DEBUG*/" @. O7 Y k7 y% x9 E4 N
- M8 ]" Y3 p; v1 a }
- #ifdef EDMA3_DEBUG+ U. V: B* ?, M4 f2 P' Z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" D) H) b& @ j' y5 V6 d" t U- m* f - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
{1 D( A6 \: R- O$ i& s$ w" X - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 y6 y1 ?. l; J5 L3 V - #else) `3 [1 g6 l! [1 [9 Z
- #define DMA_PRINTK( x... )
- Z9 r6 Q4 J0 L2 q; F5 R1 [ - #define DMA_FN_IN
/ D. c6 D* b7 P4 G. b6 C) W8 R - #define DMA_FN_OUT! \ B$ C: f% d
- #endif7 s' S, x! M$ a5 D$ a3 e# X
& o) Z# M" y u* x8 T3 N; {- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 O; |! O) I; ^; H4 e" U
- #define STATIC_SHIFT 3
3 _" a7 n: E1 t - #define TCINTEN_SHIFT 20% D% e$ b- |2 @: h9 b: j/ I6 n
- #define ITCINTEN_SHIFT 215 n( H8 W7 W& O5 d
- #define TCCHEN_SHIFT 22
$ A9 c0 t& p# o/ w1 o - #define ITCCHEN_SHIFT 23- U( X) Y' |; [4 j3 h8 ?3 D
2 e J. b, H$ E. e- static volatile int irqraised1 = 0;% @: o, o% D- m4 g
- static volatile int irqraised2 = 0;
E+ `+ L$ H& O( P9 u* L
" S# n7 r$ L. }) D- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ H2 Y& \, Y# u' r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q" ]1 c( i# N
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i* s% C3 f+ V( [" c
1 `% X0 y7 i+ S& f4 r/ y- dma_addr_t dmaphyssrc1 = 0;% g( g( M4 X8 I5 y
- dma_addr_t dmaphyssrc2 = 0;
. l5 c! n: o% W1 H8 [: v8 Z - dma_addr_t dmaphysdest1 = 0; t! {2 I' G; T. W& }4 d/ o, \% [, P! `# D
- dma_addr_t dmaphysdest2 = 0;
8 O& n f& j! F
5 d I6 ?; J# v9 h% _) ^! Z' q- char *dmabufsrc1 = NULL;
' [' x R: P/ p, ]. k' i7 B - char *dmabufsrc2 = NULL;1 ]6 X1 s/ u" O
- char *dmabufdest1 = NULL;1 U" ^+ B7 k: i& d0 r, U+ S
- char *dmabufdest2 = NULL;( e* q: \' S7 D) \% t
6 e, Q0 @3 B' f1 ?, Q5 Y) X- static int acnt = 512;
+ f0 ~: Q/ Q1 S - static int bcnt = 8;% J; ^8 k9 @/ n1 H0 \0 i& W+ h
- static int ccnt = 8;+ Z2 H- v3 _8 {& k5 [5 c# b. k
- , r) z' _" j. N# z2 p- Z/ R# B' N
- module_param(acnt, int, S_IRUGO);3 G" j5 {6 u; F |. o
- module_param(bcnt, int, S_IRUGO);
1 F" W: A5 H0 D, G3 L: U( Y - module_param(ccnt, int, S_IRUGO);
复制代码
& k9 d2 s% V) @) R& m* }: I) u2 @$ n4 R& E1 `5 g" c
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, \* {: { r3 e) X3 H. z, L2 a/ rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: v- F) L9 w1 P/ V A" _$ k 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& {: W% x3 F: y/ X7 q4 [9 I/ s/ O! B. J! j
$ i6 l. M1 ] t4 l/ [ |
|