|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* K- \( U) \2 z& G1 W; d3 O- [code]EDMA sample test application: p7 [, u9 N3 E3 B' M
- /*
7 U. ^% `5 `6 n2 |7 }: W# `, M - * edma_test.c: C, G+ _# Q/ y6 V
- *
7 l3 ?/ w) u* h% A - * brief EDMA3 Test Application( s+ H7 N2 I U0 X
- *7 e1 }& N3 u6 c: D( _
- * This file contains EDMA3 Test code.
9 d5 _' _/ n1 H$ F, N - *
- E9 f1 h {+ g! } - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: C" x3 A! E( ?/ X* D
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) Q1 ]& S) l8 L3 [3 d
- * TO CHANGE.3 q- ? Y) @+ ^# s. D! F
- *
( v* Q8 S# M- u+ Q6 F; k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 b6 ?3 U! d) a9 v% k. o$ w. `
- *
3 l4 j+ t% Y8 S& h - * This program is free software; you can redistribute it and/or
6 f4 d" h9 V7 v, \4 I - * modify it under the terms of the GNU General Public License as( @$ R& X( f9 y
- * published by the Free Software Foundation version 2.
. o5 e" P# t; R: J9 H: F - *
) m8 m8 m/ M: a - * This program is distributed "as is" WITHOUT ANY WARRANTY of any( t% B" p/ H% Z
- * kind, whether express or implied; without even the implied warranty
4 Q* [: k) Q5 a9 O - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# E" Y. ~ K- G - * GNU General Public License for more details.
9 P0 P/ X* W9 z1 T; w( [ - */9 f1 w+ v9 E0 _" C$ t8 b x6 u: f) U$ M
( \8 w& X8 k7 S/ \ _6 a3 h- #include <linux/module.h>+ d _0 e! W9 P- p1 t
- #include <linux/init.h>
1 k/ Y" g1 o/ i' h( [9 w - #include <linux/errno.h>
) V5 \( a/ c# q9 ?$ w& K: p - #include <linux/types.h>
. c! Y) H) H& N! S- p+ N6 ^ - #include <linux/interrupt.h>. R4 ^; v+ k. I! A- K- [, K
- #include <asm/io.h>- w# J5 m4 X2 j7 o4 M: w* I
- #include <linux/moduleparam.h>4 m0 m; ~! q! d# e( ]0 Y
- #include <linux/sysctl.h>! k$ p9 F" P. [4 h
- #include <linux/mm.h>6 y3 l" e! E1 N
- #include <linux/dma-mapping.h>3 @1 S( T! K/ ?8 \& E- v
- + I0 B$ Y6 v9 g* D% R
- #include <mach/memory.h>7 }# _( O" B! T; P5 L4 o/ E
- #include <mach/hardware.h>8 W3 U# ^* U' n& ?
- #include <mach/irqs.h>
0 Z( @. u5 B9 X+ N. D - #include <asm/hardware/edma.h>
. |9 Y. }7 z; \. k3 ^* W, I
5 l4 b4 X$ m! I- #undef EDMA3_DEBUG6 T4 S8 L" O# ^ R6 ?
- /*#define EDMA3_DEBUG*/
4 l( ? v4 ^- \, L, J - # ^$ F1 V! K+ h6 _
- #ifdef EDMA3_DEBUG
5 ~4 l8 d5 O+ K5 i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& B. m2 e9 G; x J( y. f& M4 Q
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# ?7 K4 A( D0 F4 \- B - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& t- S; t+ r0 ^$ ^0 m$ ]
- #else
* i! D6 X, `, K - #define DMA_PRINTK( x... )7 p' ~- J" K: V G- m1 z
- #define DMA_FN_IN
2 d# ] ~& j/ Z8 j - #define DMA_FN_OUT
) t- Y/ ?( N$ K+ h! s2 {4 U: M - #endif
9 {) H. K% z7 ^. P - ; U3 U2 |1 s$ s! K: v j
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
( t6 |. J! N. J" p7 o - #define STATIC_SHIFT 3# D) ^8 D6 ^! ^3 J: R
- #define TCINTEN_SHIFT 20. g3 U8 k" i1 b1 f7 \; V" l
- #define ITCINTEN_SHIFT 219 C+ S* x8 r6 |7 y+ x" `
- #define TCCHEN_SHIFT 22
; X2 G$ W& h4 g; w: V( X7 P - #define ITCCHEN_SHIFT 23
* l6 u4 [; b3 s* S0 F* b - 9 m' U! Q$ ^. H* r: w
- static volatile int irqraised1 = 0;
! y; s' O* K& p8 b - static volatile int irqraised2 = 0;
' \4 X" J- O6 p9 U - ( D, t' M$ z* n: w
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 d+ H+ T3 v; U* L! b1 O E
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. M# y% V) Q6 Z7 J- ^; ?' Z
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V) K4 V& ~/ p6 d$ `- a" w
- 1 Y, _: g5 s7 p1 }& M
- dma_addr_t dmaphyssrc1 = 0; q0 }% n" P) o A, Q
- dma_addr_t dmaphyssrc2 = 0;
. G, Y/ I7 X$ x) z - dma_addr_t dmaphysdest1 = 0;
% p7 t1 a7 z5 @ - dma_addr_t dmaphysdest2 = 0;2 [, b! b0 s0 c# I i8 t* i
- 7 b+ J9 G7 S" l! y
- char *dmabufsrc1 = NULL;
5 L- e+ o" `3 R% S6 e - char *dmabufsrc2 = NULL;% c1 P. @5 d3 g) r
- char *dmabufdest1 = NULL;! i- ]4 s: j& y0 ~. U
- char *dmabufdest2 = NULL;
/ g+ o9 d. t5 {
2 V' A( Y# ]0 P z: ]- static int acnt = 512;
/ k$ O2 R! @& l - static int bcnt = 8;
8 {' T' s8 ^* z7 c8 J! t0 X - static int ccnt = 8;. R R0 B' n5 J
! ^9 @8 P% b6 {4 p- module_param(acnt, int, S_IRUGO);8 R+ I& N/ ~, F; n/ U
- module_param(bcnt, int, S_IRUGO);2 W6 t; B0 \4 W+ d3 Y1 R j
- module_param(ccnt, int, S_IRUGO);
复制代码
, v# F2 K' }5 d' l' K2 Q x6 V4 ^& p2 w0 e8 {
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' f3 |- k# `6 [1 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ z' v' {0 L0 L( S3 ^5 r
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 e4 s8 ~2 q) [" |4 y2 N
$ |- P' b, q T# H$ G+ f' O4 N# P! Z1 [! w0 b# K. E+ w7 n
|
|