|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 o7 j: L9 ]" u: h% D
- [code]EDMA sample test application
( \2 V! x8 N3 ]) B2 a: M. N" Z3 ?+ e - /*
' T6 Q# U7 I7 ^8 G* i7 q: `6 R - * edma_test.c9 {' c1 T& u; J8 B2 U ^
- *
( P, q0 ~; V# t$ ~1 ^ - * brief EDMA3 Test Application+ E% w( @! n2 Q7 ?# i9 U" H( d
- *
# F4 z- I! t" {$ g1 @ - * This file contains EDMA3 Test code.
/ V* g, X7 K4 k' } L$ p E - *
9 F; F; |2 b, l - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( ~9 ^; M! s# x" b - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# {. t, w% Q6 _9 U
- * TO CHANGE.
$ T( x* ?5 v- d4 |' d - *0 K$ _) w- r: T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
) l$ F4 b) m' F b( Z& l - *
- g! A$ o2 r: e# I- l+ M8 k6 O - * This program is free software; you can redistribute it and/or# M( k9 p$ e4 r2 l& h
- * modify it under the terms of the GNU General Public License as% L' L' M, N: _7 w m: p% A
- * published by the Free Software Foundation version 2.% q; E* |% l* J$ m, i
- *
! R& F: J, U# Y1 z - * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 r: }5 H/ L9 |2 ^- \+ K2 z
- * kind, whether express or implied; without even the implied warranty& @. g( v; x* H. H) N; J& \
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) A+ \5 {2 {/ I( j! g& r9 n
- * GNU General Public License for more details.
& `6 G9 h9 S3 M4 q - */. n3 _4 i$ l" g9 r4 e
- $ g) {: Q% K+ K5 t& Q5 }/ R. `
- #include <linux/module.h>/ S/ U( \ h/ }6 y. {, a8 q: y: E" ]. L0 t
- #include <linux/init.h>
2 R; W. ~' A$ K/ D% q0 y - #include <linux/errno.h>. t8 L1 I a/ z; o
- #include <linux/types.h>/ C: v6 Q4 ?, i4 d; `' k5 B
- #include <linux/interrupt.h>
- B' p9 _+ [8 v0 x/ p - #include <asm/io.h>* k! D$ t, K, G7 L
- #include <linux/moduleparam.h>* y" M/ R' k9 v; x; K
- #include <linux/sysctl.h>( P- x0 p1 ~. y
- #include <linux/mm.h>
. l! h7 K- b- ?, k# w - #include <linux/dma-mapping.h>
! K) N5 x3 K# K0 D u
# g1 R; h& U7 ]0 b: z- l- #include <mach/memory.h>8 R( ]/ \4 f/ l9 C
- #include <mach/hardware.h>
0 A8 {3 t, V- @ p5 j - #include <mach/irqs.h>
/ p; B+ ~# m0 A, B1 e* g' K& T7 r - #include <asm/hardware/edma.h>
' h1 {' t0 A2 e! H6 J8 J - ( L; O5 g& w/ Q
- #undef EDMA3_DEBUG
# D. K& o; ?, i J& q# K - /*#define EDMA3_DEBUG*/
& x* M, T5 D1 Q# {* s! m' g
; `& {% C7 s5 A6 f8 }% w* v# G- #ifdef EDMA3_DEBUG% ?# W) e* R7 l, ?: Z, s, B
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
, l6 J9 V! W/ s6 [. C - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( V0 x3 q9 b0 K* ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 x' U/ a" m6 v4 m
- #else2 {4 I6 F: ]- P3 R6 j
- #define DMA_PRINTK( x... )
' m' _+ E: N0 i' w! C" k - #define DMA_FN_IN
: g! o' P1 m/ q9 c6 i - #define DMA_FN_OUT- J5 o; F) R' h$ V2 i7 i5 @
- #endif
n( d3 W" {) l b' _% P0 G8 j - k$ O, B4 c9 ?
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ y G( X! {+ [2 a* f4 P
- #define STATIC_SHIFT 3
7 `' w2 f8 S3 a - #define TCINTEN_SHIFT 20
% y6 ^3 @ Q( V3 ^' h - #define ITCINTEN_SHIFT 217 i. I7 C" t p- o; C8 Q0 N
- #define TCCHEN_SHIFT 226 B# A/ v F, `" e, g" t
- #define ITCCHEN_SHIFT 23
9 U1 w! r5 ?+ S
! V' V4 Y- d( ^# W7 g4 J) ~- static volatile int irqraised1 = 0;2 f5 Z2 a- K9 a0 H
- static volatile int irqraised2 = 0;- k, n2 b: s P! c8 J& t( ]
- 8 C8 ]( Q3 B5 J4 {+ a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Y+ O: G; q7 `) ?- Q# P/ ?, m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ]+ T; W2 _7 C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# i- N% F ?. U' I Q - 8 g2 D& F. b; m9 r2 T/ D" L7 Y5 h
- dma_addr_t dmaphyssrc1 = 0;4 @ D: ` e2 t8 ?5 e- b# \: @
- dma_addr_t dmaphyssrc2 = 0;
& o7 Z& l0 f) z3 Z- D; q5 m - dma_addr_t dmaphysdest1 = 0;& x* Q* Z. ?1 @# d6 k$ v0 q
- dma_addr_t dmaphysdest2 = 0;$ Y2 n5 z! n0 K* V! L! u) `
- f5 i C3 _7 U* k- q& h
- char *dmabufsrc1 = NULL;
7 `1 ~: ]: g# c2 J. }' K* _% \ - char *dmabufsrc2 = NULL;5 U {% X( \+ x( o! O
- char *dmabufdest1 = NULL;$ [5 y: z4 T# B, T& Y* ]
- char *dmabufdest2 = NULL;6 s. B( U4 }. W, R! F
( N; J9 q& S3 @6 n5 Q# l- static int acnt = 512;5 e4 A3 N3 h/ y0 \ t
- static int bcnt = 8;2 N0 \( q5 R2 V! w3 g* S6 P
- static int ccnt = 8;6 C" d4 Z& o, m5 e
. |; K+ U* r9 g, X- module_param(acnt, int, S_IRUGO);
' s9 H0 j% ~5 w6 m- O4 L) Z' \ - module_param(bcnt, int, S_IRUGO);
1 e- `9 J" y; A1 }( M8 d! g - module_param(ccnt, int, S_IRUGO);
复制代码
+ I$ G3 w/ c: |! `3 a4 {
$ s/ ^ m8 _& E; Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 {$ j* _! q6 P3 m! Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
s H5 I5 g0 W4 w# A- y% O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 |8 C! |* H4 h- V4 }2 r; U4 J ~. A
& L' z/ p2 e1 @% a |
|