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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B% ~' N0 l( j) \* E) u& a
  1. [code]EDMA sample test application
    ' u$ @: o( c) ~  h- n: v* [
  2. /*
    ( q- Z! X4 S) O7 e4 x+ R9 o1 m& `) l
  3. * edma_test.c- U% r" A7 n: L7 |( E
  4. *
    ) p0 I5 q2 Z8 A8 g
  5. * brief  EDMA3 Test Application' h" l9 O. k, _
  6. *) ]+ X4 I  U5 ]
  7. *   This file contains EDMA3 Test code.6 ]0 p) K) d) f, B
  8. *
    7 S! I2 y) ]' g* J. P% e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 v# }6 C8 H4 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Y4 v* m$ ~# v1 G+ F
  11. *         TO CHANGE.7 ^; }0 H, X5 u9 `
  12. *, |( R1 }- W; |# S" u( H# ~& m6 \' v+ k9 E+ r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 P& h' {- {# n" X+ ?
  14. *4 [* u% |5 H9 U$ N/ p1 I. B; p
  15. * This program is free software; you can redistribute it and/or& Q( m" M" @: q6 z3 o
  16. * modify it under the terms of the GNU General Public License as
    5 ], D  w& f# _6 w. ^, K
  17. * published by the Free Software Foundation version 2., g9 k. \9 h. M3 b
  18. *8 ~. @% {& Z' X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : S- W5 Z) L/ U9 c3 D7 `
  20. * kind, whether express or implied; without even the implied warranty
    4 I( p( b  }# n$ P. N; |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 ]5 Z# s; ^% o6 M% |& y
  22. * GNU General Public License for more details.! n8 _; u* @7 x8 d  l
  23. */
    5 H9 K6 f7 u  y: t

  24. * X; l3 L6 D% @& `' W2 y6 e. |7 d
  25. #include <linux/module.h>
    ( m: ]$ Z$ g7 q
  26. #include <linux/init.h>3 \. O. o* \: |2 K! ~& b1 N+ N: q
  27. #include <linux/errno.h>
    2 e; m0 l/ k. j2 j$ @8 p
  28. #include <linux/types.h>
    , ]* l' a$ j- i9 n) Q0 x
  29. #include <linux/interrupt.h>8 j! B6 {$ w8 _  z3 u6 k
  30. #include <asm/io.h>% _- a- Q, F) C7 |. q+ m- `( c
  31. #include <linux/moduleparam.h>
    - K/ x' ?3 s+ P% \
  32. #include <linux/sysctl.h>
    . x$ t1 U7 U+ K) |: c
  33. #include <linux/mm.h>
    ) v( y2 ?9 t7 x* }  L
  34. #include <linux/dma-mapping.h>
    4 ~, I. F5 e3 Y# L/ g: ~8 E

  35. # @  n+ E7 X% L" ^' ^" x
  36. #include <mach/memory.h>  g3 P- ~* p! p: _( c5 g, U
  37. #include <mach/hardware.h>1 ]8 ~8 `4 c" Z7 r4 J9 b
  38. #include <mach/irqs.h>' f0 R9 D" ?# s- I( N1 z& X% A: h8 N
  39. #include <asm/hardware/edma.h>
    / p: ^5 V" D) }5 O; s) B  J

  40. + u" Z, S2 b! e7 B3 K2 D3 }/ g4 |
  41. #undef EDMA3_DEBUG
    ) Z$ e) u0 P9 b6 p+ I8 ]
  42. /*#define EDMA3_DEBUG*/! w% N, F& n4 C7 x& `  y
  43. ( F$ b  ~& H( V& d
  44. #ifdef EDMA3_DEBUG
    7 ]  B3 |+ X  s2 B  U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# ^/ o" v! C6 a' t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 N/ ^& w, S6 i4 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 K7 S9 \0 c( f7 b1 o* T
  48. #else
    " E& {% c8 Q( }6 {0 d
  49. #define DMA_PRINTK( x... )  D* e  d! l' ?+ p- _" O
  50. #define DMA_FN_IN
    5 W+ V: L1 z; X0 i  S1 M
  51. #define DMA_FN_OUT
    1 n- v/ Q2 l" V2 _: i5 @% M
  52. #endif
    # N/ {* ^- D% Y5 r4 y( ^1 {
  53. ! \$ l0 P2 B: t' ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; Y  V: ~5 L6 O
  55. #define STATIC_SHIFT                3
    4 Z+ {$ k9 b% e) |
  56. #define TCINTEN_SHIFT               20! _( V& K! q; o/ E
  57. #define ITCINTEN_SHIFT              21( f4 Y0 L% J6 W; q  Z1 d
  58. #define TCCHEN_SHIFT                22
    8 k1 L5 K! o. ~
  59. #define ITCCHEN_SHIFT               23
    , g7 a0 n  }6 w

  60. + o" m+ v# f# f
  61. static volatile int irqraised1 = 0;
    ! {8 R$ u5 o3 L" H! B
  62. static volatile int irqraised2 = 0;
    7 m3 E2 ]0 M+ H* D

  63. 0 V! o% _( w1 I# b2 z0 N' x) K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 g3 n& Y: ?5 |- c# @5 I5 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; }* j  }6 q4 Z/ C9 J: g: ~& i0 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ i2 O# Z: y7 j$ U8 @

  67. $ H1 D! ~: W' b+ I/ H  |. J
  68. dma_addr_t dmaphyssrc1 = 0;* s9 V' y% e; s  {  Z5 O
  69. dma_addr_t dmaphyssrc2 = 0;* Y4 ?% V- q0 o0 ~. {
  70. dma_addr_t dmaphysdest1 = 0;
    / H$ Z9 _8 y- I2 L  h" G
  71. dma_addr_t dmaphysdest2 = 0;
    ' O  q/ G. V. h; |

  72.   j% d; j2 g' C7 ?% I  r- I0 Z4 _( f$ X
  73. char *dmabufsrc1 = NULL;
    ) D7 m% K0 }' r; M$ X4 p$ g! J# @- E
  74. char *dmabufsrc2 = NULL;
    9 V9 D* U3 j2 @6 h" p( x3 H6 O
  75. char *dmabufdest1 = NULL;! [% {* z. E& Y! W( E; f
  76. char *dmabufdest2 = NULL;  u# k& i$ Y" E& ]3 ^

  77. * T- ~. s- w% g1 p: U( j8 c- B
  78. static int acnt = 512;
    4 Z. F6 w+ {0 N) m$ a  d
  79. static int bcnt = 8;
    ( F/ U% W/ u, s& N. q  |
  80. static int ccnt = 8;; U: X% q7 h/ U5 z
  81. ! n! p3 h! {: K3 o5 o2 Z- H
  82. module_param(acnt, int, S_IRUGO);! B- E6 t: @8 z$ ], ?( M
  83. module_param(bcnt, int, S_IRUGO);& z/ y/ f2 F- `1 R/ g1 y9 R) P6 h. x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 ]" ^1 [( v; @) [$ ~2 a7 ?2 N' h! n! c' j+ j" A) D' p4 ]" `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 V2 Y+ ~6 m/ l6 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; J/ {2 T8 `! T* n& w1 o3 V& |) v  g" {/ I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! S+ O! W- t" i4 y
& k7 L& r- F- P
' t6 \  G5 ^+ g: U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-25 23:43 , Processed in 0.040268 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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