|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. W: @* ]: Y, O( S- [code]EDMA sample test application. G$ _ L) a; I; u
- /*# H1 ?" A2 U) @0 X, F+ h3 k7 O$ G. C
- * edma_test.c q J' U# u4 [4 C8 b
- *
$ f6 D/ x& d2 s g+ [ - * brief EDMA3 Test Application
7 Y8 T1 N8 `$ C - *
8 P7 |8 N8 \% U' O% p) f2 T! z - * This file contains EDMA3 Test code.
/ c- U$ g0 y* E - *
9 y' |" w( j4 o: E: N - * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
; E9 t# i% K! ]2 A9 P$ T- G w - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ q+ K. t- N1 h7 a. v
- * TO CHANGE.
3 t3 u; K6 ?# x1 ]; e; h- _4 | - *
2 B, k+ y9 u4 U1 H - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
% o/ `( \' v. r! j4 n - *0 n9 S) L6 K' e3 j1 R) m
- * This program is free software; you can redistribute it and/or
1 ?- z& i& Y! K( ~ - * modify it under the terms of the GNU General Public License as
3 K, G, A+ I; G9 T* A - * published by the Free Software Foundation version 2.
( R" p7 i' q+ F8 d8 O - *
. g; y% E8 j4 z, F2 r3 X* V - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
- o5 X7 v; l' \ - * kind, whether express or implied; without even the implied warranty
! S; w4 k+ K" f9 N" f7 O% `7 y/ H - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the, z% n/ f# N. r8 d2 B/ Y
- * GNU General Public License for more details.
0 y8 C: ?) N1 T8 j - */
; _7 d1 M% @- _; |8 G: e - - R6 L1 _! j. J
- #include <linux/module.h>' P w9 l: I: b( E
- #include <linux/init.h>1 k2 F; Q& [: A2 y9 q
- #include <linux/errno.h>& w) J+ b& l S2 h
- #include <linux/types.h>* R. |2 B! ~: K2 }
- #include <linux/interrupt.h>/ j) Y5 [$ {8 f% E# r3 u# P
- #include <asm/io.h>* }! B) u) w. j+ r5 S5 a' E9 f9 D
- #include <linux/moduleparam.h>
. v8 q* U7 S9 y6 e e! E - #include <linux/sysctl.h>
3 a o& [. H' T, z4 c - #include <linux/mm.h>
7 M/ P, S$ f# L - #include <linux/dma-mapping.h>
+ g+ U& X$ ~. U& s4 l: U- _& @/ `( t
8 V/ H8 T$ C1 c. P/ ?; F( \" x2 g8 _- #include <mach/memory.h>
* e- Q, J6 G* Y3 g. A' X - #include <mach/hardware.h>
: _0 r ?0 e. Y. [ - #include <mach/irqs.h>
9 s0 k. R6 z) @; U* Q - #include <asm/hardware/edma.h>
" J; ^8 p9 S& i
" J: d( y) j, f9 O- #undef EDMA3_DEBUG9 a8 T- \9 j' I+ g& ^' t0 j3 @
- /*#define EDMA3_DEBUG*/
3 X, ?& s2 E2 S7 G/ V
- J8 s4 q) `4 `6 r: S. _- o- #ifdef EDMA3_DEBUG
1 x3 A: t/ c) \. y) j6 t4 Z - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) E0 U% T# T; L6 U
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) `( h4 l- M5 s* \
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G; A$ L F5 O, ~
- #else
4 x: O' s6 G) _" N - #define DMA_PRINTK( x... )
3 {) I; l. G* ^0 D* H6 _ o& o - #define DMA_FN_IN
9 l3 X- Z( G0 P, T - #define DMA_FN_OUT* Z* R8 T9 m& Q5 D
- #endif7 X7 C( B' K) `
- ; t. c$ R" M% g0 ~, ~7 _
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. R8 K# m# A& U" ^9 |+ Z9 m5 q - #define STATIC_SHIFT 3
" R* |6 g, _5 [ - #define TCINTEN_SHIFT 20
* j5 ~; ~) R; F2 M' T$ y0 w) T+ {. \" q - #define ITCINTEN_SHIFT 216 f4 R, e" i- r
- #define TCCHEN_SHIFT 22
4 U b) d5 @$ z. Q, X& [. M - #define ITCCHEN_SHIFT 23# \1 } L9 I( T& w' J" }# [
& w5 j4 g0 u5 N, Q0 A8 d- static volatile int irqraised1 = 0;
( N4 [* H" S: Q4 ] - static volatile int irqraised2 = 0;2 M+ l) K( ?* p" S3 J
- 4 Q8 P# n% h8 ?; s# @( \7 p* G6 a
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
, v3 o1 s3 F! Z4 Y6 {6 W - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
: ]: {' V: s0 B( B - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& n, p0 q; g) Y
5 E8 [. J( J# E- n; T2 @- dma_addr_t dmaphyssrc1 = 0;
4 Q: S3 M$ R/ S - dma_addr_t dmaphyssrc2 = 0;. f: H6 b: m; d; ~! i' T
- dma_addr_t dmaphysdest1 = 0;& F; C8 J0 i4 p: }
- dma_addr_t dmaphysdest2 = 0;0 U7 Q3 h$ {" I9 ]- ?
d5 X8 o6 n) A4 H- char *dmabufsrc1 = NULL;
( E3 h. ~3 c$ T, ~ }7 S; U8 E: t, a - char *dmabufsrc2 = NULL;+ s; t, _7 }# J3 X
- char *dmabufdest1 = NULL;
( a5 |6 G7 L/ g- K3 L6 s9 }# j - char *dmabufdest2 = NULL;
4 c. W5 ~8 @2 B. F) ?. Y; h
5 n9 x6 ]: a) U3 N$ _) D+ x6 h- static int acnt = 512;
. e! A" Y) d. U9 j) s. d. N5 r - static int bcnt = 8;2 C( Q1 w# a5 @4 }
- static int ccnt = 8;
. V# u" h3 u- z5 O* Y( A( S# \
0 l; I* y7 B) q9 A9 x% r! G- module_param(acnt, int, S_IRUGO);7 v$ t3 o8 M8 s4 }: U
- module_param(bcnt, int, S_IRUGO);
+ A' u& L" F9 x9 s* q1 f# ] - module_param(ccnt, int, S_IRUGO);
复制代码
( U1 I7 C+ E/ V/ u! d) O" y) n; ~" g7 a5 s" P. q
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ B8 I( t7 W d% rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 {6 H# _( u) x( q2 G
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 {/ k; ?2 i, Z, {
7 k$ g% k* ]) G* B" {7 @4 ?# I8 t! }- Q6 `
|
|