|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % y- E/ c; X( i; l; Q" @, T; c
- [code]EDMA sample test application
! m+ P7 D+ T) P0 M+ F - /*
3 M1 Q f& ]- }' }# _4 k - * edma_test.c) X, h: o' B5 ^( S3 b/ b
- *" ~$ V% E( p" f& B7 D* T
- * brief EDMA3 Test Application$ m# ?! O0 w& ?9 G
- *
2 J0 `8 S Q. v( n1 j4 X - * This file contains EDMA3 Test code./ D& B- W& D( f& c) D8 h6 x( e
- *
8 b0 _: S1 y% E5 L- r5 X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& g# V- p' Y( f& q, y% }
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# @, K& K6 \0 F8 D# Y/ @$ J - * TO CHANGE.0 Q" k! Z* `( U& N3 M/ h0 |
- *
. G/ r- `% s# Y* v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 u4 y5 L: v8 m% {3 w
- *% l# D$ _& c' F
- * This program is free software; you can redistribute it and/or
- s O1 K1 Z# Q* Y4 p& U - * modify it under the terms of the GNU General Public License as/ y/ p0 p/ B6 E/ F2 y
- * published by the Free Software Foundation version 2.2 ^* S8 ~2 e6 d2 K5 s. y0 Z7 H1 K0 X
- *
5 Z- N' K) c, j$ m5 w - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
* _5 s+ w5 d' V5 L - * kind, whether express or implied; without even the implied warranty
- N- K/ |. B" G - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
D J4 h' D& X4 F - * GNU General Public License for more details.
$ g+ `9 D9 Z. t- N) D7 e - */
- D2 [9 u, c/ ^- a8 L; Q
2 }# t8 U# ^# C/ z/ ~- #include <linux/module.h>0 p" V8 H& q# x: x8 x% t
- #include <linux/init.h>1 `- Z. E+ f$ C) R: j
- #include <linux/errno.h>
; a3 G; I% @* y7 R - #include <linux/types.h>. M, G9 P4 ~4 a7 u j- O |) |0 S
- #include <linux/interrupt.h>) y% Q* G7 e( M/ @3 N! m# i
- #include <asm/io.h>
5 g" W8 ?, ?& x! x/ Z0 A; |, B W - #include <linux/moduleparam.h>" L" P% z- |: v5 ?" v
- #include <linux/sysctl.h>6 _ i, n. E" j# M4 E$ S
- #include <linux/mm.h>5 Q9 p3 S2 Q- ?
- #include <linux/dma-mapping.h># M; C# B* E2 ]- Q! s$ r5 U; N, \
- + b: m7 C6 K" N- ]
- #include <mach/memory.h>
2 B, M' o6 K* Q6 B7 U3 d# ^6 w - #include <mach/hardware.h>6 t& r0 o0 j0 r8 Y4 s N% R( W
- #include <mach/irqs.h>5 G7 ~' |) F; f/ C4 G" h
- #include <asm/hardware/edma.h>
* G# ~5 u( i2 o- ?
; E/ J3 U" K& n0 C8 P" X- #undef EDMA3_DEBUG
% r1 |* j0 u; g: ? - /*#define EDMA3_DEBUG*/, T. _+ T3 U) c
- 7 g" P5 j: P, H- K
- #ifdef EDMA3_DEBUG
; D( @( ^' L, k; Y8 ? s+ o5 e; q+ o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% }4 r6 X2 g+ v( i0 e7 d! M* t - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ D9 Y/ c3 J3 o - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% ^. U* D( x3 c& S! a0 v - #else
8 \: K5 d; S. V+ a1 c4 s4 x$ m$ N& W. P - #define DMA_PRINTK( x... ); x, d: b/ E$ n9 D
- #define DMA_FN_IN$ v& R: z! D. k+ q
- #define DMA_FN_OUT3 D: l/ l0 X5 |. x w
- #endif/ M9 }: Y. R- F, l
/ z2 @& F7 A+ u9 w) N8 k+ Z U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. j4 Z8 R+ n- T) H - #define STATIC_SHIFT 3
" Q3 v. e- m; h9 p. }, r3 } - #define TCINTEN_SHIFT 20/ v6 s" t h* S E% s" D
- #define ITCINTEN_SHIFT 21$ V* `7 w: H x6 |1 S. Q4 b6 R& u
- #define TCCHEN_SHIFT 22
# O }$ t# Y" m* n# v! K - #define ITCCHEN_SHIFT 23
+ e3 o6 a) n2 _ x8 |& Y9 X. I - . W6 j, p9 d. s
- static volatile int irqraised1 = 0;
/ C7 ` |# t( R1 v" W - static volatile int irqraised2 = 0;
& [5 r5 [6 Z/ \+ U2 |
3 b: z" R& O6 X4 S9 ]$ ~' F2 ~- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( h+ D. [. [: g! ~
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- q* t+ n5 x% m" y) e- L; o; Q% v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ^0 D) k. R, U% S4 R i. `
- ; n: U9 J! [2 d! x I/ _, }3 p; x
- dma_addr_t dmaphyssrc1 = 0;" ]* i) @/ g: L) t: S) R
- dma_addr_t dmaphyssrc2 = 0;* T" _3 b8 p/ y$ @
- dma_addr_t dmaphysdest1 = 0;( s/ f: j% U& e! R: w
- dma_addr_t dmaphysdest2 = 0;
, `* ~$ P, }, E) X: H/ _# }$ r+ @ - % y W2 A" t# N( s% e) z) k# g& |
- char *dmabufsrc1 = NULL;: D d# W7 @1 ? L: J) F# k
- char *dmabufsrc2 = NULL;+ T4 ?2 z4 Y, r5 U4 l7 ~
- char *dmabufdest1 = NULL;- s; `+ o, j8 J- b% S0 g
- char *dmabufdest2 = NULL;
' Z7 P$ G! _( }" A2 q& b/ Q* b( a - / E6 I; f( G2 s0 f3 W
- static int acnt = 512;
1 C8 w: g Q) b( w) S7 ~* M" ~ - static int bcnt = 8;% t8 m% [' X- `& _
- static int ccnt = 8;
+ X# K3 \& L7 }. M4 O
8 t5 {+ \- H8 n7 H5 p0 a7 n- module_param(acnt, int, S_IRUGO);
: [7 l" i9 g/ U$ F- a% A- U - module_param(bcnt, int, S_IRUGO);& o% O% i5 G) U1 O, N8 v# ~0 o
- module_param(ccnt, int, S_IRUGO);
复制代码 0 S5 w: d& ~8 o$ \3 A7 }: o
0 m+ t, N) X0 b; v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) i! \* ]! `% Z/ X L! uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 u2 ]0 E& t3 }& I' k. C' j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Y4 p! M, b. v, |: X( G4 ]9 w( |0 A. C I) \
1 v. K. C6 D- p/ t+ {! h |
|