|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 Z# y/ v6 m6 S/ T- [code]EDMA sample test application
0 Y7 p O# A7 h" R - /*- M5 T+ H' Y1 @& u8 A
- * edma_test.c! N' a) W8 r, g; v V$ V, }+ L) H
- *$ L9 ]6 J4 i& m" }+ Q
- * brief EDMA3 Test Application
* k8 Q" O/ F- R0 S6 L* f - *- i: q7 `/ n$ p
- * This file contains EDMA3 Test code.
$ ]/ F! J0 ^8 |, H - *
! t- ?( H! y' I* g/ z% C( ~; x - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, V6 S# q2 {. @5 c) q: L! y
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
# X! b) y) U6 B% n* T7 u2 v2 _ - * TO CHANGE.
# A, c+ D! o; x: s9 ~ - *
$ F$ b! ^. p$ I5 B- D" m- | - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
( ^/ o: Y, d: M+ X - *5 ~2 N3 n6 {. q) n6 B: Z! K4 ]0 A
- * This program is free software; you can redistribute it and/or
7 q/ ^1 e) L- I" ? - * modify it under the terms of the GNU General Public License as* ^; m" Z! F" [, L0 m1 @! Z0 h& c8 F
- * published by the Free Software Foundation version 2.
/ i2 A0 I2 a* i - *
& L8 V- m K/ j$ S; `3 C& D, k - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
( w$ P! @, ?% T - * kind, whether express or implied; without even the implied warranty
7 d3 G) D0 K' ]8 }4 H; z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, n2 S$ N$ c7 I- q
- * GNU General Public License for more details.( b6 R3 z0 S4 s1 s2 F. g
- */
! T0 B* U- p4 Z, ~- R
5 I, I; L e8 u1 q+ p" v- #include <linux/module.h>$ R. U q2 D) z
- #include <linux/init.h>* l* E( X% b0 ^/ b+ u
- #include <linux/errno.h>
1 l" s. b' e. d: q( \ - #include <linux/types.h>
1 z9 `: g5 g0 p - #include <linux/interrupt.h>0 R2 F& F7 B" K6 C; i: j+ t
- #include <asm/io.h>4 ^% T1 n- E1 b% P5 U
- #include <linux/moduleparam.h>4 v1 k6 U2 z" M; C2 C$ Y4 ^
- #include <linux/sysctl.h>
4 q D/ f8 y6 Y) |" } - #include <linux/mm.h>: z% B0 B( F% a9 b( ]7 i- C$ ~
- #include <linux/dma-mapping.h> Z! R; c6 ?) j3 N+ c0 U5 j9 g
- 5 v" A0 m& L% u( X Q F7 ~
- #include <mach/memory.h>4 O3 a1 T0 B$ v3 c+ A9 K+ U1 n
- #include <mach/hardware.h>$ ~8 ]! \+ ~. s" Z1 c
- #include <mach/irqs.h>
' `# r$ |5 @" R0 t( @7 O+ X - #include <asm/hardware/edma.h>8 W) h! {+ Q/ A/ U; x- c
- 3 m' B- \. m" s9 q* ?% B7 Q
- #undef EDMA3_DEBUG' m1 |; z! D! Z+ L' }
- /*#define EDMA3_DEBUG*/
2 d* u" Y; t9 N, [- I. k. t& X
# `8 u" ?# h+ D: U- #ifdef EDMA3_DEBUG+ g4 d! K- J+ U7 K
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
' ?8 T& P7 x P' c: M - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- t' U( E* t$ X9 B4 D - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
4 ]% G P# O- \/ J- v2 P" t - #else8 D1 o6 e [) d" z9 ]& \, G# w, }& Y
- #define DMA_PRINTK( x... )) D( M% [) X3 x8 }+ \- P
- #define DMA_FN_IN
4 ?0 p1 a- u3 [5 P9 ^2 e1 O - #define DMA_FN_OUT& P; |8 f+ l( W6 a* `
- #endif% ^/ H# V+ W6 u7 g* _; c6 _/ i
- 7 S9 E2 I9 ]- _1 m$ b
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)+ t0 g* I# ~/ M& u+ U7 q5 t
- #define STATIC_SHIFT 3
* }. @3 a- O3 |- M - #define TCINTEN_SHIFT 204 Z9 O# Q8 H' T4 f
- #define ITCINTEN_SHIFT 214 J7 k1 }4 j0 h8 P
- #define TCCHEN_SHIFT 22$ N: U( H) H, @# E
- #define ITCCHEN_SHIFT 23# [! i2 L+ K+ u% D, e3 E! T$ I2 R
- " C$ i$ e# {2 x! ~
- static volatile int irqraised1 = 0;
5 G$ Y+ r6 ~1 `- w* ? - static volatile int irqraised2 = 0;
' l* J( `' D% e6 u! m/ i9 b$ c& x - 3 B3 x! | w6 B" ~% X" n; W X: z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; Y3 A# B# s2 J. P. Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' `6 h. i0 f; w! K! e/ D7 @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
2 X4 p* `7 e% q; b; n6 I& o - ! H+ `; a8 ~& J9 Y% S
- dma_addr_t dmaphyssrc1 = 0;
. G+ @5 ~. M' y$ n7 c- V. S" E+ x - dma_addr_t dmaphyssrc2 = 0;2 k6 K* L& ^4 U- P4 |$ ?
- dma_addr_t dmaphysdest1 = 0;" t8 R8 [8 a' O4 N6 n# ?
- dma_addr_t dmaphysdest2 = 0;, K( h& C6 z" y6 \3 u
- * O- ^5 N8 n. Z
- char *dmabufsrc1 = NULL;6 P8 O! l) N, b" V9 t
- char *dmabufsrc2 = NULL;: {, f9 U( l' y3 D( Z
- char *dmabufdest1 = NULL;
+ G$ s( W$ }" `9 m9 D - char *dmabufdest2 = NULL;
8 p; M1 ~2 h/ `4 G B( E - 1 p8 g3 D6 M6 _/ X0 M0 n
- static int acnt = 512;0 z2 W2 x) d( [& ^
- static int bcnt = 8;. f6 P3 f Q0 s
- static int ccnt = 8;; \! l! s B6 f9 Y' b
- / m3 t4 i# p# G7 t/ u
- module_param(acnt, int, S_IRUGO);
8 {- V5 C0 i$ P; _+ b - module_param(bcnt, int, S_IRUGO);0 Q- H; v, [& U
- module_param(ccnt, int, S_IRUGO);
复制代码
! T& M/ ], a. t! C' a$ [. M! O
9 f. F; @! W7 F9 y# Q7 G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: K/ x$ b& g1 v$ U$ s" w. x# H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; C: }) F- l0 [* ~7 {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! S. _9 S# I) D1 Y# u: b1 b
5 d: h$ _1 ~/ Y* @/ \
. ?% x" k# z: { |
|