|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 S- A6 R2 Z/ o. I* S! H/ S
- [code]EDMA sample test application, R; g$ o' n. J& p8 b
- /*/ q4 T4 }: {4 c* k5 s% b& A- j
- * edma_test.c
! v$ C9 j! K# L, q) L$ O - *
5 G& _5 V- o* ?. Y; V/ k0 h* \3 D4 M - * brief EDMA3 Test Application
- i/ V" r" ^4 r0 o+ L - * r: `& R3 R+ ]9 q4 j
- * This file contains EDMA3 Test code.5 C1 Y! k) Q' C) t/ W* _# P% q X
- *, w& z# o5 } J7 C0 K- U K* C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* d/ S) l1 @! y. [( o" v" l. n" x - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& d- k# g6 m; q( F
- * TO CHANGE.
) Z" f4 l2 A# h, K+ m, |, j - *
" G5 J8 ]+ j! X+ y - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' ?: A: v. U3 \" M s0 S7 s - *
9 f2 v# ~. t/ ^. X# L' d* M" s' e F - * This program is free software; you can redistribute it and/or
% a1 B) m4 ^& Z+ P$ b1 t - * modify it under the terms of the GNU General Public License as# J) }4 Z- J( K
- * published by the Free Software Foundation version 2.
. ?) ], e: b- O' b* k' R5 n- @ - *7 J) O# o2 P% z- Y [
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: y9 e! T9 Y" l; j2 X
- * kind, whether express or implied; without even the implied warranty6 W8 N2 A- u$ {! C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) y) Z: ^* o' K
- * GNU General Public License for more details.
9 s8 ^. ~8 ^) q9 Y% U0 P - */: k5 S" A5 ~0 D7 ~
- 7 I8 Z- X; t8 _. A6 ], ~
- #include <linux/module.h># U# n5 \3 d$ v V( K
- #include <linux/init.h>
1 o' ?. r% U9 a, T7 u - #include <linux/errno.h># n2 g! G0 N& {4 [' ]5 _
- #include <linux/types.h>2 M5 {5 ^4 t2 c" c( ]# M5 ~
- #include <linux/interrupt.h>2 U9 N! @ i7 o
- #include <asm/io.h>
! X$ s9 C7 m7 ?, ?4 V6 t; L - #include <linux/moduleparam.h>+ P6 B1 b3 @4 t7 W
- #include <linux/sysctl.h>4 ^3 V% p, _7 i4 C* Z5 ^& p4 q
- #include <linux/mm.h>
0 C. k3 N( D4 L& s! F: o - #include <linux/dma-mapping.h>
C8 R3 e2 u1 t2 b - : b+ {. F! [3 E/ f) t- i
- #include <mach/memory.h>- i5 I r4 R9 O$ H, }
- #include <mach/hardware.h>
% R$ f9 r* p9 O0 t& s' X - #include <mach/irqs.h>1 w5 A* _* Z$ Y! G, s6 h% ^- h
- #include <asm/hardware/edma.h>
9 @5 D' R+ `$ h" v9 v - 4 ]; i; A& u5 a) u/ g4 [2 H- I
- #undef EDMA3_DEBUG3 J& x2 ~$ U1 p* Z7 Z1 X
- /*#define EDMA3_DEBUG*/* i8 X1 I$ N& T8 p" Q
- , H, Z$ v) d+ F# h) a
- #ifdef EDMA3_DEBUG
' }- j" {- R& v - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" x( D; @ r/ Q, t' O% u
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
4 B0 P, L3 Y: {- [; ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
& l, L- ~( a7 m9 e5 K - #else0 W/ X' r5 T( |5 ?9 o& x( t% I
- #define DMA_PRINTK( x... )# {9 h* {. x" s$ A
- #define DMA_FN_IN
) q0 q" @2 T- ]0 H - #define DMA_FN_OUT
8 n0 b! h' _; o7 c9 J2 j0 @ - #endif! j) {. @# J2 K# H2 I. s/ ^
+ W+ K3 D4 j3 C3 A% [+ w" x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& l: X0 i1 @! E/ w; S
- #define STATIC_SHIFT 31 J* w. c! q. Y t
- #define TCINTEN_SHIFT 20
1 Y# l ?3 R H$ [$ p6 o - #define ITCINTEN_SHIFT 214 {' p( z M/ J+ O0 C
- #define TCCHEN_SHIFT 22' R, d- b5 C2 {: [, I
- #define ITCCHEN_SHIFT 23
% [. t: l+ c0 I4 \; \
# {% W6 t+ N2 a- static volatile int irqraised1 = 0;' n" D' C5 p2 @. K
- static volatile int irqraised2 = 0;4 z7 S% \4 c( M- O) K/ w* [! w
& A1 z% b8 q) G: w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
l9 ?4 g$ U; Q/ P& J8 ~$ f - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' m# t0 M+ R" P, f% W# Q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( t \# y( y0 B, o. L - 6 a$ ~6 B% r( x
- dma_addr_t dmaphyssrc1 = 0;
! i0 F: v7 j+ x& F% m+ @; F8 U - dma_addr_t dmaphyssrc2 = 0; R) ?1 f) R6 P/ J: `
- dma_addr_t dmaphysdest1 = 0;. X5 W2 M; ^4 G6 [- E! |2 a
- dma_addr_t dmaphysdest2 = 0;+ d! o! u- ]& j1 r) G
+ @ i0 I0 ]' H8 ~2 m$ X3 f- char *dmabufsrc1 = NULL;
2 R1 O( u' L3 z+ e9 _ - char *dmabufsrc2 = NULL;1 j+ @3 h3 Y% |* y8 ?$ `
- char *dmabufdest1 = NULL;4 l- t, [; W s& w. u3 y* H- O
- char *dmabufdest2 = NULL;* {$ {0 T/ R2 K" H
( a5 O/ d2 x' e: S% L; n- static int acnt = 512;
6 Z& ~6 ~7 m9 W- Y( u; [; p - static int bcnt = 8;6 A! d. p* [' Q: g! [
- static int ccnt = 8;
! Q: {# E' Z9 {+ ?
& k3 Z2 u7 ]( Z3 w- module_param(acnt, int, S_IRUGO);
9 @7 e! _" q! N% b6 a - module_param(bcnt, int, S_IRUGO);$ v4 ]$ P9 e' j, [3 s, b& B7 x
- module_param(ccnt, int, S_IRUGO);
复制代码
& |% F) g! Q* L5 T% [( y/ d0 E1 Q. @1 Y I6 Z8 Y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& E3 Q" O5 r2 Y0 s9 O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: }2 ^' O4 e1 E. }* x2 O 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ V5 h, a/ d2 o4 Z g" m4 j% u5 U2 E
8 Y6 s+ C4 [9 V( B; L
|
|