|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. |( P% x* ~; W0 Q9 T- [code]EDMA sample test application. s/ R$ P( i& G# M
- /*& E5 M3 B0 f. R! ?( H
- * edma_test.c) z. u9 y) n* O; g2 j# u2 [: |
- *
7 o9 j$ [/ Y. I9 h i - * brief EDMA3 Test Application
5 o1 P* P2 D' X( D - *
( N7 [( C3 Q7 m U1 J+ n$ v - * This file contains EDMA3 Test code.
/ K, j( S3 n% a( _* t - *- w. H7 ~1 K8 s0 P2 @, v
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
6 s% O) B; O; v2 z" L$ j - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
) [3 u9 C. Y* G( L3 }; s - * TO CHANGE.; D) U9 I* q6 C# z! o' O: u
- *; W' R8 d1 W; p: c( O+ m
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
' J. X2 B% H) ?4 l - *
" C6 G) b; C: ?! Y' V - * This program is free software; you can redistribute it and/or2 c2 F, q4 O( Z6 ^# ]
- * modify it under the terms of the GNU General Public License as
6 K8 g, k& P6 V) J - * published by the Free Software Foundation version 2.# g! t7 r8 N& s) Z6 `# p
- *. t' a) i8 G' p: v) `/ ?8 Y7 ^
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
. }) M0 r* O% O1 ?* C# u; q$ v, V - * kind, whether express or implied; without even the implied warranty; R T8 E1 p% ]* S1 u8 b* ~
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3 O$ G5 P8 i# P5 v9 S - * GNU General Public License for more details.
0 `* V+ z! N! o( Q7 t - */
- B& [ D, g( `0 Y7 `# h! } - 2 u# m8 B6 x2 h) |; d
- #include <linux/module.h>8 w( J% D& t/ |/ k. z8 u. y
- #include <linux/init.h>! W- A2 p y7 R8 i: L/ Q
- #include <linux/errno.h>
& S0 ]" ]" t. ] - #include <linux/types.h>; S6 j: h; P' F$ ^: Z5 J
- #include <linux/interrupt.h>
3 W# {7 p2 y" y" q1 U% F: Y - #include <asm/io.h>, g% t$ L; U( N
- #include <linux/moduleparam.h>
0 [9 a s% d* E - #include <linux/sysctl.h>
/ u" j6 i2 s8 O4 q) U - #include <linux/mm.h>
3 @- t% c8 i! I# B1 {2 n! w - #include <linux/dma-mapping.h>
0 C% ?) x; a7 ~2 J" k - 0 P: ?0 |& x# ?0 x# C$ w
- #include <mach/memory.h>
; Z8 a: m7 l4 K; B0 w) P$ H7 X - #include <mach/hardware.h>2 G: g$ P c) d5 p, k L/ J
- #include <mach/irqs.h>
% D1 W& |, w! E! a - #include <asm/hardware/edma.h>4 a+ h5 M1 z+ y) l) U7 y. |
! Y4 _8 a1 _6 e6 h2 ]$ D& I- #undef EDMA3_DEBUG" l8 @' ~, S9 u: Q
- /*#define EDMA3_DEBUG*/
8 F9 \2 L& Q6 p" {# Q
, f3 ]# I% i9 N2 {8 J- G+ n- #ifdef EDMA3_DEBUG7 i3 [, W6 w( f
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
( O/ Q' V0 d7 W+ X* q% m - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ |$ c5 D- ^8 S2 Z9 |2 y$ j; J
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& c8 I/ D2 M1 z9 _8 u& k
- #else
+ B' U2 z' b3 s+ \ - #define DMA_PRINTK( x... )! _! x7 G: H* R, k9 a
- #define DMA_FN_IN+ @; }; Q1 ]& w5 {
- #define DMA_FN_OUT
. g: n8 w' {! S. J - #endif! M5 b( I2 c3 ~ Q: _6 a$ k- f
; E7 c( ~( ~" X: [1 M- #define MAX_DMA_TRANSFER_IN_BYTES (32768)# ]5 C. {- \- x0 s% x+ \
- #define STATIC_SHIFT 3
5 ^) C- V6 }7 ^ - #define TCINTEN_SHIFT 20; o& I0 V' O! v9 Q- k& K
- #define ITCINTEN_SHIFT 216 C& [2 Q5 l8 V
- #define TCCHEN_SHIFT 22( R$ A- r# ~. p# W$ G
- #define ITCCHEN_SHIFT 235 s' r; l8 O* ~& C+ {
- 0 a; c v; ?+ g. ?# I
- static volatile int irqraised1 = 0;
5 g2 x6 U" L" }: x4 q4 H4 a - static volatile int irqraised2 = 0;! R) Q( V0 Z; q$ U [
- 3 B) @0 R) s9 S/ e% f
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( a: Q9 c3 z4 m4 b# a
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
& y8 q" {: B. K$ `: N - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' F& T! J3 h. G9 l - 4 h l" p7 d8 `* ]% L9 U
- dma_addr_t dmaphyssrc1 = 0;1 b/ z# d1 |9 S$ h. {- f
- dma_addr_t dmaphyssrc2 = 0;
# D6 O+ j! I+ `& n - dma_addr_t dmaphysdest1 = 0;6 N! W1 [7 J5 n2 T
- dma_addr_t dmaphysdest2 = 0;+ \' B6 R$ O4 X( s. D* C0 \* p# F1 x
- ; F) N( J7 v3 d
- char *dmabufsrc1 = NULL;! P, z$ {; M0 [7 `7 Q. Q
- char *dmabufsrc2 = NULL;
2 x' b* I) Z3 }- {& ^0 r; S - char *dmabufdest1 = NULL;: C+ X6 o8 r/ k# y
- char *dmabufdest2 = NULL;
1 Q0 ^: m& u$ `% E7 X
1 M% k2 j' ^0 S0 j* V- static int acnt = 512;
J' H4 F$ _9 l& Q - static int bcnt = 8;0 E* I5 a& K; |9 U
- static int ccnt = 8;3 a( w' Y2 E. u4 p
# F+ B3 M3 w% O$ g7 @7 j7 I0 C- module_param(acnt, int, S_IRUGO);
% I) I* R$ r" X B) C0 U - module_param(bcnt, int, S_IRUGO);% c( {3 |+ A- q0 `; n9 p" R
- module_param(ccnt, int, S_IRUGO);
复制代码
0 P9 @7 t/ \& @) l
2 H2 ]! N& \ t8 L. O" z- G 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ~" b6 `. m! M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' S$ H% W) l0 ? 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, N! g8 L @. T+ m2 y
, I+ U! B$ r0 Y, W* Y
( b7 N$ a4 V1 p |
|