|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 |2 P! d4 ^, ^# R* `6 ~( I( O& M5 K
- [code]EDMA sample test application
6 r+ L" S$ `. @4 b$ m - /*" `' [+ I5 i K+ g0 Q( D/ Q
- * edma_test.c7 `% P+ j" a1 B+ x" A
- *
' p% q$ ^0 Y" L) I; U6 k- a - * brief EDMA3 Test Application
: ~# z' F& b+ z( j+ h: j - *
& A2 b/ I. J, }& I, [ ^ - * This file contains EDMA3 Test code.' ]8 R) B1 \6 b5 f! d0 }4 H L
- *
% j* c+ P8 w5 m# ^# [1 r - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ |6 Z+ u9 A) y! M6 `
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 m% q6 I+ g- H% w! s+ }0 k5 o
- * TO CHANGE.
% _& L1 B5 k- [, O) k; H - *
1 M+ Q! K; I# l4 m, W - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 `- S2 h* G4 A. P X
- ** b4 l% G& h. p* V/ y s2 `
- * This program is free software; you can redistribute it and/or
8 U2 s8 Z" x) T8 _5 j - * modify it under the terms of the GNU General Public License as
& U( N V) Q1 j, [ - * published by the Free Software Foundation version 2.$ u9 ?! g9 c7 s1 Q3 c: O2 ?+ c
- *+ e6 B( H! m+ h% F1 U: v) {
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 g; V: ^7 e: d4 A2 }& b
- * kind, whether express or implied; without even the implied warranty
3 S8 \7 C3 _1 c - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0 r2 g( ~% Q6 `& Y! p - * GNU General Public License for more details.
. V: z, x, k% @" R9 l) y( }) ] - */
3 F3 x" }! J; z, ^( C9 B5 p2 F* @
. x, V/ ?& Q" G, M- #include <linux/module.h>
/ E2 h7 ?9 N: e - #include <linux/init.h>- V5 u3 F! r' C9 x& B5 `2 t8 j
- #include <linux/errno.h>
% U5 R+ t$ Z5 Z - #include <linux/types.h>8 d/ h# U9 _! o4 u& Q3 }, F
- #include <linux/interrupt.h>
7 ~) _6 E! L/ L - #include <asm/io.h>" _7 k* g0 C( g9 P
- #include <linux/moduleparam.h>9 ?" f# K9 N6 x3 V
- #include <linux/sysctl.h>
% R6 T5 l+ J$ o - #include <linux/mm.h>" b; i+ u0 v! b6 X4 l+ [+ L7 G: U
- #include <linux/dma-mapping.h>
- _( Q& E& e/ C [4 r# G9 B
; w$ r5 L' {$ B, ]' X- #include <mach/memory.h>
( J: ^( W" d( U$ m2 c+ N" H9 [( l - #include <mach/hardware.h>
7 h: G. K1 j, b2 B; i) h4 W, g - #include <mach/irqs.h>5 o/ T4 B* Q, i
- #include <asm/hardware/edma.h>
7 D. f% k1 p* g! B3 D; l* i - 4 P, M* X3 {+ T/ V+ F4 U
- #undef EDMA3_DEBUG
$ B6 G9 Z3 I' ?" @; P. L6 x - /*#define EDMA3_DEBUG*/
. ~4 {) @$ }5 r- \2 C2 U1 ] - 8 H. Y, U: G0 c3 }: G3 |4 p0 d
- #ifdef EDMA3_DEBUG
. n) W/ D2 k3 _9 Y( K - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f- ?9 }7 d1 n: k, L
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ~! o! K, Z7 I( U3 Y
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): h* G: R9 E$ h7 k+ s7 t
- #else6 `* { H5 A4 x
- #define DMA_PRINTK( x... )& `$ ]* [' J- {( ]' q% `
- #define DMA_FN_IN% |+ R+ ~' `. t2 m# R
- #define DMA_FN_OUT
9 ~& }* p3 g6 u. R( k4 ]! r" n$ y - #endif
5 m% Q! o# N8 p" D9 X7 a- f
3 |1 r1 j+ g# \+ n& x- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
7 Z0 y6 O, f4 G2 E, z/ \ C - #define STATIC_SHIFT 3' M( x2 U; b* h6 F- b
- #define TCINTEN_SHIFT 20
" ]: p- q3 V/ V6 g9 k4 Y. y) T - #define ITCINTEN_SHIFT 21* l: c) Y* d1 @( K
- #define TCCHEN_SHIFT 22
& ?$ g" x& R' _4 u - #define ITCCHEN_SHIFT 23. J* Z( H; i% y2 _8 j+ H4 y `
* _; m7 c3 h: T |# |- static volatile int irqraised1 = 0;1 j( o4 G: z( B" R* f k" t( V! y
- static volatile int irqraised2 = 0;
, ]6 {7 ?- s. u! Z
' R$ c) b, d* `/ {/ g" h, ?2 ~+ _- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# B! n" X7 i: u7 s5 k% b - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
+ `" K; S9 e9 z5 P - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 T8 |) \, A' k. n7 I- f3 ?
; g5 f) N, y" p- dma_addr_t dmaphyssrc1 = 0;
. ^1 ~% P r/ t3 ]( L) x - dma_addr_t dmaphyssrc2 = 0;
0 o$ n7 {1 W' \- q. B4 d" q - dma_addr_t dmaphysdest1 = 0;
7 Z5 d( Y) B1 o& n; \- \ - dma_addr_t dmaphysdest2 = 0;
9 @* @" S, n2 r+ o( y g& N8 t( P
& J5 m- j4 z3 R/ F- char *dmabufsrc1 = NULL;
+ r- [5 ^* Y C! t - char *dmabufsrc2 = NULL;$ h! M" w- m* S @" j3 D
- char *dmabufdest1 = NULL;
9 N4 f- | h. R9 y - char *dmabufdest2 = NULL;( ~5 L5 c# }1 ]8 X4 ?) ]& z3 [
- + V+ R7 a" s( a3 z! D1 y/ z
- static int acnt = 512;
3 O% g( D' Z1 J# t. {& ^ - static int bcnt = 8;
( h- w/ _5 D8 N3 g9 h - static int ccnt = 8;/ v! }7 j, Q* S4 }6 {
+ p9 e! o: `9 p- J& I. K) q- module_param(acnt, int, S_IRUGO);
0 X+ E9 U. R( H- O1 }" [( M3 e* F - module_param(bcnt, int, S_IRUGO);
2 n, ?* A3 O8 r8 u* Z - module_param(ccnt, int, S_IRUGO);
复制代码 ) C0 G2 o( F# @0 f1 e& b9 ^
+ W$ `6 i( M% O7 h! B6 X# q j0 r' s/ H 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# }) J) ?1 C8 Y5 {2 }) ^" Q& Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, m- H) A2 ]' q5 m+ ]9 |- w
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 C+ {; \2 O# g: {) l; F
, o0 y1 y! s. y$ W9 e' v5 R- _+ j/ B
|
|