|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
C- c k/ u2 I+ W) C l- [code]EDMA sample test application
* a2 p f- i5 a: O8 a: Z# i: D - /*( F9 _9 m( k* \
- * edma_test.c6 G- `1 c2 x3 x
- *$ L0 h: P# x3 I! r5 @4 U4 G
- * brief EDMA3 Test Application1 j; N/ }9 S. L
- * j% f5 i `2 e! V6 l8 r& I' G
- * This file contains EDMA3 Test code.
; `$ {9 R2 W ]6 ^2 U - *: i, F; a+ X' U" q* s& [9 V& A
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 J0 ~! e8 o; H0 M - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ m( d5 b( J& r - * TO CHANGE.
( ]% \) c% e2 v7 @ - *
7 P' E3 J0 U4 ^& s: F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
9 D, {# [4 k4 H r1 ^. ? - *8 o2 m# r6 {- h+ l( y6 M1 x$ p! t
- * This program is free software; you can redistribute it and/or
h1 f" G/ u J4 E' F2 d4 P - * modify it under the terms of the GNU General Public License as
; H d. O- M1 C" v4 \# k" B - * published by the Free Software Foundation version 2.
2 ]" q" j2 P* C; t0 l; ?. u - *5 U5 m% E# D( X( p% D2 i' z7 r
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 }0 p! V! W7 ~. ?. b& v; k
- * kind, whether express or implied; without even the implied warranty
* N4 q4 L9 e. @5 V. e" w1 f. p5 d. v - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
& ^9 A3 ~# |# {# T& e9 w - * GNU General Public License for more details.4 R) u( M+ K5 a% j9 i9 H8 Y
- */
5 } C( @' t3 m' D6 }2 A - 1 F* V( g# q3 ?9 g- A$ g! W
- #include <linux/module.h>: b* N+ r' H# S* i/ T& I) l. a
- #include <linux/init.h>/ L" J v$ @) d5 o7 _. f$ c
- #include <linux/errno.h>
/ \2 T k* K; s' v# `( U. f* g - #include <linux/types.h>! b7 s4 M# m# v0 s# y
- #include <linux/interrupt.h>" [$ t5 P+ I) P$ P$ W" x2 C
- #include <asm/io.h>9 M6 I: r6 m) \7 S# k) f, w
- #include <linux/moduleparam.h>
$ }/ }# U8 i+ w/ Q - #include <linux/sysctl.h>
, d8 ^1 ^9 a( N1 r' Z; e* N - #include <linux/mm.h>
* I3 Q; U& c2 S/ s1 T4 L5 e1 _ - #include <linux/dma-mapping.h>
6 e/ G8 Y0 q. T$ o. k0 p4 Y
- n1 m/ r* j. {! R- #include <mach/memory.h>7 I3 i. d. S2 Y9 B
- #include <mach/hardware.h>4 @6 ~+ u. `+ x3 ?5 C9 J
- #include <mach/irqs.h>
. G6 p4 x$ {" B- x. ~( p3 ^ - #include <asm/hardware/edma.h>
5 y: k4 g* Y% G' D - % q1 |. N5 U! c: _
- #undef EDMA3_DEBUG8 q9 v5 d% R" C# l% ^9 P2 f1 V
- /*#define EDMA3_DEBUG*/
) O7 q4 F( R8 h& ] - ' V3 S1 d( `" @2 h. X
- #ifdef EDMA3_DEBUG
5 x2 n; Z0 V$ L6 A - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( @6 Y" ?! c/ @ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ m$ i+ S! c+ S8 S7 x, w% k; X; t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__) u% ]+ O- h e* }5 X
- #else1 y; _' _6 n' T" F8 i2 \ y" M
- #define DMA_PRINTK( x... )5 F2 C( c6 Q- @8 t
- #define DMA_FN_IN H$ c' _5 W& F4 u% G
- #define DMA_FN_OUT
7 z7 X8 f% r2 s - #endif
) q# E B0 M0 J6 \/ Q
2 Q$ s) F- y' ~- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ r7 u9 b0 X& n! k! l - #define STATIC_SHIFT 3* ?; Q1 P0 O# R0 U/ D0 |
- #define TCINTEN_SHIFT 20
8 W- ~8 [ Q, c% Y - #define ITCINTEN_SHIFT 214 t3 s9 }6 _1 a8 Q5 D i
- #define TCCHEN_SHIFT 222 `; ]! S. b$ ^: d8 W- {# j1 s
- #define ITCCHEN_SHIFT 234 U- ]" L( x3 G K( t( l! n- w
8 R$ Q+ x% O1 \! i3 _- static volatile int irqraised1 = 0;
. z& y5 M6 ^) m( X3 P9 A, y - static volatile int irqraised2 = 0;
5 |; `+ _! V' J r9 M ^
9 N" Q* ]! r+ i! f. Y0 X9 m4 J- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) h& `5 l1 o3 j - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! p% h4 m; X9 [
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ u* y% t. j. ]
- - e1 E/ v+ B; S% r2 k# ~
- dma_addr_t dmaphyssrc1 = 0;
: S* R9 P' E V9 ]* [4 B7 @5 V - dma_addr_t dmaphyssrc2 = 0;+ E9 K, A2 G# ?
- dma_addr_t dmaphysdest1 = 0;
- ~3 |* I0 r( V5 g. T: Z& d# x - dma_addr_t dmaphysdest2 = 0;
4 p# Q3 A9 y, Y/ Q T0 H: ~
. J M' c$ ?, E$ Z- char *dmabufsrc1 = NULL;
2 \: f- l/ c& l5 @% C+ r0 l - char *dmabufsrc2 = NULL;( I1 J& C4 Q! r6 [7 ?
- char *dmabufdest1 = NULL;
$ d8 f" ]7 Z1 e0 x: @; u, c3 }; Q - char *dmabufdest2 = NULL;' [9 {: O. ^0 F. X1 z3 v; C
- * |' s% }6 a. y
- static int acnt = 512;
" P! q. M6 B Z6 K1 c# s$ e4 C - static int bcnt = 8;2 S) o. P" p# q& n0 u$ D
- static int ccnt = 8;
& c) }5 L8 d h6 R, J" w8 q
2 R' Y) ^( L* Q/ R2 v5 _- module_param(acnt, int, S_IRUGO);
3 y K3 Z* v9 o- ^ - module_param(bcnt, int, S_IRUGO);9 y( a) \( b) }7 M0 J
- module_param(ccnt, int, S_IRUGO);
复制代码 5 g H4 O: e0 k% L5 m
* r5 T- f3 _( x/ {/ L# ] 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 {$ H) r; q2 n+ Z* ?
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 `& y! P7 S* i' j/ r 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 U; w7 b# \ m: N$ n5 m
5 Z$ F3 E F. @% x1 m2 P* ?2 J; s4 R1 V( P) U4 e, ^
|
|