|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 P* \/ H0 l! z
- [code]EDMA sample test application
) U* d% q8 e+ F$ a$ U5 f, { - /*
) l' A& M7 S ?4 L H. ^* T - * edma_test.c
; W* N% P+ b b5 a - *' @8 S1 Y8 V2 @ @# c% d
- * brief EDMA3 Test Application
9 X1 g. m* [ B+ K+ }6 p0 P - *
) `8 n- l% j8 @- o/ J - * This file contains EDMA3 Test code.4 [( K* P0 j* }% Q1 |% h; f
- *
- x0 i, c& t; Q1 { - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: g$ A7 z; v! {# m6 r8 ~; N - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 m/ n! ~7 z4 H( P- b. r
- * TO CHANGE.& @ E# { A. `. \7 Z
- *
0 N% _ `* M3 T. j - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 t; @! s' e; |9 q1 o& a1 t. ]& I
- *) H+ [& R- g( i3 o% M/ h
- * This program is free software; you can redistribute it and/or; ?% _) z1 C! O+ U! J. G
- * modify it under the terms of the GNU General Public License as1 r: a7 I2 h, e: Y
- * published by the Free Software Foundation version 2." @0 \7 r: U* v/ P
- *
" U! y: i7 U( p3 Q- c; V& A - * This program is distributed "as is" WITHOUT ANY WARRANTY of any& P4 i! x( ^/ ~% P! K- E
- * kind, whether express or implied; without even the implied warranty
- B; I- y6 Y9 G$ I - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the% t9 i; ~6 y5 d* w9 \) D1 f( O
- * GNU General Public License for more details.5 t2 C7 ` ]' q! S
- */
$ b5 l4 W7 K3 }- f - ) a V+ p- P3 @% K
- #include <linux/module.h>
/ r: i7 P5 C4 G! h0 O6 M - #include <linux/init.h> p! F6 b$ T' c
- #include <linux/errno.h>
7 }: J* E" o/ R' w, i7 g - #include <linux/types.h>
* C6 L5 ~5 {; d% X, L, Z9 C+ |0 ^ - #include <linux/interrupt.h>! x# Q7 O. z8 c, o8 l! Z$ V4 n
- #include <asm/io.h>
3 H; i( N }5 U: S: k - #include <linux/moduleparam.h>
! b# R; i( K* x" Z% d* G - #include <linux/sysctl.h>
3 H. K% J8 V( G! | - #include <linux/mm.h>
; X% y" t' ^) d4 D' l9 P - #include <linux/dma-mapping.h>$ b) x8 x' o: ]& Y9 E* v
0 V6 [$ R3 @& }# H! _2 }' @- #include <mach/memory.h>; B! i4 e+ v* Y
- #include <mach/hardware.h>
: [, ]3 |6 \, `* [/ C6 O - #include <mach/irqs.h>
8 y8 G! A' d3 N! a; Y4 k6 B+ \5 } - #include <asm/hardware/edma.h>8 _. ~: F2 ` w( J& Z
- ; A, Q/ S3 V7 Q
- #undef EDMA3_DEBUG2 s& k; A! a& M# ~# a- d* P! u% O8 B
- /*#define EDMA3_DEBUG*/
+ b' U, b5 R4 I; z5 _# `, Z2 X - , g! c1 y: G2 b6 P1 i
- #ifdef EDMA3_DEBUG" N" u0 W9 K8 F$ e4 G/ g0 E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* ]! c5 T2 o e4 F7 N* U8 F5 Q: V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
' y5 L! y) a3 }- A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
h! ^8 ^% l, d# O! L, s* p - #else
: S5 U$ J; M1 x1 {/ o' T( r - #define DMA_PRINTK( x... )
8 |) a7 Z- d% I - #define DMA_FN_IN, d7 a# x& P2 V8 E
- #define DMA_FN_OUT5 L: U3 J( N- ~$ f9 d; K" Q0 u$ P
- #endif
3 S% A& T' H; u" m X
9 n6 Q/ m0 T5 D0 U. _! K8 I7 W- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* J6 F2 x2 d6 ~# e1 Y& Y
- #define STATIC_SHIFT 3. A: `- H( L4 k1 M: b
- #define TCINTEN_SHIFT 20( n7 p% W8 }! P: `
- #define ITCINTEN_SHIFT 21
' p+ Y7 U; f3 N: A+ ~) h - #define TCCHEN_SHIFT 229 ]. n6 Q8 N6 O/ }/ V7 g
- #define ITCCHEN_SHIFT 23
1 J5 t, C0 q9 j& O
/ @! F, D3 t6 f/ o6 c( w% R- static volatile int irqraised1 = 0;
! m5 }1 T. G, Z3 c5 i( G - static volatile int irqraised2 = 0;6 R' G1 D, n4 O& ?/ Z6 k3 e9 r
- . b+ v% S$ c; p3 Z4 k
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ D7 k7 A0 ~+ a% ^ L- G- u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# Z/ B3 k* ]+ @& M, Q - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! e" }2 t7 @$ A T2 k; t1 N
3 D# v% K- x/ _* P% _! G- dma_addr_t dmaphyssrc1 = 0;
$ f- A5 g8 Y: u5 _* s# ] - dma_addr_t dmaphyssrc2 = 0;3 p! m. |$ ]) ]$ R
- dma_addr_t dmaphysdest1 = 0;, A# w5 P! J* [0 ?
- dma_addr_t dmaphysdest2 = 0;* C* @4 P# V# `: J3 _
- $ V8 r# S% @" Z' k* R, Q- I: u7 v
- char *dmabufsrc1 = NULL;2 L$ c- [* F0 U2 A
- char *dmabufsrc2 = NULL;5 N# G" j3 C1 @7 C( `2 U: F
- char *dmabufdest1 = NULL;
) J0 k( v1 b8 \ - char *dmabufdest2 = NULL;
% q/ i, S7 @2 k. h, u& k2 X1 i - 4 |5 A+ J& H1 _7 i
- static int acnt = 512;
. g# k0 X7 m/ o" F! i _4 }8 V - static int bcnt = 8;. n2 o3 B' M% G5 @5 g4 z6 c
- static int ccnt = 8;2 \3 w8 E) n! r {
- : z! C K U* i4 n! M8 u
- module_param(acnt, int, S_IRUGO);% {# k- C$ k( ^; h) W& [9 x; M
- module_param(bcnt, int, S_IRUGO);
) _7 S6 \+ e% U: Q5 G - module_param(ccnt, int, S_IRUGO);
复制代码 \3 d# y9 O7 U% E1 W
% I2 v0 `+ r# N9 D9 \ 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 V; }! F9 C0 M: b! [" N+ l0 W; ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( D M8 ~) I9 t& D; N 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) Q2 c3 H) L) j+ f B! z2 n
# }3 Z$ i! g3 r+ z+ m t0 z; y4 g3 E* g3 x
|
|