|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 i" n5 r4 t/ F8 @: U
- [code]EDMA sample test application1 L6 _% t6 S8 m+ N5 K
- /*& }; W5 [' W: O9 [
- * edma_test.c
6 G* H) B; P' W3 `" `/ l - */ u) M" K2 y! O4 a+ E% Z& E
- * brief EDMA3 Test Application
% d1 `0 Z( V- g% c - *
# q/ y; Z) g+ M D, T. I+ n - * This file contains EDMA3 Test code./ _2 D. S4 f& T6 A
- *
8 ~: m4 H: M/ ?. K: `4 g - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
: l4 M* z* m v2 {) q" X( u - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 m+ O. f' Z/ y7 b- U8 [ X% ~
- * TO CHANGE.: p9 Y7 S. _6 ]
- *# Q4 H# G! p# B' m6 V$ ]
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ m# O- K0 y1 T# h4 ? - *; `# t ~2 d( r2 K' j
- * This program is free software; you can redistribute it and/or
. C+ l, A/ ?% U9 G - * modify it under the terms of the GNU General Public License as2 T0 ?& e, b+ Y( J: `3 \& z5 X
- * published by the Free Software Foundation version 2.
/ o; Y& [& s* B* S, \ - *
$ m, T: w+ {& N# I) f0 D - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# J8 U. G( K4 u! ]- k0 w- H
- * kind, whether express or implied; without even the implied warranty
& X8 {* k# V9 Z - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
. }( c$ P8 B8 y. l+ l - * GNU General Public License for more details.7 w* Z! L) P3 I2 P( G" ~- ]. V
- */
A5 o5 x# C2 B: ] - ; p9 Z( g6 t5 z7 }
- #include <linux/module.h>: {- N5 i9 g# D- G' |- F7 r# B
- #include <linux/init.h>
) h% y; R7 I" Q, U - #include <linux/errno.h>
- k9 ] O1 p/ v' r$ o) b3 _3 ^ - #include <linux/types.h>& X7 b7 b q: n5 Y
- #include <linux/interrupt.h>: M0 B! D, e$ E' m; l! V
- #include <asm/io.h>9 h! E( Q+ }+ p. [
- #include <linux/moduleparam.h>
/ `4 D6 g/ H; b6 f) t0 o2 o - #include <linux/sysctl.h>
$ o. h! P- E j" [* j! D: h - #include <linux/mm.h>. v/ `7 A: ]0 w3 D0 b2 O9 o
- #include <linux/dma-mapping.h>& k. O1 s' ]$ I6 \5 \( C- g O
- % m8 d4 b; T; R" k$ L& o9 z; b
- #include <mach/memory.h>+ {' \+ u& g3 U6 g
- #include <mach/hardware.h>
, x [4 |1 }3 O# W - #include <mach/irqs.h>8 U0 r- v3 H `" s0 p" e0 Y
- #include <asm/hardware/edma.h>
" \; }. X9 G" [; A8 ^3 g - - }$ r3 B; x( i) c7 X; h/ g
- #undef EDMA3_DEBUG
% L% }! R3 p! a$ E- Q& ~ - /*#define EDMA3_DEBUG*/
) E2 O8 i& c( Z0 [6 d
2 j* `7 s! p2 ? @2 g2 u3 P/ U- #ifdef EDMA3_DEBUG
: ? A& }& B6 r* K* g j) o - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
* K! K7 P- V L( d, _7 g7 o - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
. X+ }% `3 A/ J* ~# t- ` - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
* J4 v9 F" w' x* a4 m) ] - #else
0 B- y& c& }" a' [7 n - #define DMA_PRINTK( x... )
+ X7 o' E! }) U - #define DMA_FN_IN
9 ]$ @" b3 ^4 p; V2 a, x2 ^ g: F: y - #define DMA_FN_OUT$ v. P0 h# n0 Z+ t& ?
- #endif
6 O1 z6 I7 U% i8 o+ g% y4 ^ - . ~3 |# |7 @( U, |
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)( `# b4 t8 o) e% l8 X
- #define STATIC_SHIFT 3* ?; b1 t# ?8 }
- #define TCINTEN_SHIFT 20
7 A3 o. a M. Z. I( g - #define ITCINTEN_SHIFT 21) e; w* ~" W j+ x# E% X# E
- #define TCCHEN_SHIFT 22, f4 v: v0 x" s1 m$ ?
- #define ITCCHEN_SHIFT 234 V1 B) J+ O- o% C% a" C/ e( K
- / l3 _% k! J- C7 w" C4 d1 G
- static volatile int irqraised1 = 0;
4 F; {3 k4 g. q$ y# _ - static volatile int irqraised2 = 0;" I J2 f6 q6 ?7 {
3 C; Y) |* |+ R; a0 b+ h- o+ u- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
9 y+ _6 k) S' j1 G3 [( b @ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
3 V8 Y8 ^9 u+ h; ` - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H* B+ w$ e) A/ j/ d8 q
; Z6 A; i0 o( W; ~- dma_addr_t dmaphyssrc1 = 0;
: {" n0 p7 M" Y7 d7 W6 \ - dma_addr_t dmaphyssrc2 = 0;$ N7 m5 E, r5 C
- dma_addr_t dmaphysdest1 = 0; N! h4 z: l; W$ f5 K
- dma_addr_t dmaphysdest2 = 0;# ^7 m* Y7 j5 z
& d5 ?+ D( v; y" c, d) X- char *dmabufsrc1 = NULL;8 t( _7 v6 G% i7 U" H: Y5 S' `
- char *dmabufsrc2 = NULL;
; ]& d( ~9 g, I - char *dmabufdest1 = NULL;
, v9 R; L$ x4 h$ O( e - char *dmabufdest2 = NULL;8 n# K$ R% P% n8 u) t
! o% r9 o( j* S: z7 @- static int acnt = 512;
9 D$ W3 N4 @( z, {$ O - static int bcnt = 8;1 |4 o9 v6 \: \' w' m
- static int ccnt = 8;
/ ]$ p N- j$ j: d- r, H P
# ?, ^7 i, d9 w/ w/ p- module_param(acnt, int, S_IRUGO);, I% n# }' j r; m6 R
- module_param(bcnt, int, S_IRUGO);' k+ e3 u- ?# I1 p9 ]
- module_param(ccnt, int, S_IRUGO);
复制代码
, F+ y: P1 {5 x+ X( _6 m
* T8 R W( z' [6 X" |3 A 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ G' }* q0 B2 Z8 c. k4 r {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 W) X4 \0 o @4 Y 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; A& E$ N' N' w8 q4 p; |5 A4 `, N" w8 G6 [
2 j% ~5 Q, ^( H& w3 N8 s |
|