|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! Z8 i8 w3 j1 U( _3 h+ Y- [code]EDMA sample test application0 L& K% `6 X0 g7 S
- /*, V+ L/ W( k1 m$ C q/ k
- * edma_test.c' o+ n& W2 a: X! e9 I0 v3 t Z
- *: _4 }) U: l' _; e) o- `% m* B
- * brief EDMA3 Test Application% v# q, B% Z3 B
- *$ }) P3 n1 ~7 ?2 ?/ Z. w5 o
- * This file contains EDMA3 Test code.: D2 t: z i# j6 M* o1 H! a% x' Q
- *
( [8 ~* ?) C: g' E! Q; j6 V7 j - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) }5 d! S* b" N3 @1 g8 `& |
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# f: h) S1 s' D! k1 m: U0 h - * TO CHANGE.
3 } q$ J( L( j7 `1 h - *; P! ?9 ]% ?: d( t7 f2 @0 Y _ T6 C
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
G _1 _ I C- M7 V - *
( }" r7 j1 l4 m. l& ?+ i, D - * This program is free software; you can redistribute it and/or! s( S6 u; T4 m* o# }% W
- * modify it under the terms of the GNU General Public License as2 T" `; L& c! h7 p
- * published by the Free Software Foundation version 2.' U' M6 H% _. V4 Q# D
- *. l, l# d& v& a0 G0 c2 P2 Y
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any- |# _: Z6 f& T
- * kind, whether express or implied; without even the implied warranty
6 z a( k* f# |1 x: d1 | - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4 F6 c/ ?' v" z G5 u5 Q4 j - * GNU General Public License for more details.( l! P; v- J% w( b% R- g- u
- */
, C& v/ g* q. L1 P; i3 j
: z8 \4 f+ V6 Z8 W; h- #include <linux/module.h>5 X& [) G7 o( b0 N$ j
- #include <linux/init.h>$ ~# J. n, G# n }7 O
- #include <linux/errno.h>) P% R% `4 E5 V% ?2 C
- #include <linux/types.h>" K: y" f* ~3 ~* ?
- #include <linux/interrupt.h>/ c+ K# g1 k2 }7 g5 }( O
- #include <asm/io.h>! Z v$ Q* c& [. Z
- #include <linux/moduleparam.h>, m( b, H @2 C# B8 O( W! K: c
- #include <linux/sysctl.h>
" V. k f) ?: ^; i3 U! J9 { - #include <linux/mm.h>, p( b$ y4 n& O8 t: g
- #include <linux/dma-mapping.h>
, C7 x# C- l! @5 \% J7 o4 ?1 ^ - 2 L+ n! {6 s* ~1 `0 k* _ c$ J* \3 z
- #include <mach/memory.h>
& M' m; ^, x `& [% ~ - #include <mach/hardware.h>
6 R% K# c1 U2 h0 q( D8 `! @ O - #include <mach/irqs.h>% g. |8 T: V" e! P+ y
- #include <asm/hardware/edma.h>: {8 ^! Z/ k: G* |# s/ r& n# @
- 6 M/ K5 s7 L& B4 g, Z% \' x$ B
- #undef EDMA3_DEBUG1 T9 m% k$ N# F" D8 s. g
- /*#define EDMA3_DEBUG*/# J# W; G/ n) o8 M5 E$ J+ q
5 o, t8 a' H9 p% r- #ifdef EDMA3_DEBUG( a* G, _1 J( M ]/ r
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 Y Z; H" W. ^5 L - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 r1 z* P' S2 e3 ]- v( O. @: [# |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
+ P- H6 b- y% _7 d - #else
( G1 _% s! {& Q: p" u* [( N! y$ p6 w4 { - #define DMA_PRINTK( x... )
! p* s8 ^) N! E. i/ J6 ^4 G - #define DMA_FN_IN
0 T L) g& `5 ~* t0 l - #define DMA_FN_OUT* ?+ C3 h! i/ ?# e* p! E
- #endif8 a! O2 q* c) K( c# u' C
* M, k$ Y( w6 i5 c6 i- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% y2 i3 h7 Z5 {1 S
- #define STATIC_SHIFT 3, e- J1 e3 e8 A Q
- #define TCINTEN_SHIFT 20
( `- \+ a+ s1 r; r' c! z5 c& n - #define ITCINTEN_SHIFT 21
3 p# x4 ]# z% q: h+ `" Y - #define TCCHEN_SHIFT 224 ^/ G. ], c+ F# G: A
- #define ITCCHEN_SHIFT 23
+ z' M$ S* O F
6 V9 ~8 l9 l+ R7 c# n' h _- static volatile int irqraised1 = 0;3 }* ?. o8 C* K* Z, E# o+ k
- static volatile int irqraised2 = 0;
1 _$ C" {3 D5 I) |: m) E7 z
$ A; X: F$ C. D9 z- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @4 ]. R* P1 u) X" M- |
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue); Z& J. M6 f) h+ J0 a3 j
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ ]! ^6 r* B/ a3 m9 ~8 B8 x8 b
, S' G! W5 v4 O* b4 W- dma_addr_t dmaphyssrc1 = 0;
( b7 R, l( }5 h% _( P - dma_addr_t dmaphyssrc2 = 0;) N: g+ {$ }. K3 H! {7 k
- dma_addr_t dmaphysdest1 = 0;0 V6 E! |$ a% O! I- T. Z7 v
- dma_addr_t dmaphysdest2 = 0;
4 e( J' @" `- h1 ?: A - 7 @* P5 Y/ ]- N6 x/ z' N
- char *dmabufsrc1 = NULL;" L2 ?2 B" a# @& p7 e" f8 q
- char *dmabufsrc2 = NULL;
4 t, z. y( V2 L5 ]6 V$ e( C - char *dmabufdest1 = NULL;
. |! v3 v% S, {, ~4 t7 V) l: r - char *dmabufdest2 = NULL; u X7 i# U9 R+ O/ }, R4 C" A
% j4 \3 d( i( {* Z) Q; w* E% f8 y- static int acnt = 512;
7 E% Q! J: Y1 b5 }, P3 U - static int bcnt = 8;7 ^8 B, p( U8 D1 y$ s$ \
- static int ccnt = 8;) _6 B6 z/ r5 V ]
- 4 E: x0 j0 z) l/ \" G
- module_param(acnt, int, S_IRUGO);
1 B- g1 b. e# ]' J7 y$ E - module_param(bcnt, int, S_IRUGO);
/ ~( ]7 d2 u' y" N5 G& T* T% B$ i$ L - module_param(ccnt, int, S_IRUGO);
复制代码
0 y" R; R0 P( Z; O6 H- f
9 `! q# ]; i5 U5 ~3 w 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; I" `$ }! A! I2 A" J4 i1 varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: L8 X7 \' U- f) N% b6 }; Q 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: z$ q# G# n( p9 j7 a7 M, j) t+ a# H7 n* a' F: v
0 e# i/ C. ^! B- w2 _& G
|
|