|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 e1 `, i: ?& `5 r. I5 J! ~" C) @- [code]EDMA sample test application" S7 w G# `, F: u" d$ D& Y
- /*: |8 T" k( y, v& ^$ y$ ]# P
- * edma_test.c
( C9 n9 O& X! N - *
& K: A) T" s3 E+ i0 Z# ? - * brief EDMA3 Test Application
5 i; R9 w% E* k# a - *
; l2 Z- ]( x3 b4 z - * This file contains EDMA3 Test code.: K/ Y( j2 h, G* D1 x" \3 R0 @
- *
8 m" g0 ~1 \& u& D b0 Y% i - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
. H7 f+ \1 w# v0 ^ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 {2 {2 o' A1 @) r) U' @8 D
- * TO CHANGE.
1 c0 }" s7 N% V4 o6 Z+ @ - ** x; C V. W5 u; Q/ t1 D' W
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- U1 P9 a1 c9 {' s% P$ H9 k; [1 _
- *4 _# H% C3 L' N! X# y4 ]4 s0 S$ J: N
- * This program is free software; you can redistribute it and/or! Y0 N- J* N8 l2 i
- * modify it under the terms of the GNU General Public License as* T9 P, X' z# o& W
- * published by the Free Software Foundation version 2.
9 O" j7 H7 {4 a - *
( h6 P. j; F" g7 N9 [7 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 z+ r6 G; C* G9 y8 s6 C/ k5 a
- * kind, whether express or implied; without even the implied warranty4 Y; e$ Q2 P) i3 y& Y
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the/ N# V/ k; ]# D6 N2 F: ^
- * GNU General Public License for more details.
+ w1 s* }4 Z5 w/ f - */
" l) @! m2 i. y5 o! f+ O: T1 N# ^
" U/ Z9 L6 F# V& p3 I% s- #include <linux/module.h>
: u- o* J( A4 }" U. g5 |$ H - #include <linux/init.h>
( @* R! n9 ^5 k; w2 V - #include <linux/errno.h>
8 S3 p" f, w: v* H b9 \0 Y - #include <linux/types.h>
j) x5 o8 A8 z' g t' t - #include <linux/interrupt.h>9 G6 L4 }( n( _3 `* r' |
- #include <asm/io.h>; }) E4 f+ l& [" t+ A
- #include <linux/moduleparam.h>/ x% Z8 {! o# a3 _9 l8 h5 y" w: P
- #include <linux/sysctl.h>
1 S0 B* \) m( a0 o! D$ |" d - #include <linux/mm.h>
/ G( a& p2 S5 h- Z4 \. L# D - #include <linux/dma-mapping.h>. C, g# m u! j! y l
- 4 W& h0 n5 R3 V- V% Y3 A
- #include <mach/memory.h># l' F3 Q# }2 Y% k: e4 E% e
- #include <mach/hardware.h>
' E8 T( U% n* l0 F! Q. K - #include <mach/irqs.h>
/ Z# H' M' X6 N, w) |% c - #include <asm/hardware/edma.h>& }$ `2 \* ^; q, c* \! a" m
- & F8 h# z# E6 r" u, m
- #undef EDMA3_DEBUG
+ I9 q% u/ Z1 |$ Z% u - /*#define EDMA3_DEBUG*/
_: s. i4 g! c$ ^7 P+ B0 s) y - 7 n) K0 c/ y. b) S# G
- #ifdef EDMA3_DEBUG5 \# x; _# G# Y5 h3 D, A f* L, z/ X
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 _! [( m9 I3 U u0 I - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
1 t4 _6 Y; y3 P+ q0 {! S/ I7 l* } - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
j3 u1 z' g8 m% P6 p# k$ C - #else
/ c$ L, |+ ~6 w9 Y - #define DMA_PRINTK( x... )
0 q+ k( e/ e6 d) K- _ - #define DMA_FN_IN
! U9 y. X" }5 O$ X' v - #define DMA_FN_OUT$ k) K, B& e! X2 o' ~8 \5 b
- #endif. y# B& T3 W6 E* b5 a+ y
- . g- A" H3 W' Y' ?5 }$ C
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
+ b& a6 t! q! }9 z1 x0 g) T - #define STATIC_SHIFT 30 ?6 I7 B" H6 u' Z( c
- #define TCINTEN_SHIFT 206 f, b1 w8 f9 U+ q, \* Z3 O/ d! l
- #define ITCINTEN_SHIFT 219 v5 N# y# s+ K, U
- #define TCCHEN_SHIFT 22
1 c0 b7 b$ y- Q - #define ITCCHEN_SHIFT 232 L3 m+ }; J$ Q) G3 _$ w
; Y, J! K" ~0 u+ C/ e4 |% b- static volatile int irqraised1 = 0;
9 @# z6 `7 x: h! H - static volatile int irqraised2 = 0;% X% S# c3 R1 y
- ; @$ c" U$ k6 V/ }$ @
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
" ~8 R: p0 r! ~( w" F0 t: o. o9 \ - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# U1 Q* S/ X9 A: B2 V! S - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
4 s% C' [: c! ]$ [ - / [+ R2 {4 M$ T2 Q+ k2 f0 d
- dma_addr_t dmaphyssrc1 = 0;
. _9 y! U0 F. P# J) l, @ - dma_addr_t dmaphyssrc2 = 0;
% g# H* ^- y2 ~: J% f - dma_addr_t dmaphysdest1 = 0;
Z0 a# m4 o4 P. O y- T: y - dma_addr_t dmaphysdest2 = 0;
9 W8 n$ p0 j. m# I5 `
4 U, `6 d% V# L0 j- char *dmabufsrc1 = NULL;
6 i0 B: Z6 D8 n% w4 n - char *dmabufsrc2 = NULL;
) D$ [8 [* r' ?! r - char *dmabufdest1 = NULL; ?* T% k* {# \4 X* B3 w
- char *dmabufdest2 = NULL;1 W; p5 `8 q/ Z6 l% c' Z
- 8 T6 ]* {: V# T7 @' O: |, d
- static int acnt = 512;
( R9 F# t+ _2 h' ?4 O - static int bcnt = 8;! @5 v4 C; u' z6 M8 p
- static int ccnt = 8;
: ^% F7 l R/ L2 F, \' V
7 J4 w7 D* ]1 [& S4 b6 {( ~- module_param(acnt, int, S_IRUGO);- \- H9 K: [1 b' J, t9 k6 b
- module_param(bcnt, int, S_IRUGO);( }! e6 C: E# R' g5 X# }: k/ G
- module_param(ccnt, int, S_IRUGO);
复制代码
- H. o6 O! o8 g
+ p/ Q3 }: X5 I% C' V6 Z 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& @- t. m1 g% x# k0 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( j" N. g3 J* L9 l8 a" N
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* f6 t/ }2 N: W" j+ k5 g( D; h" K2 O! X
! ~3 X; l" u1 L0 e' t5 m! O
|
|