|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' Y/ f( r- x; X* g. c( w- [code]EDMA sample test application6 b9 z: X: r; G% J1 c
- /*
# ^8 N" b, r, @& ~ - * edma_test.c# {/ T. b- F% L* t9 B8 m# X" \
- *
* T; N- m% u( D5 I/ Y6 {: w - * brief EDMA3 Test Application4 [: c* A. _6 |3 U
- *
9 a* _2 W) f, a1 K3 l: M" H* C0 i G+ W1 \ - * This file contains EDMA3 Test code.
4 k+ h1 `) S J - *1 }7 |, @: `/ I) s$ ~7 Z- x$ d% m
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; L" q# D* ~) S5 i - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
( n$ h% @* C: J) g - * TO CHANGE.
: P8 {" s6 y7 V0 K3 D( R0 E - *& p# a1 U5 \1 g4 a l7 l" H/ x
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; e5 z! ^/ f9 m, f' |4 j
- *; h, R$ s* {) F
- * This program is free software; you can redistribute it and/or
( w% v4 s( [0 s2 H - * modify it under the terms of the GNU General Public License as+ |/ k) W1 w, r& O+ v; y# m J& t
- * published by the Free Software Foundation version 2.
6 z' }3 R i) @- C - *( F" _) b8 X2 t; W$ q$ k; T
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
/ c* O/ a2 F) V - * kind, whether express or implied; without even the implied warranty" ?. s- Z8 j0 R: I+ X& f
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8 N' [& H0 ?# ]3 Y - * GNU General Public License for more details.
" o h5 L* ?$ T2 f - */" @- B: e( M6 E5 o" z9 I+ Y. Z. Q# k
8 {0 Y7 {. n/ ^0 X- #include <linux/module.h>' R% G$ Y) B x. I: g
- #include <linux/init.h>9 B; N9 t2 H6 Y
- #include <linux/errno.h>
7 |) z) G# l7 T( B" K5 L6 q$ [ - #include <linux/types.h>
% w4 _- Y8 C7 G0 q7 ? - #include <linux/interrupt.h>
& K1 Q# T' F% M' j) m x! q: ` - #include <asm/io.h>0 @# ] J( F( Y: F/ b6 j) D) `
- #include <linux/moduleparam.h>
) U" x1 ?+ g: U! k# ?& q - #include <linux/sysctl.h>9 B7 ]! n" G' B3 |8 B
- #include <linux/mm.h>* Q) ]0 q' j7 q& X; I) `
- #include <linux/dma-mapping.h>
3 j- V/ M! R2 {$ k% c3 \ - * `7 y# T7 h* w+ x
- #include <mach/memory.h>
" `. Y7 Y1 Q1 T+ d - #include <mach/hardware.h>; Z$ H8 C0 Z) U
- #include <mach/irqs.h>+ B3 m$ G" n& J
- #include <asm/hardware/edma.h>
- K, s5 v4 S8 I9 C( a7 D
" j( S/ @, r% q6 v6 K2 D# J& G2 B- #undef EDMA3_DEBUG$ K3 A$ B5 I' S( q
- /*#define EDMA3_DEBUG*/& J) X" t0 U& w; S
- $ j: R5 y$ [* j
- #ifdef EDMA3_DEBUG0 v& B$ w0 x9 z+ a
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
2 _" m8 ~4 F0 I2 V) c( V- g- e - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
7 i; V- V4 ]3 c L7 p - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- \4 K v# Y6 @) j$ ^8 ?
- #else3 v# x8 \$ ~, o( v9 T( w5 G
- #define DMA_PRINTK( x... )
E8 g+ e0 M- ] - #define DMA_FN_IN
" ^/ u( F1 i. e4 T, x7 M* R - #define DMA_FN_OUT- N$ m" |9 i* V( `4 F
- #endif, o9 k) |' ]0 f" \3 _3 A
& _+ K( _6 R: ] V- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
" e9 W$ `) d0 R3 j7 p, Q - #define STATIC_SHIFT 33 J' }: a L$ X( d' Q; O! Q& i; i( H
- #define TCINTEN_SHIFT 209 V! o0 i# W" R* B) k7 u# g
- #define ITCINTEN_SHIFT 21
9 ]) w% N) v9 M6 w - #define TCCHEN_SHIFT 22/ T& X' u6 R0 a0 v! i
- #define ITCCHEN_SHIFT 23
% \8 F. g0 w1 f J, f - 0 D8 n! G/ {$ s; C1 v
- static volatile int irqraised1 = 0;
0 e9 `" Z$ H1 ^" O. E - static volatile int irqraised2 = 0;8 h# V4 [- Y% d+ Q% t u2 f5 `
: F( d& C f2 x- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. c/ I; @1 q& i8 S; e, \6 m s& S - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 U1 t6 s8 z* J
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 Y4 }4 b% B! P3 U
' @& U# f1 [* L8 F8 @; d- dma_addr_t dmaphyssrc1 = 0;
' o) E2 @5 @' R% T# d: R - dma_addr_t dmaphyssrc2 = 0;
7 q5 B% D' `3 X7 i% J$ L. Z - dma_addr_t dmaphysdest1 = 0;0 t: i) N2 ~$ K8 ?! u" s
- dma_addr_t dmaphysdest2 = 0;
' @9 M) n! A2 O3 _- t- a
, Y4 v, A$ {$ o3 Q$ m- char *dmabufsrc1 = NULL;" `3 S: t0 L( Q5 r8 |
- char *dmabufsrc2 = NULL;* b5 l) a* m7 L; Q+ H/ I: x
- char *dmabufdest1 = NULL;
5 T$ t0 q% R X& I+ W/ X - char *dmabufdest2 = NULL;! f( M2 S, J) M: ^
2 o2 o# o( g- H# S( a2 W" P: p* T+ \2 t- static int acnt = 512;+ d8 m; _2 q8 e4 t% ^$ V1 Q
- static int bcnt = 8; S: f; q5 L2 M M; R
- static int ccnt = 8;
2 }' T% x7 v. M8 k( ~; X - , t" u- j* r) o2 f! n
- module_param(acnt, int, S_IRUGO);
w% P d/ C, @# Q* [7 l3 c( J - module_param(bcnt, int, S_IRUGO);
/ U) X* u w0 o" u1 A; w1 X( z - module_param(ccnt, int, S_IRUGO);
复制代码
6 v- g3 `9 i' s% r5 ~
/ y) [- y3 E- Y* @8 D 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用 ^: ^) ~3 z5 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- e. A% t9 Q l/ W
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# d( N, R2 J( v
5 i3 H, o' Q: Z" p) w4 D2 m
* s! s9 ], u/ }8 D: M
|
|