|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 w5 o; E8 [* I- L! d- [code]EDMA sample test application' q% x1 ?( O, K4 w1 ?
- /*. n, ^" b5 L) [( _; q3 n
- * edma_test.c
) V( @6 _' s5 y* C( _ - *
( Y8 w3 T# @4 @5 y8 n: | - * brief EDMA3 Test Application
5 w* ]' }% e( S* ` - *; R: t* c1 X9 U4 R' Q# r8 q6 C
- * This file contains EDMA3 Test code.: R7 F, n8 V8 @: r8 s; @6 |
- *
. Q% l3 Z" B: |0 t, T$ g- t - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE u# m( }) }- p7 @4 x/ A# t
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ o( B8 b/ N) n# p5 u! y) [' [6 i
- * TO CHANGE.
+ D; t% y% a: g2 Y4 A. C% h - *
1 _+ ?5 h7 Y) p5 V9 q( D( Z) U - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* Z0 |* _) v& I4 Y# H: L
- *% x3 t' y5 ^3 X2 ^& @% n" P3 \
- * This program is free software; you can redistribute it and/or
0 ^% ]$ f. \5 O% m - * modify it under the terms of the GNU General Public License as
, g! R% n8 |3 s - * published by the Free Software Foundation version 2.
& ?# @6 T. D0 d9 B5 o - *% Z- r; G) m3 C7 m3 F
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: s7 ]& W1 b t( L( }& }' ]# e
- * kind, whether express or implied; without even the implied warranty
0 g3 E' @ h& x* X- d# \, m - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. O2 y. ` d/ S* p. o3 x
- * GNU General Public License for more details.
_( _- W1 s- i6 e& `, W4 w - */1 X- e4 h/ d5 {. P
3 l: s3 z. {8 T+ S- #include <linux/module.h>
e/ h& b) a6 J9 o# V9 D - #include <linux/init.h>/ F0 C6 c0 q) n- [
- #include <linux/errno.h>$ Z% H2 R" w: k% {. \: Z' N: `; f" V) k
- #include <linux/types.h>
" ~4 }- G; E' r( k/ |1 o0 u1 n' | - #include <linux/interrupt.h>' b& I0 R5 H7 g: K' Q& H
- #include <asm/io.h>
$ S( C' i% h- d/ u$ s1 D0 \. \# O - #include <linux/moduleparam.h>5 p5 g$ o$ {; I: R) V
- #include <linux/sysctl.h> ]: h ~2 B/ O' ?) a
- #include <linux/mm.h>2 W' L+ Y' D9 r( E' s- {! [
- #include <linux/dma-mapping.h>* Q8 t, S" z9 S" `
7 j) x; |) [ |$ r J- #include <mach/memory.h>2 e( T1 Z( S5 I9 R3 K* `
- #include <mach/hardware.h>
* P7 G. k4 Z" t C! _ - #include <mach/irqs.h>( N% g1 d2 T8 r1 g A
- #include <asm/hardware/edma.h>5 p- a4 a( O1 u. B3 G
- * x8 C0 z* \6 ^( X8 j
- #undef EDMA3_DEBUG- J" ^" E# x% L7 i V8 _5 _
- /*#define EDMA3_DEBUG*// Y: b# T1 U- r! Y
- / X; |+ a5 O6 ?/ e8 \& a
- #ifdef EDMA3_DEBUG
, R0 x5 G: f; t! B1 v3 \ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 s3 S! Y# q5 Q5 t; }9 J - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' v4 V% W& Q/ c
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& r5 x7 U7 W d
- #else4 ~1 p3 B2 i0 M. a i! a" k
- #define DMA_PRINTK( x... )
# x/ j0 s* K1 D# e& ? - #define DMA_FN_IN+ `% w2 B6 D5 W) T
- #define DMA_FN_OUT
5 |' w4 Z" M+ ]! J! T - #endif
+ t+ O- u2 p# a& D( ?7 _ - : U9 X, B1 `0 t3 u' g: v* b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
1 j7 `, u( X2 _" b" I, j0 a - #define STATIC_SHIFT 3" K, T4 G. W* q
- #define TCINTEN_SHIFT 202 D; l! J. ]6 r/ |" }% Z
- #define ITCINTEN_SHIFT 21
3 M. A" Y0 [4 E$ S - #define TCCHEN_SHIFT 22, Y/ H7 n1 I( A' K4 v9 Y5 F3 J
- #define ITCCHEN_SHIFT 23
$ {- v' Z* B4 a' y7 i4 k2 P
' X G6 `2 Q2 s7 D# a- static volatile int irqraised1 = 0;$ Z- r7 _3 k2 U. R
- static volatile int irqraised2 = 0;
5 O9 d& i( T9 A+ w$ N4 }8 C$ c( I - 7 D' r: g: y$ A( T4 c! b ^7 x
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: g: f' }% d& v6 G7 q
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 _2 K J4 x" } - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" {& v0 i* a7 i0 o1 ~& j5 e
6 {8 E' C- J! `+ L: z- M" a( [- dma_addr_t dmaphyssrc1 = 0;3 f8 c, U+ O7 t
- dma_addr_t dmaphyssrc2 = 0;
" v, s% O u9 p$ w - dma_addr_t dmaphysdest1 = 0;' {; u) `" T# F7 j: J
- dma_addr_t dmaphysdest2 = 0;
; V/ {/ N* y% F/ W) P9 S6 `* f& f( O; | - 8 J$ Y! W+ ?( i$ e; l
- char *dmabufsrc1 = NULL;/ }* F: p3 `+ O5 Y+ l
- char *dmabufsrc2 = NULL;( K( X* m+ x, e% B0 h1 {( X: p
- char *dmabufdest1 = NULL;0 N8 \0 D3 U* C$ h i
- char *dmabufdest2 = NULL;+ V, }9 D% a0 I3 q
- + G4 [/ ^0 _* h% S* P5 q
- static int acnt = 512;, v$ o" j8 s; z- t; {, T+ z
- static int bcnt = 8;
7 x% {9 v' S$ K9 n$ z; W - static int ccnt = 8;
* x2 {6 [: j) T5 {- @ - $ f- T0 k! R9 @5 i# y) d1 t; o
- module_param(acnt, int, S_IRUGO);
$ E/ w6 V/ p1 k$ K8 [- S6 n p - module_param(bcnt, int, S_IRUGO);, w! L, J, B' B6 L' r" ?, I: x3 _# {
- module_param(ccnt, int, S_IRUGO);
复制代码 ( F3 X' K q, Z( g% w0 _; |/ }/ [
' j7 z1 r1 u! K! }5 }9 r+ q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' K) m5 C% k3 B o% t$ P4 s2 |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ a0 Z3 \( F/ X8 E/ e7 i# q
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' l0 S' n& s* a# X7 {$ j
; h1 k$ b ?7 ~: |
3 o. H1 e, N6 ~: d; u
|
|