|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: D# X6 y5 {8 W$ B: I5 `- [code]EDMA sample test application8 z4 p8 m t$ ]
- /*7 ~. x8 E0 d! J3 @
- * edma_test.c
8 d, P0 Q5 x( V - *. b$ |8 Z! Z7 M7 A( u$ V4 D% f
- * brief EDMA3 Test Application2 U1 _1 m0 @) Z' k& z: l5 ~7 @
- *
9 _+ n9 w: M8 k, M - * This file contains EDMA3 Test code." ]: F* d8 f! x; r5 H
- *( z' d& R! v( E! G j- Q$ H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 [1 ] b7 d x8 ?- Y# j# g: d4 N: X - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! m$ ~% C' O- L4 v+ v, h/ z" m - * TO CHANGE.
: ?3 `3 L' K$ @3 W+ F0 w0 l - *
' z9 n, r v* p4 V! P0 U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
# X3 ^/ c4 N. [- u# L& h - *- Z; a4 b) Y. H% G9 R) l5 K; F
- * This program is free software; you can redistribute it and/or
0 f" D2 k' X ~; {6 U G, f - * modify it under the terms of the GNU General Public License as
4 v- U4 [6 p. b5 o" d) J - * published by the Free Software Foundation version 2.! I- {9 F# x! s
- *
: N- Z5 g* R4 [2 M/ M - * This program is distributed "as is" WITHOUT ANY WARRANTY of any- B- z, s" M; o
- * kind, whether express or implied; without even the implied warranty) X1 X. j% m0 V: ^1 J/ F
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 G' j9 _: E, G
- * GNU General Public License for more details.
D) e) I6 j0 i J - */
: K7 N' k$ w) |8 W3 K3 |8 @0 A - ; B4 K2 h0 ^$ j- U" e
- #include <linux/module.h>; Z$ t( V6 ^* F* h& W( V
- #include <linux/init.h>' i0 g; U9 ^: s2 n
- #include <linux/errno.h>
2 f1 Y: s k. A1 l5 w. q0 O. o" R - #include <linux/types.h>
e- V% _0 f- N, l" h8 b4 q4 j' u7 m! b - #include <linux/interrupt.h>
; |$ {, F. l( f/ H- j9 _ - #include <asm/io.h>
* k& u) P% V5 R v - #include <linux/moduleparam.h>$ M3 j) \/ e4 Y9 X9 P* |0 k1 M
- #include <linux/sysctl.h>
' h' \2 n, [5 j7 B# d - #include <linux/mm.h>9 r: t& y3 ^7 |
- #include <linux/dma-mapping.h>
) R1 r% M* {2 X* i: {, J/ B
. e& `& v2 T# \- #include <mach/memory.h>
1 C; F. [( [ i: d+ z$ V+ I6 P3 L3 ~ - #include <mach/hardware.h>
3 l& s5 @: y0 l# e3 ]/ E - #include <mach/irqs.h>3 E' a8 m5 w9 ^ k" {1 e
- #include <asm/hardware/edma.h>
1 M/ D1 R* c( A
( N( I$ l# b2 b1 ]% [5 _1 i9 g: H- #undef EDMA3_DEBUG
* D+ ^6 H% q4 I1 R' \ - /*#define EDMA3_DEBUG*/$ p$ F2 p. V; B
3 b; c8 B( Z- @8 [+ v* X- #ifdef EDMA3_DEBUG, K% N( q. D0 p4 z- m
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 d, Z4 c! H' i' I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) P5 v+ [6 Q* Q9 w. s" p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
% q: f( |9 h2 s3 r2 B$ h3 a - #else5 G6 x, `- [- y" j4 P: T' p) l
- #define DMA_PRINTK( x... )
& g0 c1 w6 ~4 h) c$ |9 U - #define DMA_FN_IN
8 D* V% @ n. d2 D7 ~2 K( s( _ - #define DMA_FN_OUT
* }% B$ S- `; J7 H; ^* i - #endif
- }9 X% y' B" D' q
$ y! d O# x" J1 [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)5 }+ d2 t3 {( O) \3 C. v+ r" e x
- #define STATIC_SHIFT 3
3 e9 S, q1 e1 ]* f# o - #define TCINTEN_SHIFT 20
+ B) b' P0 _, \2 t* p8 e8 A - #define ITCINTEN_SHIFT 21
0 `) J+ C& v1 P' F8 }' T \ - #define TCCHEN_SHIFT 22# B9 {- p7 F/ j j
- #define ITCCHEN_SHIFT 230 L$ ]" H" _6 s) h# o
- 9 {; d# U! G0 O D) ^
- static volatile int irqraised1 = 0;
$ x0 h0 D8 I, V) L" G - static volatile int irqraised2 = 0;
/ K/ w3 E: a( P+ V - 2 w: t. D4 \5 m7 b: E
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \! Q/ e' |# y. @9 D
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 |( C1 o2 M- e( s1 E' } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' n5 O0 w8 k# W) d. } @; W - : j1 \( o- ]" U( j
- dma_addr_t dmaphyssrc1 = 0;
; _4 P( _9 X+ d/ v% H - dma_addr_t dmaphyssrc2 = 0;
3 M. c1 U4 ^3 ]! m) o8 T - dma_addr_t dmaphysdest1 = 0; z* e7 N" ?% C1 k9 C
- dma_addr_t dmaphysdest2 = 0;; v6 o0 D; c- I& V, Q
% [& }& B7 I `( B4 [6 ?- char *dmabufsrc1 = NULL;
# l$ c9 @- _- ~5 ~) \' M% K9 K - char *dmabufsrc2 = NULL;' W& l3 ^7 \) H
- char *dmabufdest1 = NULL;# h% j; n$ E; N r# v
- char *dmabufdest2 = NULL;' A x9 I: I+ L8 r5 Y- m
- 3 L: _6 O$ @) @1 h
- static int acnt = 512;
' l% A z j; K# R& _' z9 o8 w5 Y - static int bcnt = 8;7 X; N3 M( M* ]7 V# i
- static int ccnt = 8;
" S) A7 ]8 n' ]# r7 e7 U- J) P - * V* i3 a/ C7 n5 W9 n) P0 z5 d
- module_param(acnt, int, S_IRUGO);
7 D( n( O3 g# n# T6 q: C4 J; b - module_param(bcnt, int, S_IRUGO);
4 A, T% M+ }; I7 q* Z - module_param(ccnt, int, S_IRUGO);
复制代码
2 }; w+ [! w: j- ^2 w! q
4 `( i Y( |: }4 M& K3 i! k7 X; I. x2 F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ g; \- j, m0 a+ c. W8 ^9 Q. W+ w$ n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* `1 H7 l) D' b; E 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 e* G: q$ N0 |( s& C. s/ u( u
% _, j9 D" U* c
( `4 I4 }. ?# x# ^9 s7 J- c' B |
|