|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% g" N8 F5 k- j6 `4 m/ ]' g- [code]EDMA sample test application1 g2 V, q. q+ O' L# Z3 l' ` R( F
- /*5 J# Y6 K* \, P; h! H' y5 [( N6 @
- * edma_test.c% K c2 n, y! Y5 y& n/ h+ C
- *& R" c# m# X O C1 d; M
- * brief EDMA3 Test Application, Q' i5 E( M; y0 n( h
- *+ e- J- a3 n2 n
- * This file contains EDMA3 Test code.$ N6 Q& m2 M- y7 I9 H7 z. }
- *
r+ p9 i3 G1 M# l5 e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- j: P) q9 Y& e) o8 E/ ]" a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 F0 k6 E, n% p$ i3 R - * TO CHANGE.
3 i3 Z L. I" a% ^, O: |& P) F x" } - *% u8 f" O* |$ T: p# k: y/ s
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, f- z& m2 h: D - *" g7 V, q' y8 ~; k4 G& z
- * This program is free software; you can redistribute it and/or' w7 b* N. o4 j
- * modify it under the terms of the GNU General Public License as) B. `( z/ }* j8 X
- * published by the Free Software Foundation version 2.
& v B* L6 S; l" J6 ] - *% _; }# q X/ E/ W
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
0 ~5 ~( f* e+ s; a; L9 T2 F; Q - * kind, whether express or implied; without even the implied warranty
5 `) j* |: z# y! r- r2 E - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' J# r$ j3 |5 C) \5 \- _& G
- * GNU General Public License for more details.) C I) U" `; A& P' @
- */
! ^' h. c" z4 V
: M6 k/ p8 X* M) H1 y: |- #include <linux/module.h>
6 a: R# s& h, U" M - #include <linux/init.h>
& E+ o6 L g8 S' p! p0 Q - #include <linux/errno.h>
& p6 D4 n/ ^- V) R {/ b - #include <linux/types.h>
& w6 X/ o( [2 y4 A+ l0 Z; J - #include <linux/interrupt.h>
3 u; K7 b( S' o# l2 Q+ ?( M( ] - #include <asm/io.h>
9 S' U. T+ M/ W% y# D6 I1 O - #include <linux/moduleparam.h>
9 I- g1 w$ p. m0 e0 r - #include <linux/sysctl.h>
; e! l( B' ^; a+ Z - #include <linux/mm.h>
- q2 g% }5 N6 X& D6 d7 h; @) | - #include <linux/dma-mapping.h>
8 J: H2 G8 ^+ y0 b& Z! C - 0 n: k, C5 k" y+ l% q( |6 z
- #include <mach/memory.h>* e% H/ C' b9 H$ o1 k' E7 [
- #include <mach/hardware.h>
0 i! p6 v% V. l9 C/ u - #include <mach/irqs.h>% M; K! O9 F% _
- #include <asm/hardware/edma.h>
; q3 N0 ]* W, v) X
$ N3 a. A5 [8 ~: z- #undef EDMA3_DEBUG+ Z! V; V; ]6 c5 t4 K5 h4 F$ O
- /*#define EDMA3_DEBUG*/
3 i% z( i' x1 M* R8 A+ W
: I1 J; ?2 c X( S- #ifdef EDMA3_DEBUG
6 K) ]( h: t7 Z& _ l7 z4 @ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f: z% H- r' Z; N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 ?: A0 o8 u' Z/ r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ ^8 ~9 i- `; w& `2 Q
- #else
. M' ~5 h' @" c5 J- D4 ` - #define DMA_PRINTK( x... )
; x9 E% C v: Z* u# J6 J0 K - #define DMA_FN_IN
% x, ]9 U8 l) R, K9 Y; _ - #define DMA_FN_OUT
+ G, F1 r0 u# h) e G; U - #endif
* |/ | k [! b7 Z
W( `% X* L% S5 B4 H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
% a: L* `) f5 f) R - #define STATIC_SHIFT 3
7 H) T3 b# K0 d6 U7 o' r4 ] - #define TCINTEN_SHIFT 20
6 N9 L% [' N5 j - #define ITCINTEN_SHIFT 21! o8 Y) |' |* [, h7 E
- #define TCCHEN_SHIFT 221 G8 Q/ c3 m1 [2 A
- #define ITCCHEN_SHIFT 23# q4 b: v6 S$ ]0 ^/ N( `
- 6 y8 Q, u, I* t
- static volatile int irqraised1 = 0;
: \$ U# U1 y, v9 r3 u( ?0 Q - static volatile int irqraised2 = 0;. L# d$ P( b# n/ K8 {
- 2 A6 c! y, a" i
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 M" n2 R& Z& O; S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% x8 R, c d6 l: q/ R. o7 Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- h3 b& H: U0 m7 z
& ?1 M8 |3 q6 }+ B) q8 e5 e- dma_addr_t dmaphyssrc1 = 0;
0 e8 L1 |, X1 C$ R0 g# K& H - dma_addr_t dmaphyssrc2 = 0;
2 {, P. p; a8 X( C - dma_addr_t dmaphysdest1 = 0;( M, Q5 B+ i* c& l& S! U2 O7 t+ F# p
- dma_addr_t dmaphysdest2 = 0;7 M+ D N% I# m; c1 V
; w/ s+ M$ ~; D! [* |& \! E( h- char *dmabufsrc1 = NULL;
6 x. A2 z3 A3 [* s3 ~& `; ?) W$ c - char *dmabufsrc2 = NULL;
0 d6 W' r: J( ~0 ?6 E4 f* s$ o - char *dmabufdest1 = NULL;! i& o0 b3 q& _- V7 |" {
- char *dmabufdest2 = NULL;
; U; S. y- l3 ]/ C5 D: J9 q6 Y( U* g/ g
+ d, h4 l1 ?7 \5 k+ s6 w" d- ^& K! `! a- static int acnt = 512;
2 s' _6 Z7 o1 D n - static int bcnt = 8;# i6 f+ a' K1 z1 q8 u& n8 y
- static int ccnt = 8;1 V! k# |2 ?$ j* b3 K0 t0 }, ~
- . N5 W3 P) L7 } i! v' `
- module_param(acnt, int, S_IRUGO);
% ~4 M( V" c3 \/ c6 H5 [' n* ^ - module_param(bcnt, int, S_IRUGO);
- m; |# a3 h$ E3 l - module_param(ccnt, int, S_IRUGO);
复制代码 ) u' N7 }5 U/ O6 _- q+ C/ M. ?* p
8 O1 b* d4 `& C! ^) E* _) f! r; a 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, r& a0 }1 d4 M9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) w- p$ ~9 G& N) ^% A" ~
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ J1 V. V6 m' h5 c6 \
|1 W5 I# m" R7 T4 H$ c6 |
( P- ? x8 @& j/ C' O |
|