|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, k0 M- ~! M0 V4 z- [code]EDMA sample test application
2 |- Y) {$ f$ \- R' |7 @, Q$ r - /*4 e7 T; \ a+ T0 y( g
- * edma_test.c
- j: I( \5 r% U - *
5 Q8 T* | G7 s/ E1 d+ q4 I0 e - * brief EDMA3 Test Application. S6 E0 B! S% I8 X# Q
- *: D! t3 f! G/ N0 X% G% f: V8 I
- * This file contains EDMA3 Test code.- [1 O; O6 K7 B: u% N K( l: V, T0 B
- *
/ {% {5 O4 e; P6 _. A - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 X8 ?. G" J' z8 J! R$ U, I6 R - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* S( }% P# D; ^% e - * TO CHANGE.: a- E' ^8 {' f9 a/ y
- *
9 S. h* @8 o$ }. B! s. x) E- G* k - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- s! }, I6 Y8 Q; o) C) |/ L
- *3 z! v+ A4 i" E/ b9 F
- * This program is free software; you can redistribute it and/or
7 `. l( c3 H2 b2 P. ^ - * modify it under the terms of the GNU General Public License as- [! U9 s" t& j9 R3 m2 ^
- * published by the Free Software Foundation version 2.
6 w% w T: U$ H - *# Y% j% @' O" d. p3 F v2 u6 Y5 r2 w
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
$ S8 p% U9 j1 _/ @( \: t! n - * kind, whether express or implied; without even the implied warranty
0 \; B0 \, f2 w0 d - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 F1 P% _. D3 {" s r, n! O - * GNU General Public License for more details.
( f& }2 z6 g+ h# L- L - */9 v# Z% J9 J, _( Z9 u5 ]# ^% [
- 2 s& H: B3 @, d: N* ?! u
- #include <linux/module.h>& u! }' [( J6 i# c! ]! M
- #include <linux/init.h>
& L! Z _' j1 ~* _, X - #include <linux/errno.h>
4 q0 _. h8 {4 Y4 @0 l6 O# u; x1 g! e" L - #include <linux/types.h>
; K# e) ]. D z: S: w: o - #include <linux/interrupt.h>$ \) T, \- q1 j; ]7 ]# q
- #include <asm/io.h>
: |7 @6 P2 E3 D& O% N4 G+ U+ W t - #include <linux/moduleparam.h>
# P5 C" n# u2 {4 z - #include <linux/sysctl.h>- B# I, x+ w) ~) w+ e
- #include <linux/mm.h>3 P+ I8 @ @( C; z( e# |2 m
- #include <linux/dma-mapping.h>
9 [2 |1 Z4 g5 b4 o
+ R( @' P9 i, L- #include <mach/memory.h>( L- q4 | c; \$ P4 Z
- #include <mach/hardware.h> p: B1 l/ N, y% u. b
- #include <mach/irqs.h>
7 t3 D6 L- }! M9 F2 n# x0 a7 W - #include <asm/hardware/edma.h>
) }/ {6 ]. o' {( a
; w, V. E/ S4 Z( G- #undef EDMA3_DEBUG
7 d2 d" @, j v7 C9 q - /*#define EDMA3_DEBUG*/
! x4 Y4 z, n9 b; a) _ - * [1 {7 A* L3 t3 ]: |) E+ R
- #ifdef EDMA3_DEBUG% y% O" L+ G% {/ d
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 X* J" }' i) R2 X2 T% _" M* l
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 M' w* l: A: I$ a4 n
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
( f2 N" ?) j1 @( a0 L8 j - #else' U( T0 O9 V$ w" G
- #define DMA_PRINTK( x... )
N5 M, C! q4 F- P - #define DMA_FN_IN' g) Y6 d% }# D0 t0 \$ u
- #define DMA_FN_OUT& O5 y* ?# E. c4 x- U. w
- #endif
' B6 {. q/ J( r [7 I6 n
. T. Q8 \1 u; B z2 Q- ^/ y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
# _# v$ J# A0 Z! N! X$ t - #define STATIC_SHIFT 3
! }! g: ]* D! |! @ Y2 l: w$ B# M4 s% ?0 a - #define TCINTEN_SHIFT 20 `& C+ C. q& T, R% @: n) Z i/ O9 B
- #define ITCINTEN_SHIFT 21- D' t* r( I2 u) n
- #define TCCHEN_SHIFT 22
7 R% m/ n, ]) G( G5 B - #define ITCCHEN_SHIFT 23$ r d! y. b2 v/ E9 a
8 c+ t( a' T8 a5 v0 T3 P- static volatile int irqraised1 = 0;
+ W; P; B9 l6 Q - static volatile int irqraised2 = 0;7 l: B; d7 J$ t* @! A1 j) ~
) j$ w$ b' g) ^* {% Z9 K/ _. I; f; o- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 {! g3 h4 S2 b% q- c
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 e( Y( W; M- s
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
7 M4 U- F* s! H) _+ i( O0 z# Y - I; m# w8 u9 K) T3 w2 f' c
- dma_addr_t dmaphyssrc1 = 0;
, ~; E; E- b& X; ]3 {0 t- H - dma_addr_t dmaphyssrc2 = 0;7 d- @. g1 b! v3 t* Q# `
- dma_addr_t dmaphysdest1 = 0;" y6 g0 R& Z& l2 o
- dma_addr_t dmaphysdest2 = 0;' E2 ?: P; T6 i
- 6 M: r" k* V" g0 r
- char *dmabufsrc1 = NULL;% Z2 B. w+ [7 V7 B7 `( X* \, d: G
- char *dmabufsrc2 = NULL;
: g/ t8 x; u- b4 r: { - char *dmabufdest1 = NULL;6 N9 G# P$ C. K# V/ {8 Z' v) E
- char *dmabufdest2 = NULL;
3 @2 f2 r7 [; x9 _7 S- ~9 N
/ o0 L; M( {& ]! H( j# ]- static int acnt = 512;9 T& G1 y' h) \+ S3 A% E+ k
- static int bcnt = 8;% [/ ? M5 {6 C1 ]
- static int ccnt = 8;2 c" n. ]0 l$ p7 H
i$ d) ~2 D( z7 b# F- module_param(acnt, int, S_IRUGO);
9 `0 g- V9 z% U. G" c! m: @, h - module_param(bcnt, int, S_IRUGO);
0 [0 `1 T( p+ }; [! M' S+ `+ @! t - module_param(ccnt, int, S_IRUGO);
复制代码
2 D- } u/ [! _3 S/ t
* h, u7 N. ]9 n9 H* l. E7 @0 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 `8 N* p% y, S3 z, Y8 h P3 g& parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 l3 @5 N9 J3 e$ u: ]: e- e5 [, v
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) O8 |. p: n7 M) D: t
$ G* @- F- x1 f C3 E; Q1 a' n& N, p5 c4 X% ~* ^6 ^/ ~( J
|
|