|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( t3 n" _" Y1 X( N+ S$ u7 p- [code]EDMA sample test application( X7 T7 c$ t' Q5 R% r9 H
- /*8 Y" h+ {" C& g
- * edma_test.c
) D5 D3 i A) `' |+ J - *
7 z1 h- e0 H; |* f( ]8 Q, V5 ] - * brief EDMA3 Test Application
! Q' w1 |9 ^* S3 K4 X - *
$ {# W: F2 q6 T: u - * This file contains EDMA3 Test code.
- t6 Z6 N& Z9 D, @0 K. U - *
! h5 H! ?3 x. c7 }9 T" ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 D* g5 k; W1 H& G
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R( I% h9 ]4 |: S6 t5 x
- * TO CHANGE.) v7 ^# b- N" h) M* S: r
- *
- w0 g; I S+ L: b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
. I2 @( c+ a2 V* G+ @" {. ] - *
* w5 X6 {( w, {6 c% ^" Y# ^ - * This program is free software; you can redistribute it and/or% a# b( [1 [8 z: M7 W6 ^
- * modify it under the terms of the GNU General Public License as
$ k9 P1 \5 N7 H N - * published by the Free Software Foundation version 2.; o1 w7 ^5 u4 h3 ?( P9 M
- *. \8 ]; C; \% Z! S, {' s
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
; u4 ` f( T7 z, F' w. E - * kind, whether express or implied; without even the implied warranty
& l5 C0 H$ x, X' Q; @, R - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Y/ @- D7 n( i: Q! C; n6 S - * GNU General Public License for more details.
& J8 L2 h) T* w1 W2 w, R" w - */
- O: O( H. b& Q+ X. @
( V( [9 B8 N1 d9 O& u+ g) v- #include <linux/module.h>9 M. P4 D9 P+ d
- #include <linux/init.h>9 T, d4 L! j; a$ ~ Z9 Z5 c
- #include <linux/errno.h>
6 F: I5 ^- q. I# j4 W6 ^ - #include <linux/types.h>) s, Z$ N* P' p
- #include <linux/interrupt.h>
: S) }6 f0 R) {0 j - #include <asm/io.h>
; S( B1 u6 k3 ^9 d3 v+ Y7 V - #include <linux/moduleparam.h>- ?0 q' G ?) l
- #include <linux/sysctl.h>3 q" ]$ t* b, @( d
- #include <linux/mm.h>
8 b' h7 U4 D! O8 X5 o" | - #include <linux/dma-mapping.h>( f* ]6 x8 b& g7 {+ q3 I* u
- O+ j$ ^- T( w, |3 R# q' K( _& w- #include <mach/memory.h>
, t# {$ B" g* D) h) K4 ?/ L - #include <mach/hardware.h>
4 i& M" A2 p- p1 G, a. }" t - #include <mach/irqs.h>
6 d7 z2 Z$ {7 S7 s- ^ - #include <asm/hardware/edma.h>
* z0 {& A" F! K* U! S; l# J, T
: ], x8 p2 e; J$ o# u/ |2 H0 r- #undef EDMA3_DEBUG
$ u' A$ R( o3 w% [' x - /*#define EDMA3_DEBUG*/
& H4 ]6 s4 q1 _2 h# d8 m" R
( t' W( K' y. i5 C6 `* M- #ifdef EDMA3_DEBUG8 F% S8 P4 u$ o8 z) ^# C
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& ]3 E' y: K0 o; I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); s3 R5 r* i1 Y" p- o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ x$ ^( S1 R3 D
- #else
3 H; B& K0 }/ T2 m% {' d - #define DMA_PRINTK( x... )3 T& k% u j: }+ w
- #define DMA_FN_IN
- _3 C g7 M3 M# M - #define DMA_FN_OUT- W' S' p" o, i# |! q/ a
- #endif
! o: D# F* y, e0 l - : F; ?5 Y" t; {
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* c. N1 R' p% A2 ~& @ - #define STATIC_SHIFT 3
. F5 @1 t" ]6 Z8 l+ s& N0 k - #define TCINTEN_SHIFT 20
0 ?5 A& f8 q9 ^2 ^) t; Y - #define ITCINTEN_SHIFT 21
( U5 n7 _" J+ j1 y% q7 `' b, s - #define TCCHEN_SHIFT 22
+ t" {8 j! f& s- b* N5 r - #define ITCCHEN_SHIFT 23$ S# a @5 }0 m- T. s; x0 o+ j
- 6 J" p3 U- w6 ~' P9 a
- static volatile int irqraised1 = 0;6 x3 l# q8 D0 F4 M; \! i, Y
- static volatile int irqraised2 = 0;" t2 l5 M4 D' M4 F# m
1 G3 K0 d1 h, L7 l9 g2 C* ?# h- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ~8 D* P' E5 I( ^0 i
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; _# s% s* k0 s9 q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( `, z v% R$ V7 c5 a
: L! k" e8 d7 x( T* v/ \- dma_addr_t dmaphyssrc1 = 0;
. L7 u4 w8 ~% R5 M2 T9 M - dma_addr_t dmaphyssrc2 = 0; T0 C. |* o: @; ^' w) P
- dma_addr_t dmaphysdest1 = 0;
3 H( Q4 m; ^! n/ O& I2 m - dma_addr_t dmaphysdest2 = 0;
2 G! e# h8 t2 v% s; b6 F% L5 K - : S, c: c; b% C
- char *dmabufsrc1 = NULL;/ `, n) N6 _# A- Q. Y) o; `/ s8 F
- char *dmabufsrc2 = NULL;( C) I% p& m; C
- char *dmabufdest1 = NULL;' q% h0 {9 K( K, z2 I2 n
- char *dmabufdest2 = NULL;
6 w! X; Y1 Z. G8 Z$ ~! X. | - : g9 W/ y( r9 q7 y3 L0 [% }
- static int acnt = 512;0 _& ?5 Y8 R' P7 g6 e6 }
- static int bcnt = 8;
9 m0 ]" V. v) R" p/ m - static int ccnt = 8;. Z( |* ~5 O) m; U4 ~
- % N* _2 b6 |. z
- module_param(acnt, int, S_IRUGO);
, f' \ E5 t% g7 j# U - module_param(bcnt, int, S_IRUGO);
9 Z; \, Z& M7 p% y |# [4 y K - module_param(ccnt, int, S_IRUGO);
复制代码 - s- d) N F4 I% r3 K
& J$ ~! G1 s Z
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! r$ b) U( l4 j6 P2 i0 k3 Y* }+ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; w3 m9 n( R! Q. ?' F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 }; ]$ q8 ?. g ^: [' S" k8 h' C; u0 k" k2 o# a" m/ u4 n
0 r7 a- S7 j, x2 F$ g |
|