|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % A# W t, E5 L# [
- [code]EDMA sample test application
8 @, [& { X" p3 c) z# P; W - /*0 f( c9 \- c- D! [! b6 S
- * edma_test.c
$ Z1 O+ m2 `, O3 z4 J - *5 w( I: B* K( h% v2 S3 q( T
- * brief EDMA3 Test Application
. o4 a7 w% K* b( |. ~$ T3 n0 Z+ ^ - *+ G+ g1 D4 @) Z! x& }0 x. S
- * This file contains EDMA3 Test code.
! Y# `- V" q8 j4 A9 V8 W8 w - *" D$ A% ~' ?$ A/ {4 a2 z" ?
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% ], q, I0 m- B+ w6 ~* c
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! S" s% w( T# U - * TO CHANGE.1 h. l! ^$ c6 J$ d: b, I, D
- *
" n$ D7 y P6 q# \% n - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y/ Z( ~9 p9 h
- *
3 C' _* M' p# T4 M - * This program is free software; you can redistribute it and/or
7 R, w5 G4 V% W7 S$ @ - * modify it under the terms of the GNU General Public License as: I* D& E3 S. @5 m+ J! R
- * published by the Free Software Foundation version 2.; L2 j- Y8 x, {( n5 Y4 ~9 r
- *5 l3 N& t( X: t' I& L E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" `' u0 g4 {+ y- |1 O - * kind, whether express or implied; without even the implied warranty7 M- m. B7 v# u, x3 l2 m6 ?& u
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 g; r4 ]% {3 W/ K1 w4 c1 W* e" s - * GNU General Public License for more details.
7 |2 N3 l, `, m( w - */( k( n2 X% d2 U4 B5 a
; ~# s7 u8 s5 v8 J: h# D6 E- #include <linux/module.h>
, S8 ^0 ^2 y' n: Z' c - #include <linux/init.h>
) l+ c8 {# f& J+ e& \0 U - #include <linux/errno.h>! y4 E! V" n5 B6 O" r
- #include <linux/types.h>
0 W0 p- x( r5 M* R8 r9 t - #include <linux/interrupt.h>8 P/ Z, {7 k* i
- #include <asm/io.h>" D0 x; f) x7 t
- #include <linux/moduleparam.h>! e+ Z0 G3 `1 o3 S% r1 m; O0 N
- #include <linux/sysctl.h>
; O, z' m; f# a; U# L9 D - #include <linux/mm.h>
. _0 \4 J2 o) V, D; n& u( ?3 M - #include <linux/dma-mapping.h>" B( g# N: }! v. |9 ?
, X8 I2 ]1 Z' P5 N9 y! @5 ?- #include <mach/memory.h>
+ a# g0 ~: e1 ^& D M' i4 e - #include <mach/hardware.h>
, H' C; R/ [* H( ]' c) T - #include <mach/irqs.h>' b$ E! t8 D; {9 h7 b( A
- #include <asm/hardware/edma.h>* O6 {$ d3 f5 Q2 T" N) v
- 4 U/ p% ^$ E0 D7 y6 ]/ }
- #undef EDMA3_DEBUG" Q+ O9 k* Q- c1 Q: O+ b% g
- /*#define EDMA3_DEBUG*/' e& v9 e" R: F; z# y+ Y- F
- , g4 a+ {8 O! ]! E
- #ifdef EDMA3_DEBUG
# W) ^2 y% q' C/ p. C* t" o- j2 y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 `% k3 x2 [" c+ ^6 ^4 W7 Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* ?$ Q! z% C2 x" B- T0 \" E
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 E: O5 P: z6 i: N - #else* B8 ?. A1 P7 U& a' d: q" m1 i0 f% i
- #define DMA_PRINTK( x... )# M4 H$ Y) _' _$ t7 K4 W
- #define DMA_FN_IN
- X3 }' x: [$ C' K/ m* S* Z - #define DMA_FN_OUT
6 K$ {7 |6 n Z+ a$ g - #endif- S; e H, ^3 ?+ ~2 Y
- 8 P! n! K3 E4 J* R
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! M& E8 X- n4 s5 x. w' L* @3 y7 o
- #define STATIC_SHIFT 3# s& e9 ]* w& ?( y# C/ F% @
- #define TCINTEN_SHIFT 20( b8 n: g" H/ W6 [% e
- #define ITCINTEN_SHIFT 212 L) { B6 g5 g
- #define TCCHEN_SHIFT 22( n' S7 H0 e; h8 y! N3 w
- #define ITCCHEN_SHIFT 23
2 T4 E$ G2 H$ n8 x; p# [/ d
& h1 Y, Z g) K# h1 h- static volatile int irqraised1 = 0;
, g" k* g" Z" V) |1 s - static volatile int irqraised2 = 0;
. }& B* |* D* L$ w9 J% C
5 o' K! n; z2 Z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ o& y% p1 P/ a) j8 @
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h0 \1 D' ]) r! j3 t
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 ? c7 Q! N% d, U8 |/ Y - ) }# C; k: L/ C7 K" V3 r
- dma_addr_t dmaphyssrc1 = 0;" v O K) [) d8 i; z7 f
- dma_addr_t dmaphyssrc2 = 0;
' v# S- C. Z- \; K - dma_addr_t dmaphysdest1 = 0;; x: R# s0 f' K$ m
- dma_addr_t dmaphysdest2 = 0;
+ @1 I& h: c: F' L0 \: i8 U$ n
* E5 \3 [0 w X5 K& g' Q- char *dmabufsrc1 = NULL;
( L2 u( |- q @2 t. Y( ^1 o0 [ - char *dmabufsrc2 = NULL;
6 c( V# \4 z1 y8 i p+ N - char *dmabufdest1 = NULL;: G, Z8 K. z& ^* L8 [! r
- char *dmabufdest2 = NULL;
4 ]- J/ d, C4 r3 J! ]/ ]4 G
; R+ i% A+ J/ q+ z9 f+ o- static int acnt = 512;, Y+ r( s* }3 A: _: I7 ?! Q9 ~( U0 R
- static int bcnt = 8;$ f1 j, ?2 E/ d" ~) i. R+ D
- static int ccnt = 8;; O |. m2 f0 R" T
- 4 I( z! Q3 T+ i. S; ~* U, [
- module_param(acnt, int, S_IRUGO);. I2 i; k# Q3 m) J3 ?1 v% X& q. E
- module_param(bcnt, int, S_IRUGO);) j7 F+ L: R, m. Z R
- module_param(ccnt, int, S_IRUGO);
复制代码 # U% q8 {5 r+ P: A% K9 s* Z+ {' A
5 E# L2 F' C& u2 f8 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* s' X! Z1 z; T2 s8 ]4 Q g$ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 @( t' L" j8 U0 x" D7 F9 j8 Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 W& Y! i3 f2 `, E: R/ ]/ I( G. K" M! e8 {+ |! ^( n1 c! h
* z" {2 u$ l& j
|
|