|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 `3 S. M. | \, y
- [code]EDMA sample test application0 y' A% i! d0 n m- B& Z1 t2 F/ @
- /*
/ }1 V6 q/ Q6 X4 \) `5 Y - * edma_test.c; H5 L5 \# w, h/ U- i9 L
- *7 o& w6 F* {3 l+ S& Z; o
- * brief EDMA3 Test Application. a" e2 u+ V+ F) `8 B
- ** v3 R' |* c& z
- * This file contains EDMA3 Test code.% a& e M( ~& G7 Y
- *
! F8 ]) v( W9 ?6 {6 i% i, r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( Q* K- C- ]( k x k( n
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
9 }4 Y" _, | ^ q# R r' j - * TO CHANGE.
* T$ x1 c/ b v9 W: b: D: P - *
P: Q+ R$ ?* R, z. C5 A F - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: a2 Y6 w, D% f3 Y) F5 t: b
- *, H/ H3 I( y9 f' Z! S. q' a
- * This program is free software; you can redistribute it and/or
?) {' F: D5 x2 F: H - * modify it under the terms of the GNU General Public License as3 K5 B# N" }! ^1 O. V Q
- * published by the Free Software Foundation version 2.
# f& P* H* Y5 m, E d+ T - *
Q' u* e9 c4 K+ D$ m5 }! u* W8 B# {$ Y - * This program is distributed "as is" WITHOUT ANY WARRANTY of any a+ E0 c* N4 N5 Z* }; U
- * kind, whether express or implied; without even the implied warranty
. o* P9 z, F W- q( V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. u% g& S- S3 ^% X - * GNU General Public License for more details.
9 ]: P) d4 L- p, d$ x - */2 X. Y/ d8 r5 N
- $ _ y8 g, o( {# U
- #include <linux/module.h>+ n3 v* a+ t# {
- #include <linux/init.h>9 v* }3 y9 Y7 z. J7 D1 i
- #include <linux/errno.h>
* i: z: x! p4 g - #include <linux/types.h>- D6 h7 j- H9 a
- #include <linux/interrupt.h>2 c E& v) r& D: L) e
- #include <asm/io.h>
4 h% A9 f# D4 x6 T; S; s8 b% U - #include <linux/moduleparam.h>
w e4 E# [, A }0 l9 l! s) e - #include <linux/sysctl.h>' }% o* S3 j. w1 Z* S1 R: _4 D; } a$ ~
- #include <linux/mm.h>. X- d$ R+ x) K
- #include <linux/dma-mapping.h>/ i9 F# ~/ o0 B9 Q5 [: ^
" l+ `: h8 m0 J/ {/ T- #include <mach/memory.h>
" f' o- d% ]5 f7 t - #include <mach/hardware.h>( j$ W6 Z2 c. E' S3 Q
- #include <mach/irqs.h>
0 T1 X- T5 M6 i. \ - #include <asm/hardware/edma.h>: q6 W* U- ?& j/ \
& j4 R2 Z7 W% Q! s4 H- #undef EDMA3_DEBUG
; J9 a& W4 C' n: e - /*#define EDMA3_DEBUG*/
; a/ Y& S9 j/ n( R3 O* X - % H; `0 A; u7 x% R2 l
- #ifdef EDMA3_DEBUG
: T. C) n7 x" B$ a& o1 C - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ~# n5 P( u/ H$ V" x) p% U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 f1 V9 q1 H% |
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
t# Z# A8 ~0 v0 Y; D. y - #else
/ ^; _" M2 |3 ]5 m! n' W - #define DMA_PRINTK( x... )1 {) O) F1 A1 g& n$ O7 M( w! N- b2 [
- #define DMA_FN_IN0 r- l$ w6 G+ G! I A: V
- #define DMA_FN_OUT
( K1 z0 @3 u: g% u1 b - #endif3 p9 A/ J" W0 W7 O# T
- 7 I9 s% s; L& ^. d
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)* u* i( n ?% T5 u
- #define STATIC_SHIFT 3" P' T, q* r% c, p
- #define TCINTEN_SHIFT 20
; |. g2 Q2 \; n$ _1 S - #define ITCINTEN_SHIFT 212 b: p, n! s6 L: v
- #define TCCHEN_SHIFT 22) s7 J6 K6 U* d9 ^7 u) [- E
- #define ITCCHEN_SHIFT 23
. y. y( y3 c* V0 ]) {" M! W* ?
3 k/ I" K" s ~4 d5 x+ H+ } B- static volatile int irqraised1 = 0;8 x' l% O# i2 Y% m% B! `1 Y$ z
- static volatile int irqraised2 = 0;, w8 y- Y/ H9 p1 U' B- n
- 7 c* X2 t3 n( Q& z- |) X
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; p2 Q1 x* ^! X9 k* B - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
/ Z+ }3 n$ i- p# N0 o6 M4 q+ M - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ s7 s, {! s- B$ Q' [3 Q
6 k2 e' ^8 }) e( V6 v' r2 H' T4 v- dma_addr_t dmaphyssrc1 = 0;0 S/ x6 t% D7 \% k' c- z" O/ c
- dma_addr_t dmaphyssrc2 = 0;5 @6 E: t3 U' g9 r- z
- dma_addr_t dmaphysdest1 = 0;
. R2 {2 v4 _. b - dma_addr_t dmaphysdest2 = 0;
4 E( \5 F" b, g+ s1 d' s - 8 O3 H/ D, |. i$ p) r: ?! M: G! B# r
- char *dmabufsrc1 = NULL;
5 C8 i4 m8 W, D9 w. \ - char *dmabufsrc2 = NULL;0 v+ o$ T; `$ T2 h4 n; S8 O r U4 K
- char *dmabufdest1 = NULL;; Y# y% V7 o* ^$ h$ N: S
- char *dmabufdest2 = NULL;
" I, C( A& C' {+ G' O - # G3 @' G6 }( n* Z
- static int acnt = 512;. S" k% ]; P n* z+ s( M
- static int bcnt = 8;
6 b# |$ ~! O; o0 Q7 i - static int ccnt = 8;
$ g# n; _" Y: `
g! ]/ w1 O5 L9 `! j% u$ j- module_param(acnt, int, S_IRUGO);
" b$ K8 ^+ ?4 Q4 p - module_param(bcnt, int, S_IRUGO);
' ~( G" @2 k! X0 o- F& k3 W( k - module_param(ccnt, int, S_IRUGO);
复制代码
' C. X" h7 I7 d9 l$ |- D
: J# ~6 g0 T }8 a# N0 J 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 r& K' i: a0 f2 S" {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" L3 O$ ^2 ^% N% Z4 U6 {: Q5 n; e 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }0 @' \& ~# A- p
: _! a. X; j7 \: n. q4 }7 {# v0 q( i: Y9 C3 I# `+ @
|
|