|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " \: a' n- ], V
- [code]EDMA sample test application
) W- C; j* Y3 m+ o# [" L - /*4 p0 a) q2 p, i/ d/ _
- * edma_test.c
9 e" J8 ?4 |6 t( I) ~0 P- V; _' m! P7 R - *
0 T! u6 m+ ~! ^, G( I, ~* k - * brief EDMA3 Test Application3 ~# H$ a/ P0 r5 g3 ]# `
- *' h" T z9 F7 c* ?5 v
- * This file contains EDMA3 Test code.. ?" \- G/ _; D, f
- *
, G4 O/ C' W; u - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 W- r0 Y: Z8 }/ C2 y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" q% l3 b3 E% u5 D - * TO CHANGE.
9 i' `' ]' B! A- L' z6 U3 R3 N - *
* V# V! @2 }% J% j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K( d6 `" ?' `! N$ B
- *& s: z. w r5 T
- * This program is free software; you can redistribute it and/or
* Y2 ~- y7 o. I/ T - * modify it under the terms of the GNU General Public License as! m3 V5 C5 k7 Q5 I$ A
- * published by the Free Software Foundation version 2.: x( o1 s: @6 e) h3 E6 h
- *
5 f' j2 c/ J f- b1 d7 n - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
, b7 e+ s5 T) [: M3 G8 V - * kind, whether express or implied; without even the implied warranty
& v# ^: i7 h4 H$ U( O& d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 G; k( z' A1 b# B3 E - * GNU General Public License for more details.
* A; j7 M) u! J# T# ` - */# }; y. j m, n2 O# Y! W
; j7 ]3 y" a+ z- #include <linux/module.h>
' ~! l* o2 K* Y# S - #include <linux/init.h>
( W* \& D ~' r% ^" _ - #include <linux/errno.h>8 q! q' u5 j# ~" D9 S0 A6 Q
- #include <linux/types.h>' w& A0 o d: p2 e$ u8 N0 y( h. k
- #include <linux/interrupt.h>( p1 k, `7 m, o3 Z2 z1 N' r0 R$ C
- #include <asm/io.h> o7 }4 w8 }# W! d
- #include <linux/moduleparam.h>
+ n: Y! W! m" b+ s, n* f5 s - #include <linux/sysctl.h>
! W# N( B* M3 ^ P( W! T - #include <linux/mm.h>+ i! ~1 M; J, }3 h% Y P
- #include <linux/dma-mapping.h>
0 q% _3 y* [' C$ l5 Q1 N& q
4 }9 o. P& p% B" U- u7 ~/ }2 Q: v4 v1 l- #include <mach/memory.h>
. B# P* j/ ?* w" A h3 t4 T9 S - #include <mach/hardware.h>1 ~: x7 }+ K1 b6 S* @8 L
- #include <mach/irqs.h>9 j' k+ o, O$ Q# Q. E( f* I& O
- #include <asm/hardware/edma.h>
2 F2 Y$ i% `! ]' c - 8 S+ N, k8 ~" z, c, F6 J4 `3 w
- #undef EDMA3_DEBUG+ A& |7 \+ l* Q) M% y4 _
- /*#define EDMA3_DEBUG*/. m0 L3 o# G; G. L2 t' c
$ v r# i7 W" p) e1 H) w' O3 p- #ifdef EDMA3_DEBUG
; }6 n/ S7 T @2 q p& I( m1 H7 Z2 } - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- G: N- P" N6 f- r' F) z
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 `% D% v: s) h1 ]+ F9 D
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R% l l- U8 r3 \. N, f
- #else' W3 q- l8 z$ r5 e; F }4 |
- #define DMA_PRINTK( x... )
9 U5 r# A0 n/ |6 r - #define DMA_FN_IN
5 X0 C/ N2 n; b - #define DMA_FN_OUT
! D3 B- K1 Z1 s9 A3 T6 ^ - #endif
. N8 S6 O2 R7 y5 C
& ?$ p8 F2 \/ N- y# d0 I7 W! t# a- #define MAX_DMA_TRANSFER_IN_BYTES (32768). Z O) n8 y( ?, d5 n6 z
- #define STATIC_SHIFT 3: O) g7 n @0 C
- #define TCINTEN_SHIFT 20
5 _+ K8 }! _( [+ ` b6 [. ]; ~ - #define ITCINTEN_SHIFT 21
- x% m2 z! S' i" _# ` - #define TCCHEN_SHIFT 22( S6 N& W# O! A7 @
- #define ITCCHEN_SHIFT 238 k- Y+ T; ~6 Y0 s3 S
- 7 C( Z% S. q, L3 P
- static volatile int irqraised1 = 0;/ C2 V! t; Z/ P( p1 z4 g# c
- static volatile int irqraised2 = 0; z4 q" J2 h7 {/ ^; K8 o7 e: h8 P% V
- 1 a' [& q+ {2 U
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K) j( g1 H& b
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 u; u2 y$ \3 _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; L1 \; g' e- z/ q9 t - ! Q. O2 G* ?' I# }
- dma_addr_t dmaphyssrc1 = 0;
8 w/ `5 N+ E5 n8 w! N8 R1 t - dma_addr_t dmaphyssrc2 = 0;+ F7 N) b0 W/ E3 S0 d, Q3 a
- dma_addr_t dmaphysdest1 = 0;$ j, T6 o# L( X; S/ ~
- dma_addr_t dmaphysdest2 = 0;7 E0 c# y3 w* O2 [4 K
- 5 F) C6 v8 M u8 \) a3 E
- char *dmabufsrc1 = NULL;% Y0 P+ I+ T/ ~6 F0 D
- char *dmabufsrc2 = NULL;6 g3 L' h8 i' Z; Z0 @2 u3 O
- char *dmabufdest1 = NULL;
% x, J6 P8 o% k - char *dmabufdest2 = NULL; A, f: V" m7 N$ Y9 m; w8 h( h
- 4 m" y3 e/ w. M- w$ n1 W1 I
- static int acnt = 512;
& h$ ~; ?0 |; _8 s2 v$ h - static int bcnt = 8;# g) c* ~1 C' B1 V9 s
- static int ccnt = 8;
6 H6 \$ q* U' r, ]# K! U - : x Y# H# t5 c; m
- module_param(acnt, int, S_IRUGO);
# L# B5 S- m9 ?& i - module_param(bcnt, int, S_IRUGO);! Y7 |; f3 B* R5 @
- module_param(ccnt, int, S_IRUGO);
复制代码
: M! ^, o1 i+ I5 r9 T- R9 b/ z4 R6 f
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 F9 I2 \$ v K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) F9 q1 q* m0 _' D9 i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 @; U5 l i' z6 H5 v
4 E7 w7 |: e1 u3 A
A: e$ }( q- j& i" g4 ~! O |
|