|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - C4 W* {: b) @1 m
- [code]EDMA sample test application- j6 w7 q l) ?
- /*4 W+ `( }$ _+ ~
- * edma_test.c d$ n9 m3 Y7 z
- *
; w" ]' k# i" j! E% x" P9 L S - * brief EDMA3 Test Application
, V& _0 z1 Z/ D& l# f - *$ s9 W6 h8 }! H1 J4 p
- * This file contains EDMA3 Test code.# e, H8 j0 m9 [
- *8 A( Z5 b; u8 |* ?+ T7 E2 W( S |
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
' S9 ?4 N' g! z! q4 z1 v - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 m. |- l. E2 L" F! j& u6 Y$ O( A - * TO CHANGE.
7 z& `2 I5 i, F/ F7 b - *
: W8 U6 O7 G) A) x* i2 k; d# H9 } - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 N! J$ R w4 e5 ?% B( m - *
6 t- Q j; G+ V6 o O$ }' P - * This program is free software; you can redistribute it and/or
% S' v: J* _6 a* d! J' L/ M - * modify it under the terms of the GNU General Public License as5 K7 `" G: j) J( B: m' O5 {+ p/ Q y& R
- * published by the Free Software Foundation version 2./ `; K% Q* D5 K+ ?
- *
! R4 E& U+ [ m/ e - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( `' T& X; J* A7 Y2 r) m+ P
- * kind, whether express or implied; without even the implied warranty6 f6 M6 J& y) b
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% Z* M8 q0 V- [+ ]9 I
- * GNU General Public License for more details.2 @) W% l; d# G
- */- [4 Q2 f4 z9 x6 U
) R4 B5 q) M" K L5 w- [/ I- #include <linux/module.h>+ N) D" g: u. S# ^
- #include <linux/init.h>4 J& D" n5 I3 M8 @
- #include <linux/errno.h>: y- m" r" a r X
- #include <linux/types.h>5 u1 Y; N$ p/ b
- #include <linux/interrupt.h>+ a) g9 C: ` L- K# @& k5 U% l
- #include <asm/io.h>( n3 L7 B5 g) W3 a
- #include <linux/moduleparam.h>
" K. T* B' S! U' O. M f - #include <linux/sysctl.h> z: A' _1 k) _
- #include <linux/mm.h>3 l2 _# Q: R4 R4 H
- #include <linux/dma-mapping.h>
! p% Z/ u1 t4 Z5 | - 1 L6 K; P" {' E
- #include <mach/memory.h>" Q1 i4 o. a" i; l# W$ N
- #include <mach/hardware.h>. g: P8 W Z2 c+ w( p$ {
- #include <mach/irqs.h>
+ \8 X' a g1 z" A4 a' y; u5 W - #include <asm/hardware/edma.h>
" f f f7 \. C* }2 I: D - - Q0 K6 Z% p" i' k1 `8 g& x# N0 @
- #undef EDMA3_DEBUG
! ?( g) D4 k! P( E# l$ o - /*#define EDMA3_DEBUG*/
7 E" {- U3 Z+ C, s' l* A - % ^( g: ?$ E8 o. N' e
- #ifdef EDMA3_DEBUG
o7 X" L) R T# ^ g6 y7 k! n" q# r - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# q, Z, y# n9 I4 v% n, }
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F" F5 s6 i* k5 Q/ `% G
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! s; W, H! d5 T5 v
- #else* q1 Y( E& R$ P7 }2 Y% {
- #define DMA_PRINTK( x... )
0 J& G) M5 R/ x% s3 H - #define DMA_FN_IN6 o: [7 o2 \- s1 o
- #define DMA_FN_OUT3 E1 _$ W A2 U" G2 a# W
- #endif
7 K) b9 b- E1 p6 ?6 ]- ], } - / I8 d0 T7 E' T7 s5 x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)7 \# r7 |4 Z/ f7 y' ?8 u8 Y
- #define STATIC_SHIFT 3
. }$ F0 k/ t& I, Y7 J$ V - #define TCINTEN_SHIFT 20
! ~2 p) ?; q) C' Z" c - #define ITCINTEN_SHIFT 21
- p- b$ Q% h4 h8 t S2 Z" | v) r' ~ - #define TCCHEN_SHIFT 22
* u3 r3 X. ~8 e. e1 o" b - #define ITCCHEN_SHIFT 230 c! J' s6 i6 J: T
7 m5 y7 N7 {1 K% C4 Y7 {7 |- static volatile int irqraised1 = 0;
& ?, ^3 o4 A ]$ { - static volatile int irqraised2 = 0;
8 o5 _2 g2 i6 _0 q( O - " w! _% U" ?# U, N
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" F4 R. k) d! M! D - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" G3 i/ q+ s% N) J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 v; i, O( Y* [+ _/ v3 |3 X - : [, z. M+ C0 R6 C2 m
- dma_addr_t dmaphyssrc1 = 0;
( x+ z: N! U. t3 d6 T+ J$ G - dma_addr_t dmaphyssrc2 = 0;+ L7 p. `2 S: g% O0 g- q6 [
- dma_addr_t dmaphysdest1 = 0;$ B& A3 z; {: g2 E, `% C& B
- dma_addr_t dmaphysdest2 = 0;2 ?8 T0 f( G9 \( R5 L' ^) q
+ r' N' c+ H6 t. ~8 R' q- char *dmabufsrc1 = NULL;
0 K' }# Y/ v4 F K ~ - char *dmabufsrc2 = NULL;
5 d, @% m* W2 h! @1 ~6 B. a, V8 q - char *dmabufdest1 = NULL;0 C% h, R7 `* s: R- s' z
- char *dmabufdest2 = NULL;0 V- ~+ N! Z+ r5 @
- 6 _8 v& c$ |1 [5 L: _
- static int acnt = 512;
+ { y5 H& q/ U2 i - static int bcnt = 8;: O% o9 W5 o: E
- static int ccnt = 8;) ?, I# t9 l* W
* q3 J1 D$ L1 U( l6 ^4 t5 e- module_param(acnt, int, S_IRUGO);% {( C# M# U% z3 x4 J n* O
- module_param(bcnt, int, S_IRUGO);2 ^5 t: Q7 \. a
- module_param(ccnt, int, S_IRUGO);
复制代码
8 J( R$ o# M5 K; ~& Z6 o4 ?& ?- E- A3 I6 J/ O+ O6 }* M8 }
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- _9 r! n6 z. ]+ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 O$ @) ]3 R2 g, q7 Z3 a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ r5 D( N% W( p0 ~% `4 B3 a$ Q, h) e0 i3 `2 G. R7 }: ]
3 F* p9 ^* H- k/ m8 l
|
|