|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # S( B8 ]# E; m) {
- [code]EDMA sample test application- s+ ?8 g! a+ a) o7 A- C) u4 A
- /*: T- U O2 O3 b! G( q
- * edma_test.c# u9 ]' s% n0 {- x3 c
- *
8 \) L0 m5 w/ n( l - * brief EDMA3 Test Application
0 j! I6 H6 l" j# [- N - *5 E+ s; u+ e3 z A. I2 Q
- * This file contains EDMA3 Test code.! A+ l9 T: `1 y- a
- *9 a- P# v0 E' Z/ C
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 c6 b6 y0 j3 g6 Z2 F
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
$ c1 l4 K5 S( M; a4 a$ f8 R6 G$ J - * TO CHANGE.+ Y* _% O& s: W9 F( q; ?4 M/ Y' A
- *" n4 W% Z. P4 ]" o/ T3 ~. ^$ {
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
$ w" s$ C Q, B - *# @8 j" u" n x7 \7 a3 M! T
- * This program is free software; you can redistribute it and/or+ M8 }3 Q# M& L! t& ^% \
- * modify it under the terms of the GNU General Public License as4 ^" V: a" ^. x; y- B8 Z, w
- * published by the Free Software Foundation version 2.
3 N0 O2 ^2 z2 S' k! X' [4 { - *" e# h$ m* u+ ~- N2 \5 ?
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
U# a! x: S* z8 P - * kind, whether express or implied; without even the implied warranty& u _& R* T$ e3 Z
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1 Z6 m3 Q+ Y7 b' Q1 v7 z) F
- * GNU General Public License for more details.
+ S: C( Y6 e) W1 I; U j - */" a4 p1 D; V0 t; u# s
/ a% d# [" U- g9 l" q7 S% N* G: y- #include <linux/module.h>( H$ g, k8 Q, [1 Y
- #include <linux/init.h>" }+ Q& k5 {1 _: u" P
- #include <linux/errno.h>* a- O0 x" x( @8 R# A
- #include <linux/types.h>
2 L! A( \/ E0 U$ \ - #include <linux/interrupt.h>. x# E& I6 V; `; `6 m, _/ @
- #include <asm/io.h>
( \- I$ g @* b( [8 k - #include <linux/moduleparam.h>! v) i. d( H, c
- #include <linux/sysctl.h>
7 |& _8 H [- P: L - #include <linux/mm.h>$ [% q* E& g( V
- #include <linux/dma-mapping.h>4 c3 H# Y4 N, L- k- A8 X
- Z1 K: s, v2 S+ w- #include <mach/memory.h>) y5 ^- t5 t. K% K; a- Z
- #include <mach/hardware.h>
- E$ V2 V. ^. B, J - #include <mach/irqs.h>
3 c' z/ J I; J }" m7 M - #include <asm/hardware/edma.h>! a* h3 N# w3 w5 O( E {
- 4 d2 P0 G& q8 i& D9 a; L
- #undef EDMA3_DEBUG1 m1 _- k3 B; @ q4 S5 [' t
- /*#define EDMA3_DEBUG*/
+ n; K: |7 s9 K: N" ^ { - ! d0 g) N9 c8 a! C2 D' P7 Y3 U
- #ifdef EDMA3_DEBUG; v5 `: W; _- g
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
0 F5 M" B5 s O- s8 p; r1 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
& q% h% A' e! w$ j* A7 i - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ W/ r, s6 x: H& y5 m - #else
v1 W/ i9 o4 J3 t' Z8 Y - #define DMA_PRINTK( x... )
( `+ @0 e0 G1 S. E! j - #define DMA_FN_IN3 K! c$ H: W& U2 @
- #define DMA_FN_OUT
" C5 G! p5 w& G3 g% Z, I; l - #endif
3 G$ R! }' ?8 O6 B2 ~' I# K - 5 ?) }* `8 s( z
- #define MAX_DMA_TRANSFER_IN_BYTES (32768)4 S g, y, G6 y
- #define STATIC_SHIFT 3% Q6 z5 }5 m; G/ L- D7 c
- #define TCINTEN_SHIFT 20
0 k! ^- x4 t% \& p$ L8 S - #define ITCINTEN_SHIFT 21
! S. A. \0 G' W( g z+ e - #define TCCHEN_SHIFT 22# u u# d! o) ]/ c6 N) Q9 H
- #define ITCCHEN_SHIFT 23( k4 o6 `% W0 X; h
8 @4 I% O$ l: A9 m8 G* S- static volatile int irqraised1 = 0;; W' K6 j0 K5 P* a. q; R
- static volatile int irqraised2 = 0;0 Z, K# Y2 S! [& M
- ! Z7 _5 H' c+ m. }! C# t
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
5 l m7 @! N# @8 Q - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' U n5 f/ N" ^$ T% o - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _! r. F* q, z( {
# }; H/ \7 z% E; d- dma_addr_t dmaphyssrc1 = 0; d) ~( k' l2 K& a+ U: @. Z& G
- dma_addr_t dmaphyssrc2 = 0;
b) o( j* \" ~ - dma_addr_t dmaphysdest1 = 0;* O& X7 U" a1 ?
- dma_addr_t dmaphysdest2 = 0;4 t: X7 v6 a# |6 H: U) G! k6 \
- ( }; l/ a+ Y ?+ A s7 [; _
- char *dmabufsrc1 = NULL;* c; B# b; ]$ X) |: G
- char *dmabufsrc2 = NULL;
2 Y2 Y! X/ l3 x( e( E2 ~0 `# ?- | - char *dmabufdest1 = NULL;
1 k; B ]2 j* _* {' ]+ G9 q - char *dmabufdest2 = NULL;8 f, u: U. }2 |; I0 A: l
% z/ q' O: X( @! u2 X4 N9 r p- static int acnt = 512;
* q. ~% W# K a0 W9 u0 A1 Q - static int bcnt = 8;0 b" \, O; i9 T; @2 l$ W8 g
- static int ccnt = 8;% `0 |& E# e8 Q* N" V9 S
H. m0 B7 h E9 K% H- module_param(acnt, int, S_IRUGO);
4 }; \' [( h2 Y/ `$ o2 Y: V - module_param(bcnt, int, S_IRUGO);$ t( Y2 o/ ^& {, f4 t
- module_param(ccnt, int, S_IRUGO);
复制代码
9 {0 ~/ ?3 L9 F9 U: M- ~! b
$ p7 f: o& R8 W; J5 l 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' d% K m0 h6 {& Z2 [7 D1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ N! c* C6 Y1 I. f( F 我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ T' C8 t( `' m$ x E7 c& ` ~) k& I
" n. ~0 M$ X2 T& ~, s8 t |
|