|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 D5 t& E0 I; a; X& u
- [code]EDMA sample test application/ K8 y' x3 O: p3 X: ?
- /*, F5 K/ U: g* {
- * edma_test.c. b4 k) d# f; }. @: V, z# [
- *- r) W+ u8 j& O$ t6 O) l
- * brief EDMA3 Test Application( {: T! G! J8 C2 t2 z
- *
+ x" \; a$ t1 @% U! f - * This file contains EDMA3 Test code.
. m2 {* j: E# z/ \, K' D - *
5 D, A+ l x3 `7 |. T5 c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' q f/ z+ g- m6 y' j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 A# g. }2 W' p% n, M
- * TO CHANGE.
: s% L# b+ S; I: e0 Q - *; t' W- p. K5 |" C; S) Z7 O) T
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( G( V, G' [% `( y( w - *# D+ R; f, u6 J5 }
- * This program is free software; you can redistribute it and/or, Y) t- Z5 s: D* f
- * modify it under the terms of the GNU General Public License as8 _) p0 z7 T5 c+ k. B
- * published by the Free Software Foundation version 2.% n& I- m3 ^5 W, w' m, q3 X0 x
- *) m0 X9 O# @9 U5 X3 q
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; H3 J# b% j' \0 \$ g; k7 t' t - * kind, whether express or implied; without even the implied warranty
' J# |: i$ H7 a' G5 b6 K - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/ D& Z( J) C6 x0 ?8 X. E - * GNU General Public License for more details., ^% W7 _3 q5 e, g
- */
1 _+ E2 G, f: w# ~5 M2 h; p - 4 G0 r# K% `& N' c
- #include <linux/module.h>
2 l) ~$ }- A3 `- m% ]$ \) k - #include <linux/init.h>, T1 y) r1 W# H c8 l$ d" g
- #include <linux/errno.h>' l7 J) w; ~, q) F
- #include <linux/types.h>
4 a" G/ k L, O% A8 ? - #include <linux/interrupt.h>6 T" C$ Q$ p+ }: V
- #include <asm/io.h>
8 r) i" R; M9 E9 t- q: p6 t' k - #include <linux/moduleparam.h>1 C. E, q+ N3 }! s
- #include <linux/sysctl.h>
% h0 b& {, X5 @ I- u& y - #include <linux/mm.h># q- T- z3 J4 [1 v; _& v/ _4 z) ?
- #include <linux/dma-mapping.h>
- c6 P3 n3 W0 r) B
" K# O' F$ I3 q& b( J) |" J- H' _# h- #include <mach/memory.h>
, e( s; L/ z; C% x. ~* L - #include <mach/hardware.h>
. u/ f4 ?7 B P3 |5 i0 n - #include <mach/irqs.h>" K! K! s5 g# H0 {' Q
- #include <asm/hardware/edma.h># |9 J, h; B, U; o
$ y( Z! ~# e# b. ~9 [) f% m- #undef EDMA3_DEBUG e4 m& w& P/ j+ X
- /*#define EDMA3_DEBUG*/& k) x6 ?) _# _& P$ D
8 K) h W% ?: k( p- #ifdef EDMA3_DEBUG: ~4 B& f8 X4 t( G. I# K0 I
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 q& g* _1 ^4 b! t3 f m7 H
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
9 y: t% T7 \: d. r9 p& Q, z- F - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" f) F# p- k2 E$ F7 G d
- #else$ s! f8 U7 d) V+ I
- #define DMA_PRINTK( x... )2 Y' g* @3 `) [1 }1 W2 S
- #define DMA_FN_IN
# k5 X) P% t6 G# [- D - #define DMA_FN_OUT$ R' p4 n) f; p3 i
- #endif
- s; t* p3 p. y& M
4 W6 Z9 X( x0 ]. ]' Q1 x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* i# _: r- \/ K* {& s - #define STATIC_SHIFT 3# N0 y' z# C. N& d/ ]
- #define TCINTEN_SHIFT 20/ H+ G2 C, F1 H j- ~$ O
- #define ITCINTEN_SHIFT 21
, l0 T! _3 A5 Q8 L8 O$ f5 W4 y' { - #define TCCHEN_SHIFT 22, e7 |- c, i3 x
- #define ITCCHEN_SHIFT 238 d( e1 R2 \& P) a7 i' }
+ R- y0 `/ ~( p+ a" T) B- static volatile int irqraised1 = 0;/ H- v, Q' E2 o
- static volatile int irqraised2 = 0;
3 f6 w$ Y6 B' Y
9 F9 a/ `- ^1 t+ R0 v7 V- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. X% l. }: Z+ L' e* b# Y: j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; U! }* k% Z1 u' b% X' G, ^
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 A* b; t( U( z7 w( b7 C
2 g9 l" \8 O# w% w- dma_addr_t dmaphyssrc1 = 0;! a2 G1 \9 G$ T% X( j
- dma_addr_t dmaphyssrc2 = 0;
/ I4 l- M8 Y3 Y0 C - dma_addr_t dmaphysdest1 = 0;. q+ w6 U* N Z
- dma_addr_t dmaphysdest2 = 0;' h6 U$ g7 v: f% X3 X+ P
- 0 N$ ~4 B( u, \8 }9 k3 K) b
- char *dmabufsrc1 = NULL;
" J( h. L' [, Y# j7 ]) G - char *dmabufsrc2 = NULL;
+ l$ G( g" H3 k1 `) g6 O - char *dmabufdest1 = NULL;- j- x3 H$ W8 ^; }$ I1 A. b! M
- char *dmabufdest2 = NULL;1 Q9 A- C# l5 |9 p: G+ d
- 7 N9 A& |; l: V0 j& `: \2 S
- static int acnt = 512;! P- p- K; H) u4 J2 d, x7 y2 M
- static int bcnt = 8;
$ O( P# [- P2 ~ - static int ccnt = 8;$ M8 c3 r& w" [! }0 N3 J
+ o7 T: `( ]% @% p- module_param(acnt, int, S_IRUGO);
" f7 x L9 ~1 N+ o - module_param(bcnt, int, S_IRUGO);
# S' W* N* C0 _8 r, J5 `1 a: A8 C - module_param(ccnt, int, S_IRUGO);
复制代码
* y. U7 d. v5 |/ W" [9 W9 X6 W8 d# }+ _# Z" w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 [1 t/ k. W# e7 V3 l& F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 S) q& t& r% h. o% ` 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% r3 K5 ? R5 Z8 F& l0 B( w- f- G
r* _# ~4 i3 w/ r- q
|
|