|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U5 a. f: U$ m! l
- [code]EDMA sample test application* |. G9 G9 @# J
- /*
! m( @( @4 B4 a: b& z0 Z, e - * edma_test.c) \7 Y. j( ^0 p2 ?3 ~# N
- *
5 a% {* j5 m- [7 ? - * brief EDMA3 Test Application' v* A g- p* {! @' r! r
- *5 _6 v; g% h6 U7 n& P5 F9 M/ M
- * This file contains EDMA3 Test code.9 A% C- G! n9 S8 ?
- *, |& l; c. U$ d
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
- i4 g Z8 r1 t& Z# l& {" I - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ s; o5 `* d% T4 u4 v1 O/ n, ]& U! f
- * TO CHANGE.# @" T0 i1 d; b
- *
2 A' _: R3 _" F+ n/ ?1 m& J8 a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. q, _ i- ~8 {9 Q; v* {
- *
% [, _7 u4 x' p: A! R - * This program is free software; you can redistribute it and/or
# v% j' q8 L- H) L2 u: d - * modify it under the terms of the GNU General Public License as
) `" C7 c5 ~& x+ n* \# A* c: v6 Y - * published by the Free Software Foundation version 2.
1 h/ c# ^- G3 Q: h0 T! d! C - *, _( _/ b+ F8 J c
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }: d2 H8 P. q: q3 p
- * kind, whether express or implied; without even the implied warranty
; M6 n F& M0 f8 Y' @ - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the0 C3 \3 V0 V4 b+ q, ]5 W
- * GNU General Public License for more details.1 J6 U" k; f6 [' n
- */
! b0 [( G3 W/ y S" a! M8 \ - 9 ~# t( X8 q7 k+ J- K4 F
- #include <linux/module.h>
& }2 l! l. n/ d* t6 E2 B3 u; `2 } - #include <linux/init.h>! g7 ]; E& q4 M2 r% x2 o2 Y& `
- #include <linux/errno.h>, Z7 {7 F; q" H9 J
- #include <linux/types.h>5 y" }2 W { r, m" Z, u
- #include <linux/interrupt.h>
9 ?7 O2 J5 j* A8 k R3 j - #include <asm/io.h>
# i9 M0 O' t1 S/ K - #include <linux/moduleparam.h>
n- f7 M1 v& V - #include <linux/sysctl.h>
4 H6 @1 K% s/ C Y4 S0 C6 J - #include <linux/mm.h>
2 {9 O( X) |0 m4 g6 a9 p$ d - #include <linux/dma-mapping.h># j, L! |' _4 V. z
- $ r8 t1 B, ^, i- I, r
- #include <mach/memory.h>" s) }" n2 y8 g) j+ m
- #include <mach/hardware.h>* S8 U( o' F7 ]# P
- #include <mach/irqs.h>
5 \0 {& a6 G; u, J4 F' {5 V - #include <asm/hardware/edma.h>) R. O# Q* e" \) D) q6 o
- T5 E/ W! y9 b( a' Y- #undef EDMA3_DEBUG6 i# ?9 G& P3 B7 ]8 L& S. g& s
- /*#define EDMA3_DEBUG*/
1 H' }$ Y( N) z* q' ]3 H - 5 C( ~/ s& {9 K. Z! f0 x }
- #ifdef EDMA3_DEBUG
# O. ^- R% `( c, X9 ~& G; ]9 N - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; B' D+ K" j9 Y3 `8 k6 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# W& N7 r% r: v' a" `7 d. G; D5 Q
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- B1 @" F Y0 ]! i
- #else9 h! A* }" j& m; H" \( k3 a
- #define DMA_PRINTK( x... )+ a, S7 @; V( S" t: p* a# }9 j
- #define DMA_FN_IN# r3 f( R! i8 |: B8 X s. C
- #define DMA_FN_OUT
2 x0 K: u; C1 I# ?8 h7 ~! U - #endif& _7 e' x: x% e4 W
- ' J4 V. n+ j* A: y# x
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% q9 q' m) k. R" F: z4 `1 {: Q
- #define STATIC_SHIFT 3
" Y" q6 D$ I) |2 p - #define TCINTEN_SHIFT 20
* e( ?, F6 F& C4 d9 K; h2 z - #define ITCINTEN_SHIFT 213 e% t7 a% c4 D M1 h4 Y, i* d
- #define TCCHEN_SHIFT 22
2 f( ~: g1 d+ [8 K6 r2 w& k - #define ITCCHEN_SHIFT 232 k1 |) G( V* q" ^9 k' G
% s/ T; q7 Y D5 L, ?+ x- static volatile int irqraised1 = 0;/ {1 L/ D; ~* [ t: e* o( A
- static volatile int irqraised2 = 0;8 s/ m( R8 ?/ g0 b4 Y7 T
- 0 D2 L8 E5 q4 C) b
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]% s ]8 b3 Q2 ~$ r
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Z/ \/ m# t8 ~. M E5 X$ s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 w+ o5 Q( r; w k
( O) \+ Z6 J4 [) k4 V1 d- dma_addr_t dmaphyssrc1 = 0;
# G; M( |: z6 n) B1 R- y* v6 m - dma_addr_t dmaphyssrc2 = 0;6 V0 X+ c( e7 w. T7 ~0 l/ ^' z
- dma_addr_t dmaphysdest1 = 0;7 ~5 @0 Z; a' j0 T+ @, L
- dma_addr_t dmaphysdest2 = 0;& ~" i4 y. i! O7 f7 W" U: I m: U
, m( x, M q4 @1 `- char *dmabufsrc1 = NULL;
3 j5 I1 z% ~. ^& C& H - char *dmabufsrc2 = NULL;' w+ W" X9 W( c: }
- char *dmabufdest1 = NULL;
% ^5 F# k; N. m0 t9 S - char *dmabufdest2 = NULL;- G- Y* o% j. u- W9 ?
- 9 T8 W. H6 x# `
- static int acnt = 512;1 M4 W* @: ?: l7 v0 |" R* W7 \/ A
- static int bcnt = 8;+ S) _4 `, h2 b/ W
- static int ccnt = 8;0 ^4 ^! r, J- [+ V
9 s( Y% ~7 T3 S* |- B3 F7 v2 [- module_param(acnt, int, S_IRUGO);
2 p+ B B8 f, \ - module_param(bcnt, int, S_IRUGO);
' b8 r1 d2 k; s& Q, t% v6 a - module_param(ccnt, int, S_IRUGO);
复制代码
, I8 r4 Q, F# U/ Z, W9 n" E' g/ H0 p$ V8 T
, Q) r5 ~- \ k( n% X- M4 { 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 u* }2 Q6 k; W) R4 `! Y% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& [/ t9 F! A: E7 }/ n! _& x
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 n0 S8 p+ h/ C. W6 s
% W C1 g$ A' [/ H8 B7 A5 V9 }5 G; b" W
|
|