|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 ~; X8 O8 {* \" p% c- [code]EDMA sample test application
' s7 s0 J g! n$ T# ]1 d - /*' i4 O+ ~" I/ m* i3 y% z* e* @
- * edma_test.c1 T( i; Z6 }& s7 v5 ?( v) q7 H
- *+ U, S5 n, B& M# H6 d& x
- * brief EDMA3 Test Application) x8 L1 A& H* f; e3 X* ?
- *2 a. |4 M% p9 N+ k7 ~
- * This file contains EDMA3 Test code.' \" ^- M7 T6 L
- *
; f2 U: }- [1 `, c - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! {$ ]7 D& F2 q1 k) _0 K
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
+ g. `7 H, F; r7 K% `% W - * TO CHANGE.
7 _' a$ j+ F$ ^8 S - * [+ c' C/ ?% p3 D! K. F
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ]3 W9 [0 l$ R4 I; I o0 d
- *# w- L( C( u, F2 G0 Y
- * This program is free software; you can redistribute it and/or% v, a( y/ u' e/ |+ B* h2 s
- * modify it under the terms of the GNU General Public License as% i$ y. G% h8 Q0 w
- * published by the Free Software Foundation version 2.
; B2 l, D2 I& F/ D - *- C x0 R8 a7 y4 W/ i' M# l" C/ \
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ _+ w/ G$ o3 z) ]+ S - * kind, whether express or implied; without even the implied warranty% Y2 E7 d7 p- \3 V3 \3 V5 C
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( P6 s: m3 t, W5 ^! `4 A7 D
- * GNU General Public License for more details.. H) C1 \; n/ e k6 J
- */
: ^: D7 J9 t& J( L9 r& V' F0 @* s
$ ]( d- X) ~2 `# M- #include <linux/module.h>
" K: G% {. D/ i7 ]; t: | - #include <linux/init.h>
4 F4 t% b& Y6 ?% n( m8 h i9 w - #include <linux/errno.h>' p6 ]" n! A5 \2 g# p' U0 I
- #include <linux/types.h>3 ^- \2 j3 Q0 h/ n# @
- #include <linux/interrupt.h>
1 m5 Z0 J3 C6 D, f$ @, n% m - #include <asm/io.h>
) g" j9 k) N- s4 z% O3 _ - #include <linux/moduleparam.h>
% W3 H% l5 u- a3 Q - #include <linux/sysctl.h>
3 {1 U& A0 {" T$ l - #include <linux/mm.h>9 i* `, j) A% F& a% i/ n
- #include <linux/dma-mapping.h>' R: I6 T @1 g! G( {; u
- . q. e7 r9 q# E: S2 q
- #include <mach/memory.h>
5 E( | X9 |5 E - #include <mach/hardware.h>6 y3 _4 I4 O; m3 _; b; V4 [
- #include <mach/irqs.h>9 p9 D" H! U$ r2 ]1 n
- #include <asm/hardware/edma.h>
( e' q. |1 W6 g9 h( s - 3 A" m7 F6 x( G
- #undef EDMA3_DEBUG7 v( ]" g, \) e7 Z5 `) c; h* _
- /*#define EDMA3_DEBUG*/# Y/ C1 l$ u5 C3 V+ u+ M
- 5 b, Y5 m. q" m, M* H
- #ifdef EDMA3_DEBUG
8 G- A" b2 i( }7 \4 C6 V$ S3 ?3 L - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 T/ i) n9 N- C0 l - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
% u5 B1 s) @$ f( L5 r - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
1 M& c: U% X; o* S' [ - #else {3 N7 | t" H9 ~
- #define DMA_PRINTK( x... )9 Y7 n( X0 K) N: {: i8 }- T
- #define DMA_FN_IN! L! l1 l& l* x( J( J8 V4 y
- #define DMA_FN_OUT7 F6 f" z. ^' s, u- ~0 X9 ]
- #endif0 \3 e7 e% s ]5 O2 i& l
- x# y1 J& s! A, N2 f% P
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# W9 @/ v; w- }0 P" d) s& C
- #define STATIC_SHIFT 3
. |& C+ E2 R$ ]: S4 R - #define TCINTEN_SHIFT 20! N! |0 P* V6 |/ Z
- #define ITCINTEN_SHIFT 21
4 n0 v6 S' }# B! j7 X$ _ - #define TCCHEN_SHIFT 223 l; X& D. t) A
- #define ITCCHEN_SHIFT 23: [/ b3 r8 z+ k. ^9 @/ X" M
8 ]" {! U! {( w4 K- static volatile int irqraised1 = 0;' ~% r+ v7 x1 \( _3 V% X& P0 B
- static volatile int irqraised2 = 0;
: g% @* d0 `$ D) m- I+ u
) E+ T6 y5 ?& [6 e- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k$ H- ~( t6 w+ d- ]4 A, \
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V8 Z& w9 x+ T4 @) U3 @* ]$ h
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. q. _% o, b" M( Z, ]
5 S( W& V$ o/ k k* e- dma_addr_t dmaphyssrc1 = 0;
/ r# E) x& |3 }% i1 ]" U1 G6 o& u - dma_addr_t dmaphyssrc2 = 0;
. {7 L( @7 x# L* r7 M - dma_addr_t dmaphysdest1 = 0;
& T- S, N: Y ?+ H* b0 T6 v - dma_addr_t dmaphysdest2 = 0;
! @1 T5 s2 ?1 w! e* \4 ] - * t# e2 y9 v( g9 w+ s
- char *dmabufsrc1 = NULL;
; {! }9 q/ O" D' \6 g - char *dmabufsrc2 = NULL;
+ }' h3 ]: w T" g g; o1 Q9 L - char *dmabufdest1 = NULL;$ B( H) a) Y% W) T( f/ a. o1 T9 o
- char *dmabufdest2 = NULL;
8 l% V( t( ~# y% L8 n* U0 e - 4 d% V% Q2 i z4 @
- static int acnt = 512;8 L. x" ]1 C% O5 N
- static int bcnt = 8;1 o3 m- I( N. {9 H
- static int ccnt = 8;
! [( v! a M8 f+ ]" N
2 a8 Q: I, e, X; M) ]: P- module_param(acnt, int, S_IRUGO);
3 x# C! R+ J$ [1 s, Y; w4 u - module_param(bcnt, int, S_IRUGO);
! H+ d" Z% {+ P: D - module_param(ccnt, int, S_IRUGO);
复制代码
% S, B* a" y! A( i! \
t R0 m8 l% o+ O$ ~: M4 P 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 W' t$ ^6 y7 A+ W1 X
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ M- P$ h8 Q% a& a! z& M# z5 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 K' H1 K! y) ?) U* N2 `. ~0 V6 ?
5 W" O6 r9 X2 k5 U! R
3 o9 n0 \2 t9 q b7 | O/ C |
|