|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 q4 j5 J/ M9 H2 `4 d- [code]EDMA sample test application
+ C9 M" L* P8 t- g - /*1 H4 f# O" E) q0 c( O& _0 h3 O9 h
- * edma_test.c8 ]7 o9 _% `% e! t( Q @( l' |3 w
- *
; X- p9 i I8 T- `% X0 X - * brief EDMA3 Test Application
* E4 Y6 Y! X* w0 V& e: H: G - *
2 W+ x$ o; i. }/ r( C - * This file contains EDMA3 Test code.
1 R3 M- v: T- T- H* j4 a' l - *) ~% R: r+ o$ d$ e" a9 F% z
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
3 o, [; l- u$ C! X. U - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
" i" X! q V/ d( `3 d& c" ` - * TO CHANGE.
\; v+ ]- D$ l - *
% `: r: N" m2 r6 _' ~ - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
4 X, C( y; E N& N. N - * b" ?. t1 T; s) R
- * This program is free software; you can redistribute it and/or, G5 l+ `0 I6 E' U" i
- * modify it under the terms of the GNU General Public License as
$ u$ W' X/ ^" r4 a" V - * published by the Free Software Foundation version 2.
- g- ?0 K( I9 u. g0 ]! }9 p - *
7 G, q* p7 r/ A. D2 [0 h" M" } - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
7 G# H; l. I/ ^# h - * kind, whether express or implied; without even the implied warranty9 k/ C6 S# Q' f/ q( |9 {) ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the( }& S$ h7 U* X% L4 U& v
- * GNU General Public License for more details.
% `, e, e6 w7 `7 p6 ~ - */( v2 w5 ~/ Q6 W) q- G6 t
/ w0 K2 z/ L; y8 b) ~- #include <linux/module.h>
z$ V) T" c+ Z K - #include <linux/init.h>
) R- y) F! A) c) Y+ X7 s8 j( L - #include <linux/errno.h> B) k: C% x& k$ M
- #include <linux/types.h>
: F- r2 Y$ {; m4 s - #include <linux/interrupt.h>. M' U- i$ b8 m3 V& i; A
- #include <asm/io.h>7 k6 m& k- p, X
- #include <linux/moduleparam.h>
# G- c- j1 w! b$ ]4 H - #include <linux/sysctl.h>
$ Q8 j; M5 b7 C0 @ - #include <linux/mm.h>
6 E. Y7 n9 i; h+ i - #include <linux/dma-mapping.h>
0 ]/ `- U7 H! C& m7 L, i' G
; o* |/ m5 L+ H& Q( R- #include <mach/memory.h>/ ?6 ` V) [+ u# T( a1 n! ~9 m
- #include <mach/hardware.h>
& y7 n, Z N d - #include <mach/irqs.h>/ I9 m9 r9 s! R$ c3 C& C. u; |5 e% ?( \
- #include <asm/hardware/edma.h>
; r/ p0 [9 u& u
' Q; ], L: I5 }- \- #undef EDMA3_DEBUG) P/ O8 A) l2 S3 @4 E. `
- /*#define EDMA3_DEBUG*/
5 `8 t% S# E8 J& a [
- V9 B8 z: {: O9 A, J- #ifdef EDMA3_DEBUG+ g, \1 m4 R% `& r* m9 m/ E
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 \4 H, v, ~- m+ f
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
- v+ D' Z3 |( I0 Q - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 T" S, e" b8 D
- #else
' j) j/ a, ]( Z \. Y7 a - #define DMA_PRINTK( x... )
& s) c: d9 y7 m+ T, [! }( | - #define DMA_FN_IN+ O7 S& t* P* Q; i. d
- #define DMA_FN_OUT% j Q' Z2 G' q0 L$ B
- #endif7 B3 `' s! D. K+ `0 s) o0 z
4 H2 q1 F1 S1 k. |, u# A9 w- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
9 d3 P- k3 G, f) t! M - #define STATIC_SHIFT 3
6 V' X, q! o$ ~6 R3 \; M1 |9 Q - #define TCINTEN_SHIFT 20) b8 R, p2 N$ R+ ]5 m
- #define ITCINTEN_SHIFT 21
) |) X% P8 O9 _ e4 Y - #define TCCHEN_SHIFT 22
% s9 S9 J/ V2 v1 G N - #define ITCCHEN_SHIFT 23 K2 E3 W* p3 u3 k
- , O$ ~/ s0 d- F. O
- static volatile int irqraised1 = 0;
: \8 ~3 G3 @3 o# Z& z0 `% p - static volatile int irqraised2 = 0;* a' G: l8 S3 i5 t3 j# j {
- - ~# C# J% @. \: g0 U# z
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i. d$ p' u- C) J H$ x4 g* r8 ^
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" E6 B# o4 Y: _$ }! ^5 w9 x
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 [: ~; n+ E2 V+ |8 c
8 F$ e5 x7 X( T* F- dma_addr_t dmaphyssrc1 = 0;
) o! q( z( ~8 b5 {" N. q- O1 F: D - dma_addr_t dmaphyssrc2 = 0;
7 G; Q% f3 h, m- \ - dma_addr_t dmaphysdest1 = 0;
5 A" u% u: O1 E& [3 T* z" P. L8 ` - dma_addr_t dmaphysdest2 = 0;8 N2 d$ o) x# ~! S# N: Z8 j4 E
5 l& A& E4 j( s2 ]! O, g- char *dmabufsrc1 = NULL;
1 L0 {0 d- c0 o - char *dmabufsrc2 = NULL;
9 z( x+ a- M( C3 d' O6 A9 W6 y - char *dmabufdest1 = NULL;
* k4 p D, z0 c! p% M0 ` - char *dmabufdest2 = NULL;" o, z' m% } @! f4 y# f
- , P2 @6 s; h7 U* X
- static int acnt = 512;
8 ~, c5 x- g6 f( Z( X - static int bcnt = 8;/ Y b0 j, g8 c
- static int ccnt = 8;; J c2 N" r# q% a" J5 @6 [
- ! N3 j- q7 s* t+ ^
- module_param(acnt, int, S_IRUGO);
; [2 d7 ]$ Y0 A) y ?1 w: W - module_param(bcnt, int, S_IRUGO);2 Y3 d) v4 s# p) j$ o0 J6 m+ J% `
- module_param(ccnt, int, S_IRUGO);
复制代码
4 i- e5 n5 i7 M# Q, y: N5 i
, @3 ]; l9 @( {: M) m 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 J, ]4 N8 o% Z6 e+ q, d' 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: [" s9 l& e# N/ Y7 `/ p; V9 ~0 Q6 z 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% F- E! Q% T+ y: z# r
5 }$ A6 }3 y. _# r$ }" y2 T+ W( S1 l3 `8 h6 S
|
|