OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 W5 z" a7 i1 T6 y& m# t5 M9 ?
  1. [code]EDMA sample test application: ~$ W% }% {2 N
  2. /*0 R8 l0 }9 l8 V: W# I
  3. * edma_test.c
    : S+ f3 T/ F' _
  4. *% ~2 b3 H  b* E' X8 G
  5. * brief  EDMA3 Test Application1 m4 n) C+ Q$ u8 H5 W
  6. *& e- N# i  @2 S: j) R
  7. *   This file contains EDMA3 Test code.
    5 l- L- H; \" }
  8. *" w& w8 b3 Z: h+ ~2 J  {( ~# A( o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 k: r/ f" j+ {8 ~$ S, f' W( B# z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- H4 l- j* n. T% N  f
  11. *         TO CHANGE.  [& K  S+ Y3 o
  12. *
    - E, j: ?) ~: Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' Q5 V! o7 {# a
  14. *
    ! h5 e% Z6 Y1 {: K: n4 J* N
  15. * This program is free software; you can redistribute it and/or0 `# {( q$ m: J+ C7 l# s; y
  16. * modify it under the terms of the GNU General Public License as
      Q. j# r! M- c) I, k0 \0 e
  17. * published by the Free Software Foundation version 2.
    & o- M% c1 Q" p0 G: o) r
  18. *
    : |/ j# j/ ^( f/ L" V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \: M! O: S3 S
  20. * kind, whether express or implied; without even the implied warranty
    0 |% \' G; ?- D, e6 [% H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; ^+ |9 u1 D5 B( H1 J0 k) A; R
  22. * GNU General Public License for more details.# O/ h: p  Q: Y4 e: g
  23. */! K3 [% b' x$ w2 Y" [" u
  24.   @- S9 Y- R' {1 P/ J1 Q
  25. #include <linux/module.h>
    ( e5 v: t" [# j% h$ m, ?) S7 G
  26. #include <linux/init.h>& @  Q7 W* _7 ~! k) W
  27. #include <linux/errno.h>
    7 h. R8 b. x: z: r
  28. #include <linux/types.h>3 u& |+ d, a9 x9 i# S
  29. #include <linux/interrupt.h>3 m& ]) s( m/ D) @# l  Y$ e& i
  30. #include <asm/io.h>
    % a( p8 g, Q, b
  31. #include <linux/moduleparam.h>' F% g3 w3 m/ W
  32. #include <linux/sysctl.h>
    " ]; H. o  o5 d
  33. #include <linux/mm.h>
    9 c& i% G. x  q; K0 y- A2 m
  34. #include <linux/dma-mapping.h>7 X5 o' s9 z! U* J

  35. 6 N$ o( [. Y) W. B( b
  36. #include <mach/memory.h>) H7 v+ @& ]" _( X1 h" L1 h% j
  37. #include <mach/hardware.h>
    : d$ f& m1 x$ b& C. Z% \
  38. #include <mach/irqs.h>
      c: z; G% p9 Z7 D% a8 o
  39. #include <asm/hardware/edma.h>! f& D# W1 o6 Y

  40. ( K0 t, i9 K! U. G! W
  41. #undef EDMA3_DEBUG
    " i0 X8 _+ L( p) j2 `
  42. /*#define EDMA3_DEBUG*/0 c% J/ h4 G- i8 Q+ V; ?
  43. ! |, I7 X" P. ^+ L7 I  y  H
  44. #ifdef EDMA3_DEBUG
    9 ?1 @) p' X! c1 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), [7 ?! ]0 J" i5 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : J% `5 b4 M5 n( ~: s1 p& ^$ q5 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 U* K2 L/ k# u/ `) i  ]8 H7 `" G" _' ~
  48. #else
    ; f( h8 X5 ~# E8 K+ q8 S
  49. #define DMA_PRINTK( x... )
      D# k( F0 P- K+ t& l
  50. #define DMA_FN_IN- ?& X6 A: P) e2 ]2 e
  51. #define DMA_FN_OUT
    * U  b% ~  k1 q  o( w
  52. #endif
    ' U# G7 _2 G7 v, i- l

  53. & e. k4 n6 k3 J+ }" l7 }5 w: {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), @7 P  U1 i! \9 ?/ Y/ {
  55. #define STATIC_SHIFT                3
    ( |: n' u9 ^$ x  Y# i9 g
  56. #define TCINTEN_SHIFT               20
    " Q, p6 w  ^# b
  57. #define ITCINTEN_SHIFT              21
    : U7 o& a4 p% r8 ?4 z; u
  58. #define TCCHEN_SHIFT                22# |& r: b' j. A! n) \1 F3 @( T
  59. #define ITCCHEN_SHIFT               239 g) l& f1 J) M0 \5 a
  60. ( J' I$ U  c. d) o3 B+ t5 I/ m8 b, ?
  61. static volatile int irqraised1 = 0;* I+ n# I7 y* _, f
  62. static volatile int irqraised2 = 0;
    * S9 `& W' E( d# }3 e6 g8 i6 ]

  63. * p- A  j# Z! f/ z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ [3 ~- |6 B& u1 s7 p; Q0 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - M' k! o, c& N6 j- X* Q+ z0 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . |* A: Z: ]- @" t* c
  67. 9 |; _3 V% Z$ M5 v3 d) r* X/ o
  68. dma_addr_t dmaphyssrc1 = 0;/ d8 q2 f9 A0 H8 v" b% ^
  69. dma_addr_t dmaphyssrc2 = 0;# ~# I4 C' _' Z0 o" _/ F
  70. dma_addr_t dmaphysdest1 = 0;
    2 m. u5 M' i% L
  71. dma_addr_t dmaphysdest2 = 0;  }& \' E0 L+ F& m
  72. - _4 C+ e1 W! k8 O& l/ F, I, m
  73. char *dmabufsrc1 = NULL;4 Y% x2 i( a; g3 `0 f
  74. char *dmabufsrc2 = NULL;
    ' M. Q& P  n) P
  75. char *dmabufdest1 = NULL;
    , g: o, S0 c* N8 F
  76. char *dmabufdest2 = NULL;" D6 o, J( \0 n: u1 C% \7 k
  77. 8 O6 R; K% T2 Z% c% V1 {
  78. static int acnt = 512;
    2 W! _$ i" g1 F4 ]' m( u1 S
  79. static int bcnt = 8;
    ! {; q2 z1 Q7 y
  80. static int ccnt = 8;- K* y. l; k1 s0 r5 d# W

  81. $ L2 i" t8 ^# J+ Q- j# K
  82. module_param(acnt, int, S_IRUGO);
    , \/ V! D, P/ K# z$ @
  83. module_param(bcnt, int, S_IRUGO);+ O- Y2 |- d/ O, ~5 p# t
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 F; Y5 B# q( t& [
7 w# _1 T+ K+ K. N& g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 T; m' ]  [% parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ]. J7 Z5 F' j) q/ W+ r. u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 r1 h2 [% W+ T* w; W+ D- a; V( q+ ^5 C) W$ C9 Y4 s

# |% B6 F% C9 @; B2 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-1-19 04:51 , Processed in 0.045748 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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