|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 N9 d3 ?/ y. ~) y
- [code]EDMA sample test application
, b# H5 ?' H4 c9 P - /*
% s" w% a2 `* A4 @ - * edma_test.c) n E. i% c A# r
- *9 T( H- e! W8 s* b3 L, ~
- * brief EDMA3 Test Application( _. C9 l" m1 _) i( N0 X% J
- *" u4 A" O) b5 j3 p/ ~2 v
- * This file contains EDMA3 Test code.
, n: h$ g# [$ I; N v5 C/ z# ~ - *
% n8 w8 M* f/ f; U$ f C - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g6 {* }- A6 M) x6 b& C8 O) z
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# f8 T% I6 h3 Y% l0 A - * TO CHANGE.: f% J0 r7 e+ t3 {* {3 b* r
- * B: q. R8 `1 k0 _( ^0 `
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
" B0 j4 t8 |3 q - *! G& z- {6 Q# H1 n
- * This program is free software; you can redistribute it and/or
' C* m& [- n3 j! t- f- s1 G - * modify it under the terms of the GNU General Public License as
2 |3 o, f" r" H8 e, M: g - * published by the Free Software Foundation version 2.. l7 j! N# I+ s) x _
- *
, e' \+ a- ]1 v |# A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any; B) S; e. `/ Y' i g) [
- * kind, whether express or implied; without even the implied warranty
1 J" @8 {! k4 H! a% d. q$ } - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the7 C! D$ o& p* Y: f! q6 W* h
- * GNU General Public License for more details.# g- V! l/ `( l ^5 u0 j, Z
- */; w! F" x6 k) a; K) b6 F# l- s
- 2 C+ I6 v! I$ j% O
- #include <linux/module.h>6 K; [5 Q8 N/ l; G
- #include <linux/init.h>
8 \$ d! |! @* _2 U - #include <linux/errno.h>$ g2 K% B: @2 E/ o
- #include <linux/types.h>& \! K6 q' d# N3 x
- #include <linux/interrupt.h>, H6 J; V3 j4 k5 Y$ l3 N
- #include <asm/io.h>3 }2 e5 P; B- e& F6 [% f) N
- #include <linux/moduleparam.h>( e& {6 |& m6 ~5 s5 k6 {6 E8 L
- #include <linux/sysctl.h>
$ f1 ?: h2 n- d9 E7 x - #include <linux/mm.h>
& i6 {. V' ~3 g4 q! C2 e/ i - #include <linux/dma-mapping.h># k0 j, A" |$ D
5 E: X& N, h: `2 S8 g9 B7 a- #include <mach/memory.h>
8 A l" \( s2 L - #include <mach/hardware.h>
+ }: ~; B; K% C) X; S* L+ M. G: V1 V - #include <mach/irqs.h>8 [% X( A3 k2 Y) y; W
- #include <asm/hardware/edma.h>; V+ Q( r( G; n
- % u# y* d" a. V- f% F
- #undef EDMA3_DEBUG2 o( M& y/ u% z- q/ E' V
- /*#define EDMA3_DEBUG*/; [% W+ c0 F" {( R' H
* X2 C0 a) w8 |; t6 V- #ifdef EDMA3_DEBUG
' y( x9 j, E" S: `2 d$ N: a - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( A# ]( |5 N4 z: @" z2 _1 X# Q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 U' s; `; D$ y& G) @2 _4 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
0 y$ g @* K0 u2 O% u4 w - #else
- [3 f" _: V# f9 Z* b$ x$ {, C - #define DMA_PRINTK( x... ): h5 O# [6 y0 L' d$ s
- #define DMA_FN_IN, R L0 g }) J( L6 ]
- #define DMA_FN_OUT
7 r9 g+ G& B k' y) n0 `/ f0 b1 u9 K - #endif+ R8 Q2 M9 |, P5 O; N5 Y S
& \* Z6 C! v& T+ ^5 y% l8 j- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
; [( ~! }9 l' z1 i% ` c# s6 s1 g/ c; l - #define STATIC_SHIFT 3% U( a. V0 x; z# O; i j" `% v4 D
- #define TCINTEN_SHIFT 20+ N: R( a8 g1 i5 J% Y
- #define ITCINTEN_SHIFT 21
, Q' `. O2 s9 A - #define TCCHEN_SHIFT 22 Q8 T9 k! U- q( f0 i; L# G( d4 Y
- #define ITCCHEN_SHIFT 23- u5 z9 Y5 [& k( v
- # ^8 B8 V3 p7 H& _
- static volatile int irqraised1 = 0;
7 F! n F3 ~4 p6 u( x( y3 k! V - static volatile int irqraised2 = 0;9 c( s3 W! G0 \( }
- v" E8 {- H4 z2 b }/ F- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 [* [8 D, r5 T& J- d$ v3 s A7 d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 u: j# U6 Q* b* Q! _* u+ i
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C) ~6 P. t/ Z( z
0 I, ^% S/ V; w0 C# \- A% y- dma_addr_t dmaphyssrc1 = 0;7 @' M E$ w- G0 x/ n2 O
- dma_addr_t dmaphyssrc2 = 0;
* G; ]1 x& q' R8 S - dma_addr_t dmaphysdest1 = 0;
' x9 F1 h: S5 K( e' \0 a - dma_addr_t dmaphysdest2 = 0;+ y& p6 o- O) y: A
- % |- Y# V; W" D
- char *dmabufsrc1 = NULL;4 G! T3 @$ Z- q% m2 y1 D$ Z
- char *dmabufsrc2 = NULL;( g8 l0 ?5 K& P7 D# r
- char *dmabufdest1 = NULL;
! |2 O- }! p$ i! H - char *dmabufdest2 = NULL;
7 Q& @' x4 E8 ^8 p. f8 T2 `( n, [
2 v# F# C. S' Z" ^. j6 j+ I- static int acnt = 512;/ n0 O% X" }' g! t; `1 o4 \
- static int bcnt = 8;! S1 t- ?6 A/ d% n3 b3 T( F6 ^
- static int ccnt = 8;3 h) t! Y5 @# l% h1 M7 L7 [" j
- 6 Z: \8 T+ I) }+ t( b$ W6 R1 b
- module_param(acnt, int, S_IRUGO);' F6 ] G, R/ X- E: E8 j
- module_param(bcnt, int, S_IRUGO); i/ V1 G) Y2 o4 B
- module_param(ccnt, int, S_IRUGO);
复制代码
8 m7 S" z7 b7 @" w1 Z5 q0 k! c( ?1 R6 E' c! L5 G8 F+ K
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r0 U W0 ]! @' o6 J+ n9 \5 j$ _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 M% b/ z+ H/ P+ V 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( z' X- P" s* G9 `0 x W+ k V" J% m* s- e6 f# a) i3 T! B& z- z
+ d% l& v- I9 N8 c& ^; Q
|
|