|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( n( n8 e. a+ x! s# S
- [code]EDMA sample test application
! t5 }- Y( P% _& q* e# _ - /*% g+ F: q5 l( n2 ^9 z2 I
- * edma_test.c
$ b. b( K' L- `: q0 P3 {4 { - *4 H, I M! T1 `
- * brief EDMA3 Test Application# E5 [/ w2 d5 M0 A2 U
- *. @ R3 D: [ w/ _ k/ X% C9 O( f+ N
- * This file contains EDMA3 Test code.$ Z+ O# S7 T% Y- B
- * T8 I- P5 e5 _; r. V: M- N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 L1 r7 X" J$ ?5 q. A' V
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
* K6 o4 V% M( V7 T' b0 \ - * TO CHANGE.
1 n7 ]; o, @' F4 P. R. I8 D% R1 a - *
7 D8 n, ?- \ [3 @' A) ]$ b - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% Y. B6 a$ { ~8 M5 }+ _) ? - *
$ l& t$ ^& Z- B% B4 }9 d3 A - * This program is free software; you can redistribute it and/or+ a4 r8 g6 g7 k) d# b
- * modify it under the terms of the GNU General Public License as
3 u3 Z/ ^" \) T& F - * published by the Free Software Foundation version 2.5 _) g/ h' q0 Q1 W6 }
- *
: k5 w" l2 ^0 i$ y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
1 Z# n5 P! S; D2 k" ]4 d% M - * kind, whether express or implied; without even the implied warranty
! K( n( z& Z0 B$ ~4 i# V$ z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. p2 o2 a$ O/ P# P' C8 S - * GNU General Public License for more details.+ }4 Y; B* ~ L* n
- */
8 z: Z/ t$ F/ v0 o, m% ?% i( f - 0 @7 H; j" u( r8 p
- #include <linux/module.h>
8 v" {, y) @! f$ k - #include <linux/init.h>
4 P# r. u- h% Z& C - #include <linux/errno.h>
, f2 M9 Y8 s2 L1 B4 K: ] - #include <linux/types.h>
5 ]& T$ T& Y" S: U/ {3 h; i4 ` - #include <linux/interrupt.h>
6 H3 C& x) V5 ^ K% D; K% B+ O - #include <asm/io.h>1 c+ I" ?! K8 }: ]; q* a# ^
- #include <linux/moduleparam.h>
, a) n: ^4 M: z4 v - #include <linux/sysctl.h>
; D3 q3 x" P, w - #include <linux/mm.h>8 U. K5 \: G; ^! o1 J" c
- #include <linux/dma-mapping.h>
0 K9 l2 ~9 G7 F4 O - 2 R# ~$ P1 d) e @
- #include <mach/memory.h>
4 z1 }' ^/ m( E - #include <mach/hardware.h>5 d; ~$ o0 S) d2 R
- #include <mach/irqs.h>
5 W0 B# ?2 L$ B) k# ?8 N9 k - #include <asm/hardware/edma.h>) [3 Q' @* {; ]/ N: [
- ( x7 c/ C4 @& d: G
- #undef EDMA3_DEBUG/ P# }) m* E( h# O9 P. U! N
- /*#define EDMA3_DEBUG*/6 R: D* M3 V! X
- 1 g, D* F: y* m: Z
- #ifdef EDMA3_DEBUG D5 k/ y* ?* z0 T
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
4 b" F% H6 N3 c0 Z! s- [ F5 |0 B* V - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% o8 Q# K H4 r7 N
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ]" q* a* Z+ S; e/ O
- #else" P2 b5 g2 V0 K- ^
- #define DMA_PRINTK( x... )
3 L9 X0 Q6 i) ^( ?$ Y" Q* h$ O - #define DMA_FN_IN$ Q, R0 M$ j9 ]+ Y5 ?2 p
- #define DMA_FN_OUT
2 c4 i* ?0 w) j. l9 e# [ - #endif, T% q& Q( g% M! r8 }& w( k
: T1 `' o7 i% j$ R: `2 r5 \, q- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 ^# I& ]# s8 p: C0 g( `3 u. L. K
- #define STATIC_SHIFT 3
# k$ c. @2 @( e2 J3 h/ T# H5 j6 w - #define TCINTEN_SHIFT 20
( p1 m3 D# ~% ?' S6 W( E! ] - #define ITCINTEN_SHIFT 21
1 W9 ~$ }- q) g& H; p9 ?4 H( Q7 k" { - #define TCCHEN_SHIFT 22 i9 h) {' K% O
- #define ITCCHEN_SHIFT 237 p8 D7 R8 ?! @4 I
- + s% F' E& r1 X0 r$ |2 k
- static volatile int irqraised1 = 0;
. N6 l+ b6 {- F, w2 k5 v - static volatile int irqraised2 = 0;
- Z/ I% u* q! h' v$ ?! I
# ~9 e/ M* V" ]& \" ?. g+ C- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ x6 b6 t6 b6 C% S9 X
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& k# p! u$ J8 e/ T3 F6 A; U - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
% D# p, y( O7 K7 t, {, z4 V. n
* S( ]! D t$ B9 X- dma_addr_t dmaphyssrc1 = 0;
9 f9 P2 U- M* P- F/ x - dma_addr_t dmaphyssrc2 = 0;
& j" x8 e+ H8 o# }) M: V - dma_addr_t dmaphysdest1 = 0;
# X* A" T7 p3 B7 F# Z( T3 z* N1 L - dma_addr_t dmaphysdest2 = 0;, G' v& F- T6 ]& F/ ~: t
- ]6 t4 J A9 i0 x4 \ {- char *dmabufsrc1 = NULL;
( P5 A! A# D9 {5 H) C - char *dmabufsrc2 = NULL;% B; E' w3 l5 T
- char *dmabufdest1 = NULL;
& N6 a- C& D0 h - char *dmabufdest2 = NULL;
1 {# E2 H; G4 [7 N - * G: ^8 @" E) p7 e6 X5 c/ `
- static int acnt = 512;
1 _0 ^7 A# i- i" m4 H2 B - static int bcnt = 8;
, q8 R- r0 C' ~- @ - static int ccnt = 8;8 J+ ]7 g. m& W. @
- * s( f0 Z. X1 k* P
- module_param(acnt, int, S_IRUGO);/ [6 N9 e" q0 ^5 }* ~9 f0 e3 k
- module_param(bcnt, int, S_IRUGO);
( a9 g) E, i1 H7 h" @0 v2 ?5 j - module_param(ccnt, int, S_IRUGO);
复制代码 6 F5 o) }' c; C
- m, R& x( }0 M 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
K! V) B# @' U, l% {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& j- U/ J) s3 B8 @, M) p 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* {# k* A* J6 d5 u. s
1 w9 Y5 i4 K( K# O/ {" d1 c
( Z. i8 z- L7 b! l9 i$ n% O5 H
|
|