|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) H: V4 \# g; w3 o6 q! \- [code]EDMA sample test application
% L1 ]3 P# O9 y& u$ Q - /*) N% C5 ?0 X1 ], d) O$ u9 \- c, @/ i n
- * edma_test.c$ R7 S, Q: r$ b, w Q: E5 L. e
- *% i1 b" n" i. ~& I4 h6 K
- * brief EDMA3 Test Application) U+ l- o7 c o9 c% G7 X
- *
" ?% u; [; a* M" ?, r6 A1 ^ - * This file contains EDMA3 Test code.6 o- b" z0 o8 a* {2 Z2 [
- *: E- O$ y' k. r! F f
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: j2 c+ M. d0 S! i: y. g - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" {0 J& L5 n, L/ [- @3 `& p
- * TO CHANGE. H% }5 E* c' D) q) Z$ r
- *$ `2 w1 |$ I/ e( X% p6 Q: j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- X' |2 N5 f+ A% D
- *
/ H% F; D3 c4 @! F- D3 s) |0 r - * This program is free software; you can redistribute it and/or
' s0 r) }. ^2 K" s# I) f b3 \ - * modify it under the terms of the GNU General Public License as. x! R9 f+ |" g+ W4 Z
- * published by the Free Software Foundation version 2.$ y1 j3 ?& ~" J
- *. h" d4 ~7 i& D0 ~
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any. m& R$ \( ?5 T7 `) ~# D2 I
- * kind, whether express or implied; without even the implied warranty
9 j6 |/ b- K1 K2 W2 E+ _% d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
: k& X9 v% O+ p - * GNU General Public License for more details.# i1 `7 u2 H" i2 \4 l/ A2 t7 V/ w
- */! d* d3 T# P% t5 Z8 |+ y5 j
- : }0 k! d/ _7 U, x
- #include <linux/module.h>
3 ]# k6 a1 A8 _8 _* b4 B6 A- T - #include <linux/init.h>
, q4 I1 p% H7 _% z+ q i - #include <linux/errno.h>
0 t) Q2 r: o w' f6 f9 B+ P - #include <linux/types.h>* C* O+ y- j. B1 J/ c
- #include <linux/interrupt.h>
0 @$ `2 Y5 x; M5 u0 _6 p - #include <asm/io.h>
( D9 {8 P6 p$ G; ^9 ?" B! p - #include <linux/moduleparam.h>/ P. E3 h, n8 A: m( e! B
- #include <linux/sysctl.h>
( B, L+ i0 P; A! u& k7 C - #include <linux/mm.h>
# b, r8 @7 V6 ~& m" E3 Y8 w - #include <linux/dma-mapping.h>) T/ h! E4 y7 z% F( g) b
- 9 C* j' U1 e/ p$ y2 E _
- #include <mach/memory.h>+ C/ m3 N. `. M8 g! v! C4 @* c
- #include <mach/hardware.h>; [ `6 H6 f4 N; d L1 G0 L$ J
- #include <mach/irqs.h>
% l/ x: d0 E+ H* O1 D2 h - #include <asm/hardware/edma.h>
6 O$ p, U$ `6 }# S
T/ ~& B/ h- {4 G @- #undef EDMA3_DEBUG+ j4 p# B% D, A+ [, ~; E& j% o
- /*#define EDMA3_DEBUG*/0 w1 ^& O1 h7 M& x! b
- . _- r4 ?4 v: N
- #ifdef EDMA3_DEBUG
$ W0 O0 \: e5 j# Q5 n5 Q( ` - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# w9 X6 L* z( [; d
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* k4 C5 x' i6 T1 d. R* d4 B4 e X
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) E; Z0 `2 T: I
- #else
. V* f6 \" y9 {4 H! o - #define DMA_PRINTK( x... )
( i2 n$ V! p H x - #define DMA_FN_IN7 V9 B# Y+ Z" Z5 m: D+ G
- #define DMA_FN_OUT% S0 V# ~0 F4 _8 {7 w6 L
- #endif% N4 n5 ~3 z7 J3 @/ N
- 2 i( q( W7 ?, ]: S4 H8 J
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)6 ?, p. @! C% d6 m2 \" }
- #define STATIC_SHIFT 37 V0 Q0 x8 D* `
- #define TCINTEN_SHIFT 20- t1 F" }! q/ S" s& N
- #define ITCINTEN_SHIFT 21' A: m# T! r, X5 |
- #define TCCHEN_SHIFT 22: Z |2 f, s5 {; x# X+ @+ ]0 t @
- #define ITCCHEN_SHIFT 23
! X; S( S+ l9 a$ L9 f) z1 E: C0 t - ; I' O2 v/ [7 d% l6 I' W
- static volatile int irqraised1 = 0;: Q K$ `; m. G! G
- static volatile int irqraised2 = 0;, J: p" K) \! \0 ^
- % e, W" |6 F! v
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b6 A. G" E) e1 c$ B
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u* A, q* j; m7 V
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( I7 ], i5 T1 w$ D
- " p6 V* Z8 \7 V& L' c+ h
- dma_addr_t dmaphyssrc1 = 0;6 H8 ^1 n: n- N8 I" T
- dma_addr_t dmaphyssrc2 = 0;
+ N! _7 v7 T3 |6 Z6 O - dma_addr_t dmaphysdest1 = 0;; k! y: h' B! [/ r
- dma_addr_t dmaphysdest2 = 0;
( H6 ?6 j4 ]/ t( w - 3 ?+ U% a8 ]" x. b* T1 `5 e
- char *dmabufsrc1 = NULL;) U) ^$ z, D+ { n- Z
- char *dmabufsrc2 = NULL;0 I) C! _3 }0 p5 Y
- char *dmabufdest1 = NULL;
$ O' g; B* g# m- l& M* _ - char *dmabufdest2 = NULL;
- C I' |! F9 Q1 a' w6 r$ A
2 D2 r- q8 z' O. t0 ?0 v5 f$ w- static int acnt = 512;
: P$ J" Y+ k3 p - static int bcnt = 8;
+ T b. n$ z0 @4 E2 b# e/ _; R. d - static int ccnt = 8;
- J# {" S+ \2 d9 M$ [$ e
; o6 p0 H6 ~& p6 H! Z1 k- module_param(acnt, int, S_IRUGO);
7 |8 {0 Z% L8 f' i - module_param(bcnt, int, S_IRUGO);# B- M: T1 a5 e3 I
- module_param(ccnt, int, S_IRUGO);
复制代码 8 K* g4 l/ ^7 \6 m& ]. p
- U" A3 [9 m" @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) a& x9 M! u2 W9 L& U" U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' ]' `$ g3 S8 Y! H4 ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, }4 X+ t' K! b
8 W* v( B9 N& i9 V2 Y, _; R! N. K& ~4 z% m% J
|
|