|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ @# ~- R" a( }. D9 u- [code]EDMA sample test application! L* U3 X" K# l, q( {) g- I. `
- /*
3 b: q1 }1 T2 e: u - * edma_test.c
. r2 t/ t: G1 P# i - *6 L5 Q9 ]. {2 j% a9 v1 ~. J, Z
- * brief EDMA3 Test Application3 N5 ?0 z. F5 h/ x ^8 R
- */ _% G% x, r1 L: P; ]# n& z9 a
- * This file contains EDMA3 Test code.9 k# T+ I! B# ^7 G( @& _
- *( w4 O, q# ]. K8 F. z& c
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# B9 i Z& o" z6 \1 N
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) @* k# x3 J$ n6 i Q - * TO CHANGE.( Z4 I- f/ ^$ D: a; m& A
- *
; D9 l/ _7 I1 {0 a P1 ?, k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// b, S! `6 M0 \# e! c
- *
- z6 @6 h0 |# S! d+ r9 [0 W - * This program is free software; you can redistribute it and/or
7 k3 ]( @0 a5 y) ^6 ^$ ?' | - * modify it under the terms of the GNU General Public License as! _% M* V8 _4 F* }* ~1 g! G
- * published by the Free Software Foundation version 2.
! t8 B- P0 O0 P a - *
) v7 J) ~% C/ b - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 _6 R" J; e/ X- E) J* ` - * kind, whether express or implied; without even the implied warranty# i. S+ ]1 k" [1 |/ c" D7 p
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% h r6 b; \! u6 }8 N O
- * GNU General Public License for more details.
7 ?5 ]# m9 v$ ^& J4 @: p - */
& \* O5 N8 ~7 ]$ @. ^ ~ - 1 h/ c6 [. w3 Z/ _1 P/ g' y
- #include <linux/module.h>, A v$ ^# G/ }
- #include <linux/init.h>9 G: X! N* j/ A8 G
- #include <linux/errno.h>+ K& k/ t ]& M
- #include <linux/types.h>
2 m' x4 b) z7 e - #include <linux/interrupt.h>2 l- | p& W/ ]8 R3 ?# q
- #include <asm/io.h>
5 i$ g' }6 r4 H - #include <linux/moduleparam.h>
3 w9 ]. \6 V4 k - #include <linux/sysctl.h>
% x2 F. Q& C# B0 s7 o0 s m! b - #include <linux/mm.h>; N' {% @2 w- B9 `( F. K
- #include <linux/dma-mapping.h>
+ k! |- i% J' V# L+ J2 \% N - " P3 _; A# d! e& N
- #include <mach/memory.h>
' v5 z; d, M6 @5 O2 E - #include <mach/hardware.h>9 ?- g$ M/ M& w( F# [8 a
- #include <mach/irqs.h>& \* @/ Z1 s' u+ J m
- #include <asm/hardware/edma.h>
0 q. e" C1 `) f- j. r - " F# ~( F4 t( }4 G+ ^' l
- #undef EDMA3_DEBUG
, T9 w* ?" l- O) |3 t - /*#define EDMA3_DEBUG*/. ]( s0 a- q) q: K" x
) s3 A$ g# @& f- #ifdef EDMA3_DEBUG
' F( L! o2 W3 ~: W: _% j6 X - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) t7 ^ G" x4 a1 z. V
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- Y: k' Q- j7 l4 v( {; i
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* B( o3 {) T6 v - #else
: Z+ I6 Y. h0 |3 ?* G' j - #define DMA_PRINTK( x... )
- j: ]7 D3 n% E/ ]* }2 T - #define DMA_FN_IN8 S8 S1 r9 k( v& T) x9 l( a
- #define DMA_FN_OUT2 c0 ]) l; W9 S" \* E
- #endif. Y8 I: ?9 J, @ o- }
+ O1 t. I1 v5 U8 m0 }6 Z- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
i; {/ D/ e( \; M; I( Z8 s - #define STATIC_SHIFT 34 H# H$ y+ O, D0 ?6 T
- #define TCINTEN_SHIFT 20
6 F" b' F5 d9 P! O - #define ITCINTEN_SHIFT 21
# B. }' e( Z4 Q! G - #define TCCHEN_SHIFT 221 w! h" V) ]: i, M* m
- #define ITCCHEN_SHIFT 23% _0 ]) X8 `! z1 G: F2 j5 e3 g
- ' X! J$ n6 R& \2 ?' A/ w- m
- static volatile int irqraised1 = 0;8 ?! Q! C% F: w
- static volatile int irqraised2 = 0;
) S; @5 r, ]1 w: [5 g
$ B' g/ ?# U3 {* n+ L9 B- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 `$ @4 ^+ h% A* i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
0 o! K. u; y- n+ t1 A - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ { j* y7 q$ H }
- ! Q+ C3 Z; I, u, Q! s
- dma_addr_t dmaphyssrc1 = 0;
( E; |7 D! d6 u$ b! E, ^" Y - dma_addr_t dmaphyssrc2 = 0;
9 D8 \( M3 x2 C7 `. j - dma_addr_t dmaphysdest1 = 0;
& a& X4 g* ^1 M' f) y2 e, J - dma_addr_t dmaphysdest2 = 0;
% U b- I" `' K, K4 V - , j/ ]1 x, |$ K# \( E
- char *dmabufsrc1 = NULL;0 ?' r% R3 k1 d/ z" K& L6 x; t! z: F
- char *dmabufsrc2 = NULL;
$ `" p9 ? V3 P4 Y) d - char *dmabufdest1 = NULL;
! d2 i9 u- r( U) O5 h; @( P - char *dmabufdest2 = NULL;
" P5 W; g7 i+ r& w" C; G - 1 {4 |; k* S \& x8 p( B
- static int acnt = 512;
5 O1 n& @ P( g1 H9 K1 B* w) N - static int bcnt = 8;# {& `& a8 p9 y% S
- static int ccnt = 8;7 t1 R+ V! b) i" q/ Z6 n, W3 y m
- - Y# m% k" \' G8 C
- module_param(acnt, int, S_IRUGO);6 I3 u6 t9 V- b s
- module_param(bcnt, int, S_IRUGO);. Z- t# y) d$ U5 ^5 R' h
- module_param(ccnt, int, S_IRUGO);
复制代码
2 L; N8 s7 B4 z. M9 H) Z" {6 C! G# b2 ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" F. O9 C0 z) a9 [; V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) N5 w/ s, }0 C+ F! F& f+ y& a 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# b s' Y: k2 [6 c
: c( Z! I' p) h/ A$ P1 P( F) G
/ N5 U: U7 T. S9 B; y |
|