|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 [9 [; Q4 P) O7 y- [code]EDMA sample test application. O4 Q# R; X3 E) M k9 z- c
- /*9 l0 V: L' h( s% y9 D4 V3 q
- * edma_test.c
: H( q0 h7 W: O4 y: V. s* E - *
1 K$ N" B7 ^1 S - * brief EDMA3 Test Application
3 B1 v$ M, z; s$ A( n - *
# E$ t6 [* z; {1 c - * This file contains EDMA3 Test code.. A' A* a9 r9 G+ ~8 H
- *
. Q& R1 x7 w- E' y7 Q! r; G( Z - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( B7 P$ H2 u2 {* v2 j0 D - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& j; V: S w5 b0 x# w! J) S; e. ]
- * TO CHANGE./ B1 t O3 ?$ @, \( D4 Q
- *) }6 s4 |5 d: d( }
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ g% V$ q/ Y: V2 Q: |9 s/ _ - ** N' e9 Y& l J9 Z' f c/ b
- * This program is free software; you can redistribute it and/or/ b- @) E& h, G' i2 |$ F
- * modify it under the terms of the GNU General Public License as
* W+ p( n! \" | R - * published by the Free Software Foundation version 2.8 F. f6 q' G7 K4 I
- *8 k5 `' ~: \/ G! {: i* a
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
D% [/ j: g$ F- A3 t6 n4 l/ c- }! e - * kind, whether express or implied; without even the implied warranty
; q" W# |- K1 O- t - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" x. D( A& U% s _- B- r% D
- * GNU General Public License for more details.' Z' E: k0 l: U E
- */
3 f* T3 L, l* }2 c* q$ a! r/ S2 c
8 |* K9 q3 a0 B: v) B- #include <linux/module.h>
/ N% T- T0 \7 d - #include <linux/init.h>4 x3 d0 Z2 R, I P
- #include <linux/errno.h>
0 r! w" Q% R, x" ?+ r8 u - #include <linux/types.h>
" a6 K! W9 \/ v - #include <linux/interrupt.h>4 j* k, U; }" n# u
- #include <asm/io.h>
" _# N& h' k5 P& ~9 @# j, W - #include <linux/moduleparam.h>
$ F" U, s* S- T9 l1 O+ M! H - #include <linux/sysctl.h>
, p8 v9 V, F1 |/ ^9 x; { - #include <linux/mm.h>
# Z' R$ k& b) ?/ c - #include <linux/dma-mapping.h>
7 p1 ?- S4 ^8 @: X' D - % |/ o4 z8 j* b! a
- #include <mach/memory.h>' w, ^1 G1 i0 c0 d3 V9 I0 i9 {
- #include <mach/hardware.h>! Y4 h9 X8 N. K) N' R& ]) ?. N
- #include <mach/irqs.h>) ~% b: R; S4 w9 C2 W# P/ D2 i
- #include <asm/hardware/edma.h>8 L1 A0 a; c- r' K& s$ R j. y; h
- 0 L9 e, j1 l/ v5 l
- #undef EDMA3_DEBUG
9 C( u- Q' D, s! Y - /*#define EDMA3_DEBUG*/, ?; V* m/ |. H" c* v
- " M! g6 U4 {- ^" W
- #ifdef EDMA3_DEBUG5 ?- g7 {3 R" x% f: d; z
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- I5 V7 ^( q% y3 ^1 v& o% c$ _
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
" y5 f+ Y4 y; C - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) G# u: E2 g. \% @
- #else
' f3 P5 h, w5 M4 F( w+ x% s0 t - #define DMA_PRINTK( x... )
( L$ n$ T0 n) |) p. v - #define DMA_FN_IN! ~# h: k; C" b6 ]& N# [
- #define DMA_FN_OUT
: E0 \4 ]7 p @. u, }! K& T - #endif u: E# q5 ^7 f; e. |
- 1 @6 u0 y7 b8 ^3 t: v6 }
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
- ?- B) S6 T8 h% J1 w% B - #define STATIC_SHIFT 36 O# M5 I5 E1 D, d: d/ C2 Y6 T
- #define TCINTEN_SHIFT 20/ X7 K6 A7 R) |' B, D
- #define ITCINTEN_SHIFT 21! o) _) d/ x% o2 p* ~
- #define TCCHEN_SHIFT 22' I |3 s" u/ |9 e) a
- #define ITCCHEN_SHIFT 23: ^- e% I$ W1 Y E
" T0 }6 ~1 K8 h5 [- static volatile int irqraised1 = 0;8 { ]: y! f, z: d' x
- static volatile int irqraised2 = 0;
5 V* w6 f& D3 b+ B' {9 \* r - 0 h" B( m/ Z: Y& z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# {; V7 L0 `1 n1 f+ @$ Y - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 \( U% `, X/ _& J% K, c6 K2 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 {4 l1 h `3 s) A" k/ r1 i1 x
- . u* F- }7 N! v' n p2 U3 ^3 p
- dma_addr_t dmaphyssrc1 = 0;
7 B7 `; j& \" l2 y8 A) R - dma_addr_t dmaphyssrc2 = 0;. J- h4 J3 t9 ^' d2 v$ M+ i( U$ S
- dma_addr_t dmaphysdest1 = 0;# D) o& c( B+ x; x( U. I; Y; q' X
- dma_addr_t dmaphysdest2 = 0;. d7 C0 t, `! a. ^6 w
- 5 ?0 p# _: K! m/ V4 b$ J, A- b& d2 @
- char *dmabufsrc1 = NULL;, M3 S/ I" }- v, f, ^
- char *dmabufsrc2 = NULL;
* \/ c$ h+ Z9 I) C5 R - char *dmabufdest1 = NULL;6 L3 ], b( U. d: q0 w
- char *dmabufdest2 = NULL;1 I; ^0 R, E& K" u m
- ) j, u" Q3 ?5 ]0 b: o! v3 O2 F
- static int acnt = 512;
8 F! k* C6 K( n4 t - static int bcnt = 8;
' i" F/ k( n a' {' O8 i% N* d - static int ccnt = 8;
/ a$ P3 a1 `: u0 d - 7 w" Z; P# C2 t7 R l8 y3 T. `
- module_param(acnt, int, S_IRUGO);
4 Z& z# r- b+ B8 N. T) b0 } - module_param(bcnt, int, S_IRUGO);0 T/ o+ z4 t# u2 n1 w! x6 p2 W
- module_param(ccnt, int, S_IRUGO);
复制代码
/ K+ Z8 c0 z5 `$ ]& w% f G0 K! Y$ R. U. H
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ l; B, {( b) x2 V a, V9 l: ]! z6 q# h3 M! Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* E, N3 k( M7 P5 q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ]: G% b; e, J9 d& V8 s
% A2 T2 Z$ J& V7 x+ | [- |
1 c$ ]* t) {- F6 n# a4 l
|
|