|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + I) v$ \5 @+ ~7 r6 a0 v
- [code]EDMA sample test application/ o$ l. p. B- o. `5 T; z
- /*4 J* ]2 Q, N, r. [ H6 k* Z: o$ X: b9 f
- * edma_test.c
0 m" q: h3 l" A5 _0 T) F - *
; o, N- [3 R# b! W* z - * brief EDMA3 Test Application9 `: [8 \, l. l/ ^1 n# n$ M
- */ v3 q" p2 X' x( {: H
- * This file contains EDMA3 Test code.2 {5 e; }9 F0 T
- * }9 Y j! Q5 W7 D5 R) a/ X
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
4 g, F$ A, {! z, R6 W! ] - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; S8 y6 G6 _( l6 E, B: O/ n
- * TO CHANGE.
! w _: R* i& j1 x; l# ]5 H6 x - *, G6 B: _ o4 d$ i6 g
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' {1 `0 k0 U6 V5 X' u- p - *; q2 H3 ?/ \) \- _0 I/ Q- j
- * This program is free software; you can redistribute it and/or4 o* B: D9 J9 l' q
- * modify it under the terms of the GNU General Public License as3 |! T$ Y" {- K6 A
- * published by the Free Software Foundation version 2.
x) d4 O" U3 ^# B; Z2 c - *
/ ]/ Z) _# r0 I( W - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& }# z2 Z0 q1 k, m3 M3 u7 J
- * kind, whether express or implied; without even the implied warranty- r* J0 Q. R# J3 D' n; W) v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the2 S3 a( [" N/ |. z# N- @
- * GNU General Public License for more details.
7 I9 e) l" H: ?5 N/ J3 ] - */( J9 O. O5 D8 ?. G' N7 s
/ G1 n& z1 c) O- M! c ?2 i. p- #include <linux/module.h>
) @7 \2 } R' k, K5 M0 G6 {- V - #include <linux/init.h>( Q9 C& ~% g; |; d: A& |+ U3 s
- #include <linux/errno.h> W/ _8 H# J* n7 X1 X
- #include <linux/types.h>( ? s& f5 P q" Y' U6 }
- #include <linux/interrupt.h>2 E4 k. |' T" z: G
- #include <asm/io.h>, ^2 U0 x. w S5 h: |0 u6 L5 V0 } a
- #include <linux/moduleparam.h>, ^& p" j5 z, r7 m6 j5 M
- #include <linux/sysctl.h>
/ N, c0 R, M& r - #include <linux/mm.h>
! t( l6 N% `, l0 c( U - #include <linux/dma-mapping.h>
9 v( l2 s( R/ x) j8 t1 u - 7 K" h3 t9 T1 c. d* i' S
- #include <mach/memory.h>6 E- _1 x/ C/ ^- S# h
- #include <mach/hardware.h>
0 r0 h' k0 z# p/ u - #include <mach/irqs.h># ^6 ~7 Z u+ d; a. c
- #include <asm/hardware/edma.h>: }4 k, p @1 Q; x
- j" z) p/ `1 a$ K" z- #undef EDMA3_DEBUG
# R V* w) v8 h - /*#define EDMA3_DEBUG*/- H0 k; X- b* P4 G' s" \
4 D3 i1 i5 B6 T9 Q" ]) ^- #ifdef EDMA3_DEBUG. P+ K2 D* z% n. a* D- @6 l: } z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 v+ U( I% V; A. M; E0 f" V; Y7 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): D1 U: L/ V. n( U" x+ b
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f5 s. Z' n3 ~& \4 E3 [
- #else- R2 L+ N! N! @* T
- #define DMA_PRINTK( x... )
( e @! p2 W9 @ - #define DMA_FN_IN" K; [3 p0 Y2 L
- #define DMA_FN_OUT
% e$ S' d! t3 x/ _) \" L! L3 U - #endif( g8 m6 ^, V) h; I
- # F r C2 V. c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)2 C# Y. k- \( R) t9 Q! F! y) `3 g
- #define STATIC_SHIFT 3
7 A; L3 X6 _" R - #define TCINTEN_SHIFT 20& h. F8 Q8 E4 a0 y- Q' X
- #define ITCINTEN_SHIFT 215 \8 A- V. L, H$ Y6 `
- #define TCCHEN_SHIFT 222 V- @- ?6 j; h- R5 E) C" }/ O
- #define ITCCHEN_SHIFT 23
B/ ?4 f! P. D# R/ Z - 3 f0 D3 M% M! \' R3 s! l
- static volatile int irqraised1 = 0;3 ~9 u( p' }7 l( r X1 e2 O! a
- static volatile int irqraised2 = 0;
7 R! h! Z ?! ]/ d/ Y3 s) J
# U8 @9 x; h: X0 J4 r- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ b( W6 v. u2 X3 A
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }( }( L1 e7 \0 U2 @
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- g# a5 A$ y) ]& N% ]
9 v0 n& Q- i3 v5 X- dma_addr_t dmaphyssrc1 = 0;' U! v" [0 B) G) i+ _; T: P0 |
- dma_addr_t dmaphyssrc2 = 0;/ N5 w( v% [2 `8 p
- dma_addr_t dmaphysdest1 = 0;
+ g7 L: O) c! ?1 L - dma_addr_t dmaphysdest2 = 0;
e% p, g4 E+ i$ D7 n% L
9 Q1 }, i; U* U. \- char *dmabufsrc1 = NULL;
$ q, z% p! w/ u: x! V: Q$ P - char *dmabufsrc2 = NULL;
% O4 f7 M K" u - char *dmabufdest1 = NULL;, R5 n( Y9 o3 R7 ~
- char *dmabufdest2 = NULL;
4 a) @! t- i1 Z3 O5 i - 0 M% c% N* y! e. T5 P, h. [
- static int acnt = 512;2 B9 }" C. [; Q' c, H0 \8 t) \2 I9 @
- static int bcnt = 8;
# o& i3 w3 X/ { - static int ccnt = 8;; x5 x; [- O" C _( D( e
- 4 Z: S6 t& R/ i2 E: u8 P
- module_param(acnt, int, S_IRUGO); b1 N+ A& N3 \; r
- module_param(bcnt, int, S_IRUGO);
8 P/ v7 ]7 c8 {3 M4 S# W* ` - module_param(ccnt, int, S_IRUGO);
复制代码
7 s' b* k9 g& z$ D3 D" ?4 r' t* C' M* ~8 W& R2 Q O" L
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 g S4 @/ N# q8 D! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Z" E w% \4 ~* G+ Q" r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( h; M X4 J; g0 u0 l/ |5 _
+ w/ }* x' j c/ e, f
% Y0 d- {' h5 Z |
|