|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ q' V1 J% y! q) z; X6 R- [code]EDMA sample test application
3 _1 Y) E: O5 Z( P0 W9 k - /*
9 C0 Y' S& q4 _& { - * edma_test.c
9 H, S# q n. D% D6 C - *
O4 j5 b. E5 u9 a9 l7 J - * brief EDMA3 Test Application
) x. V. w- H* } - *, e( _/ H2 Q) T" \, _4 {# O3 t
- * This file contains EDMA3 Test code.
4 a9 r( Y* O. {$ |/ Q+ D - *
4 s9 p1 M; W6 U" g. ]* R - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 z( a3 X" x* M
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: i: V, K# I3 T7 I8 ]
- * TO CHANGE.
1 G/ |: L! D: }7 j" w8 H( [+ Y - *
7 H' h U0 p- ~4 ]+ s - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* u# z% }3 j& c/ r& f2 @
- *& N ?+ ^2 W& Y$ t
- * This program is free software; you can redistribute it and/or) A/ x/ X" Q& t: U8 ?. M" J
- * modify it under the terms of the GNU General Public License as
& T. e: j; Z" W" Z; [' s; t - * published by the Free Software Foundation version 2.
6 z2 G# ~- A) `9 U$ C+ `5 W2 U' E# z - *
3 @; o C8 T0 c& m6 F( G - * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ V# d. p: `/ l! F7 S* N
- * kind, whether express or implied; without even the implied warranty% D' F6 B" P) I! {: Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 z, z2 f, ^# }% X- U. ]/ { - * GNU General Public License for more details.
; p& c" ?- W& k4 a0 c% B - */
7 ?4 w! R1 N1 k+ Y - 9 P+ {+ [, M" v% y! E) {
- #include <linux/module.h>
& l0 k: l1 z$ v, D - #include <linux/init.h>( ]/ c v: e5 L2 h: U% X' r
- #include <linux/errno.h>7 L0 S1 i9 m$ Y5 l3 @
- #include <linux/types.h> o0 d _$ R0 u& Q3 v; N
- #include <linux/interrupt.h>7 a; t5 x- v% @% Y5 i4 q
- #include <asm/io.h>
* F- e0 e- L, { h( ]% m$ T - #include <linux/moduleparam.h>2 q$ ~! \7 r; x/ D
- #include <linux/sysctl.h>" d+ p# I; z: \' I+ r/ p ~
- #include <linux/mm.h>
" ^; B7 Y( Q0 ]6 U' k - #include <linux/dma-mapping.h>
) V2 q& w0 R P9 ]! z - 6 U) q3 `* h1 M$ M: a9 Y
- #include <mach/memory.h># ^. }( w! D) _& S6 j
- #include <mach/hardware.h>
( H! n# L- I" b" S - #include <mach/irqs.h>
8 P, i$ r3 l' [- r. @5 ]7 x: J - #include <asm/hardware/edma.h>
0 B& B8 N8 @" @1 R; [& K* d - % E9 s) _; K: T! D/ D
- #undef EDMA3_DEBUG S! A0 d7 }5 X4 P
- /*#define EDMA3_DEBUG*/
2 e5 D3 p1 {" g2 {4 \ - , H3 i9 b3 T; C- C( C) ]: _
- #ifdef EDMA3_DEBUG. i; j, y2 Z( W
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); T$ g, x* ?* K
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% E" @; w5 \3 T. ^& R% o
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Q" v* `% d8 K ^$ D# c
- #else
! M$ \: q& G; j+ [ - #define DMA_PRINTK( x... )4 j6 ?0 r7 V& N6 F/ b5 u
- #define DMA_FN_IN
4 t% H, K K# l; d& `: K8 y3 x - #define DMA_FN_OUT2 F0 d' H% ]) @" F& o4 }% w
- #endif
* X. Y3 U& S, \$ [' t
! A0 U) r# [/ q! q8 X, q8 V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
/ I4 Y& `+ G3 P3 P - #define STATIC_SHIFT 3 H9 v% Z. S, t
- #define TCINTEN_SHIFT 20
: z2 I, N" F# Q - #define ITCINTEN_SHIFT 21
* [* I9 e! _! x9 ^$ K. T* y) J- C+ s - #define TCCHEN_SHIFT 224 ]- G4 D3 V* H- b# ]7 w
- #define ITCCHEN_SHIFT 23
( q. V) k# B6 y6 q B, v* e
# K) B5 d: X2 w2 Y" ?$ B! w- static volatile int irqraised1 = 0;8 C% v3 e" ?& R+ U% f
- static volatile int irqraised2 = 0;' p3 Y. x% l1 Y: m4 P) i, g
5 }1 ~& r0 U, Q7 {0 w/ {# y" W" Q) U- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
Q+ q* _3 G0 |" b( V5 {4 n - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 n, N* Q4 C) I. s# _
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p6 \: T, l6 c- p6 S
- K$ F) H) U8 N1 j! c" G, }- dma_addr_t dmaphyssrc1 = 0;
: z# r5 l0 Z: b. r* _; e* \ - dma_addr_t dmaphyssrc2 = 0;( w0 g& l, Z7 E! y3 h
- dma_addr_t dmaphysdest1 = 0;/ y. r- K" ?, h5 x9 q
- dma_addr_t dmaphysdest2 = 0;
: w( k6 E! K7 G# ]2 F. ~4 N$ \9 L
; \( \; |* T+ I- char *dmabufsrc1 = NULL;
6 O3 V& c% H# D3 z9 a. B) q5 ~ - char *dmabufsrc2 = NULL;$ I- |$ c$ @" u! B
- char *dmabufdest1 = NULL;
, e9 b$ w5 m. ]' X% S0 @! i - char *dmabufdest2 = NULL;
( i% K$ [& B6 I! b. c - - p$ D3 d$ Y* k
- static int acnt = 512;
, p1 M7 X6 X8 J( d - static int bcnt = 8;
) @( i* d# r1 \- p# s A" Q - static int ccnt = 8;
: ?- z( U' t" v z% u
: z( x- X ?# L' I" W7 `* b3 x- module_param(acnt, int, S_IRUGO);, @% _ u# h1 M! o
- module_param(bcnt, int, S_IRUGO);' `0 ]! w. H: k4 \ M/ `5 [
- module_param(ccnt, int, S_IRUGO);
复制代码
2 S: a8 |1 k6 f- j, p: Z% O ~8 I/ z" W2 B
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% x$ {' _ s0 ?% D8 aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( u) i+ p) B8 I" L) x1 z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. d- O7 G/ e) x3 e6 v9 }- A v: _. \' e3 i& D# u
( C0 _$ Y! ]' b- ]
|
|