|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & A7 }" g3 W! M
- [code]EDMA sample test application! u' ]0 v* R: N9 v! K( F
- /*
$ r) |* K% ?2 c: u4 n# s - * edma_test.c
* V0 k% N1 Y! s! ]2 V - *8 X' {; v# h! |- C' s! k2 Q
- * brief EDMA3 Test Application3 S1 t* M/ W( ]0 P! J9 }
- *
. x% y0 o3 x& b - * This file contains EDMA3 Test code.
. o8 O V, }6 n, k# S - *, p$ _6 }9 X; N1 ?3 C5 U
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ @$ B2 K5 G/ k) q# M: T) Q3 Z7 Q
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 |: A! Q) [* e: u; e* O' [! Y$ C1 Y
- * TO CHANGE.
& J5 d6 f! O, M* Q4 j) ] - *
$ f; _5 e% C% |* v - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 y" j) {9 P( l. o9 D
- *4 L" z. Z; k6 |
- * This program is free software; you can redistribute it and/or
# S/ v6 _& ?4 A* x - * modify it under the terms of the GNU General Public License as: t5 i x1 y" L0 |: r
- * published by the Free Software Foundation version 2.0 _1 @# ]$ O: ?" l" h
- *8 o& c& m$ {7 U5 J
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any% A$ ?/ \3 F$ l
- * kind, whether express or implied; without even the implied warranty; Y$ h6 l# F, \, n2 {
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5 W& o- @% e) z- b1 m - * GNU General Public License for more details.0 t7 q- H9 c. I& S
- */
' d4 D# b" |" ^! j% e0 J - 4 R5 S2 y8 [; f; j9 i( K
- #include <linux/module.h>+ y. M" ]8 B+ [& V1 ]3 I* G
- #include <linux/init.h>
" T. i" j/ |* m3 \ C: c- U: e - #include <linux/errno.h>4 S# [; O4 N% W: V9 v
- #include <linux/types.h>
9 Z+ S6 @* V3 h3 a3 Z, f - #include <linux/interrupt.h> e) j4 l+ d$ c
- #include <asm/io.h>
J/ ?, R' I! P: ^- l) q6 C, F- t - #include <linux/moduleparam.h>
! y: R8 N$ @5 a - #include <linux/sysctl.h>
; u( K/ u" e- \, d - #include <linux/mm.h>+ ]' I6 J$ F2 _; ]$ `8 j. B6 U
- #include <linux/dma-mapping.h>5 k$ y; ?- ^% ], W1 g
* ]% ]6 e) Q+ B# \- #include <mach/memory.h>
4 b3 M6 N3 \; e& e# q* i% { - #include <mach/hardware.h>
/ d i; M, w6 N: p5 t% ~ - #include <mach/irqs.h>! L% f+ m" ?1 h5 g% K
- #include <asm/hardware/edma.h>
5 K2 h/ {: O6 E4 |) P
; i X' K9 g; X. t- #undef EDMA3_DEBUG5 J1 z' Y' T; q. K! B- q( H
- /*#define EDMA3_DEBUG*/
9 J- J. q8 p5 J9 l4 @ - 5 D/ n& i8 B* [9 c7 U$ C
- #ifdef EDMA3_DEBUG
1 y4 W- W4 j5 b& w - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 Y, m+ x. X6 @- H/ D
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) r7 n/ |; ~. a/ m- U
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 h; K! m8 k A G1 o9 Q
- #else r8 L9 H3 y- z5 m5 y3 l
- #define DMA_PRINTK( x... )" U# V9 r8 @4 F* {4 I
- #define DMA_FN_IN
' E) P- b1 p u$ G - #define DMA_FN_OUT u; q8 e6 C' q4 Q# ^
- #endif" @! Y) w$ v" s. E9 ]( {+ q/ W% k7 z
1 c+ @7 ~) u+ t! w2 V. |# Q5 }- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 X# \1 \( O' E# a
- #define STATIC_SHIFT 3( j9 g8 C: ?! B: Q4 L
- #define TCINTEN_SHIFT 20
( Q9 a, ~9 a5 ]8 ]' J - #define ITCINTEN_SHIFT 21" v/ Y* ~" J) P8 O; k# n
- #define TCCHEN_SHIFT 22
5 Z, L, R* `0 x: p. h0 }* v. N - #define ITCCHEN_SHIFT 23& o& E! t1 W5 Q% a; l. w( U
- , @* S3 L+ W' X: n5 m0 H# T
- static volatile int irqraised1 = 0;% l# e5 k2 q9 i/ i3 {
- static volatile int irqraised2 = 0;
- P( _' @6 `8 B2 z5 K- {) [0 {
; j K n% M& z# ? c- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P$ P4 M' q9 s9 n0 l
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 D9 X2 `# U4 e
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. B0 b, S# \! V% u: `
4 A- f! a7 O' ~! O, Q6 ]. E- dma_addr_t dmaphyssrc1 = 0;
# E% H: i$ [) Z0 D! }# j5 E: x; q - dma_addr_t dmaphyssrc2 = 0;
. I# q5 H4 q" Z9 m1 `; |1 G - dma_addr_t dmaphysdest1 = 0;
% j* Y. q2 } G; S( ~8 K- p - dma_addr_t dmaphysdest2 = 0;
6 V' x( K, E% t: v2 B0 Q
, w/ D4 X. V8 m3 I3 U/ z- char *dmabufsrc1 = NULL;! ]- N6 w( n% V
- char *dmabufsrc2 = NULL;
; z6 r& X5 [0 O6 b* J - char *dmabufdest1 = NULL;8 J: K- S0 Y0 ^
- char *dmabufdest2 = NULL;# B3 S$ s& o. g7 i8 U
- ! Z6 o- t; u- n0 ^* H+ \% Y3 E
- static int acnt = 512;* {/ l# D+ M* v1 u! Q
- static int bcnt = 8;' y2 `2 R; V3 B3 N1 L4 p/ C
- static int ccnt = 8;
; |9 @& @4 t$ o" E# S' D0 F - b6 V- J' l* ~' U7 }
- module_param(acnt, int, S_IRUGO);) w! B5 v( A1 D5 @& V. {
- module_param(bcnt, int, S_IRUGO);
( ?1 {5 p1 V: T; } - module_param(ccnt, int, S_IRUGO);
复制代码 + P1 B8 |) d. L% b/ D1 t* L' Z4 n
/ M+ q: N" n2 Z; F n" \0 `, I, ~0 @
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 J' n; |, q W' S0 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 k# s3 Y" N3 Y8 W; t* a2 @ 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 [' H% w8 U. m
0 T# |: ]2 A) _- ~1 i/ _
( N9 R) R4 d5 }1 ~; k/ f0 {! N
|
|