|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( w( ~) a0 x% d
- [code]EDMA sample test application1 m7 e1 D% |. ]: p" T) g( R
- /*
7 c; h8 H) }) J( _7 @3 k - * edma_test.c
8 t- T+ T! u8 K+ P - *
/ \, b: l) Q% b" u$ T - * brief EDMA3 Test Application- M* j, O, R0 M0 G4 S4 J
- *
% s0 f9 l4 E3 _) R! q; h9 s3 n: Q - * This file contains EDMA3 Test code." t E( o- W2 x4 W; {6 E9 a
- *
4 _+ @# E7 K/ J G+ e - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 P) T. x5 U6 T5 l' n! S3 ]
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
& n+ [; y# K7 g6 a1 L* w1 n- t - * TO CHANGE.
2 k* B( u) }; K% ` - *
* K6 P8 K" M6 w4 ]( h( V. \ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
, ?% R5 N2 y$ |5 A$ | - *% L( a1 E* U( o) e: \) x
- * This program is free software; you can redistribute it and/or" _) e" j; h1 w' x8 t# I& m/ a1 Z
- * modify it under the terms of the GNU General Public License as4 x4 A2 {& |# K% @, _$ f4 Q
- * published by the Free Software Foundation version 2.
4 N* {4 J0 X. F: t' N3 y1 _* s6 | - *+ { c* f9 W" k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
2 {0 b5 x1 j! X, L. x - * kind, whether express or implied; without even the implied warranty
% J i; u8 A r: |( n8 X3 ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the' l) O# n, r( r, @. U i
- * GNU General Public License for more details.
% X. T! M: | L# C- w8 S - */
8 i0 Q. h& [. o! Q! T7 s* f1 D
* {6 G! f$ R# V4 @4 y' K& c- #include <linux/module.h>3 _' T2 A% H) J( J" q( V" a/ t0 m
- #include <linux/init.h>+ F6 T2 O) j% k7 M5 ~( N }
- #include <linux/errno.h>+ v$ j/ C9 U1 E
- #include <linux/types.h>$ g% ?; k' E' f9 j- p5 l) e
- #include <linux/interrupt.h>4 g9 m$ u7 S, @' N/ |2 a
- #include <asm/io.h>- A( U( F; d8 K# y; A/ ?- J% f* B7 h
- #include <linux/moduleparam.h>5 @% {. L7 L4 A, `1 c& t# v2 {1 e
- #include <linux/sysctl.h>
* M, E' e! M: g" M5 m - #include <linux/mm.h>3 T3 J" g* M6 E; G8 B4 p6 _! t4 H
- #include <linux/dma-mapping.h>/ ^% m& p9 A# g$ ^' p" {7 |
% [5 B7 x* O: Q1 Y# ]- q- #include <mach/memory.h>
' e" t* f0 Y# a# D- {8 C- [1 u3 d% i - #include <mach/hardware.h>
+ l' ^) t4 k T1 T - #include <mach/irqs.h>! a; U4 P. p' c
- #include <asm/hardware/edma.h>
/ d& M3 J& u+ [2 n* z% T! `7 g8 k - ( [) P5 q" s# n- @) ]! }& Z$ F
- #undef EDMA3_DEBUG
+ h7 d: x9 \# ` - /*#define EDMA3_DEBUG*/# F0 g$ x& q4 v3 Q3 K* p& {1 _
- , G( l6 N/ T# o; ^& [) Y! K
- #ifdef EDMA3_DEBUG
5 Q5 Q7 ~7 v: h3 S# U# z7 `; O U - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
/ A! \) Y: @9 B; C4 a1 Z - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ w! A, Z2 V7 q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
3 O1 m$ ]. @* m% ~) A - #else
" R; Y; d* u& B, j$ m; A - #define DMA_PRINTK( x... ): \. E+ {! Q+ R }) t7 l4 I7 ~6 \: |
- #define DMA_FN_IN m* R* e& s$ U* M: `% o
- #define DMA_FN_OUT
/ m) d4 \9 |1 ]5 |& _7 S! w - #endif
& a2 P3 y M2 @ - ! ?" T3 f& k3 q
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
) l U) Z- @* F; J: }3 J/ m) d - #define STATIC_SHIFT 3* L y3 E# Y5 ^
- #define TCINTEN_SHIFT 207 A/ v+ n+ W4 A$ o* ^3 N
- #define ITCINTEN_SHIFT 21
: U/ ]9 }8 N' d9 @: D, j7 i - #define TCCHEN_SHIFT 22$ z( y% L9 {; t0 U2 B) J$ w; R& m. W
- #define ITCCHEN_SHIFT 237 A6 o7 I- t: S, `* K
- ( z0 z6 ?% b, G9 Q9 _- i+ q, `+ F
- static volatile int irqraised1 = 0;) \, d) s' P& w% B) v% y
- static volatile int irqraised2 = 0; J; }' w, x* l
" d( f1 f/ V0 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: b8 @* ~7 u/ H4 F$ x/ {3 K/ |! h - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 i1 S0 L0 V$ o; t: I7 J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: w9 w& w- ~, V; q# i2 [5 b - : d! l' P4 I( J
- dma_addr_t dmaphyssrc1 = 0;: u* \- [& {2 Q9 E, o
- dma_addr_t dmaphyssrc2 = 0;: D* l3 ?; l$ ~) E# G2 q
- dma_addr_t dmaphysdest1 = 0;
5 a/ o2 `. i4 @/ m - dma_addr_t dmaphysdest2 = 0;
. G! {; _+ f( T6 R8 |. ?* A - W3 O9 V2 F$ Y% C$ r2 s
- char *dmabufsrc1 = NULL; D' j- `- `' U4 \; ?' Z2 f
- char *dmabufsrc2 = NULL;8 o2 [" o- |9 }- L9 r
- char *dmabufdest1 = NULL;
9 ]" }- g D/ ^ - char *dmabufdest2 = NULL;, n+ _: x% f& M
8 e* C9 E0 R# k- static int acnt = 512;0 u: x: X* t, T
- static int bcnt = 8;
3 e& M; {6 L' o. F - static int ccnt = 8;2 L6 ]) q& W) U$ n; q \7 ^/ e
5 L/ \, \( |5 z# B6 `' @- module_param(acnt, int, S_IRUGO);- D$ m& H+ }# r- M: V: Q# E% R
- module_param(bcnt, int, S_IRUGO);- e5 s/ f3 `) @" Z& w" O
- module_param(ccnt, int, S_IRUGO);
复制代码
* q9 K+ {/ V, B l7 D% ]* T: B1 t9 n4 G4 p) D
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 R" @3 b# z1 x6 v, F6 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
|5 J0 C5 @# f$ A- i 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 W& X% |0 `2 d' k( t9 R
$ Q, O+ V. i! Y! E# {5 \$ x% ?
, |$ }' \* y: @" \3 D, e/ S |
|