|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ^- d; M4 ^; d; p; T# i
- [code]EDMA sample test application
+ t. C4 P+ \0 [$ Z; h5 B" ` - /*
" O7 V. D3 b6 f% ~) K8 R* v - * edma_test.c. Y) {) o" K' Z; b
- *
! g7 h1 p* Y# W - * brief EDMA3 Test Application
8 [1 a) `1 k. ~) Y* Z" b* k$ z# U - *
# I, g. g( D: x - * This file contains EDMA3 Test code.
' E! m! T0 q/ z0 I# { - *1 b" i& @) t6 R/ U" U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
2 _! [4 E' D) f, ~) S$ o v! n - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
6 h2 V& r! L5 k& g" K# E8 `" K- Z - * TO CHANGE.3 J8 O" Z2 B! W) ^
- *
6 c) _" f B! i3 L& [: I - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. p9 R' s& W) ?. M6 ?% J! b
- *% a, W7 o# p3 n& }1 }0 t
- * This program is free software; you can redistribute it and/or
. ]: u/ e9 h/ t5 n7 D( M - * modify it under the terms of the GNU General Public License as
0 e2 c7 ~8 k/ }4 M% [( R - * published by the Free Software Foundation version 2./ I; n! Z* H; t
- *0 Z" \6 C" g4 i3 |$ F: E
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 d& p N4 K0 I# G; S - * kind, whether express or implied; without even the implied warranty
; g7 j. B6 U: B* O- p: S1 L - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. w; W& r0 V! L5 M& `
- * GNU General Public License for more details.
& Q9 a. ^/ H+ N }5 d - */, z3 R: K. A! C
- * z. s; J" P& l$ l/ l. R" _4 ~! G
- #include <linux/module.h>4 I7 t" p6 U! T& ?
- #include <linux/init.h>7 i' t/ \6 E u9 g$ p" s7 o/ c
- #include <linux/errno.h>
5 g$ Y# P3 G% ^4 V9 H' Z - #include <linux/types.h>
! O' H6 }8 b# O7 |6 E! H3 Y - #include <linux/interrupt.h>* `) b$ |; [) _) ~
- #include <asm/io.h>; X" s( n: x* C9 k" ]( d1 h# W
- #include <linux/moduleparam.h>4 F9 i7 A( }* P( y6 m) J/ ~
- #include <linux/sysctl.h>
& ~8 o6 A+ {8 b* b" p0 ? - #include <linux/mm.h>
( x) l6 X( O( c6 ~( _ C2 X% G - #include <linux/dma-mapping.h>5 [) C; u8 g+ U+ @( |; y7 [
* L; [+ E+ d! _' r- #include <mach/memory.h>" m/ c+ S# D3 ?5 X8 h# y& J0 |: n
- #include <mach/hardware.h>- C+ Z+ o5 v9 C/ n4 }: |1 v5 o
- #include <mach/irqs.h>7 y0 m: {) Y$ Z6 j3 K
- #include <asm/hardware/edma.h>! e: z$ U4 _3 u, n
, h, c" v" ^( c+ L# ~2 ]( W2 P/ s- #undef EDMA3_DEBUG
* V$ c- B9 I8 B - /*#define EDMA3_DEBUG*/
$ {& K0 _; o0 E" C2 t - 7 c( B6 D: j9 ~4 @
- #ifdef EDMA3_DEBUG9 B% l, b9 [' _
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 R6 i* X6 p' C# \0 B$ e+ m
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 y6 V/ r: }: Z& }! N! @0 ?4 a, M
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( d# w7 a4 e4 I- w) x, K$ P- `$ O2 T - #else
" V% A0 G( G& \( S) @4 ` - #define DMA_PRINTK( x... )' Z1 ?$ f4 I" q3 ]' r& ?. { P
- #define DMA_FN_IN
- z* N* O3 U4 s) b; a - #define DMA_FN_OUT
8 m5 j3 c9 c/ ]6 \! }9 R - #endif& y8 }, _" W$ p/ g+ S% u$ c
- , \% r: J3 J2 Q2 k
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
{8 X4 f7 G& r- k% Q( N* I - #define STATIC_SHIFT 3
3 d) e. {; S' r/ W, H - #define TCINTEN_SHIFT 20
* w. e3 T; L$ M+ Z9 y/ N! U) R" j/ T - #define ITCINTEN_SHIFT 21; t) V. A" e% L7 ^' F7 C' m2 r
- #define TCCHEN_SHIFT 22$ N6 f: M* Q1 e1 _6 i; Q
- #define ITCCHEN_SHIFT 23, h+ q" i9 t7 ^3 C* E
2 L; S6 J2 ]+ {5 J. \ m0 k- static volatile int irqraised1 = 0;/ M0 d6 {& J$ b
- static volatile int irqraised2 = 0;4 T+ h$ ]' M2 S M
6 F' A+ `: b7 w- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 t0 x# \6 Y1 \: a4 q( a- T; L' b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 W8 S6 Y7 K/ {0 R" u
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @/ D! v7 F4 S S( I' }; s
- + F9 B* [9 {* j: r
- dma_addr_t dmaphyssrc1 = 0;: `; N! m" g# i/ h4 O+ M3 l
- dma_addr_t dmaphyssrc2 = 0;
+ t& ]- Y4 R% g" T% J: C - dma_addr_t dmaphysdest1 = 0;* v; }( f- x, Q6 E
- dma_addr_t dmaphysdest2 = 0;/ W- P+ H8 u/ c$ s' o! C# U+ o
- # J6 \/ U0 M: \3 r1 u
- char *dmabufsrc1 = NULL;$ I0 N, Q* Q2 y) E# B& V
- char *dmabufsrc2 = NULL;
/ D' @; g* k: K; S - char *dmabufdest1 = NULL;2 {- h/ c0 n2 H5 ~0 O% e* C
- char *dmabufdest2 = NULL;# Y7 w9 `7 E8 g( B+ X
- , o/ d2 q( z0 \( V4 n
- static int acnt = 512;
% N# `# d3 a) s* @) `# | - static int bcnt = 8;
! i1 d0 L+ x7 Z6 ] - static int ccnt = 8;, W' Q- M# H- n& U& K' H/ g& I/ w
; |( z+ E' ~) t. }7 N$ W- module_param(acnt, int, S_IRUGO);
& p( V0 }- w* e - module_param(bcnt, int, S_IRUGO);
) x; V3 I: G) I3 f8 g3 y1 o3 L! o - module_param(ccnt, int, S_IRUGO);
复制代码 8 V2 i$ l1 v4 |6 _3 z
& k! T2 U' q4 |" M; a: h( M
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ }3 I* G, a/ x1 C8 M( darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 o: f1 L7 \. J! E, g8 f% j 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 h% x# A6 ]& z4 ?
2 I# O9 i5 B1 s2 V3 _
+ p X. ^7 Z: L5 F' @9 `% ]" H |
|