|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" H: t/ x9 J( ^ ^1 S9 _& F- [code]EDMA sample test application
: |2 F- X9 U1 f0 B: \2 l - /*
7 T. f7 z; B' ]9 k - * edma_test.c' z) O+ g$ t+ W1 [- p- i
- *
& N7 f8 y, F0 N: v( L - * brief EDMA3 Test Application9 [% y |# H' r; x6 [
- *" a$ L+ Z: ]% ?: ^+ [& \; }# G: p
- * This file contains EDMA3 Test code.
7 [' _" ]6 x' J0 V" U - *
# P* C" ?) w6 b& f - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
5 [/ _' {6 r! w1 ^! q P, F6 Q# G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 z& y+ _0 c+ J2 g2 ~9 w
- * TO CHANGE.
, Q4 P& I; Y7 Z% m$ i' H, z - *! g$ s1 T+ z/ R( H5 X$ L5 w
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 o' E% V ^: U) W! {& {
- *( _- L6 s: t! [: Y$ ~
- * This program is free software; you can redistribute it and/or
) [# g4 O$ T k/ u& | - * modify it under the terms of the GNU General Public License as
& ^4 T- E: D2 _: o0 S' R - * published by the Free Software Foundation version 2.0 ~3 X' T+ @# z8 |4 x" ~! t! ]
- ** V$ q% L. [, V O4 T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L7 G# R ~1 F
- * kind, whether express or implied; without even the implied warranty$ o# V: }! I* _, O* v
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the" T# e, E$ @0 O
- * GNU General Public License for more details.- ` e# e( i7 _; j; p$ f
- */
\8 S/ k5 B0 y8 `* Z
$ _' @3 V4 V# I( ]! X; q* I; t- #include <linux/module.h>
7 B8 O8 Y0 v2 c- h" Q - #include <linux/init.h>$ N& X1 e% l& j4 D+ D4 v: M
- #include <linux/errno.h>8 I# k: C* ]$ d% D5 n, x
- #include <linux/types.h>8 i2 _8 U, \& h, ?- J
- #include <linux/interrupt.h>2 G2 C q$ A+ j7 H
- #include <asm/io.h>
- F# x' q- u+ E; \8 ~7 X4 d - #include <linux/moduleparam.h>
, M: A) A, s) y3 O; |* | D - #include <linux/sysctl.h>* V+ E/ M5 ]+ W: T9 p2 B1 E, B
- #include <linux/mm.h>
5 h1 y3 L j3 S P0 A - #include <linux/dma-mapping.h>8 {4 }% a4 }, W! l* l5 L" `/ F" b4 i
# S+ r3 x. i* ?% N3 N0 y* _- #include <mach/memory.h>* L7 a% F4 D4 F. U$ d6 n" V
- #include <mach/hardware.h>4 x3 r8 V; \ ]+ P" m
- #include <mach/irqs.h> m+ A8 d- f, _& _2 g: \
- #include <asm/hardware/edma.h>. [$ q* ]2 I7 G* [
) }1 C+ {7 j- |$ {# M# h- #undef EDMA3_DEBUG0 e4 Q1 f, g" ` u
- /*#define EDMA3_DEBUG*/# Q, v1 l% U {
, e* m$ @5 V: S- #ifdef EDMA3_DEBUG
9 ^. W# s# J# V2 h) ?' \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
) n) R2 m: C1 K) \ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 w+ y, p7 m7 U3 t+ K
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& o ~; ]0 }8 a, T: o, `# v
- #else
& S z1 ^- M1 ~4 t( T* ^# E( L - #define DMA_PRINTK( x... )3 {. x, s4 X: p, p
- #define DMA_FN_IN: k7 X6 |# T. b% Z- R
- #define DMA_FN_OUT
. f+ c! v/ f5 y" }, ]5 g' C9 S - #endif
' U6 ]( {; r1 F7 a
; w/ L c# Q2 k0 n5 K- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
, t8 f+ i4 y! X/ `5 \ - #define STATIC_SHIFT 3
" \! A1 _5 N$ {4 ^- U6 f$ Z# P - #define TCINTEN_SHIFT 205 b% y5 W! ^& P' o
- #define ITCINTEN_SHIFT 21
9 m. @' [. [4 H: E6 s$ v) v5 t1 n, } - #define TCCHEN_SHIFT 22
+ L: L3 p: M- y: H0 F" ~( C - #define ITCCHEN_SHIFT 23
0 O4 m. N$ Z+ w2 Z% p& @
' L a2 Y" v# H' x* N l- static volatile int irqraised1 = 0;
8 o4 r2 d p$ t - static volatile int irqraised2 = 0;
2 f: y$ t7 u* h/ S - $ V# y' i x! [! I+ x; o
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ u. V" U# `7 F; y! e
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
1 ~$ A+ Y! u/ X# b0 Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: u/ L8 n) t# z5 D1 v( }( O+ V
. T$ ~2 }) l. c* d. M. N9 s5 p- dma_addr_t dmaphyssrc1 = 0;& W: V1 j9 @% t. W" L
- dma_addr_t dmaphyssrc2 = 0;7 {# I) n7 j L" e$ [
- dma_addr_t dmaphysdest1 = 0;" c/ {1 t. U& k) W% r0 \* V3 ?
- dma_addr_t dmaphysdest2 = 0;
2 v8 G+ r( u+ b- _6 E6 q7 {+ i" z - 1 s* x- e! K& o7 ~+ u
- char *dmabufsrc1 = NULL;( x5 f0 c9 b3 j W# ^5 ]& x$ t
- char *dmabufsrc2 = NULL;4 k) Q( O% M7 q
- char *dmabufdest1 = NULL;
# _1 \8 b6 _4 P% ] - char *dmabufdest2 = NULL;8 p4 ]/ A' [$ S
9 n/ X1 H. B2 A" w- static int acnt = 512;
4 ?4 G. N/ x& _; r' B h. L, b - static int bcnt = 8;% E9 @9 K& E* [" b4 S7 F$ B/ y
- static int ccnt = 8;
' h" g4 G7 V; P - . v9 U* x _) k
- module_param(acnt, int, S_IRUGO);
. P& g1 C8 m2 S% I0 j - module_param(bcnt, int, S_IRUGO);7 n$ g# H, j; w" P
- module_param(ccnt, int, S_IRUGO);
复制代码 9 @4 G5 Z$ J5 P5 ]- `( s
|4 T1 X& t4 r& I8 L/ O' U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* t6 ^: S( A8 G( u/ X+ K* L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& c+ m& C4 t6 P, N4 z; I
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ N8 ]: A' B$ Z7 e5 b4 L9 j; O) K$ _- r( {' V* F# d
& k. z# j" H% V |
|