OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9198|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 N* [8 x+ _+ _$ [
  1. [code]EDMA sample test application
    ; ~  @/ }# V+ e1 ~
  2. /*
    7 W+ ?+ r2 U; k9 O4 m' @7 R' l4 k& R
  3. * edma_test.c8 d' G  S' g4 S3 ^( W+ `
  4. *- R/ U. |! l" q. o
  5. * brief  EDMA3 Test Application
    + o9 N0 f( [# f" g4 q6 M$ t
  6. *
    1 \8 ?* U) y2 A- G$ z: }) }* L
  7. *   This file contains EDMA3 Test code.
    0 \) @; o) v8 A
  8. *( }+ S5 h, s! t5 s$ n$ i% ~) r* S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( o3 q! l3 k3 {9 d* H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I3 X! ~# o/ l, i
  11. *         TO CHANGE.( h. B. U; B  n5 d8 [, A
  12. *
    0 ]% ~) }% O' e0 {' P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / s1 ?9 N" Q' s/ w- U4 j
  14. *" P1 [8 Z3 q! V$ u
  15. * This program is free software; you can redistribute it and/or
    - `) X4 m& D4 B& X1 \' }2 E. t  o: o
  16. * modify it under the terms of the GNU General Public License as
    ' Q( H- k" T) _
  17. * published by the Free Software Foundation version 2./ F5 ~( m" `2 l# {& I& T5 U9 e
  18. *, z( x: C  \7 r1 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( j1 {" J" O% a9 [  P6 e; q; x
  20. * kind, whether express or implied; without even the implied warranty
    5 F) ]$ R5 L* y5 a$ ~1 ~/ U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . T" v1 J+ Y6 ?" E; `- W
  22. * GNU General Public License for more details.
    , u. ^! C* f2 {9 F* o  D/ b" p) }
  23. */) L2 ]2 I% ]2 Z5 A
  24. : J9 n1 ^/ y0 l! H- B2 B, v
  25. #include <linux/module.h>* q, p+ p! ]9 j* B4 o3 P
  26. #include <linux/init.h>/ N. Q1 i" ?5 O0 e
  27. #include <linux/errno.h>2 L  [; c, B3 s
  28. #include <linux/types.h>7 Y5 s  F( \+ ?3 i
  29. #include <linux/interrupt.h>
    - A( b$ }$ ^+ t7 f+ n( q
  30. #include <asm/io.h>
    7 \! e2 h7 p6 K4 s4 V4 w
  31. #include <linux/moduleparam.h>: r* e& J5 ]7 |' p. _- ?- {
  32. #include <linux/sysctl.h>6 T1 I& g* i, `9 i" U5 A" @2 X
  33. #include <linux/mm.h>: a7 H4 m: d) \% ]
  34. #include <linux/dma-mapping.h>) t1 F0 w; I+ A+ i  ~) N
  35. # w. c# E: f: ^. R) T
  36. #include <mach/memory.h>) h: o8 z8 d+ Q1 ~6 W
  37. #include <mach/hardware.h>
    % @2 d( Q/ G' }
  38. #include <mach/irqs.h>
    ; _0 U) r4 }0 [& C! V" n) a
  39. #include <asm/hardware/edma.h>
    ; c, K: z1 y7 I
  40. % C0 F3 D; z# Q( X, Q, V' K
  41. #undef EDMA3_DEBUG. m6 w0 Q. M$ q
  42. /*#define EDMA3_DEBUG*/
    2 R3 A( \; c+ w8 K% ?
  43.   U6 ~8 q% Q3 |$ ]
  44. #ifdef EDMA3_DEBUG
    . J" G6 h( z0 w5 e  m. j/ G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % P- K( B! @. Z7 P$ b' P5 p" |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( U0 y2 T' s+ l% S& ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): ?) K4 D/ X7 e& F6 U+ E
  48. #else
    . ]2 z+ Z9 q8 L7 A& l
  49. #define DMA_PRINTK( x... )$ X2 N- j0 V1 i  @7 o
  50. #define DMA_FN_IN; [! B. G$ V. t4 O) T6 j1 [! X! Y
  51. #define DMA_FN_OUT
    ; e9 |3 p) Z0 `, u( I. d; W
  52. #endif8 e* X$ z, g, Z$ U
  53. ! U" R7 T! ~+ ~7 I( D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 g. C; s7 P+ O5 B: i+ m
  55. #define STATIC_SHIFT                3
    ! l0 J; d3 A9 p& {) C9 P/ j  a9 p' U
  56. #define TCINTEN_SHIFT               20
    5 P. ~' M* C( V7 [
  57. #define ITCINTEN_SHIFT              21
    , B, C$ O' ^6 Z0 [/ W
  58. #define TCCHEN_SHIFT                22' [! Y( X. u: V2 W1 |' }# t7 |& J
  59. #define ITCCHEN_SHIFT               23
    8 ]9 d6 L9 j2 w4 @  G5 |9 ]  |6 H
  60.   ]9 m/ r9 v! ]; y9 o) O8 c- T
  61. static volatile int irqraised1 = 0;. W% _+ o- F" @8 u% `1 o' S
  62. static volatile int irqraised2 = 0;
    % @% G4 N; V: b* U4 Y0 [/ l0 _
  63. : ]3 n# f) k& u5 t, }) D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . _, u; l/ R# d' ]; i1 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) g8 j+ y# E/ x1 X& u, l8 o1 ~. G/ v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 i( p7 K* ^! x1 c$ g1 S3 X- U/ _

  67. " Q! c5 f( c0 {( l/ }
  68. dma_addr_t dmaphyssrc1 = 0;
    9 n% U, @# d- y. y
  69. dma_addr_t dmaphyssrc2 = 0;
    6 i; a$ R; a0 o6 Y6 g5 N7 e
  70. dma_addr_t dmaphysdest1 = 0;
    4 \) X2 F, ?4 V/ ]* P$ Q
  71. dma_addr_t dmaphysdest2 = 0;, W. ~: A) x" |- N; E/ _
  72. 2 b: M! i( v, |( I
  73. char *dmabufsrc1 = NULL;
    - E9 ~$ @. f. d8 B! M" y8 I; L
  74. char *dmabufsrc2 = NULL;# I5 o( Q- \( s4 k
  75. char *dmabufdest1 = NULL;
      J1 s9 \  B8 h. }
  76. char *dmabufdest2 = NULL;1 Y. {# L, I+ o0 C1 G7 X/ t! W' [

  77. " m% D# U: J$ f6 Y5 e# _) E! `, G6 [
  78. static int acnt = 512;
    4 n; O) T; d2 P7 E! ^: _
  79. static int bcnt = 8;
    9 c5 L" N$ O* o% |
  80. static int ccnt = 8;
    / O- R2 ~* _6 }! v9 S, q1 [
  81. - D! H5 S1 X+ ?
  82. module_param(acnt, int, S_IRUGO);
    ) C. `' i7 C$ X- p) g! D; I
  83. module_param(bcnt, int, S_IRUGO);
    4 T4 @9 m- l+ [' t/ j% F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' i, ?" t2 L5 x; j# A7 a+ b. j0 I% K$ o

% a* e5 W8 w4 O3 j/ u6 G2 I. n: w. R% q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 {- x* P, @. R/ k. k: N; ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Z- s- u( W  V1 a1 v) k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 @5 z/ s/ [' b+ }9 n" f4 ?9 v1 w  G* E  E( d+ W" Q6 ^7 i& j3 X% j

8 q& C' T; e* u4 V5 h% J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-12-12 02:48 , Processed in 0.037691 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表