|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 h5 N# C6 X( N( f# w- [code]EDMA sample test application
8 G* p* B, }" c- Z$ Q - /*
6 P4 c2 f% I' i3 p5 y+ O# Z - * edma_test.c
) P3 m0 l6 d" ?1 s - *& V) Z* H- X, f& {/ T9 I2 q
- * brief EDMA3 Test Application
/ b' N+ B A: g# _& S - *
, u+ G. ]" f& E B' | - * This file contains EDMA3 Test code., ~/ y, ~( M- q6 _+ y) O
- *$ V6 C6 }# ] `3 A& o# r I
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
( E2 j0 k$ r" \ - * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 P* g- v; L) j& ~/ W1 S2 V
- * TO CHANGE., E0 F' P' M+ B8 X" m' ~. J* X
- *
+ ]- j7 U) T; S# b5 S5 ~5 B - * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: e6 T( U( m& y6 x c$ O - *
- c; O2 q6 X Q5 k/ ] - * This program is free software; you can redistribute it and/or
5 X5 P5 a! s# X2 P: }+ I0 P - * modify it under the terms of the GNU General Public License as- l3 i" I* g- v& g$ d8 [. e5 t9 Y% s6 |
- * published by the Free Software Foundation version 2.
! O4 }! `- P2 @3 o' I+ K - *
& I4 V, S- w5 g: Q - * This program is distributed "as is" WITHOUT ANY WARRANTY of any
V! n% R& W' h0 \+ y; h- R - * kind, whether express or implied; without even the implied warranty
: ^! P7 h, A. n% \& V - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the) C9 `& X0 ]1 M) R1 {" s E, ]
- * GNU General Public License for more details.
5 d% H, s. U' g - */7 J2 o1 K5 r6 D. f7 |* C
1 a% S+ y7 q% I7 i- #include <linux/module.h>
9 y. m6 G# N) Q! j4 S5 I# | - #include <linux/init.h>
5 S5 t1 Q8 M. [; v+ m - #include <linux/errno.h>
! s. H( n; s1 H& E! p+ r - #include <linux/types.h>
5 R: `% x6 ^! W4 g# ?# y+ P b - #include <linux/interrupt.h>
5 \3 l& A5 D* p4 e& i0 Q - #include <asm/io.h>; n9 Z5 N9 S2 A/ h3 d4 |+ {
- #include <linux/moduleparam.h>
* S! o- `0 q% I- t; Y5 d - #include <linux/sysctl.h>
( P- _+ u R, \ - #include <linux/mm.h>
( s+ Z0 H4 e& \4 r6 {/ k/ s - #include <linux/dma-mapping.h>
1 R" [1 R; I: J, a( b - 1 _, ^3 ^* ]* |3 f
- #include <mach/memory.h>
) q7 |$ g( y* @. q% l3 P - #include <mach/hardware.h> \% V! L1 n3 x B1 w; w
- #include <mach/irqs.h>+ a _# @, q* J( }5 }5 h
- #include <asm/hardware/edma.h># D/ y. K5 {3 E" C
- ) y/ V& T8 M% R7 j
- #undef EDMA3_DEBUG
! n1 k' m B7 e! `' ^ - /*#define EDMA3_DEBUG*/2 C$ J8 F# _1 t
- 3 m+ D7 u: |5 i# I
- #ifdef EDMA3_DEBUG4 G4 x6 u" x. M2 f+ Z+ P/ M! K! h
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
8 |0 l; R3 Y7 ]& P K0 F; A2 i, j: i8 q - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
( [9 z. y2 z1 ^% \' t6 V! y - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
w1 g$ T) Z( |3 C - #else
% s* G- f4 d7 H" d9 ]' H! d* | - #define DMA_PRINTK( x... )
: b6 f% x) n8 o- O4 B3 O - #define DMA_FN_IN
; K7 i1 t; R! q9 }; J - #define DMA_FN_OUT% U K9 Q- D/ m" B. J
- #endif6 b* J3 k1 Q$ I1 ~
- : N+ q9 O: I/ i" T% O
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)% `# C1 `" w+ B+ J6 b+ K* f
- #define STATIC_SHIFT 3
3 {5 o9 o* }' V2 X* V$ s; d# m - #define TCINTEN_SHIFT 20
9 Q6 `, Q* P: o& h - #define ITCINTEN_SHIFT 21+ J9 v. y9 V; S# V
- #define TCCHEN_SHIFT 22
+ {( d( t2 }8 N% R) L+ K1 _ - #define ITCCHEN_SHIFT 23
$ g, n. \7 x# c$ d8 S6 B1 I
( ~7 D) z7 w b- static volatile int irqraised1 = 0;
4 z+ O# n, ~- |. J$ U4 C; s - static volatile int irqraised2 = 0;
' T. L- l+ M7 c( d8 t- L7 q! R
7 i7 n& y4 A! |, F1 g" f- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
; o) Y# H" Z* E; H - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! L3 s/ A% V$ x - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
* w8 f- Q3 I" C& d% }$ M+ u, n" e
4 X( x5 A+ d: k% A3 |: Q- dma_addr_t dmaphyssrc1 = 0;" v" d: C. {" L5 t" ]; F' i$ N
- dma_addr_t dmaphyssrc2 = 0;9 G6 Y1 M7 K- ]/ I; o
- dma_addr_t dmaphysdest1 = 0;
; B$ o4 B8 r. ?, f+ F% a3 L6 o - dma_addr_t dmaphysdest2 = 0;( d* i% J7 Z# r) y8 T) A" _
( V4 O! y0 G1 m. X- char *dmabufsrc1 = NULL;3 t3 S# z" X2 O* v6 `7 K W+ _
- char *dmabufsrc2 = NULL;8 ^5 W1 o4 p5 c
- char *dmabufdest1 = NULL;
: u, s: C9 Y) G5 A - char *dmabufdest2 = NULL;
: c" v0 J6 x! A8 G
! |" x" v5 |2 m- h- static int acnt = 512;
1 c% J* b9 P4 u: I; W9 k - static int bcnt = 8;
" M. P% l3 R5 G7 w1 K - static int ccnt = 8;& w" K v8 D: Q7 H7 c' u
" K6 Y! |. e6 E' J4 h/ b3 R6 m- module_param(acnt, int, S_IRUGO);
" S5 `. A5 S1 x& k: d1 H1 ]+ m( ~* { - module_param(bcnt, int, S_IRUGO);
0 I+ t" r" h" ?. m - module_param(ccnt, int, S_IRUGO);
复制代码
- F8 ]0 F" y) ?' Z
# P: z$ u4 n( p# A$ T* d5 x 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& w5 n/ f$ W" B9 T) N# K4 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. `" p7 d: m& Z: r; @# f) A 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Z3 Z& r3 {* o4 g) r
! z; n2 G; z e; u, L, w9 T- [& q, |& L9 t7 }
|
|