|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! L! f/ ^7 ]% j) g- [code]EDMA sample test application+ A1 S: P/ a; [8 F- I; K
- /*+ ~4 G& f1 U( }$ g& p4 E+ I- j; D
- * edma_test.c
, b" R/ E6 G' ]& [) S6 ] - *( |! X$ d9 ?& `% r; j2 \* q7 m# k: [7 l
- * brief EDMA3 Test Application6 O1 D/ Z. K7 F
- *7 N% B/ k; Q% J0 ]
- * This file contains EDMA3 Test code.9 }# b5 t6 Z, {5 m2 C
- *$ _- P+ W9 @9 g8 S8 d% n
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* i6 W" t# K/ S9 C" _% P/ [ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ Q* n: m% _' B; C
- * TO CHANGE.
" z* B+ ?5 L! j - *( w- U" q$ V1 V
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ V7 x K7 m' U6 o - *( i6 O& F2 F% ~0 R2 h6 P
- * This program is free software; you can redistribute it and/or1 }+ ~! t4 ^ i8 Q# t3 W
- * modify it under the terms of the GNU General Public License as2 c4 b& \2 V( X. W) x+ D; `
- * published by the Free Software Foundation version 2.5 [8 s9 p- X7 \
- *
; Y8 Y9 i# s+ f( `! T: S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any* r6 A9 g' W# _4 x3 \. q- H9 u R/ s6 W6 p
- * kind, whether express or implied; without even the implied warranty- C( F3 D, g9 D9 z% i
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
$ N( q1 g6 E0 H) s- W! G - * GNU General Public License for more details.6 C7 l' m* L' Y
- */
2 l' G U- Q8 O# @: @8 j# x) Q/ C
! M1 r) H* P, v h- #include <linux/module.h>9 e2 Z5 r( ~1 a' d% c
- #include <linux/init.h>5 T4 P0 G5 W, g: ?0 U8 o
- #include <linux/errno.h>* X- c, N/ C: B8 Y. u9 p
- #include <linux/types.h>% f' _# f( ^' r" D& u
- #include <linux/interrupt.h>2 X X* j8 q2 |/ x9 S! t0 Q
- #include <asm/io.h>
' Z( l0 X5 T$ N* t7 ?' r - #include <linux/moduleparam.h>
- ]: l; D) S: _) ?4 E - #include <linux/sysctl.h>) i6 r9 c3 K: L) c1 l: j( w/ M. g
- #include <linux/mm.h>
3 J; _3 g! i9 l7 p! `1 t' v - #include <linux/dma-mapping.h>6 C( F' {4 X! d' Z0 r
# Y) }) V9 T6 [6 a. G- #include <mach/memory.h>
7 t# M( y6 w4 B" o \2 ~ - #include <mach/hardware.h>
& N% W' R3 `) F7 B( d% n2 Q - #include <mach/irqs.h>
, B H8 k; r1 ?- T" I' A& a, @ - #include <asm/hardware/edma.h>$ E& r/ {; C. `
- 9 l+ Z- c. M: V
- #undef EDMA3_DEBUG
: y% _8 P8 N5 Q# b7 M. B9 a - /*#define EDMA3_DEBUG*/4 M! a( ~- ?! V, j5 n; ^1 n
+ R8 _# o9 h( X/ H0 c C8 a- #ifdef EDMA3_DEBUG, u( f! P: \) k6 _0 X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): v8 B3 |2 D# H3 G9 j
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
! X) i# x( D o2 d1 _# H - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
$ ^5 `& }2 A, {5 ]# ?* F* Y! Y - #else
% i& X+ v$ `2 x# e9 y - #define DMA_PRINTK( x... )
; ` W* E3 n' k5 c. u' _) [9 t - #define DMA_FN_IN
I% H/ F& [4 k, T f - #define DMA_FN_OUT9 F5 T4 a. _7 o- R- ~
- #endif
. ]9 L" B3 g5 K1 H4 ~- x2 c
' w2 @0 y r2 s- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( D5 j- {3 I. n8 |
- #define STATIC_SHIFT 35 C! q1 g1 g1 ^+ u1 b
- #define TCINTEN_SHIFT 204 D& N+ h* b0 ]; [
- #define ITCINTEN_SHIFT 218 R3 r6 m" ~/ `
- #define TCCHEN_SHIFT 22
7 e, [. T9 z e5 K+ Y, y( v6 O/ ?* v - #define ITCCHEN_SHIFT 23
( v% T1 I; ?6 f4 F8 s* I+ x v- V9 b - / G1 L8 S: U, `
- static volatile int irqraised1 = 0;
* i$ k* Q) k: a( {! h - static volatile int irqraised2 = 0;
# D) v5 X- g" c/ f% g$ _
4 I* x5 t% T9 e; @, j' N- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 x% o# o! F6 t* J. \( q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F7 g D$ M9 f0 ?
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* f$ G2 R5 f; B7 E, N9 X6 L
& L, x2 g# r# X# q4 }- dma_addr_t dmaphyssrc1 = 0;
2 f; C q7 T8 n - dma_addr_t dmaphyssrc2 = 0;
- Q7 ` f: |$ g7 k! _' ? - dma_addr_t dmaphysdest1 = 0;
S0 k( M: b& T* q: R - dma_addr_t dmaphysdest2 = 0;
& p& V3 P) U# {
. w- {: o+ _& |. Y4 f0 ]- char *dmabufsrc1 = NULL;
5 K/ M# V* K0 G0 t) s+ L' k - char *dmabufsrc2 = NULL; G2 K) w5 I S- R5 L
- char *dmabufdest1 = NULL;
$ `' q' Z" x8 g+ j* k - char *dmabufdest2 = NULL;0 `- a# ?! t4 p! M% I. B) ?. z, F- j
- $ j) m# O3 Z3 d4 ]
- static int acnt = 512;
" e0 Q! r2 ~0 F* H3 G& @) M7 X4 e - static int bcnt = 8;
# p+ F, h' k5 Y/ w( q: t4 ^# a - static int ccnt = 8;
) q) Y9 u5 e: {# T) w/ A
, x$ E- W& [) Q: G5 t k3 c- module_param(acnt, int, S_IRUGO);" B8 p, C; n/ h$ d1 [
- module_param(bcnt, int, S_IRUGO);
1 P5 V$ q" F1 P4 ?1 m. i* ]; X' F* f - module_param(ccnt, int, S_IRUGO);
复制代码
+ b8 R7 r+ Y2 X/ Z
' @# h, D2 j+ J% i7 {5 y& v+ U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; N2 q" w: L4 u$ }$ l6 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 H2 @7 E% L0 X+ J' [& _
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( I; A) X3 l G4 s% `$ ~- i' t0 e4 X* [- C) | O" Y
, M4 W+ b2 s9 {1 b |
|