|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 }0 G" A+ Z ?- [code]EDMA sample test application) c2 j3 t/ ~! w- c& {: j
- /*
, b# G* [5 @6 V* C - * edma_test.c
- g& r1 s9 y3 [* [' B( |- v - *
# t/ N5 V7 _/ T& c- R3 b/ ] - * brief EDMA3 Test Application
$ z( m8 u/ S& x1 p. t% j. H - *4 Y7 G1 l% K- r$ u0 u) Y
- * This file contains EDMA3 Test code.) ~" a$ ^$ Y3 ~/ z' u; u/ J
- *! u, `7 B. h" H! c. H
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; j+ x2 Q$ d- C5 i& A
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
5 a2 o' X$ s( F4 Y; T0 M - * TO CHANGE.
z7 b. f/ O: L - *5 z. w, z' X. W: n; ?9 V7 q
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ P9 W6 U" T0 \6 f- `$ P" r' n8 C - *
4 D$ ]" E7 @; `& o - * This program is free software; you can redistribute it and/or e: N% S2 @' v. I. U, e* ~4 J
- * modify it under the terms of the GNU General Public License as* [! l. o3 j5 k, O
- * published by the Free Software Foundation version 2.8 f! D1 d3 \% G
- *
* N5 P8 |7 ]9 B1 P. Z- ] - * This program is distributed "as is" WITHOUT ANY WARRANTY of any) K! p$ _" @* {9 t4 ~
- * kind, whether express or implied; without even the implied warranty
5 O$ T/ E( N) D - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
( h9 N/ k7 |1 }3 e. b) f - * GNU General Public License for more details. O" S- r. D& \ ~2 B* r
- */
5 e- J4 P* m5 n4 p3 e Y8 J
5 A5 z1 X/ v Y8 i& O1 q7 S7 s! f- #include <linux/module.h>
6 a2 t! v2 A" x/ L, i# f3 q - #include <linux/init.h>
' n Z: i8 }- E0 m* N1 H- p - #include <linux/errno.h>
. M+ J6 f! `9 V5 S" _5 Q$ R7 g - #include <linux/types.h>
, q* T+ q) |$ K2 W - #include <linux/interrupt.h>
% }2 M8 ?1 k- N" D8 S) x - #include <asm/io.h>
! u6 V, H* O* N) y - #include <linux/moduleparam.h>
0 N, m2 n9 [+ f2 q - #include <linux/sysctl.h>
8 S3 w9 c/ P7 B0 @( u8 u9 \4 \ - #include <linux/mm.h>' u5 Z" G) m, a7 L' k% D; m
- #include <linux/dma-mapping.h>
2 v9 G2 m% i5 s; \
- c& N4 P( c) L3 s- #include <mach/memory.h>
4 o7 O ?6 O7 _: A9 E - #include <mach/hardware.h>
$ T' O# w" b3 h! u$ u$ {! K m! V - #include <mach/irqs.h>4 k. u5 C! P2 d' V6 c' U. G' F, E
- #include <asm/hardware/edma.h>* j; c3 Y3 \! X# y' f
- 5 X& h9 f, u9 p, N! J0 [
- #undef EDMA3_DEBUG
% O6 G3 S) J2 S - /*#define EDMA3_DEBUG*/
/ u) N0 K; p) {7 M$ L - h6 _0 D! K: r- Z
- #ifdef EDMA3_DEBUG
* z) t' W0 H) \- ?; ^1 ~2 M& I - #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), q R8 a% `2 k$ P
- #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* e Q( u5 w) F! z
- #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 ]$ b+ ]/ y3 j
- #else O% ?* E- a- Q* J
- #define DMA_PRINTK( x... ), u! A( K6 K3 D
- #define DMA_FN_IN
: ?" Y4 i; Y7 O' D' ] - #define DMA_FN_OUT5 b$ ?$ K: [" }
- #endif5 o' H5 H4 G/ h2 v, V1 v/ @
N$ W ^% B1 {3 V$ n0 E- #define MAX_DMA_TRANSFER_IN_BYTES (32768)) X8 o; P/ ^- j* t9 a
- #define STATIC_SHIFT 3
; W) r9 X8 A' Q. d - #define TCINTEN_SHIFT 20, K! K" m3 t6 Q% ]- V) p& j
- #define ITCINTEN_SHIFT 21
# ]" f( Q1 U3 G: i2 N' u! z6 [ - #define TCCHEN_SHIFT 22
8 U, \- n, I: B3 m - #define ITCCHEN_SHIFT 23
* i6 f; D- X8 g5 `" S2 Y. s - 0 @* t' \- @8 H/ U4 v6 m
- static volatile int irqraised1 = 0;8 u* T; I. o8 |5 Z/ w
- static volatile int irqraised2 = 0;% M; Z+ |+ I' l$ ^7 z7 Y
+ _, b* S; r) K- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
' g' W' M2 P" R4 `9 B) c8 U) u - int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
. [1 R$ R. k- D' I% @ - int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
$ ~0 R6 m( W9 Z" _( ?
, q! x0 U6 ]; q! S: v- dma_addr_t dmaphyssrc1 = 0;. N; Q) r \% _
- dma_addr_t dmaphyssrc2 = 0;" }; y- g6 \' _0 s' H3 f1 q
- dma_addr_t dmaphysdest1 = 0;
! U$ D4 c+ e9 @9 i1 \- | - dma_addr_t dmaphysdest2 = 0;
, p2 z. l" G$ x x8 R7 Z - + A# D: O1 D9 f4 n3 q/ o
- char *dmabufsrc1 = NULL;: [% l2 L5 e; ~; [9 p* R
- char *dmabufsrc2 = NULL;0 u$ N! w. i3 x$ R/ ~* t
- char *dmabufdest1 = NULL;
9 y% S1 R$ h: I& z; x9 H( P2 J - char *dmabufdest2 = NULL;% }- P, H6 f' ?2 |6 y% c
- 3 M0 D {8 t* ], ]# a: H6 z, T
- static int acnt = 512;' A. D. v4 q2 k7 Z, l
- static int bcnt = 8;
+ K/ W, F+ j. S. k$ q7 I - static int ccnt = 8;
0 U/ u6 O! S( l: `: D - ; J" _+ |. s; K! A: A3 ^2 v" q* \$ s( S
- module_param(acnt, int, S_IRUGO);1 o4 d; ?( K2 P% S5 {( m. s
- module_param(bcnt, int, S_IRUGO);
7 X7 }9 T/ T+ M1 M5 \6 w+ x - module_param(ccnt, int, S_IRUGO);
复制代码
! G" V7 h2 u7 k+ X; M, K. w
/ X2 F/ m+ L+ c0 U 这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 a; N& i8 z; a( x6 Z; s# |5 }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 f. q# L$ i4 f+ U6 S# Y
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 ~( c/ O% ~, G: L+ ?" h/ Y
' u( ?! R# N9 y% |$ e# ~& M4 ~9 ^0 ~8 L
|
|