|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 W/ y3 V1 R$ V( g- [code]EDMA sample test application
% t2 p7 h& X* v) T' x3 L9 @ - /*
4 }# @! H2 R" G U - * edma_test.c8 ]: G. j+ O; r8 L# |- I
- *5 G0 _& K1 Z9 [
- * brief EDMA3 Test Application
, I$ V2 v9 h' _) J- Q% d - *
/ w& T" @* `( @ X) G5 o - * This file contains EDMA3 Test code.) ~; ]8 r9 n& B+ {5 Q
- *
; \8 b5 n3 Y2 Y* D/ W1 s8 t4 s; t; F - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
7 @9 @) j Q, n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ b. F- W/ i- R, E4 q; b - * TO CHANGE.
( y3 _7 j" i2 k( o$ s5 E- J% M" N0 } - *0 m( d& F+ o: e' f
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: i( J! e8 d& R9 e
- *3 X. k* ]/ }& ?1 d
- * This program is free software; you can redistribute it and/or' v$ Z. Z& w- e
- * modify it under the terms of the GNU General Public License as
: l* d) |; g+ w: f6 u0 J! f+ h$ | - * published by the Free Software Foundation version 2.
/ h" a0 S! f2 }' F+ k% ~0 t6 l5 ?/ l - *2 q7 q, {3 `8 {. Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ p' x3 J' ?5 \8 W2 K5 Q
- * kind, whether express or implied; without even the implied warranty+ m9 E+ |0 A1 p! _* I6 @
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the: B3 {- `' ]# U: _7 G; D9 p
- * GNU General Public License for more details.) y* Y1 U9 j% {4 [
- */2 V( S+ j/ | P! B! [
+ @/ {2 @$ V) s; g9 n! Q m! ^* l- #include <linux/module.h>
4 H4 q! X+ U$ ~ - #include <linux/init.h>
4 D: K( n4 ?7 Q% ~9 {* z4 H5 I% v& \ - #include <linux/errno.h>2 {* s! |, O: j$ `
- #include <linux/types.h>
8 ^9 P# }8 O& T! I4 c - #include <linux/interrupt.h>
# m a* q1 n+ _ - #include <asm/io.h>
9 l! M" K5 j& ` - #include <linux/moduleparam.h>) c3 m* H2 }1 ^" ]! h- g
- #include <linux/sysctl.h>
% P* o7 Y+ W1 i/ a8 X - #include <linux/mm.h>
( v- C+ V+ K4 K ^8 H# n- U - #include <linux/dma-mapping.h>
4 P% [ v2 d: ~0 X. `" ?$ B v - 8 {' {" \+ L. G- p
- #include <mach/memory.h>. Q1 f6 p% ~* v: s* m8 q
- #include <mach/hardware.h> E* K9 w) T# q- V: E( s4 z
- #include <mach/irqs.h>
1 a, V9 f, l( y/ i2 l" d/ ] - #include <asm/hardware/edma.h>
( v0 o+ a) z% }7 t - ' m$ l: Y v7 Y
- #undef EDMA3_DEBUG
6 ^7 [1 k2 E% f7 c1 n2 m, p$ b" f - /*#define EDMA3_DEBUG*/' X& y, ]2 j% X
- 3 `0 D g) j( J% _; l% O6 X9 s# v
- #ifdef EDMA3_DEBUG
" L+ @. Q( b" S$ _ - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% |* e' U8 m- {. l& C: l4 B7 z, C
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
: ^" C' L+ w# g - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( |4 ]% [( G; \
- #else
4 v: e p# O9 D- @: I" H f' M6 [ - #define DMA_PRINTK( x... )9 }2 T* b* [3 i! Z( X+ H
- #define DMA_FN_IN
2 o! w3 c: F1 J - #define DMA_FN_OUT
8 N: `) e/ C8 N) x6 ~- W8 t+ q - #endif
- ]3 y/ E8 i) z7 b- ]$ I4 `! W
! @( B+ e j7 b/ m- u/ C0 i5 g- #define MAX_DMA_TRANSFER_IN_BYTES (32768)9 L5 Z1 s* a5 B$ l% k1 G; I
- #define STATIC_SHIFT 3
9 d- q; q* Z7 p7 z! y, m - #define TCINTEN_SHIFT 20
/ F. W' _) {7 m: u: x a3 ]: c - #define ITCINTEN_SHIFT 21" F) J1 v, G2 s* i+ P" I
- #define TCCHEN_SHIFT 22) L( h [/ J# ~
- #define ITCCHEN_SHIFT 23" M w' [6 Y9 K, C3 H
9 `& c# g' [; k) q5 K% [3 e- static volatile int irqraised1 = 0;
# y3 x' p2 W, `/ l* ?2 `4 w- Y - static volatile int irqraised2 = 0;/ o$ `2 R# S& D4 O9 X
- + N/ {/ s# Q- l* h+ `' M6 ]: R4 K
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# E& _. ?7 ?6 n' ~9 q& C0 N
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ F9 ~* _8 p2 Y; s0 S+ q. Y - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 A- p& M) C. A1 w - $ L1 g5 u J# x+ O- @ K
- dma_addr_t dmaphyssrc1 = 0;( L, }+ y% P- ?5 x0 K
- dma_addr_t dmaphyssrc2 = 0;
, m- r+ L, m1 t/ F8 n - dma_addr_t dmaphysdest1 = 0;
/ W' @8 w( A9 P+ }; [6 S3 ?; K. q - dma_addr_t dmaphysdest2 = 0;- _' X0 y _5 V; h! q
$ b9 R6 R7 D4 F- char *dmabufsrc1 = NULL;( x5 y' I% x( y. W( W ~1 i6 Y
- char *dmabufsrc2 = NULL;
, x7 R) O5 d, C$ P - char *dmabufdest1 = NULL;( a+ U& u( c% |. L. ^+ l
- char *dmabufdest2 = NULL;
/ k0 O4 A, y( N0 {. ? - - x; V$ D/ F: _: S
- static int acnt = 512;
! N/ p, z0 p) S - static int bcnt = 8;
4 ~- A9 u' p4 Y# l9 d+ C3 [, L: w - static int ccnt = 8;& R N9 _# [$ v: x, A+ E
+ ]* v5 `2 ^0 N- module_param(acnt, int, S_IRUGO);- P X9 s& A- w
- module_param(bcnt, int, S_IRUGO);
3 G4 z7 ^& r: m6 v - module_param(ccnt, int, S_IRUGO);
复制代码
4 s8 H4 o) C+ t3 Y
, W, Q$ ~% k4 a5 Z; q9 t0 n# F 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) j' f6 R, i, W3 | @& x
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 K' K" y* ?) A6 _/ @
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ~( ?1 P; h1 ]9 n& U9 @5 E6 k% v0 z: J. i/ g3 T
" o: A' }* s% u5 ~5 L( L |
|