|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' U4 u; \ b' C6 R% n, |- [code]EDMA sample test application
0 s! L. L* w2 C9 U - /*
1 a6 j6 z {% @, K" D& v - * edma_test.c
3 k' B0 b! M9 q: ^ - ** C5 a& y/ e, m% K r9 E7 x# f
- * brief EDMA3 Test Application
: @/ W: |, J# E8 [. }" z - *, w. P( G. l2 H. A
- * This file contains EDMA3 Test code.) _' } J0 r ]# N7 V% [+ U
- *& g% {8 h7 K7 R0 H9 G( b5 p
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 e7 ?0 H! }" g; V a) G7 j
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
1 [* K3 G( P! X+ b* `" @ - * TO CHANGE.6 j. M7 p X! q6 T- ^
- *
) O! k) G$ e9 F! m( x5 ^/ g - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) G8 X# h- @/ m$ R
- *
: q) t6 _. V& k$ D/ [+ w0 M* Q, v - * This program is free software; you can redistribute it and/or
! _6 ^5 b1 C8 V) f' f2 g k - * modify it under the terms of the GNU General Public License as3 Z; s8 V/ C6 F3 T7 J" H" \
- * published by the Free Software Foundation version 2.
& r" N3 ]9 G2 Z a! P - *
1 A! T0 a/ r5 w8 j" ^, h - * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 Q" Q1 E* _- x! m% G. R) x M
- * kind, whether express or implied; without even the implied warranty
" H/ l8 n8 _# c: z% W% E, X) P - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the& `9 F6 Y' V4 ^+ {. W. _( F* g
- * GNU General Public License for more details.- {/ B( Y; a* w: h5 y
- */
, b5 W9 z& l- d% l# n - / m* z" v: R( X$ i' D2 T1 {7 y$ l! E" Q
- #include <linux/module.h>
; Z- z, E2 O. G! z* v+ m - #include <linux/init.h>; T8 ~$ F9 ~8 f. ^3 e( ?3 B
- #include <linux/errno.h>( V. U9 F$ y/ D- e( Y s0 c
- #include <linux/types.h>
: a9 W) n' ?5 C& v2 j - #include <linux/interrupt.h>8 o. n* b& b& {+ H& ?& P
- #include <asm/io.h>
- h0 F) Q" D3 U: m. G* L: b - #include <linux/moduleparam.h>1 X) u9 \7 d5 z; T
- #include <linux/sysctl.h>8 V0 j& q. P. g; R
- #include <linux/mm.h>8 q3 ~* g- ?% E; `7 a/ m
- #include <linux/dma-mapping.h>: y) K2 p, d" _/ A
- 2 Y. T( D2 `, A9 l0 A
- #include <mach/memory.h>% g0 v# w7 a# U& ]! B" `
- #include <mach/hardware.h>
+ c9 B. F9 u$ u4 x - #include <mach/irqs.h>
; n( ^6 N9 v: R( v$ x8 B - #include <asm/hardware/edma.h> ]' A, C0 H3 c0 ]) q$ i6 g
' w- O" u- u4 [* B& t8 Y5 s$ E- #undef EDMA3_DEBUG
' n$ X8 V8 X- C* o3 N9 X - /*#define EDMA3_DEBUG*/
! S$ c& m# X* |* `* F V - 4 w* P7 S1 g% ?8 W+ m6 V) A+ d
- #ifdef EDMA3_DEBUG+ p9 H* H7 i# h8 m2 |4 P
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
; q; G8 Z3 u! X: Q# J- P - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 {# _6 [) `8 o& ?9 p% R, q$ I
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
: [# v! A4 J" d3 |/ s - #else
3 T \4 U7 O4 y8 g) d; C- Z - #define DMA_PRINTK( x... )% d! E! ^+ f! l
- #define DMA_FN_IN
+ z- G; J: f% u- _( `# | - #define DMA_FN_OUT
- |- [" z) j0 h k j- g6 M0 l2 k - #endif
4 |4 n+ z4 m1 ~* ^ X: O! B }1 U - * z! u, ~# k5 n+ n
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)! \4 N$ d3 p7 c
- #define STATIC_SHIFT 3
9 @' I/ m* d" l! a o. p7 R - #define TCINTEN_SHIFT 20% I- C+ {! T) U6 ^$ m7 ~- n
- #define ITCINTEN_SHIFT 21
I4 E2 @2 S! X- a - #define TCCHEN_SHIFT 22
: R# b5 G% W6 _, b; s; X5 x2 ]7 e - #define ITCCHEN_SHIFT 23
4 d U" f" T1 H0 j; r - 3 u0 m: y% k5 `7 }7 X
- static volatile int irqraised1 = 0;) H5 o5 z: _ U: k& z! y
- static volatile int irqraised2 = 0;3 u' L, w" N8 n* }% }$ T
- ( Z l6 v# {+ y, F1 s# @+ `, f ?
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' n R3 E9 x! N2 f$ |& C! u m# K
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* i5 C6 V, ~- h% s1 ^* w
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
( ?$ C1 S; |$ R1 u% r# F; L - ' J" S, P0 D/ B/ L3 p; U6 l# T
- dma_addr_t dmaphyssrc1 = 0;
1 }! U: I. K/ h. @! E% g - dma_addr_t dmaphyssrc2 = 0;! @2 Z' b) d& O& |5 d
- dma_addr_t dmaphysdest1 = 0;
}' Q/ g2 f' B2 p4 f7 [4 Q, P - dma_addr_t dmaphysdest2 = 0;( ]1 L1 Z o9 V7 j
- : P+ f/ z/ ?, ~* t' Y: L! ^2 I
- char *dmabufsrc1 = NULL;4 s8 ^; e- |5 T9 x
- char *dmabufsrc2 = NULL;% w) \ x) x' {$ _
- char *dmabufdest1 = NULL;
0 C+ U. t5 t1 q7 G - char *dmabufdest2 = NULL;
, W& { ^4 k( r' A1 V
9 @) n2 {6 X* W" |7 a ^& C- static int acnt = 512;
. ` F O' } ~5 N1 J# g* C7 t - static int bcnt = 8;; t% k5 ?5 z5 {2 C
- static int ccnt = 8;
G6 ?# i: E* {: t
* e, i% C( y8 O' {6 Y* Z$ Q. G- module_param(acnt, int, S_IRUGO);
. C; h& O7 c. o* ~0 Q* q0 h - module_param(bcnt, int, S_IRUGO);/ t7 \+ D( m7 L9 K2 e
- module_param(ccnt, int, S_IRUGO);
复制代码 4 U4 s7 e* h2 X8 j9 w5 A: y. g* q
. a4 s+ R% @) k$ I 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 M7 S% F+ X; oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ ]( N( Y2 n! I9 L7 y9 P, T* z; |
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 |4 t( h# X6 V( B
+ `. S3 x, W4 d x4 e4 _8 x, A
- H* M9 l2 L; j# @9 Z
|
|