|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 |, q; f! w3 {* X3 f, p
- [code]EDMA sample test application+ N. i2 T8 S1 E( T2 n {$ z
- /*7 N+ r l' S# Y2 ~( Z* u6 i
- * edma_test.c, D! H* |* F8 C9 o' H: g- p2 p2 z) v
- *
* n( s& h k; @- x) W9 Y; I - * brief EDMA3 Test Application
6 @" |$ x+ \9 T- o. u* Z9 _ - *3 D9 B( b' B; f8 |3 |! _
- * This file contains EDMA3 Test code.
' D2 B U0 a* q# q- u. V - *0 A( r0 X4 Q4 \- H3 Y( M) C& s
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
" O, Z. O/ Y) o - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ u( \' G! {' [1 m. Z- P
- * TO CHANGE.
0 T& C6 @- e; b% I' a - *
: m, L/ C; n6 j% \5 T - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 i E1 x4 f: N. _% E
- *
/ T6 g$ p+ _" }9 }" B$ Y8 n0 K3 ? - * This program is free software; you can redistribute it and/or6 {! D1 b- b7 u$ J2 o9 A; F9 V
- * modify it under the terms of the GNU General Public License as
! e: Y: F0 o! I4 k$ [4 H% q - * published by the Free Software Foundation version 2.
' b* D+ O6 c! b- G% x$ f4 B; w& w, F - *. H3 w" U* u& I! Z; k
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
" b4 u0 n4 o# K* P" i. p - * kind, whether express or implied; without even the implied warranty
- D- J# |4 O, r7 ^: `" c' [/ v8 y - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 `% ~! E! F; u6 g% S9 | - * GNU General Public License for more details.5 T8 G7 Y- g, D6 c0 W( k
- */
- x1 a7 Y. T9 |- _ - 3 [# `$ X- ]# }+ S) N" q
- #include <linux/module.h>
6 P* J4 F$ D3 v4 A- q ]$ w - #include <linux/init.h>
7 Z+ r! y! J8 y2 T. V6 {; _ - #include <linux/errno.h>
6 q* ?# S- f* c9 ^' b - #include <linux/types.h>" C, ^4 o( O- [3 |" \- M. s! n
- #include <linux/interrupt.h>
, E% _# o4 C; u3 V+ M - #include <asm/io.h>
* i- U& D2 t; v - #include <linux/moduleparam.h>
/ r0 d M; s: } - #include <linux/sysctl.h>
& w* C: J# \! B( g- N - #include <linux/mm.h>
1 F. ]7 w# {1 Q7 g: w: {0 h7 S - #include <linux/dma-mapping.h>( L+ Z- u& o0 \5 w4 {; x" V* x# n
- . c0 G" n+ J6 i# T) h- W
- #include <mach/memory.h>- a7 b% F: X. K/ r
- #include <mach/hardware.h>; z+ N# O5 ^; h
- #include <mach/irqs.h>7 Z' T, v0 L$ O# y' Z
- #include <asm/hardware/edma.h># x- t, I* Z' n8 q; w) I
- ( P3 x: N* U) s, f* j$ D+ D U
- #undef EDMA3_DEBUG: O# H# U$ N5 q
- /*#define EDMA3_DEBUG*/
# A$ O4 C1 ]! V) J' ^! W/ e
: Q: k6 M$ P& _7 x" C- #ifdef EDMA3_DEBUG a3 B( W" B5 x! s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 @1 P. P/ @+ Q, Q9 z# Z* q. I
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
0 o6 y9 y" @) a8 |( X" k9 A - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); [& L# n. ^! R. j; n$ O! `! U
- #else; @4 {2 _7 p- J
- #define DMA_PRINTK( x... )3 |. ]4 P' o$ J7 t& _# O
- #define DMA_FN_IN2 n" I& p- l w2 ?; H! x m' m
- #define DMA_FN_OUT
4 q( ]* k, B: x- E5 T0 X - #endif1 T, _- E: t% W! ^) a
" ~8 s2 i9 A! X: Q2 ]+ c: S- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ k& B+ m$ j7 E: z+ T+ ~8 R - #define STATIC_SHIFT 3 w% b# G3 G; @$ J6 x
- #define TCINTEN_SHIFT 20! U; C" s1 S& e
- #define ITCINTEN_SHIFT 21
, K% I$ l+ k+ t3 O - #define TCCHEN_SHIFT 22, l0 t/ j, P! O; G2 ~
- #define ITCCHEN_SHIFT 23
! `7 t6 G& i# ^ B* [ - $ ]* O5 a/ H8 z2 m* s3 W
- static volatile int irqraised1 = 0;+ e% q5 a$ w2 W0 u: ^- Z4 V
- static volatile int irqraised2 = 0;# q& H# r! A% r w$ P0 t1 ^
- . `, B# e0 T& g
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ T" H1 y$ ?, s8 }; v g: [8 K - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ~$ p7 ?8 ^, y" j+ w$ y* X+ z5 M* q
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); W6 `4 K9 G: t, F$ U# G3 V( l
: u* v7 a' m+ A p9 s- dma_addr_t dmaphyssrc1 = 0;
+ u- w7 M/ w; }$ N - dma_addr_t dmaphyssrc2 = 0;- M( a0 s8 T, X% C X3 p* {' V
- dma_addr_t dmaphysdest1 = 0;
+ y& c. I6 Z F2 x% G3 F - dma_addr_t dmaphysdest2 = 0;
' l* S/ t# j0 t. _- b
4 `6 f% L2 l7 f5 E# s* S; n- char *dmabufsrc1 = NULL;
/ o. y0 V( i. Z - char *dmabufsrc2 = NULL;( B3 Y- J/ E, y5 R# e* N" W, s3 e9 B
- char *dmabufdest1 = NULL;6 u- [2 Z- Y; X5 t, G
- char *dmabufdest2 = NULL;" e( b, i x/ e. `
- , E. ?3 z+ B9 E1 J( b) O t9 U
- static int acnt = 512;. }1 T; y# x A* [+ h, S. d
- static int bcnt = 8;, f- A; ^. q3 D* j
- static int ccnt = 8;
: k" R: l5 D0 W
3 `: K4 q U1 _; h7 k3 k- module_param(acnt, int, S_IRUGO);
* o7 f+ L8 q; f- l( ?! D - module_param(bcnt, int, S_IRUGO);
9 a% [( X. J! `0 v$ h - module_param(ccnt, int, S_IRUGO);
复制代码
, W1 {$ N; }+ x4 e8 a3 W( Y0 c, s O6 P2 w
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& D k% Z' X& }- Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 I/ B2 F* H) F4 F: n P
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, ^9 h& U0 c( r+ u% C! S: q
% S3 h6 x5 E/ g- ]' @
: d0 c2 P% t3 Q |
|