|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ t! x! {$ o& Z- [code]EDMA sample test application
- p# K; Z4 i# M3 _ - /*
5 ^1 {9 U4 x; q# m2 j6 \ - * edma_test.c
2 |9 Q: C8 I* y/ _ - *
$ e. M: {9 Q0 U9 b" a3 v4 O - * brief EDMA3 Test Application
7 g7 ?: d8 h5 Q - *3 a+ n7 W4 k- s" h7 G u; ]8 \
- * This file contains EDMA3 Test code.8 ]( V2 }1 f8 F, a( }! u" T* M9 w
- *; E' C1 H5 }! a4 b4 \
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
, h# E7 n3 {/ e - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
- N2 X9 D# c+ _$ N/ s/ V/ S - * TO CHANGE.
5 q7 \! b6 M1 g- A- y - *
. {: |- u& w+ l: f' s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ c, t0 }$ V( v% N P0 y. Q3 [7 s - *5 f* ], E4 w7 a, D
- * This program is free software; you can redistribute it and/or! |9 b* J3 x; @. T/ q1 c3 I! H4 x; ]
- * modify it under the terms of the GNU General Public License as9 t, X# J" ?! q* H& h
- * published by the Free Software Foundation version 2.1 B6 T" x' O+ k2 ~3 N
- *! T7 i% d" h F7 J1 J- ~8 J) b
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any; x9 t- X' U3 X
- * kind, whether express or implied; without even the implied warranty
/ I6 g* f% V Y' A; ^ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" \( G0 E. b3 ^% g- b5 U - * GNU General Public License for more details.
6 s3 i. O) l' y - */
8 \8 G! n# q% H7 l1 i! p, O2 s
/ ~" x# @7 a) ?) b0 g# h- W1 X- #include <linux/module.h>3 S7 }7 ?# Q$ X6 h7 F: F
- #include <linux/init.h>
: Y4 {; R/ {4 b - #include <linux/errno.h>
- J4 D) R0 }# l' D$ k( v - #include <linux/types.h>* S5 i& I5 m; P. i* }
- #include <linux/interrupt.h>( ?# `9 f; d% Z4 K$ m$ }
- #include <asm/io.h>% A6 Y0 S; m2 E
- #include <linux/moduleparam.h>8 s3 W% X5 K, u, x1 ?
- #include <linux/sysctl.h>; |8 @& o; q+ W* e: [
- #include <linux/mm.h>. g m( q: z( T: [) C. _9 d2 t
- #include <linux/dma-mapping.h>
+ o" V: D2 e0 ~5 m4 k* O - ( d- f& B M, C4 g4 D; x
- #include <mach/memory.h>4 H6 \+ S B$ n9 F
- #include <mach/hardware.h>" X- x! u; w, e6 n) i/ i* B* j" {; N
- #include <mach/irqs.h>/ k7 K! R6 Y L% D
- #include <asm/hardware/edma.h>
2 C0 Z4 \: {, O# M
0 V _) A) Q0 _ `7 O2 E( ?$ A- #undef EDMA3_DEBUG" G7 @2 F% g, o( b" j
- /*#define EDMA3_DEBUG*/% u& O' O Q. K( K: t& d- V
- * E% @) P7 `+ {& Q
- #ifdef EDMA3_DEBUG
7 y6 D4 J& e1 h5 C' F - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
6 ?; `# a- Q$ s6 R2 h% e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 j* y( r& m5 \- r* ]' N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
L$ [4 T# E# o3 v4 p) x - #else# d" p7 j. R H
- #define DMA_PRINTK( x... )
$ d- f' b- N% `$ ~ - #define DMA_FN_IN
- K; h1 w2 f' e% Z, s8 U/ W5 ^" r - #define DMA_FN_OUT
7 ~6 i a* L. X3 d - #endif
$ W, I1 k/ c0 W, I/ ?8 K
4 I# g8 o. O7 H9 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)0 F1 o2 s5 ^# |6 p/ N: S5 u- F
- #define STATIC_SHIFT 3( x, a4 ^7 u, Z$ ?4 v
- #define TCINTEN_SHIFT 20
& l4 R3 W3 E) Y5 \% t) K d6 ^ - #define ITCINTEN_SHIFT 218 ?$ ^& g1 U1 }6 P
- #define TCCHEN_SHIFT 226 N: }# Z+ v9 t" w. q& |6 N
- #define ITCCHEN_SHIFT 239 R& z, O+ C; s+ X8 @) E. I' r
- 8 q- i6 V% U p. ^
- static volatile int irqraised1 = 0;
+ h: K' f0 |4 v; |: o - static volatile int irqraised2 = 0;8 E- h6 P- [' a: P
- - [6 ?3 x! T* @$ h$ h- C
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 g2 i) f, u- Y: J1 E8 \! s& \1 S
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C5 T3 z9 E1 }, j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' `# c2 s3 z, Q0 r; C
) s- [: n# r* _7 R. f% K) B g, n6 |- dma_addr_t dmaphyssrc1 = 0;5 m6 E( e7 K6 n' W& s. Q* o% D5 {2 X
- dma_addr_t dmaphyssrc2 = 0;( @8 l4 F7 x7 Q( ?+ N
- dma_addr_t dmaphysdest1 = 0;
6 @ J" d: \/ }0 u - dma_addr_t dmaphysdest2 = 0;" S3 m, X2 n x1 K4 s H
1 G* z+ G% h+ x* ?+ ~; a- char *dmabufsrc1 = NULL;
! s- h! j6 [7 f) N5 N - char *dmabufsrc2 = NULL;
+ d' I& A# X' k+ D - char *dmabufdest1 = NULL;: F+ x% ~. L* j9 o
- char *dmabufdest2 = NULL;
7 K0 z9 S5 l) |* O6 }0 K2 S( O - 7 J' m' i! M$ g! U: b3 t/ n) l0 y
- static int acnt = 512;
0 M" L$ B7 c* j/ S - static int bcnt = 8;, ?( y( R2 I5 z% z* c
- static int ccnt = 8;5 f! M3 u9 ]9 ^4 E: @
! w' I- F* z4 y- module_param(acnt, int, S_IRUGO);
# Z+ S+ s6 L+ z3 w% k4 t - module_param(bcnt, int, S_IRUGO);
2 O9 ]9 I) q }; o; @3 v% h( L - module_param(ccnt, int, S_IRUGO);
复制代码
7 s% z- w8 Z" \# l5 K) x; t& m- I
9 b! y) ?' }* r 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 R- `8 N9 @' \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ~) t5 X% X" e2 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 ^5 s7 @. p9 \% H) N4 U9 a" n! H8 R( s
# h" l2 x w* f8 @
|
|