|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 v* `& t& J* j- [code]EDMA sample test application6 u7 u. o* Q/ c& a$ o w
- /*
$ j- d5 r0 Z/ s7 T- E, f# o - * edma_test.c
: J# l! W1 y7 T9 R7 I+ r - */ J" Q1 n: K6 I6 J5 X! {" N) f' F
- * brief EDMA3 Test Application# g' u% @+ |( Q. L7 f( o7 e; m q
- *
; j0 i( v1 v; {# B5 ?$ ?2 p - * This file contains EDMA3 Test code.2 m/ K- u$ V$ H9 d
- *
( r) w2 g; a6 s* H - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 B% M+ b$ t3 r& l$ A" a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 E. U* d: K4 [! X- S - * TO CHANGE.
) K) C6 g; g" O: d' d/ e( E - *0 K9 a8 L/ ^0 j5 t+ h4 A( ~: @! B( Z2 B
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
8 v' u. F! D M# s% l7 N - *' Y: P* o) W# G: \: ?
- * This program is free software; you can redistribute it and/or
* w* v3 l. \* ?, x/ m1 b - * modify it under the terms of the GNU General Public License as
. ^# o, m7 G) y# {8 ]9 k+ |/ U - * published by the Free Software Foundation version 2.0 |) L% J( \ B) \3 m0 d" Y6 i
- *+ g j! x7 R1 r- H/ p# A
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any: @: D* o9 p9 b( C7 L' v* t+ O
- * kind, whether express or implied; without even the implied warranty
2 z9 m0 r( R7 Q' w8 b a - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( e; }5 g: {1 Z
- * GNU General Public License for more details.! J1 n- ^* m7 S% z) ^3 Q
- */0 [( ]/ p8 n6 o ]
0 u, ^6 h2 h0 b- #include <linux/module.h>
. m3 L# y ]; r - #include <linux/init.h>
. C; B! P y! V4 J# p - #include <linux/errno.h>' H9 }# k7 B% b8 [
- #include <linux/types.h>* L& O, q5 K- |( H
- #include <linux/interrupt.h>, ?- F7 x; D8 l) _$ T
- #include <asm/io.h>
) K. K& W4 c& V. _& N - #include <linux/moduleparam.h>
# V) N2 M6 T. h - #include <linux/sysctl.h>5 `# Z6 P, H8 S# K
- #include <linux/mm.h>
. r# @- d+ J1 ^, N; u - #include <linux/dma-mapping.h>2 D/ C3 G) ^; k. `# g# ?
; H/ W8 p: O, U: c4 a$ R9 `- #include <mach/memory.h>
! ^$ D! b9 A! P1 p - #include <mach/hardware.h># U' l; m( x) a, N
- #include <mach/irqs.h>' q4 ^ d+ }% q7 w. F
- #include <asm/hardware/edma.h>9 _. Z1 i R& f+ Y4 p D
3 S7 v/ _+ X- |5 a9 B! d) v+ R% c) U- #undef EDMA3_DEBUG
7 S& Q T; \% \; }& H4 ~ - /*#define EDMA3_DEBUG*/
: I9 E/ K$ F+ K) v - ; p: E! O5 n' t" Z, a0 B
- #ifdef EDMA3_DEBUG
3 t/ v9 I! f3 {" m - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 ? F$ F( l$ S( b( y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( t- p c$ b. K3 a7 y/ A/ l# h' J# {1 b - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); A4 c" O% h( U& N4 J% R
- #else. ~4 A5 {( \$ j' K" j
- #define DMA_PRINTK( x... )
7 U. q0 h$ W$ {% m5 ?* X- A - #define DMA_FN_IN
4 u. _' h+ `$ e" U3 O - #define DMA_FN_OUT
4 w/ g7 p8 g( k - #endif
8 J+ J- h: R7 x' E
/ q6 D1 x# ^4 V* e$ \7 [: U- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 a1 H$ Y6 W1 {4 q - #define STATIC_SHIFT 34 O5 m: W; W1 A6 j# W3 m
- #define TCINTEN_SHIFT 20) a$ T( D9 I, d5 ~, |! h
- #define ITCINTEN_SHIFT 219 Q4 ~+ B" _% d: C% S* i
- #define TCCHEN_SHIFT 22
# L( K' `0 f5 ]. j4 b* T3 i' R4 E/ R - #define ITCCHEN_SHIFT 235 I* m4 k6 m+ ` |! }2 P
- 5 l# P3 w1 I2 P8 m. Q
- static volatile int irqraised1 = 0;: W- G, x# y* Z: }* ]6 j; V' |
- static volatile int irqraised2 = 0;
9 y- D# C8 x% L/ ?* `& u
3 @6 i+ p% c6 w8 c0 F2 ]- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ j& ~9 _$ F0 l# b7 }" W+ ?/ K% d
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 N/ c# W! l3 G# i% D! ^ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* k' M: }, C' c% M$ x+ R' i9 l# ]1 x - ! D* B5 E4 U3 ]+ Q7 d0 p9 h
- dma_addr_t dmaphyssrc1 = 0;' o& T, i- N- K# T
- dma_addr_t dmaphyssrc2 = 0;
5 t& U# P( ~7 ^3 [0 f. u8 d - dma_addr_t dmaphysdest1 = 0;
6 k+ g$ B4 j/ ~7 C - dma_addr_t dmaphysdest2 = 0;
" @( d* S3 K* l! u: z: s3 l: d. q' \- ] - # w) s4 d( {2 }8 i' L4 |
- char *dmabufsrc1 = NULL;
- T h" O' u- s/ B n0 ^' C - char *dmabufsrc2 = NULL;( Q! d; p6 }% Y* q% Z
- char *dmabufdest1 = NULL;
: Y2 P+ q* x" `' `& x+ i, L - char *dmabufdest2 = NULL;
# w2 k9 g- }% O+ i - ( K' K {' }( k+ ^
- static int acnt = 512;5 T" `$ X3 l' V @
- static int bcnt = 8;; b2 m$ {; {5 N" k
- static int ccnt = 8;
* P) F ?# v/ J) ?2 H) T
8 D6 e1 ?0 O- @7 R- module_param(acnt, int, S_IRUGO);0 {& r: \5 V+ j6 {8 w0 u
- module_param(bcnt, int, S_IRUGO);4 q3 w. J1 \+ u4 J) Y1 ^( w$ z
- module_param(ccnt, int, S_IRUGO);
复制代码
8 G; r; T2 J6 n9 }$ d
# x: x, s2 j3 ]: z- Y 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
N# l5 k; a6 s* S- Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 T2 N1 F; F; c3 i& C, X 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ s6 @( E2 M2 B& c4 V
2 U# N2 l0 e1 m, F) ]! v6 r1 C$ ]' y" h
|
|