|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 a7 ]7 {" I0 Y4 M5 _- [code]EDMA sample test application2 H0 ]! c' x, I! x9 E: t+ F
- /*
. L4 x6 s+ H. X - * edma_test.c
1 n9 X- B! `* g7 V3 r% t/ v - *
( x! C B$ H7 y - * brief EDMA3 Test Application
% m9 F0 Z) n: U6 r' c - *
* @) G$ w3 ^( b' @3 M" P - * This file contains EDMA3 Test code.9 ]2 Z4 [3 @% ?' s# u
- * N: A7 Z" ^& x- B3 N
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
8 M% Z* |. Q6 n0 g/ G - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
% h- e% J ]1 }6 S* G6 g- K. R - * TO CHANGE.
3 i s9 @% Z9 W, J0 v - *
; o( i L$ b! i+ {- u9 O - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ t% r$ B. z+ }- S
- *
6 U4 B- T: p. g# w. `5 q6 S1 B - * This program is free software; you can redistribute it and/or9 G2 h! ]6 z% c+ Z" l% @% y9 |
- * modify it under the terms of the GNU General Public License as
# P& q z% l2 | - * published by the Free Software Foundation version 2.0 p7 D' \% @( m6 B/ C! u
- *
Y3 U5 }3 } o7 S - * This program is distributed "as is" WITHOUT ANY WARRANTY of any# B/ R# K. ]* o* B% A/ u
- * kind, whether express or implied; without even the implied warranty; }# q8 g1 n, M
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the. O/ J$ p' B% `0 b2 c
- * GNU General Public License for more details.
/ k0 l" _$ b" c2 I) ?! L) ? - */
- Z. v! |, ]4 g9 e4 T l
4 g; s A5 }* u9 l- O: p- #include <linux/module.h>
/ F8 g3 l5 z: a- M+ x- h9 q( d! Z - #include <linux/init.h>
+ h0 P$ G+ C: W4 M0 k+ i - #include <linux/errno.h>
6 n$ |/ R" J! ]- q$ j1 ~. i - #include <linux/types.h>
( l% d# f) {4 }* F; [ - #include <linux/interrupt.h>
9 L3 r) y7 B% }/ @/ _ - #include <asm/io.h>
0 u7 T- _8 f# M - #include <linux/moduleparam.h>
( y# C. F% ?& ^/ i. }! Q! m - #include <linux/sysctl.h>3 X' ~* q6 Y( O; n; n$ G" V
- #include <linux/mm.h>
0 m& t& p7 v$ \; n% U$ u8 [- f - #include <linux/dma-mapping.h>
( k+ e; j& x) q( @( N1 L* o
; c8 I" Y9 d+ L0 d% f" ]. b- #include <mach/memory.h>
% ?3 w) u9 ^. D' } - #include <mach/hardware.h>/ c7 z- P: D* T V1 \ ~% G7 U
- #include <mach/irqs.h>6 r l/ P: F4 R% h. T @; X
- #include <asm/hardware/edma.h>. e" C- a; z% J" M7 k! A
5 @7 s7 x: J; S) x- #undef EDMA3_DEBUG K& d1 k: a% _* R! f
- /*#define EDMA3_DEBUG*/
" [5 l3 Y6 `' d) N
+ Y9 e1 M" j' @* p1 R- #ifdef EDMA3_DEBUG
7 h- o3 X% b$ I3 M/ H8 j - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). [4 Y7 g; l9 y
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 M8 i1 `! J+ F) F% V [9 t
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G) l/ s4 i6 ^$ E8 j
- #else
% u( p) f$ b' ^+ o! I5 b - #define DMA_PRINTK( x... )6 w9 v/ s$ k# ~* T; a4 ^& h9 y7 y
- #define DMA_FN_IN
5 j) [9 U) t' I8 F% K% E. ? - #define DMA_FN_OUT
8 ?. k* R! t% Y% U9 u# G; ? - #endif
1 Z# w8 h0 [2 M# D5 c3 v - 3 _7 R8 ]% h1 d% G
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
6 o) @; r' U/ j/ e: x0 ]1 r& ^ - #define STATIC_SHIFT 3; u/ P9 e) ~# E
- #define TCINTEN_SHIFT 20
9 Y, Q9 n1 }0 E0 z! c - #define ITCINTEN_SHIFT 21
3 e, z q; u/ b6 n: u9 V - #define TCCHEN_SHIFT 226 f: A/ q9 i6 @. i/ B0 w# t
- #define ITCCHEN_SHIFT 23+ q1 O% |' P! o( g- R
- 5 k: N4 z) U" m1 G/ W( F
- static volatile int irqraised1 = 0;
) \; ] }; q2 S0 s% W- m* I1 \ - static volatile int irqraised2 = 0;) m% V5 B) ^% {! {6 l" ~" x- v) E. y
! ?5 K0 \6 z- D3 d. r* s- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ a2 I2 @, C; C5 Q3 c% Z
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
# N# z( h! L( U( Y% }; m* _ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* T& x( H# x! K( O& K/ Z
3 n7 U+ ^+ i+ t6 y" G- dma_addr_t dmaphyssrc1 = 0;
) @5 N/ [3 F& C6 m - dma_addr_t dmaphyssrc2 = 0;! A ~ }8 G9 p: U1 S- M
- dma_addr_t dmaphysdest1 = 0;
$ N/ Y/ N1 W+ X1 N+ C7 ` - dma_addr_t dmaphysdest2 = 0;/ F! P9 y2 `- ^9 O
% K) Q0 v$ {/ R9 W0 i4 i% a) h- r# A- char *dmabufsrc1 = NULL;
( A1 _5 g8 v0 `. l C$ @2 |) e - char *dmabufsrc2 = NULL;
# Z( z" }( q- X9 d4 y6 \# e - char *dmabufdest1 = NULL;1 J4 @4 D9 k% E& Z: P
- char *dmabufdest2 = NULL;
8 C" A( G$ e9 m
/ M% ^0 g9 t* @; a9 o- x, B; r- static int acnt = 512;
% J* o( z9 y+ x4 N% B - static int bcnt = 8;5 L; o+ I% F+ @
- static int ccnt = 8;
) y( M1 w! @# z5 F% o
. V+ a/ [5 r1 w# `5 q% M8 c- module_param(acnt, int, S_IRUGO);" C. m& ?) S+ ?. M
- module_param(bcnt, int, S_IRUGO);3 g+ f% L6 t) \3 E v" d5 p: o
- module_param(ccnt, int, S_IRUGO);
复制代码
3 D$ `# h/ m) A6 q) m$ c; J
, N) n2 b$ r' u$ T7 t! q% } 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& J) z/ r" ]+ A+ [% varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 E- z9 {9 R0 X7 | 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 D& @8 p3 L6 b6 O& N$ t4 _
! o. ?0 |7 T# ^
& G6 M- D/ B" I4 h0 i/ Y4 {" S! z |
|