|
|
本帖最后由 yyj 于 2018-1-30 11:01 编辑
P/ n; v2 {2 \/ ^- [code]EDMA sample test application+ [2 r4 P% w6 _4 n& g; V* i& k
- /*2 @ Z( ]# m& e( Y! x
- * edma_test.c w0 i" n# f4 R* Z) ]
- *% U. y9 h3 H8 z: D
- * brief EDMA3 Test Application4 ?8 E! q/ H f+ E7 r+ M
- *! z& \1 C6 u( a2 L( z2 ]
- * This file contains EDMA3 Test code.
4 |( d7 N6 h; s2 y+ I - *4 S+ p/ }6 `8 ]* M
- * NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" x, O7 C: ^0 }! _2 ]' C, I' i
- * REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# t$ _. {; k( t
- * TO CHANGE.( x9 g! q, F6 D' U& I
- *5 c' S* Z0 S( {8 U
- * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
: m% ]0 \5 [& I( a6 I. o( t; H - *5 H' E& Z& e9 K! _7 H9 F
- * This program is free software; you can redistribute it and/or; h) v, Q+ E: T6 A
- * modify it under the terms of the GNU General Public License as
6 o0 E: T1 v7 d' z1 E1 K9 @. D% H% L - * published by the Free Software Foundation version 2.+ Q- F( Z6 L5 F" m
- *2 B! A$ l5 D3 A1 B2 U3 |9 S
- * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 ~, ?8 M0 Y5 T$ n - * kind, whether express or implied; without even the implied warranty
V' z1 D/ G; ^8 t$ U - * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the8 _& q6 G* e5 j3 U
- * GNU General Public License for more details.* e2 V: q+ D6 v2 D" z" e
- */) _+ i$ M0 s7 b* a) Q( O3 D: r4 ]4 B
- 4 ]( Q% z1 _. t s( l9 G1 C/ I2 E
- #include <linux/module.h>
6 M; H0 s& c9 ~* E; |0 |5 b# Q% U - #include <linux/init.h>
& [; Z8 D% P# s2 L- Y - #include <linux/errno.h>) G1 w& \: n8 T4 s9 D9 [; d
- #include <linux/types.h>3 y: ? [+ s/ {/ J" W
- #include <linux/interrupt.h>9 y# j) ]2 D) \: x3 \
- #include <asm/io.h>
- t+ e) d7 V2 ? `& u* h0 t - #include <linux/moduleparam.h>, j$ `* M4 b* r$ `; w! F0 R
- #include <linux/sysctl.h>
1 Y9 H9 J9 c6 V - #include <linux/mm.h>
$ V0 x4 V2 D, @ s8 { - #include <linux/dma-mapping.h>
8 ^# o+ s6 g( R7 W K i
$ |, {4 U" Q% S+ {% i- #include <mach/memory.h>
. u' O6 q5 i8 Q3 o* H( r8 d4 f) o - #include <mach/hardware.h>0 M# k- U* ? |/ v# R) ~9 p
- #include <mach/irqs.h>. g! x& ]" ~ Q% J
- #include <asm/hardware/edma.h>
S' |% Y# K4 }5 t
$ N9 K9 r# w- w* c- #undef EDMA3_DEBUG
1 R3 p! l! u7 A% t+ F, v - /*#define EDMA3_DEBUG*/
2 S! B8 a; ] Y - + @+ d1 D, @1 \; u8 c
- #ifdef EDMA3_DEBUG# T; R9 h/ p. k
- #define DMA_PRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
9 W$ L) f8 B9 s7 ^, r7 S - #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
) @. K0 _# t5 ~$ s7 L3 i5 ? - #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
/ A3 X/ i. r% a& _' y1 i - #else' T8 G. U8 Z) V, f( s
- #define DMA_PRINTK( x... )$ I! w6 p+ f. s
- #define DMA_FN_IN3 _$ s( @- ?* G+ @" @
- #define DMA_FN_OUT
* D ^8 J8 `$ i- e( Q4 F/ r - #endif% M( z: ?- h2 h: c2 h* c5 a' R
! W* D3 `" i4 F) @, ^- #define MAX_DMA_TRANSFER_IN_BYTES (32768)
. y- K; w, J+ o* V5 C6 M. `" W0 X- x - #define STATIC_SHIFT 38 Z& l8 |; ~! E2 m( O8 r3 d
- #define TCINTEN_SHIFT 20
$ r1 ]( L9 i0 { - #define ITCINTEN_SHIFT 21
$ j3 |) A d9 Q$ g6 y - #define TCCHEN_SHIFT 226 o" x2 t7 n B" M+ I- @
- #define ITCCHEN_SHIFT 23 O0 o3 g# I$ E, ?" J$ l/ M
- ' v1 |' y- c& {) n! Z0 y( T1 h% U
- static volatile int irqraised1 = 0;
* g% c" Z4 {) f4 |) m7 n- } - static volatile int irqraised2 = 0;, ^% S5 [$ T- F& @) U7 G
- 1 W/ W( M$ }; m; E) F3 d, h
- int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 b+ n. q0 n& @9 q6 n' ?
- int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( C) l9 G4 H# v c& O
- int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
! J n( L( n; s" J2 y" j
% ]# e. E& i* X- dma_addr_t dmaphyssrc1 = 0;% O4 r4 V2 @# b- @$ P( H* l
- dma_addr_t dmaphyssrc2 = 0;
1 h1 _; b. D) F; w" T - dma_addr_t dmaphysdest1 = 0;/ f" O$ g% O- r
- dma_addr_t dmaphysdest2 = 0;
, q; h% z" f4 e) J, `: N i& F - : n A* f: @( o: V. i, ~6 t
- char *dmabufsrc1 = NULL;
9 t' n/ U+ Q1 i* M - char *dmabufsrc2 = NULL;! A" a3 o9 e [
- char *dmabufdest1 = NULL;& Z" Y* [( C& P- D9 h: [
- char *dmabufdest2 = NULL;
; w) }$ d3 v) x6 V+ {4 [
. |: E1 Y- ?; `0 z. h) i% e- static int acnt = 512;) o2 c: Z. g# t+ l" ^8 `6 T" j
- static int bcnt = 8;1 E9 O+ K5 m) o. S }. V. m# _3 Q5 S
- static int ccnt = 8;
" D+ @* z$ f+ p* U$ O: k- `2 `
: o8 U" R' r0 E Y' L& ]1 b8 G- module_param(acnt, int, S_IRUGO);( _4 ~ Y8 p$ y8 f
- module_param(bcnt, int, S_IRUGO);
8 ~ A* l% A: L5 C% y, \/ n - module_param(ccnt, int, S_IRUGO);
复制代码
8 {& L! c, z* _ F$ W& r3 e; o% t* _9 @6 `0 }: y
这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( j4 D0 l$ O7 [$ marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 h+ K" y6 L% _' R/ c3 Z
我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. Q% P' o$ L; W$ `6 V _0 U- b8 V1 a& j
# t, j9 M! N" ^# O6 a9 n& k
|
|