|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ]" F) @6 U, {0 S; {5 s( g1 O
- [code]EDMA sample test application
3 A. y" \% z# R3 \ - /*2 F: _" ~5 S* r( Z+ x! ]
- * edma_test.c8 A- W1 p f- w1 p1 O( ^1 f& A
- * N# b; t+ h+ ^: g
- * brief EDMA3 Test Application
8 Q8 Z! {1 D; b. V4 s, A- D. T - *" B# K( ^5 R A) D7 A7 v1 [4 N
- * This file contains EDMA3 Test code.
6 ~ Q9 G4 o' o - *
/ x' X( e. N( b# T: {6 `3 L - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 A/ t2 U$ x, X
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
/ O0 a2 w( ^0 F; S& ?3 ~ - * TO CHANGE.4 e6 `0 f% M- o' f3 z2 ~
- *7 P2 H; f2 |9 D: p+ j
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' T4 u0 z) L. x! e - *
; I7 C" z" {# e2 F. ]8 { - * This program is free software; you can redistribute it and/or3 f4 w# s1 M' d. ?' q5 G- S3 C
- * modify it under the terms of the GNU General Public License as% I' a3 @# |$ q+ x* O6 b$ H p& ]2 Y
- * published by the Free Software Foundation version 2." _6 f/ C; Y N, z
- *
+ e8 e5 G [8 t% u/ P& F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S0 P# b% Q. u
- * kind, whether express or implied; without even the implied warranty
. P. h0 J, T9 h( t- x - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
' q" o% T0 _8 j7 G6 D3 O1 O - * GNU General Public License for more details.0 {. G: ^: J1 g& ?3 b
- */
; {! V; p# _# I9 Y7 N o - ! n8 N) w" ^+ G6 U& s# ^2 T' ~- @
- #include <linux/module.h>, {, [- i7 D* F
- #include <linux/init.h>
1 Z, @: S/ s7 t - #include <linux/errno.h>1 { {) r# w) p# n4 i$ _/ M7 A' C
- #include <linux/types.h>9 C/ S4 U- J- O% ~( b7 e3 t$ J) i z
- #include <linux/interrupt.h>3 M' \2 K% V$ A- E* }
- #include <asm/io.h>1 R o# q/ ]7 T
- #include <linux/moduleparam.h>
* e! v0 D# _1 O/ U, p& v! b+ q6 C - #include <linux/sysctl.h>
' d* w) `* X& B9 w6 I - #include <linux/mm.h>
" }/ E" k- ~$ @, c) x0 w- v# Y - #include <linux/dma-mapping.h>8 I9 H" [8 V+ X9 o2 S
9 X. }" n: u7 [) P ^9 a9 L u- #include <mach/memory.h>
( I/ C+ S1 H& a% M! i* g8 M - #include <mach/hardware.h>
b+ y" o, H* k( r5 d1 ] - #include <mach/irqs.h>
C: ~6 t! D2 s - #include <asm/hardware/edma.h>* C3 R- E- X' [4 @* q: u
- 9 d* C3 \2 Y* Q* K4 G7 C
- #undef EDMA3_DEBUG3 ^" V/ }' i1 ~/ w0 X7 z
- /*#define EDMA3_DEBUG*/4 d! F( @, H5 G# B
- # g+ T0 n+ A9 o! K
- #ifdef EDMA3_DEBUG1 b9 m6 s0 |3 W& h+ h: Q
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
7 F- T1 z6 R8 z$ Y - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
+ @) O e' p* Q/ ~: t. \0 ^ - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- O0 v3 |5 X5 S+ f4 S% V& V
- #else% F6 x# W+ `' r- H
- #define DMA_PRINTK( x... )
r1 n s* T- r - #define DMA_FN_IN
0 B$ _5 i+ D- [. P" L9 a - #define DMA_FN_OUT0 u( g% p9 r8 H. g: X
- #endif( \; L+ H; K; ~; ]' p
& L8 p7 F/ D$ `1 [- [- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* D% Z: u9 O( ?5 Q' I6 O0 h/ M
- #define STATIC_SHIFT 33 C3 b/ R- F. J' V' @: a
- #define TCINTEN_SHIFT 20# [' i3 \4 W& F r8 H) z7 n
- #define ITCINTEN_SHIFT 218 m' J( {% t* N$ a& D+ V
- #define TCCHEN_SHIFT 22
- q: r5 y! g9 K- L& H - #define ITCCHEN_SHIFT 23
* \) r) W& }, {; s' B' ~: W
7 U6 e( M3 j7 K$ F) P9 V4 ~) r; _- static volatile int irqraised1 = 0;
1 B# J' E( B% \6 b( ~' g- C - static volatile int irqraised2 = 0;1 ^8 [$ s# ~0 A. U7 D+ _* {
- / o4 R9 e5 w( z$ |
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R' g! f* c: `: G
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I6 b- U7 E- Y# v k, I
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i9 V6 J" P. c
4 k* s3 }5 C# F' h- dma_addr_t dmaphyssrc1 = 0;. z: s1 j" K' n! N
- dma_addr_t dmaphyssrc2 = 0;5 ]2 m7 j/ @" D3 o! M3 O
- dma_addr_t dmaphysdest1 = 0;2 [. U5 a7 s% R6 ~3 F
- dma_addr_t dmaphysdest2 = 0;
7 ^7 G1 o; n% b2 @
4 f2 I4 ~0 g' r2 e- char *dmabufsrc1 = NULL;- x+ I, U1 ?% h; }$ R0 y; E
- char *dmabufsrc2 = NULL;+ b% U5 Y: T1 e; S
- char *dmabufdest1 = NULL;8 @: U4 L$ \ ?
- char *dmabufdest2 = NULL;* e% @. m- k% N6 x4 C6 A, g# b
- - [% h; G w) E! W. ^( k/ m- i. L
- static int acnt = 512;# r" u ?3 h( R) }# Y
- static int bcnt = 8;
/ U* A7 P r8 r8 c' L2 j - static int ccnt = 8; ^6 T9 `) Q2 N {% P8 O
- : d; a8 K3 h) B5 i* S, H$ I3 x0 j7 h+ [
- module_param(acnt, int, S_IRUGO);
/ {- ]6 |4 b% |0 X. S: ]8 Y - module_param(bcnt, int, S_IRUGO);+ L. J, K6 O: _
- module_param(ccnt, int, S_IRUGO);
复制代码
/ B! x! D+ U% f9 ~0 C$ D8 t
1 ? T" C0 a0 Q 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* v0 m# x$ A! v# p! V' Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# k; M; E+ ]5 R' ^- G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" I2 a; Z1 f/ F/ D' C* E5 V' \1 J& r& r9 h0 w/ x
e" Z/ I6 O2 `8 c* w% a5 W |
|