|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. h1 X' ^ u* _& {6 H: z' M8 M- [code]EDMA sample test application) ~6 B H, n& v9 e# ?+ u' i; k. ]7 t
- /*& [/ r) M$ j0 h! e6 {2 m$ B% L
- * edma_test.c4 U$ }+ {, C+ m, y# g
- *8 a* V0 F& w: N$ a
- * brief EDMA3 Test Application
& D8 G( G: |' [( @ - *
5 X4 p+ M1 _% q, c& e0 S( }2 h - * This file contains EDMA3 Test code.( Y2 W# g6 w9 c2 \ z) s5 ^/ I
- *; t0 I2 x ?+ w8 j$ z( K
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. x" I8 r$ C6 y. E, v6 V) K2 M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ B- i' Q" V& L' K4 |+ P
- * TO CHANGE.: y- z3 I4 b- n
- *
! J+ X2 `( A& s; g) ~- `. B# Z - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 e8 K. s. C$ O9 f0 Q( }4 U; [
- *
8 v G& ^( b$ ~: [# w5 W# {. i; ^ - * This program is free software; you can redistribute it and/or' n! s' @2 z, N+ G1 I- r8 H
- * modify it under the terms of the GNU General Public License as) @# u) w; B1 ?# z. q4 V
- * published by the Free Software Foundation version 2., c1 `. g$ v2 n; S
- *
/ c( P1 Z& O& ^$ V. ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
6 ?1 z, L5 K# W& s4 ` - * kind, whether express or implied; without even the implied warranty4 Z9 `3 Y# c$ c; W) `* k
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the! j3 i8 j) x8 o$ {9 x8 k3 ?2 h
- * GNU General Public License for more details.
" r* f9 ?* k5 j5 f! N2 z8 x, t* z8 d - */0 d6 P; N: [9 i7 m9 o
- ; j5 G; P [5 ^7 r8 P {- o8 E, I
- #include <linux/module.h>
2 a/ D, f1 \' W9 s - #include <linux/init.h>
. d2 j; T- p# x2 h - #include <linux/errno.h>
1 q' ~/ W6 q- g$ r) D - #include <linux/types.h>
# O# a, t0 w- s6 p W7 }, _/ c; y - #include <linux/interrupt.h>
7 e. a! K/ B ^! x5 w. Z% b- D - #include <asm/io.h>% y* z I# e1 j1 p9 I$ m, K- x
- #include <linux/moduleparam.h>( T! L! I; ?; X+ U
- #include <linux/sysctl.h>$ I- r- N7 `2 h( H
- #include <linux/mm.h>0 {: w! x" W/ c
- #include <linux/dma-mapping.h>
( t3 s0 I0 h/ J" z0 J6 j - + ^6 `" W: U: O6 O
- #include <mach/memory.h>
1 |$ q: k( S$ Z4 D: [8 L+ d$ A - #include <mach/hardware.h>
6 J! v- y; o: p" b {1 N0 g% l& M- Y - #include <mach/irqs.h>) y- I: w$ _. T9 h
- #include <asm/hardware/edma.h>: n5 T$ R' {, e: ?
; I$ N! V" X( z. E- #undef EDMA3_DEBUG( ?; B0 D) I! t, c8 B! N
- /*#define EDMA3_DEBUG*/+ [8 c0 ~5 b2 e z |+ Y
8 k5 r) r |0 K& c# [( m- #ifdef EDMA3_DEBUG
- O' ~; }; q! E9 z; w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
3 S; w' R, x V7 F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! d: z0 [+ a7 L2 }' L/ e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* O: g- z. q e: R3 y c+ W
- #else% f7 h% i& i( G; l% @
- #define DMA_PRINTK( x... )5 P+ c u/ T8 r" y
- #define DMA_FN_IN2 N* f8 \: u# _
- #define DMA_FN_OUT
2 P1 Z+ A! h$ T1 ^7 L0 C( O - #endif1 s5 E @' B# B% q; \7 M
- ( H: z2 C& a' L* W
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 o' h/ V* J6 f/ H9 a8 Y% ~* H - #define STATIC_SHIFT 3
4 p& `0 b3 d v, _, }* P - #define TCINTEN_SHIFT 20
3 n1 g. {8 E; g. W: _ - #define ITCINTEN_SHIFT 21
) N1 K, R! M. n* K8 I8 m4 X - #define TCCHEN_SHIFT 22
4 j2 ?; g2 c! M) J# F - #define ITCCHEN_SHIFT 23
4 ?, Y2 n1 ~( S4 a! o* O; x
: j. h; }7 k3 y7 p- static volatile int irqraised1 = 0;3 m6 j$ t6 |* e3 a" m
- static volatile int irqraised2 = 0;# h6 ^' H z# o$ i+ m' t: e8 M
+ ~: D0 F. v. |! |& \- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ?# T0 J: a( d0 b; I - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; \2 T6 h6 ^, V t2 x+ ?5 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?8 `! _1 \6 U# ^- J( q, Z! u' [8 E' d
; _' {/ _9 v( w+ g+ |- dma_addr_t dmaphyssrc1 = 0;1 _' L, f; t' `# N% l
- dma_addr_t dmaphyssrc2 = 0;
! g' \! V( S3 K& j2 W+ P% a - dma_addr_t dmaphysdest1 = 0;' l" F+ M) Q9 o. ~9 u* G
- dma_addr_t dmaphysdest2 = 0;
9 z+ {: {9 p" ?+ \: S! A+ P
+ U) c' O% U3 P4 z7 a- char *dmabufsrc1 = NULL;6 p. W) v. q f8 |4 X
- char *dmabufsrc2 = NULL;2 v0 g" z, M: p
- char *dmabufdest1 = NULL;; q% s. H. b$ V0 I: n
- char *dmabufdest2 = NULL;- k. Y- O2 x: @
$ x, C& s6 K7 M/ }( C5 H {- static int acnt = 512;
) V/ V7 S3 ]( ?8 g/ G! E - static int bcnt = 8;4 R4 X' L( z% L0 v
- static int ccnt = 8;/ F5 H3 m: b4 c- o7 j6 ]. T/ r8 ^+ G
- 1 C; q" H7 b7 P e9 M% O* y5 x6 ]) m
- module_param(acnt, int, S_IRUGO);
! E4 G9 S) J2 _0 c& k - module_param(bcnt, int, S_IRUGO);; g e0 I9 @4 m4 f% d! K
- module_param(ccnt, int, S_IRUGO);
复制代码 ) a: s: l- I2 E" ]* h% ~' o: R
0 s; e& t" V, N$ j* d; G
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 ` m& d1 h, w6 m% l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 i' V; ~1 L$ Z# ?- @8 P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. M' V, v: Q, B- @3 C: f- \3 D: \, [ e `' O$ A/ B/ O
. o7 S2 ]6 h# E# D0 f
|
|