|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" G3 S2 H H$ S" r* C: y) q# S- [code]EDMA sample test application
9 U: s4 R, O( K9 w8 V6 r a7 | - /*/ X7 r) d4 o4 C1 H! M
- * edma_test.c; C, N! H; ~, m! r1 [
- *6 P; v7 _, }7 m6 l8 _& @: i
- * brief EDMA3 Test Application
) e9 m5 N9 l. |9 X - *
9 V: A0 {- M6 V9 W u& H0 d' i - * This file contains EDMA3 Test code.. E9 G- T l1 x: @ \) x
- *
: p4 ?9 }2 N6 y# ? - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* x7 g( x- t1 D4 X a
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
3 H* [) b2 N- O0 B( O" h, k - * TO CHANGE.
! G" y0 w- L2 q6 u. q - *
& p$ c6 h, \) x: C1 b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
/ f: p) j! H- N3 I$ } - *
- S. {4 ~0 Y' E; i7 f1 U - * This program is free software; you can redistribute it and/or( v$ r: Q' c5 p- w' z# ]
- * modify it under the terms of the GNU General Public License as
% p! Q1 u: j0 y6 V% o& N S - * published by the Free Software Foundation version 2.
) ?2 z# \9 Y0 m* w. A - *2 _2 E5 G5 P" B4 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 ?9 }+ p1 H" g( G5 s - * kind, whether express or implied; without even the implied warranty
# q# g! P8 Y( x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 ~1 N. t- w& z' F/ y ^
- * GNU General Public License for more details.
& f/ [4 E$ @- F9 | - */
3 A4 x" C% S" H+ \- P
3 s! `9 l6 p8 x' y- #include <linux/module.h>
1 E, {* O' B/ Q* b/ q. I% x# ]* I - #include <linux/init.h>
0 G' \2 q& Z$ d4 S, ] - #include <linux/errno.h>: ?' }- S9 |* d* C/ g
- #include <linux/types.h>. I/ N8 W. y. L/ \% ]4 u! {
- #include <linux/interrupt.h>
! ^* j2 F: C% t1 h R; p# v- [ - #include <asm/io.h>
1 Y/ s. ]' p) u N4 L - #include <linux/moduleparam.h>
/ B4 R9 J9 g W$ r* z - #include <linux/sysctl.h>9 `) _* H8 g* W! u: [
- #include <linux/mm.h>
2 q# I2 ?9 `& A8 C- l6 o! F$ [" e - #include <linux/dma-mapping.h>6 \) T$ v( `. T. c6 Z
( S# G8 s/ z. \ ?6 |- #include <mach/memory.h>1 ? B; p- b# i, J
- #include <mach/hardware.h>1 a) K. f0 `; S$ m, X
- #include <mach/irqs.h>
$ A2 C ]+ a) @! [: i - #include <asm/hardware/edma.h>
6 G. h/ A! D$ M' u6 O( n/ b. F% h! Q - 0 \' W; ^( T9 u! Q
- #undef EDMA3_DEBUG
) o4 V9 r. y a0 g5 f - /*#define EDMA3_DEBUG*/9 W8 s& k2 y/ @/ Z' K
- 6 V( s* Q# Y" G( [
- #ifdef EDMA3_DEBUG
; e* r" A: r4 l4 c+ b - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' G8 A, q* ?3 g) F - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
2 ?. z: b# U* m+ B( G - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); x% x& B8 ] N% n& b" w
- #else0 ]* m0 a. \2 W
- #define DMA_PRINTK( x... )2 s: r( u2 X0 t% n- r7 ^
- #define DMA_FN_IN
# R S" c" s) z" s: e, c* J - #define DMA_FN_OUT
2 n* @" k5 f5 W; ^+ @ - #endif
- f. g7 _& [# j/ _! }# Q - 6 ]( {5 I( q$ E- P9 L
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
* x2 R% e. F$ u3 b7 H n" W - #define STATIC_SHIFT 3, s J) `6 J6 F* J
- #define TCINTEN_SHIFT 20+ s( X( m9 l( X4 Y. J: d0 m
- #define ITCINTEN_SHIFT 21' \( Y0 K1 ^* v n
- #define TCCHEN_SHIFT 22
+ r! l$ R$ A2 I8 \: ~ - #define ITCCHEN_SHIFT 23 o+ a" i" O7 m$ v$ l% u- j! k+ ` |
- 4 p+ O a9 y- e9 [" Q
- static volatile int irqraised1 = 0;' Z6 m; }- T( b
- static volatile int irqraised2 = 0;( y( \; F/ v0 {) U$ X
- 6 @% ~' N5 i( I3 Q& O8 n6 j
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B3 {: f9 C4 L f; [
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ b' q3 {2 f! D# U q/ Q3 A) V - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ j X7 _( s2 d. `& I) G - ) I7 p, N! m6 N$ a
- dma_addr_t dmaphyssrc1 = 0;
3 v2 S6 z; ^) Q! f1 k- N7 T b - dma_addr_t dmaphyssrc2 = 0;
, g% ~2 N& e/ K& _0 Y" i M - dma_addr_t dmaphysdest1 = 0;
( l0 c0 X0 p( t - dma_addr_t dmaphysdest2 = 0;( `+ e* g) l" l4 k+ p$ T
- " Q8 A$ V5 m' G2 C& J
- char *dmabufsrc1 = NULL;4 R1 L+ m) M* {+ p5 d% h! S* H% Z. X
- char *dmabufsrc2 = NULL;. ^8 k2 N M4 ]+ |5 K8 C2 _
- char *dmabufdest1 = NULL;
; q: D; b$ a q/ T6 { - char *dmabufdest2 = NULL;( V% `+ i* X% _5 r
" J0 z1 g8 G& U& g7 x4 e" k: u- static int acnt = 512;, N4 b" ^3 \3 |
- static int bcnt = 8;
- l/ y0 }( D8 R3 `' [( o; I - static int ccnt = 8;* V+ D3 p$ K' P) A. ?
- * ?' k3 X1 l- A7 L
- module_param(acnt, int, S_IRUGO);
+ X. T" ^0 T8 Y - module_param(bcnt, int, S_IRUGO);
4 R9 h( q& Z; r - module_param(ccnt, int, S_IRUGO);
复制代码 ' B6 n8 m# d& Y3 K3 `
/ \; }6 s" {! i! ?
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Y9 q2 ^) A3 Y' v0 ~/ m0 j% harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# }' x$ ^( R s; C 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 V, v$ T% `: {. o; b; u
8 v7 V& ~# D- h/ G+ g$ I: r
1 W: }5 m! a3 H" i |
|