|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + _- ^- t5 e M0 s. W7 A! j
- [code]EDMA sample test application+ c$ R6 i# `- g) G2 p
- /*$ H! y9 M( z5 [; T
- * edma_test.c
! C; j, H) O- v! J2 b% H - *6 o& x: r3 l- F4 E' G/ l3 V9 ^/ N
- * brief EDMA3 Test Application4 ^3 g% G5 F" d, R N: g
- * I1 K6 b0 M0 F; ?8 x
- * This file contains EDMA3 Test code.
7 i- b- z1 X V - ** w' y0 z3 z6 C- a O3 p6 g: |) b1 r
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
Y5 L2 ]* E# Q8 \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 m* C7 r, x6 D/ h$ m5 a9 |
- * TO CHANGE.
8 Z% Y7 e2 {7 @8 W' p2 R: O3 Y- X - *
7 ]% r- o# z! I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 \( w; S" J. H$ R - *
% s% Q8 [& ^' u& l+ \ - * This program is free software; you can redistribute it and/or
9 n! {" [' R( | - * modify it under the terms of the GNU General Public License as& | {# A: p* a1 {
- * published by the Free Software Foundation version 2.# t8 O: d/ G+ F2 f
- ** R. k( |2 K9 \) n Z0 {$ ]
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( }" F; Q5 D; i! k' G t - * kind, whether express or implied; without even the implied warranty: O( L7 w! b8 R! r
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 z+ B/ F1 |+ \! M
- * GNU General Public License for more details.
- z0 A4 O8 x; Q6 f - */: @. W+ S) R& v8 b2 j3 _$ Z! E# i
- 4 B$ X+ s- y a+ W. F. u
- #include <linux/module.h>
4 e9 G0 V& a) b% o; h - #include <linux/init.h>
9 D7 g7 G! `% i6 Y - #include <linux/errno.h>
0 i7 A' S/ v) F/ h. U - #include <linux/types.h>
5 n8 ^% x) t1 ?- X( M' s - #include <linux/interrupt.h>
8 j1 b- h$ x5 ~. E" }* w# c - #include <asm/io.h>
6 B! m$ Y* Z1 {0 T% M - #include <linux/moduleparam.h>
. u: p6 N# Q8 {; z6 a0 i - #include <linux/sysctl.h>- {' e8 s* {$ c% D7 c& t; q' w
- #include <linux/mm.h>: L8 f8 S5 }% L. s) P
- #include <linux/dma-mapping.h>
8 b) Q" `; z8 U" _( m% ~* Z - }, O6 W1 Y; ?) H# D% i! }' U6 p
- #include <mach/memory.h>" J% J, A0 v, A( _, }5 O4 ^7 c/ v
- #include <mach/hardware.h>6 _0 }0 [' a+ g: l
- #include <mach/irqs.h>
% E' E" t* {% F" U8 U6 x+ f) i0 N, | - #include <asm/hardware/edma.h>
$ U A& b* i& [) H. g - " g) d) [! ?; |# O( A
- #undef EDMA3_DEBUG" f2 I' }' [: S$ K3 K, g/ ]
- /*#define EDMA3_DEBUG*/
0 |+ M9 ^" K7 `, @ - 9 T8 M+ m9 u/ e! x- V$ D
- #ifdef EDMA3_DEBUG
- x# r/ Z( d2 q m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ ]9 L# L7 z& K8 U) `7 \
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
6 x" e0 \( m) I$ M* L3 z8 m - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) s. n% N7 g/ W8 z, J: f
- #else
7 o' V, B2 o& m+ j) E - #define DMA_PRINTK( x... )
0 ^( l, `1 g+ B- D! f - #define DMA_FN_IN3 `0 [( w h- \. l, @+ _
- #define DMA_FN_OUT: E9 k0 R1 q# o
- #endif
) _+ J: k: ^! l3 `' C - 9 `: }, _: I! n. n& L0 Z4 K
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( B; r$ t6 b3 L4 `$ q
- #define STATIC_SHIFT 3
4 q. f( |, Q5 V7 j+ h. p8 T - #define TCINTEN_SHIFT 209 f9 `' Z* A0 \1 M( S; `. ^' e
- #define ITCINTEN_SHIFT 21; U) B# Y4 Y/ `
- #define TCCHEN_SHIFT 22+ ]( Y: f5 V1 t! \$ k! V$ U
- #define ITCCHEN_SHIFT 233 c3 ?' [6 I' }# q' M- p
- 9 t! e' x M/ W+ S, X5 h4 R Z
- static volatile int irqraised1 = 0;
; v0 |5 j3 D' b j# V3 g - static volatile int irqraised2 = 0;
k/ W; }0 \; V0 f% v& H& s+ d4 e% L
% R7 s' Z9 @. g" c. l- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F% V$ x8 x3 w! v' {
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% y2 J7 G4 a0 [) ]0 a - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s8 G7 ]/ f* E1 t \+ C1 ^+ Y7 O
- ~ N* O6 B1 Y& C' c% z! B6 @2 s- dma_addr_t dmaphyssrc1 = 0;- h( X/ L } b- V: K8 i, g
- dma_addr_t dmaphyssrc2 = 0;: k0 o( V4 d1 O" j" @
- dma_addr_t dmaphysdest1 = 0;
& ]: Y+ Z: j$ Y2 m - dma_addr_t dmaphysdest2 = 0;
+ U- M" ^5 X, I2 B4 f4 n* @ - / ?) k- Q& P/ F$ [# N
- char *dmabufsrc1 = NULL;* ~' ^7 M" M/ ], R
- char *dmabufsrc2 = NULL;: D4 I! V2 g' R
- char *dmabufdest1 = NULL;
# x: Q- I K! W - char *dmabufdest2 = NULL;
4 ^7 G# k( ^0 \8 B8 u1 S, n - 1 [0 c) U2 S2 h! W) [2 e
- static int acnt = 512;
# ]" R4 z+ E" _8 x+ ]/ D - static int bcnt = 8;
: N. L6 Z: @! J! ? - static int ccnt = 8;
1 A" A' y0 `6 C' {: b
. Z/ Y4 o1 i6 M: ^% t. t5 l- `% B- module_param(acnt, int, S_IRUGO);
/ `, @+ b7 D6 B4 G/ H7 _5 k - module_param(bcnt, int, S_IRUGO);
6 i* s5 x6 t6 \0 o - module_param(ccnt, int, S_IRUGO);
复制代码
" \! W$ u4 \4 X) R, t3 d5 {# ^% z1 z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! H9 A) T/ H# e& @& ]% Sarm-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 k: B6 m" E- J; D( c# G n 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, w) k1 U3 m3 b% S$ }; {
* t; q* L/ r3 {3 v9 V0 S1 y
' ?& c. Q$ ?) Q" u% R; u
|
|