|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E; M, i7 {) i# Z( B- [code]EDMA sample test application
7 J, r( Z* A# \" c. ?# u - /*
1 P" P1 t3 q5 Z - * edma_test.c
, o2 d; {# d$ f* B - * J. C6 w" Y# |4 x
- * brief EDMA3 Test Application
! N1 y/ F \; w* | - *. \6 V; V" O5 r
- * This file contains EDMA3 Test code.
% `% ]9 N0 P# \5 W' B" {# |, b$ c - *
: d6 V6 |: I- H2 m, q - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
# _0 T1 X% S3 m3 ?. L8 W - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 E4 L* X/ q. x' o' G" }4 |+ l
- * TO CHANGE.9 W; R2 B+ Q2 y: `
- *
, ]5 w6 h) c. R. q( s9 r) a - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& V# X( P$ x& J$ L% d
- *
% ~9 Z2 i- ~- j - * This program is free software; you can redistribute it and/or
$ B7 e9 g9 f+ \; @1 w, n - * modify it under the terms of the GNU General Public License as
- }; l6 H( }: C' B: B - * published by the Free Software Foundation version 2.+ z" O3 O @* `" p8 j" e
- *
& }4 ] y# J8 F - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 O5 [! v% O, o$ Y4 e, i }% F: M - * kind, whether express or implied; without even the implied warranty
% z4 W; K1 _4 m; ?0 s8 r4 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2 G4 q3 y: H" r- y - * GNU General Public License for more details., d' ^: l5 M7 `' N$ U: z
- */2 l$ q6 c/ }* X3 s* L/ V9 `5 s
- 5 E; q. B, d, \0 ]
- #include <linux/module.h>
5 J8 |3 ]& o) W - #include <linux/init.h>3 g5 `+ P- R" h# c4 y) D$ ?
- #include <linux/errno.h>% p% c- Q4 ^" r
- #include <linux/types.h>
6 L. K! m! [, d. P - #include <linux/interrupt.h>5 _1 k) a. D: q% a% b
- #include <asm/io.h>) f1 Z$ c% H/ t, l# O: W2 n
- #include <linux/moduleparam.h>2 u0 S" A' n6 q; ^
- #include <linux/sysctl.h>
6 G# g+ M8 ?0 q! m" N: R' A - #include <linux/mm.h>
4 U" N1 J+ a+ o" s* g - #include <linux/dma-mapping.h>4 m- e% s+ {1 Z3 O& D
8 L2 j% G- W! z1 [7 }2 f- #include <mach/memory.h>( Y. ~6 M Y6 h. f" _6 d
- #include <mach/hardware.h>5 G3 P+ `2 w( i2 P9 Q) a
- #include <mach/irqs.h>
, c9 h. Q8 i, Y) Q7 E; I - #include <asm/hardware/edma.h>
$ a+ a7 I* Y$ b& K& n' b - ; t9 ?$ {$ J, J
- #undef EDMA3_DEBUG# t( P+ O- u0 X' R/ s
- /*#define EDMA3_DEBUG*/
! C$ V! h, F1 x7 b# Y4 D
6 n5 s }+ F7 [- K# Q- #ifdef EDMA3_DEBUG/ q" {; T" y& S: G% h, E# k! ~9 s
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
1 F) T V- s; A* ~ - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
# g. |2 c8 ]* s" w/ V: u - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
" ]4 l! |4 v- M& o - #else
' a" U x, F) ?% ^9 H3 w7 H* G4 m - #define DMA_PRINTK( x... )
& ` K4 b+ h* r7 m! a - #define DMA_FN_IN
* `/ G1 b9 |4 h" J - #define DMA_FN_OUT% Z4 ~" w6 _9 P x- e- `9 _
- #endif$ z; Y' y3 J" }4 L. H2 ~
0 R9 S; a1 z8 s; m) B5 y0 Y- #define MAX_DMA_TRANSFER_IN_BYTES (32768)3 e8 y. n$ w6 F4 o
- #define STATIC_SHIFT 3+ y* R' K5 h# A5 l% D2 x& m
- #define TCINTEN_SHIFT 20+ Z. f# A5 v# d7 B% p0 D
- #define ITCINTEN_SHIFT 214 a8 F% r1 w) g1 m" F& J3 j
- #define TCCHEN_SHIFT 22
6 P7 `; m3 {! g2 ^; l - #define ITCCHEN_SHIFT 23
8 f, V- T9 o5 `6 C - 2 i0 t J! t+ h4 i6 ?& @7 o1 k
- static volatile int irqraised1 = 0;# e) X7 n2 f+ m7 t: p! a
- static volatile int irqraised2 = 0;
/ ^" K) c! r Z' Q - Q& S' D9 h; f: n+ `
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# z0 [* {: z: v2 l. D$ g
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& q9 m7 K- k# M+ z! A# v
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
- E$ x+ v: `* I$ ` - 8 O- |6 Z- z9 i: z/ Z, Q% `5 P: {
- dma_addr_t dmaphyssrc1 = 0;
v& k3 O( _. @) S0 v - dma_addr_t dmaphyssrc2 = 0;
. ^# m3 G* r9 M( D - dma_addr_t dmaphysdest1 = 0;
s9 t& S1 \7 ^" t - dma_addr_t dmaphysdest2 = 0;
7 n2 ^' r V5 w. J* Q" \7 n2 N" X
0 p# s r! `: Z' f& l& d' h @$ d6 u- char *dmabufsrc1 = NULL;. S6 L2 S" s) p9 j0 ?7 a
- char *dmabufsrc2 = NULL;' M+ v6 n' P$ L$ U0 P5 ~
- char *dmabufdest1 = NULL;5 o- V; Q4 ^7 P/ }1 u: N. X. Q3 G
- char *dmabufdest2 = NULL;
2 c, \6 b- h9 D1 T5 T! D% w - ' J1 D$ t6 H8 c( e' V d: Z" H2 y' N$ S
- static int acnt = 512;
! g, x9 }7 j' a - static int bcnt = 8;
& A$ P( v2 s6 c# A9 j( f5 C - static int ccnt = 8;
9 `6 H8 X( v9 O7 f6 z7 A% @5 G - 6 I9 ?9 V; c0 G2 J1 J }' _
- module_param(acnt, int, S_IRUGO);/ k/ N/ D- i7 s: z+ `# V4 Q
- module_param(bcnt, int, S_IRUGO);
) b; S8 i1 ?: J1 N1 S6 S: [% L - module_param(ccnt, int, S_IRUGO);
复制代码
! P D# i2 K( Q) }7 `- n0 \9 \4 B* k
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& v$ \+ d, Y' Z2 F: farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ h/ C* Z1 z% Q; ?4 P& ?4 f/ E
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( g* F9 d. o T) v+ }+ k( l/ z% S
: \) z3 q* _9 Y# N! |& \0 Y0 E4 ~
; b) B* S$ l* b& O |
|