|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 V/ E4 F* O3 g" U# H/ ^3 O- [code]EDMA sample test application
+ R9 f; @( K0 X. q - /*( A% d s/ N0 D' b
- * edma_test.c1 C( o8 d0 ?& {& s5 V+ l" {
- *. P r0 c1 r0 b, A3 A; Y& x: m
- * brief EDMA3 Test Application
# k9 f9 R3 n# C, l+ A - *
+ G9 [0 R$ k9 o# d* ?, U) k - * This file contains EDMA3 Test code.) v5 i8 [ G- g! T5 S6 `
- * @% q4 @9 R3 I1 I5 O- t' W
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
9 J; S: N K; X" U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! T6 r& |# [$ c% H
- * TO CHANGE.+ j- J. T& m; d3 G, y
- *! ? P! F1 ?$ g0 W! u: e: n( ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* [: B! W* ]2 M, p - *$ h+ ?9 G8 d6 b( T( _4 m2 ~0 m; r
- * This program is free software; you can redistribute it and/or
4 N; e" I) K- v% P' J0 o4 |2 x - * modify it under the terms of the GNU General Public License as
1 q; R' r0 y0 n) S - * published by the Free Software Foundation version 2.: d# p9 i3 b4 n& Z+ [) c* k
- *
* ~4 ^- @. q* h8 t - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
: ~* u: @4 A/ r+ Y - * kind, whether express or implied; without even the implied warranty7 c, P+ G: ?3 Q* j
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. E# t) e& H' l - * GNU General Public License for more details.
' C6 I; }9 t9 x6 {% ?: _ - *// F4 D$ z: I% Q7 J
+ H! @; W' S/ ^- #include <linux/module.h>$ H, B8 N+ r. q, w3 N/ }) p! x9 o
- #include <linux/init.h>( ]7 s2 ?% t& e( R+ v; l( D% R
- #include <linux/errno.h>2 C6 V8 i) N" r. F8 k9 e& P
- #include <linux/types.h>6 c5 G. M3 f [) R! t$ u5 b( \( Z& u
- #include <linux/interrupt.h>8 u3 r; ^1 I) Y8 T
- #include <asm/io.h>( q9 i4 N6 F `% G" m
- #include <linux/moduleparam.h> s/ b d, Z# p
- #include <linux/sysctl.h>
; N0 s5 J9 d8 H+ ^# e6 M/ Y0 r' ~ - #include <linux/mm.h>
" V" Y0 J- R4 H - #include <linux/dma-mapping.h>$ r" G1 Q+ I' B
/ S i( t* _2 h; e+ k/ \7 o3 C- #include <mach/memory.h>0 {1 h+ K; M8 X$ g; h4 S
- #include <mach/hardware.h>
6 v% w7 c2 ~ u. U8 t0 v# c - #include <mach/irqs.h>+ y# X9 W+ f X7 `3 X8 o3 U8 h
- #include <asm/hardware/edma.h>
. l% r. ^$ |3 i% ^$ B - 5 N9 I/ O$ p V+ r5 s
- #undef EDMA3_DEBUG
# Z3 f5 ?9 m( `9 P: [! H - /*#define EDMA3_DEBUG*/
2 n. |$ f1 S9 I; l: i+ R - " s/ ^8 ~ [# `
- #ifdef EDMA3_DEBUG
: `& ~9 w1 U% c1 E/ M- K7 i/ i - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), o) |) \+ t9 ^% r* N
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
/ ^# n3 z1 M- U" L; q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: g1 n; x' h! v/ V' v8 z - #else0 W9 F* k) l0 c9 i) _
- #define DMA_PRINTK( x... )5 p/ \* G6 P8 C4 [$ J* t" a( \' F
- #define DMA_FN_IN5 `, |. o* Y0 W# g2 ^ j
- #define DMA_FN_OUT
9 p9 [* l3 S0 g* ~/ q - #endif
8 ]3 {& {3 G& o4 U. x( e
2 T" a6 X. d7 |! X3 Q- b3 n) I( z! H- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
W: l2 f- h# g5 n8 X% E6 q+ d - #define STATIC_SHIFT 33 o {! _5 F( L9 h( s1 t2 p4 y" ?
- #define TCINTEN_SHIFT 20
& `2 o+ V6 a! c6 e) E - #define ITCINTEN_SHIFT 212 i9 ]9 a/ s5 V" x
- #define TCCHEN_SHIFT 22
4 _3 o. g; s" T: ?; p7 U8 L - #define ITCCHEN_SHIFT 23( o# Y& q# h- V; E" J* v% G4 W
# M' E4 y) p @ [! N- static volatile int irqraised1 = 0;
2 X6 [2 s; g+ P; C. }0 ? - static volatile int irqraised2 = 0;: P J9 \% ?' [6 b( k
- 7 F9 B5 Z& W, Z. Q+ I ]
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 E1 X F/ C7 ^7 }1 V0 h
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
8 t) \" X: C6 n" m. b! y/ P; w/ ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! v7 v+ B) f( F$ }/ X" D - ! n: P5 g% _: o: ^
- dma_addr_t dmaphyssrc1 = 0;: J* S3 A: Y6 t. a Z3 Z
- dma_addr_t dmaphyssrc2 = 0;
' { {( G! Z6 g - dma_addr_t dmaphysdest1 = 0;7 J6 F' f6 \$ M I& c) u; R i
- dma_addr_t dmaphysdest2 = 0;) b! U/ q# i/ C) w
2 m: e1 g( \. Q2 o; @- char *dmabufsrc1 = NULL;
4 Y. w& O3 d- v! t8 @% @: |: F5 X w - char *dmabufsrc2 = NULL;
* |5 Y) U* b* Q0 n. _% h3 c* I - char *dmabufdest1 = NULL;
0 `( I, n8 p% S$ B9 j" y3 X* G - char *dmabufdest2 = NULL;+ y' A/ u: l- w1 N8 y F
- % @: v* w& K4 Q; F5 \' X
- static int acnt = 512;
7 R% z) J8 |6 B. d) L: J/ _ - static int bcnt = 8;; H& K1 O* l' M$ [2 z# [" {8 b& k& c
- static int ccnt = 8;
- ~: y _ z8 v- Z1 q& b2 ~ - / ^3 V4 T9 F! C: z
- module_param(acnt, int, S_IRUGO);) \( _7 j5 `! S4 C/ L+ {$ Y
- module_param(bcnt, int, S_IRUGO);# t# f3 m1 n0 N6 C: `5 K
- module_param(ccnt, int, S_IRUGO);
复制代码 ; }7 }! t% ~0 u/ `
% }) V0 W; q) i6 h
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) X" W; S% ]7 n( _4 a0 h) garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% h% o! w9 B' Z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 Z5 ?) m: [6 V+ J7 T. t. |
; t9 G, ~1 J. @, F) p- o) m: `% x
|
|