|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 r, R( B9 L6 @- [code]EDMA sample test application- j' X* `+ D& b) y- J c+ X
- /*
0 Q( q5 ]9 t. {0 O - * edma_test.c# M0 I. O" G' m7 M! C: ?6 k5 E
- *
4 ?$ _9 [7 h; G# k - * brief EDMA3 Test Application
- |+ G% t- |& c" [ - *
, k; c6 b, B/ z; h2 R - * This file contains EDMA3 Test code.
! x. n7 Y. [# I( V - *
4 f8 Q, n6 S) i( m8 N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 e( B2 n. }3 p# i3 L
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T3 v1 Q9 I+ u3 F) E( @: |/ a P
- * TO CHANGE.
/ i5 e( k* f) F3 r! d' q5 T. Q - *6 x; u6 N g; {; D7 O! L, ?1 G
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
?# ?3 o% y- g+ H. C - *
; H5 N& M6 e- h. ^, X) n - * This program is free software; you can redistribute it and/or6 w) W# e& Y. P; N' J3 A
- * modify it under the terms of the GNU General Public License as
! ?* d9 F, {4 Y5 x) F$ H) u; p+ R4 [ - * published by the Free Software Foundation version 2.1 z& r/ m5 H' O2 S1 g
- *7 R* g& O* u) o! ~. L+ r T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 Q) }; a0 A* g) E! P1 D
- * kind, whether express or implied; without even the implied warranty; R& w, Z8 s! a+ @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ L1 O4 h) a `1 }8 J
- * GNU General Public License for more details.
# P; f1 }# v6 q4 b! R - */4 w8 W2 X7 C3 F
- 8 j9 ^+ Y/ D. Y
- #include <linux/module.h>
; d) j. g" G& [ - #include <linux/init.h>& D) w! }# _$ F
- #include <linux/errno.h>0 B5 ]8 j% `4 }/ r; I# _
- #include <linux/types.h>
- W+ n% p; a7 |. G! Y% { - #include <linux/interrupt.h>* j- t. N8 k4 f$ ?
- #include <asm/io.h>1 z, a8 T# @' @8 x! @3 `
- #include <linux/moduleparam.h>
% C/ @7 [$ u7 e1 D - #include <linux/sysctl.h>
, p6 Q; J) Z, o/ j - #include <linux/mm.h>+ F/ j& I' z+ R
- #include <linux/dma-mapping.h>- ]' L/ J ~/ _
# Q' n; l# N7 a- #include <mach/memory.h>! A7 n& v1 Y# `% E
- #include <mach/hardware.h>
2 o2 z; U* n* i2 W% c) A; a - #include <mach/irqs.h>
. ?6 D V9 E$ F" R5 L - #include <asm/hardware/edma.h>
7 h2 c7 s& ?5 T1 u
* K5 [' B% z! Z2 b- #undef EDMA3_DEBUG# j: U: o: t1 J: I- _8 _3 g
- /*#define EDMA3_DEBUG*/
4 D# E, M5 c: | - " ^4 t' u8 n" k( [
- #ifdef EDMA3_DEBUG
! [9 `. \% v8 z" X2 `. R# g - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 a1 z5 W( m+ ^2 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' O$ j( e5 q4 \ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
) ~# I) H+ @7 L - #else
( f. `$ u* _% ]# Q2 n. q- F$ t - #define DMA_PRINTK( x... )
( j2 X* K7 S- J" Z+ L - #define DMA_FN_IN9 C: X' N: [! f" k
- #define DMA_FN_OUT" O5 z+ \& c" S5 l
- #endif7 P& o3 [1 S5 T* Y! I
- 5 T6 {$ T6 d/ W& X6 B% c
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
& m/ |* ]) r: Z; x- o; [ - #define STATIC_SHIFT 3$ [6 `9 P, k% M$ m. a% o* ]% h
- #define TCINTEN_SHIFT 20
& F2 P; ~0 x6 E7 Y5 `8 S# V - #define ITCINTEN_SHIFT 214 f' V% C( \2 N) J
- #define TCCHEN_SHIFT 225 c1 T+ x7 S7 ?9 n0 U4 c. W
- #define ITCCHEN_SHIFT 237 F- Y5 v V- Y: L7 n3 ~/ l
5 m# L. O0 _$ M! w" C' @& k- static volatile int irqraised1 = 0;
" H5 @, O# }" Z4 {2 x - static volatile int irqraised2 = 0;
$ o1 s0 ]5 P( X# ^7 o - 8 l; Y% S% c% P; r+ U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m i1 y' [3 ^& ^+ P
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P! B# b5 W1 |0 }: V; C5 Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 L3 u- R8 F0 G: W* m+ A# \
- ) F! p9 Q& A% {/ e0 |3 G
- dma_addr_t dmaphyssrc1 = 0;; h2 T4 [% Q4 U" x( v5 Y, A0 `; }
- dma_addr_t dmaphyssrc2 = 0;6 ~4 h* v( p% {0 D5 d
- dma_addr_t dmaphysdest1 = 0;( [; {; I6 U; f3 |! v9 U
- dma_addr_t dmaphysdest2 = 0;; ]) @% f; s$ a# l# [7 ]+ ^
% ?# {! K% I1 m. k6 U- char *dmabufsrc1 = NULL;; i: A% K- i0 r( Z2 q9 K7 V4 S
- char *dmabufsrc2 = NULL;
( d9 w% V" |) W - char *dmabufdest1 = NULL;9 l0 S `( a. H* _( k" n1 r- W. v
- char *dmabufdest2 = NULL;& O& e4 A2 c; T; J" Z% J
- % g2 N |% {5 a3 Y9 B: V2 E
- static int acnt = 512;5 E( r2 X2 Y% T$ n7 {6 s* s# X! _
- static int bcnt = 8;
7 n1 e/ B r* n+ G - static int ccnt = 8;
U5 ]- w3 ^3 ?, C8 X% s
4 k" f/ [0 n& l1 v7 e- module_param(acnt, int, S_IRUGO);& b/ z5 m: G) ?& y8 Q
- module_param(bcnt, int, S_IRUGO);
5 N3 X: O1 t9 K9 W8 D - module_param(ccnt, int, S_IRUGO);
复制代码
' r9 p& E1 I! J: D$ h F/ l4 r6 ^0 S7 Y+ D$ B, ]9 e
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; Y' i3 }: H/ e* x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. @1 H# ^& p& a' d! H9 ] y1 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
|- P Y Z$ `; D1 ~
2 E: J% e$ ^3 o7 K0 j. i" @
& d1 v# L8 ~1 ~/ T |
|