|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ k. x4 f* Q4 O# @8 b5 o& l5 ?3 F- [code]EDMA sample test application
, z% c. ^7 I6 f, z - /*
' H% y# S! A- y - * edma_test.c T# u+ z' F+ g4 K
- *
/ e/ {% }5 q3 r: ` - * brief EDMA3 Test Application
5 a8 e: K' d# Y" X; r - *# j# \* C. ^8 _/ U
- * This file contains EDMA3 Test code.* [ D" [8 L8 h! z; d
- * k. r0 _: n# ]$ ^- j
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- x& C9 q/ b3 m5 C3 ^; [# G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
! A; W* Q% N3 G5 `) ^ - * TO CHANGE.4 y# x' ~9 D) R+ P
- *
1 L, I8 u; R0 {9 g6 C1 t5 s! e# z' o - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
0 O$ d6 h2 Y1 M# J [ - *
8 r" |: ]- H9 j {) A4 z - * This program is free software; you can redistribute it and/or$ R* S- U/ g+ Y) h
- * modify it under the terms of the GNU General Public License as3 S. G7 t* Y0 ]7 X6 G a
- * published by the Free Software Foundation version 2.
|# h, ~8 ]3 q% n; W6 @0 P - *
7 l% h/ p' P1 Y( r) S# k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# {: R0 V2 {3 F8 a/ i* N% L1 ?
- * kind, whether express or implied; without even the implied warranty
" T- M3 x7 n6 C& ^5 r0 a' \ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- u9 p$ a+ s- ?8 Z5 S
- * GNU General Public License for more details.! S# o9 i& m3 e W5 J# f3 t
- */
" _& X8 S/ I8 F
& i3 Z9 G9 \2 r6 a3 \- #include <linux/module.h>
( |+ @2 f' A1 m8 ~( a$ k - #include <linux/init.h>
1 }5 k: V! n( {5 C( J - #include <linux/errno.h>
) f* a9 q0 I9 K, k, O6 j - #include <linux/types.h>9 K. X( k9 b$ B
- #include <linux/interrupt.h>' s7 L5 p, l; M) T" P P
- #include <asm/io.h>
% M6 ]# A/ Q4 j K - #include <linux/moduleparam.h>" C3 h& ^6 s7 |1 x
- #include <linux/sysctl.h>* O F- k' ^% K
- #include <linux/mm.h>
- e$ ]& @- {( n8 e) o8 s - #include <linux/dma-mapping.h>' I" {8 P6 B* Z- P
- / T3 D" ^2 O1 H( \6 c
- #include <mach/memory.h>
" H9 q" Z; @1 d; [ - #include <mach/hardware.h>
3 }) ?: l2 B; r5 M" Y - #include <mach/irqs.h>9 C, k+ T( W" F( H
- #include <asm/hardware/edma.h>
) h- E# R+ Z. ]3 l3 J/ ^3 E0 `
6 n# f& _# s1 P9 v- r- #undef EDMA3_DEBUG
# ~, T w- h2 {4 Z: A3 m - /*#define EDMA3_DEBUG*/
/ V9 e4 i4 N5 d6 G2 [4 S. p - & A# d! Q0 m, `/ o
- #ifdef EDMA3_DEBUG* U/ G1 E% g/ D" ^+ _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' z% q: V8 i' w9 o; W3 A - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
8 Z( M4 U7 [. h. C/ w4 M% e - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ k! e. e5 x. N" _# S7 K" H - #else8 |# Z3 @! `5 g2 v/ w# ]! ^5 a
- #define DMA_PRINTK( x... )
( {% T- c$ S7 @1 C: a - #define DMA_FN_IN
2 \ N% G+ `) z& d1 X3 } - #define DMA_FN_OUT
4 L/ F$ v# {9 `- L1 ] - #endif. [ |2 D; i$ ?
6 \4 U- f0 }& Z. p- #define MAX_DMA_TRANSFER_IN_BYTES (32768)" O* q8 U1 L+ A g$ i
- #define STATIC_SHIFT 31 Q) \8 \. j6 T
- #define TCINTEN_SHIFT 204 K) d' u$ T7 s, a, ?8 i( r
- #define ITCINTEN_SHIFT 21, O5 K( R4 s' n4 j3 Z# j( @) R
- #define TCCHEN_SHIFT 22
+ T- H: D0 w! M! S5 h4 A! B - #define ITCCHEN_SHIFT 23
0 _8 d/ n. _/ I, R
% N/ y& h' y6 p- static volatile int irqraised1 = 0; B. G$ c1 z8 H b! _* S
- static volatile int irqraised2 = 0;
( g7 c# a* k. V2 M! }
+ r# R6 [0 o4 M- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% \2 k6 ~8 @6 A+ E7 w0 Y6 i - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 n1 k( C- H8 x n" Z7 n9 o
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# _5 {+ ^5 E& X; B: @4 T) e
& b" Q: U: n1 ]) w$ |/ T- dma_addr_t dmaphyssrc1 = 0;
; S' c+ u" g. r - dma_addr_t dmaphyssrc2 = 0;
* |8 I. M& r l) _. P - dma_addr_t dmaphysdest1 = 0;
' T0 i/ ] m6 M( a2 _, [" e9 a6 e6 u t - dma_addr_t dmaphysdest2 = 0;/ W( [6 M' H/ h3 ]- d2 H) g
- % K$ Y% g% y' q6 {
- char *dmabufsrc1 = NULL;
/ \6 a8 \$ ` X0 h1 q+ V! m - char *dmabufsrc2 = NULL;
( J. Z/ e2 J3 G, g6 E! `0 o - char *dmabufdest1 = NULL;, i# _% o. C$ Q! S3 X
- char *dmabufdest2 = NULL;
1 X( s" u( O4 Y: Q" b; q* J. b - 0 b& W9 `$ ^1 W) f( n0 i. L
- static int acnt = 512;
& ]: [' j( u( {7 D% b( X( i( M1 M1 T - static int bcnt = 8;1 d |9 C' k$ s
- static int ccnt = 8;
: s- V( T. Y- k* L8 c/ W( i* @ - / `; b9 a7 L7 P7 G% r! q
- module_param(acnt, int, S_IRUGO);
, B( l3 f) |+ w0 x1 Q- r - module_param(bcnt, int, S_IRUGO);
# w3 d4 }8 M3 W6 ^' I- \* T8 A! _ - module_param(ccnt, int, S_IRUGO);
复制代码 & ` `% s" f. n% L2 @; c
% }0 N: K. n' D$ j# v 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 J, I) m- f6 H: q. Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! r u. F! H( g8 {* I 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, c' j# p& x, G) i/ H; y6 G+ C6 h
; |# M7 F% B i$ s$ ~7 S
) S3 {3 U/ V5 ^) |6 ~3 ~& K |
|