|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + f3 b; ^5 E' ~3 h8 _* `7 r
- [code]EDMA sample test application6 @ a1 `' }7 |% @/ N4 T
- /*
1 g2 P: S( @ m7 S0 |# k5 F - * edma_test.c1 z" ~$ v0 Y/ o2 `* N
- *! I1 x* n' \" q0 c' J
- * brief EDMA3 Test Application
7 h$ B. g/ c2 v$ P8 \' z; u - *" ~; |( |4 W8 z" G0 N& `, u
- * This file contains EDMA3 Test code.
# ^7 I8 V2 G5 z: z8 V& ^; D- h - *$ t5 s4 t/ |. K/ J$ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
* S7 Z) H( {* R& O7 a: G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ {2 R5 \/ d9 @
- * TO CHANGE.( J4 I$ W6 m1 V1 Y2 S6 M; S
- *$ i7 L% q3 m4 u% `# G6 y, S
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. V: s1 B0 L2 S' Z/ V
- *
& a* ]' s8 h/ t7 q - * This program is free software; you can redistribute it and/or! [7 N; t5 r: j, L. N' \
- * modify it under the terms of the GNU General Public License as+ H. B0 O l+ ?: e, Q, p0 T ]7 K
- * published by the Free Software Foundation version 2. F* c0 ?; L) e
- *: K* V9 I6 d3 N. X! ?. o$ x
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ~) s) [1 N" F; e8 Q% c
- * kind, whether express or implied; without even the implied warranty
% g- t1 i1 i7 q8 {. U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! G# M: k; V% l, G1 h - * GNU General Public License for more details.
& ?8 F/ C1 I$ z) s" T' K+ n7 R - */0 G0 G0 U+ |1 J h- H
3 p9 O+ a, E5 l: [& e7 I- #include <linux/module.h>
( v3 r% K2 q6 X2 {# Q - #include <linux/init.h># e2 \3 J/ W `& O3 @
- #include <linux/errno.h>
' A1 W' w7 M% y0 F - #include <linux/types.h>+ r. _& w. d. _6 F) k" ?
- #include <linux/interrupt.h>( L+ ^2 K# P, q
- #include <asm/io.h>
2 _. l! o6 `( K: |4 K* ?$ l - #include <linux/moduleparam.h>4 W m" ]# s8 `
- #include <linux/sysctl.h>
7 @/ C6 @, ? }" f2 h - #include <linux/mm.h>$ ]# }0 F9 t9 U( K4 P$ I
- #include <linux/dma-mapping.h>
% L5 w! b( q* P+ v& g- a
0 B- e M @- U4 y4 C- #include <mach/memory.h>5 O) O8 o( j$ v4 Q
- #include <mach/hardware.h>
5 G9 N9 L. b% l - #include <mach/irqs.h>& p E0 ^- h( }# X
- #include <asm/hardware/edma.h>" Q) @8 A2 |4 Y* u% v3 x8 `
- 5 V7 w/ X6 u9 p/ P0 z, K
- #undef EDMA3_DEBUG6 N( G3 _# Y1 E1 [( Z8 j# i( {
- /*#define EDMA3_DEBUG*/% w6 V! U! F' c& {9 m- j! _
- ; W2 }6 A) n8 x
- #ifdef EDMA3_DEBUG/ @* f% V' B3 s. T- D: ~
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
" A% K7 [ T W2 a4 } - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
E; e1 e4 H8 E! n+ ~$ a* i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
9 A, s5 h' K: {9 _ - #else
8 p2 C7 {. S5 ^0 } - #define DMA_PRINTK( x... ) g: z3 d& c6 d8 d$ C! W
- #define DMA_FN_IN- S% l7 B% |0 e* C( Z3 t
- #define DMA_FN_OUT
) u: w, }: J' p- ^4 S - #endif/ R0 Z/ C9 ]1 _! Q% t3 V' W
- : n% y2 D. Y. X4 P, r( l5 i/ y
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)& \4 s) D1 [0 s5 f) Y
- #define STATIC_SHIFT 3
& C- D( }3 ? E% [# Z' | t5 }4 } - #define TCINTEN_SHIFT 20
; z2 k' M/ l6 P! P+ C4 J! R" [* n+ c$ e - #define ITCINTEN_SHIFT 21% w' ^# E/ `" V0 c
- #define TCCHEN_SHIFT 22: E1 N: U, S4 G
- #define ITCCHEN_SHIFT 23
& y, i1 P: F) S
/ \' x- I9 y. n# R4 p1 N5 e- static volatile int irqraised1 = 0;
) {+ s7 q b, J% i* r4 E# c - static volatile int irqraised2 = 0;6 l [6 X7 \$ s3 G3 N
- & N; p3 `+ V3 k K! r
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 v, g9 c3 `3 i. m
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" _/ v( {& b9 [, v5 f2 l% A- J - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
) [5 O: n& ?" O& E% w" R - + o( E Q& }' [) Q
- dma_addr_t dmaphyssrc1 = 0;! ?, e% e6 j3 N" Q7 a
- dma_addr_t dmaphyssrc2 = 0;
) R# m+ d# ]) B3 u8 }# d6 C7 l - dma_addr_t dmaphysdest1 = 0;
% l+ `" z' B# S& `( F - dma_addr_t dmaphysdest2 = 0;
6 z* Q6 a6 a m5 U1 A: ^ - , m( G' w0 G. {
- char *dmabufsrc1 = NULL;; F1 }. q- ?4 z: M4 K5 O& ]
- char *dmabufsrc2 = NULL;9 m" A, t8 s5 ?6 R2 ]( f) U' i
- char *dmabufdest1 = NULL;# M, g4 l3 _9 j/ L8 c
- char *dmabufdest2 = NULL;; X) V z& S5 {; W
) q$ ]7 o4 y% T b$ T t" ~7 ?" h- static int acnt = 512;( U9 b+ U$ L5 a
- static int bcnt = 8;+ ]7 I7 P2 x/ b' V3 c4 V6 f/ \1 \
- static int ccnt = 8;
) S8 R: H; w3 d( a - 7 E4 ], ]; `) C5 m: J4 M: E
- module_param(acnt, int, S_IRUGO);: @# Y, L2 D! A3 z5 M2 X' j
- module_param(bcnt, int, S_IRUGO);
2 u: N, R C: W4 D2 j: ] - module_param(ccnt, int, S_IRUGO);
复制代码
% q* w$ c& }" y) d7 K
2 _3 ]4 B y, {$ p$ U9 p0 V 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 J/ L( B. s6 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 O# g2 |+ D) x& a* {
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 D( Y' Y8 i" w- G5 I7 {
- B; `" s: |/ }% I# g6 s( N1 d, p2 p8 f( {& w0 y# c" `
|
|