|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 D: D, x& K/ s7 r2 I* k
- [code]EDMA sample test application
& ^6 D, |( ^" M; S( A - /*
* a) x' E$ v+ G$ K% o" j7 h9 M - * edma_test.c
" o) K, P3 m9 N) |, P( A4 ~ - *: X3 k( L; ?/ K4 Z$ P7 M0 U
- * brief EDMA3 Test Application% h; i1 G) O {- j0 Q1 | h' L" h
- *
' c W9 o2 W, W/ k. ?- I& x$ [ - * This file contains EDMA3 Test code.) V$ E* n& t+ N' ~
- *
$ `* e0 b6 M$ J- D& X - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' w* m% C* c# B j" g0 d1 O; |1 f
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# t. `4 i* p1 _- k$ z% W# g' a1 \% f - * TO CHANGE.! T1 q9 W" q4 P: v- ^
- *1 \- r2 q* E- `4 C) p# m2 K' q( l( K
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! s) O) v; H* [5 {
- *
9 c7 B0 i% ~9 b7 W y9 M9 ] - * This program is free software; you can redistribute it and/or7 ~; q( U' q; R% v1 C
- * modify it under the terms of the GNU General Public License as
6 s2 `% |( B; w2 x! ? - * published by the Free Software Foundation version 2. |& [" f, c8 z2 y& d
- *, [/ D8 T9 w$ \+ Z3 X! H
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
5 T& ~" N9 T& j1 @9 d - * kind, whether express or implied; without even the implied warranty8 r2 ]( a8 `8 C8 q. \2 E
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
" _ y& \6 ^2 R. f& ` - * GNU General Public License for more details.
4 H/ ^' ^- L9 l/ z- D5 t) a- a$ x - */
4 c3 g) [# w+ k# P9 \+ Y* _ - ; c; w, _/ W" C& m
- #include <linux/module.h> a$ k5 P0 |6 ^
- #include <linux/init.h>3 k* h- w; l2 B) p, s3 `
- #include <linux/errno.h>
% o* p. K8 z: J# p* q" c+ I @ - #include <linux/types.h>) s- A( E/ H# @7 B1 v- M; |
- #include <linux/interrupt.h>/ d, G, G. F4 Q- c ^+ q e7 `
- #include <asm/io.h>
7 {5 V5 _& Y0 ~' h% [8 X - #include <linux/moduleparam.h>
6 r- g; Q* B: e2 J# L/ i - #include <linux/sysctl.h>
6 P- h; @. a0 p I" g/ m - #include <linux/mm.h>/ Y0 a+ J# Z2 F/ q I
- #include <linux/dma-mapping.h>
# I, T- c& S4 k3 B8 [& z, c$ g
4 L2 M8 k5 F+ u' ~! x9 z. ~) ~: S- #include <mach/memory.h>1 x8 M" V7 `6 o3 c
- #include <mach/hardware.h>
$ t* y6 S: M7 W" A - #include <mach/irqs.h>
5 V+ A2 R, N0 d: Y, }2 x9 p - #include <asm/hardware/edma.h>
9 r3 L; X: w( p/ e7 X - 3 o8 ]! ]: |; d4 L: J4 j7 n
- #undef EDMA3_DEBUG
- H, B L0 o! R. `/ @ - /*#define EDMA3_DEBUG*/. _0 M0 @* I4 B5 T
- / v# {0 {% F, B
- #ifdef EDMA3_DEBUG
& @$ K3 X7 W" R' Y - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
! j( l/ e) C1 n; r u* D8 n; Y" l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
3 B+ g) N9 d, R0 A+ V) z ^* d - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
O- P0 m- z$ K6 u( s - #else# ?: N# l8 h- g- ]& G- w" z
- #define DMA_PRINTK( x... ) r" L4 s `, B# t1 b: y/ R9 v
- #define DMA_FN_IN
# x# |7 f9 y8 [1 u. `: b - #define DMA_FN_OUT! W" O3 B5 X/ t7 W# b2 q9 B
- #endif9 E. ^- x5 b. z: Q& h' ~; @
; b$ V) K7 q, a1 f- #define MAX_DMA_TRANSFER_IN_BYTES (32768), q2 G2 I% K( b; ]$ [
- #define STATIC_SHIFT 3; m) P- R- v, d4 y: t
- #define TCINTEN_SHIFT 20
7 _* N+ O3 T; m: _9 x( J - #define ITCINTEN_SHIFT 21
1 y8 }5 J* M! d! `: T - #define TCCHEN_SHIFT 22- t9 X! w4 u7 h: b
- #define ITCCHEN_SHIFT 23* k3 h. @9 n1 ?0 J9 u* j" ]
$ D9 I! ^: Y& G7 P9 a- static volatile int irqraised1 = 0;. ^8 N; P% t/ \( u2 T+ Z
- static volatile int irqraised2 = 0;- m# g1 |. R ]! w
+ W# ^2 p0 F8 F! Q4 R: t- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 k7 `& X7 L) w+ q9 U. B( H9 ]1 N - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ D) a4 r, j4 K% }0 ^5 W# C - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \! c6 e% o( j! H
' ]$ w3 Q: i9 _9 Y x% M5 V: k- dma_addr_t dmaphyssrc1 = 0;, ~8 N7 W) y& c8 p: u4 s, n
- dma_addr_t dmaphyssrc2 = 0;
+ D$ p9 Q5 m# |2 q; S - dma_addr_t dmaphysdest1 = 0;( h+ v1 y5 \ l; \2 O4 ?% C5 K% [; U
- dma_addr_t dmaphysdest2 = 0;# Y0 c6 x# l' x
2 t t9 {5 P% o$ a1 N, ^" A- char *dmabufsrc1 = NULL;
6 p! ~9 j8 b1 ?( w* p0 i$ i! e - char *dmabufsrc2 = NULL;1 ~: B7 [( i* E* h% a5 @
- char *dmabufdest1 = NULL;( J6 _* s2 [! l! R( q
- char *dmabufdest2 = NULL;# W1 t1 v, t( J! A
2 C+ t8 j( P4 V- static int acnt = 512;9 Q, W$ N3 Q: |& y' J4 I9 p: M& R
- static int bcnt = 8;
/ u: y" s3 p/ U6 C - static int ccnt = 8;
" W4 n( H0 N0 Y - & O+ K" R& \0 n/ ?
- module_param(acnt, int, S_IRUGO);: X% i! z. A1 y0 T
- module_param(bcnt, int, S_IRUGO);& E8 t' [2 F7 N0 p/ F
- module_param(ccnt, int, S_IRUGO);
复制代码
4 V6 ~- h% V, `: p( j/ o( ~% w( s5 P! \# D% ~
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ i, G) ~, U% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 q* k( E2 h @/ p. w( X: c* j
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, c e8 [3 }# d+ R$ M) k
: H, Y7 X8 h R" j
4 z; o# L0 |# b5 ?: v, h( Y) k |
|