|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % u& A. d) v* x/ b9 x
- [code]EDMA sample test application
7 n1 t% f3 Y6 [ - /*
* c Z! L3 Z7 m: Q* K - * edma_test.c. B; S: Q+ q# r/ ?7 G
- *9 \/ w1 S& a: A/ g$ y
- * brief EDMA3 Test Application* @/ k5 w* Q+ n" Z# r3 n; l- A
- *
) w6 G- J" \6 v% y - * This file contains EDMA3 Test code." p: X2 ?2 H. `! U& b% u6 x$ H
- *$ ?5 g6 i9 z4 G9 c* f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 m, ?: i2 q9 ^( g5 I5 |: o9 c* m& @
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
8 G4 Z: ?0 H2 F: O1 U - * TO CHANGE.' Z5 l+ a3 B$ c5 \
- *- s* {0 T4 y7 d9 _+ h
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 B& d1 i" A: g6 G
- * v. E0 `. f* l, ~
- * This program is free software; you can redistribute it and/or5 t0 r. M9 l" c D* X8 j( e
- * modify it under the terms of the GNU General Public License as
! w5 V6 h% z# \5 C6 k9 g# U- y - * published by the Free Software Foundation version 2.4 j: D9 x" D$ [1 t% @- d) `
- *
6 {$ F6 d+ X/ q! S- H6 k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# E) }5 C$ h8 U K* m$ d
- * kind, whether express or implied; without even the implied warranty
! Q; y( _, p% Y3 o& I- { - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 [# n2 x, z' ?4 g: E# ]1 ] - * GNU General Public License for more details.
- @, V, r2 X g1 J* m - */
7 l/ D* T4 L/ |$ O: l - # @4 h q1 s% C2 L! K
- #include <linux/module.h>' T2 N# x# k1 ?! K0 U% X
- #include <linux/init.h>
9 N8 y2 `6 D% H# V - #include <linux/errno.h>$ f+ g- I; K, a* {
- #include <linux/types.h>
- r6 t4 R G# k# G; j) P- S - #include <linux/interrupt.h>
" H% x" p( c ~. r. X% i2 M& M - #include <asm/io.h>
' z0 M2 O# r2 Q! ^* W - #include <linux/moduleparam.h>
# b# g. f: w V1 I; B0 R - #include <linux/sysctl.h>' p% m9 x$ @5 g8 l. Y
- #include <linux/mm.h>- R9 g! E5 ?3 u8 Z" F2 L6 n; p% ]
- #include <linux/dma-mapping.h>
- \+ ?* E* K: j B1 [
7 V: H* D7 s7 V3 y! J+ ?1 ]- #include <mach/memory.h>
, ]8 O3 {, l5 Z9 T6 z - #include <mach/hardware.h>
0 u1 ~# O) ]. F$ x& }0 t - #include <mach/irqs.h>
, l% G$ K7 S3 a8 l' O- [ - #include <asm/hardware/edma.h>% I" `7 ]6 ]. `$ f8 E- w
# [% q! i! w) _& K% A- #undef EDMA3_DEBUG
7 @' o0 {# a" g2 J5 {0 g - /*#define EDMA3_DEBUG*/% _4 X! R/ H+ ?5 `9 O4 k
8 i& g' M6 \$ E, ~- #ifdef EDMA3_DEBUG# u5 d* a- G) y' [& N+ T; k! U0 w
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
% [$ ^: x9 [( N% ?. B, @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
$ d2 G( v( ~* a. x - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 V* y0 a) ^! S$ u% l - #else2 o/ X, e6 v4 ?! K& I
- #define DMA_PRINTK( x... )
* {, C A, P$ s( K+ ^* V - #define DMA_FN_IN8 e8 n3 x; \" d. p3 t
- #define DMA_FN_OUT5 O: |4 B$ J0 ~1 n! k
- #endif4 r$ b# o: d- N9 x8 W K5 r% @
( C( m1 X* T# { @- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 j5 m) C0 ]$ Y4 \' _
- #define STATIC_SHIFT 3! i' {/ W7 s6 O. w2 V
- #define TCINTEN_SHIFT 20
$ W" }$ B% b$ p# K# I! ^' t- p" A - #define ITCINTEN_SHIFT 21
$ l7 }/ f7 E" _ - #define TCCHEN_SHIFT 22& x! W7 F& L. i# e% i
- #define ITCCHEN_SHIFT 23; S9 V: r* w. o+ l" `
- ) c) j2 B& D% V3 k
- static volatile int irqraised1 = 0;
( r8 }* R; F, ?. v, ], {% z - static volatile int irqraised2 = 0;
- w- G; |9 f& I. }+ [$ B, m' C - 0 {( G( ]# Y! T }
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b/ u% J4 K7 h. q* w# [" p" v/ s1 ^ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" q7 E1 F0 b; Z6 J$ K9 i, W7 F
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* e! \. S0 d3 O: s1 u* b - " O( J) o5 `8 e) ]! k4 }! @' K( T% w
- dma_addr_t dmaphyssrc1 = 0;# d% D8 Z. q) Y
- dma_addr_t dmaphyssrc2 = 0;
0 T& b5 O5 U/ L - dma_addr_t dmaphysdest1 = 0;- T8 w2 Z; c- M! i( _ S8 U ^2 L! U
- dma_addr_t dmaphysdest2 = 0;+ v! B# M8 l+ ~& m9 P. z
( o% @' k+ X& z, h- ^# l' Z, ^% w- char *dmabufsrc1 = NULL;
' M7 ?" N* Y+ Y, A% b - char *dmabufsrc2 = NULL;/ G8 k/ b1 g3 p1 ^& E
- char *dmabufdest1 = NULL;/ _0 Q5 C! g8 z# q
- char *dmabufdest2 = NULL;
: _3 p7 z" b2 Y - ' L; N9 {9 P9 B
- static int acnt = 512;
? f$ _( j* y - static int bcnt = 8;
7 ?- Z" V* @# Z* A- y, D( n0 ^ - static int ccnt = 8;1 d5 z/ r0 V$ k
- / W* Z9 d4 m3 V" l. d/ b# Q
- module_param(acnt, int, S_IRUGO);1 f6 C* a0 \& N1 L" c
- module_param(bcnt, int, S_IRUGO);
5 t3 }' S0 u5 P7 L" \4 t8 ? - module_param(ccnt, int, S_IRUGO);
复制代码
& g' C( z7 M. d$ O! K5 K% p5 {; R" k0 s3 X7 o7 A
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' s0 G2 n% v; G" warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# w1 v b) N7 H# I$ \
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 g9 `$ W7 u5 ]* N* j: @
' x5 \* @9 b% v1 ]* z+ B. ]
0 N& {2 K; s+ L3 j* T
|
|