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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 n' y' r  D, R2 v; `( @3 F' k
  1. [code]EDMA sample test application5 j8 {' [7 S# i5 P" f
  2. /*( v3 j! V: _' H, |
  3. * edma_test.c, C4 T  T  c4 {3 f
  4. *+ I0 a1 k+ Y5 a
  5. * brief  EDMA3 Test Application* B0 u' g. f( `( f" ?/ Z; B
  6. *
    : B% i7 R$ \5 g
  7. *   This file contains EDMA3 Test code.- |/ O; u- Z. f' ~; Y2 e- c
  8. *) m+ z9 L( u0 A$ Y" k' W/ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : _# J# x6 \" M% n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! M( {' x1 ]0 D* M$ A4 B
  11. *         TO CHANGE." L/ |  _7 @" z8 \+ @2 g
  12. *# k$ c& ?- ~: j- d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 G' [# l1 u) H6 g+ A  B
  14. *
    5 m2 ?, U7 ~1 N( a" w  S. |$ b1 R3 q
  15. * This program is free software; you can redistribute it and/or/ o  d  M% }& P% n
  16. * modify it under the terms of the GNU General Public License as7 C& D1 g! H! b; c
  17. * published by the Free Software Foundation version 2.
    ; H. r: L) M' y$ B& j' V8 J) P) c6 o
  18. *! ?) h9 s1 R" f$ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' @  C9 [1 |1 ]8 b  p; a& R
  20. * kind, whether express or implied; without even the implied warranty
    . U* o) G6 b0 ~. @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ Y8 ]9 l- U, H
  22. * GNU General Public License for more details.
      S% Y% n$ r7 F. q
  23. */5 q: e% Y) r9 l1 k  ]. G3 V

  24. % M: J5 Q( a% ^' A! p
  25. #include <linux/module.h>( h  D% v2 c" d3 }' e6 N
  26. #include <linux/init.h>
    " H: f" I) W! `6 C& h
  27. #include <linux/errno.h>$ c5 N5 @% u* _: p1 I$ a. Y# @1 M
  28. #include <linux/types.h>
    8 f2 P; o  a% r
  29. #include <linux/interrupt.h>* I6 G1 D  D% t, e8 L- @% M: l
  30. #include <asm/io.h>
    , L1 O4 x: G7 x/ G$ q. h
  31. #include <linux/moduleparam.h>. q: z* I, _' s* ^
  32. #include <linux/sysctl.h>  V/ Z. w& b2 `3 j2 ]1 C
  33. #include <linux/mm.h>
    * K1 l1 T" @+ l" [; W6 C2 C
  34. #include <linux/dma-mapping.h>
    4 [! D( i: s* N2 w
  35. & V' Z# ]$ d, H+ F" b& w$ ~2 x8 C
  36. #include <mach/memory.h># d5 V/ q4 a2 R" c" L
  37. #include <mach/hardware.h># d% n8 {( y' e4 I! D3 g$ I
  38. #include <mach/irqs.h>
    # x1 D& b& W: Q; L
  39. #include <asm/hardware/edma.h>
    / }, u7 R# H0 t) G( l( Z
  40. + L2 a9 `' Z  j! ^
  41. #undef EDMA3_DEBUG
    , N* @" C8 p4 y- [! m
  42. /*#define EDMA3_DEBUG*// ~* j1 g' i' d8 |
  43. 9 F9 K2 K4 ]3 D2 ^
  44. #ifdef EDMA3_DEBUG& t0 o3 A% h* m/ W) u7 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  }* a7 @7 u! B1 e8 e! ~  W3 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& J" C+ n" C, m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' a: v8 ~0 C* j6 o, l& x
  48. #else4 S% M! w' q$ A
  49. #define DMA_PRINTK( x... )4 w2 ?& M7 o; q$ _2 k' _
  50. #define DMA_FN_IN
    2 P3 P% d" L3 X- z$ \0 \, ^
  51. #define DMA_FN_OUT3 a# Q  y9 b. E' y3 Z7 L0 w
  52. #endif
    $ n0 }9 j5 z7 p& w) j

  53. / b( K- A8 @! z% d8 s5 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 z0 @: _; K7 i+ G9 L& Y0 y
  55. #define STATIC_SHIFT                37 }, q8 n  q7 F8 N: w
  56. #define TCINTEN_SHIFT               20
    5 k" ?2 o+ e0 d) h' k
  57. #define ITCINTEN_SHIFT              21/ `& M" y8 \* v1 W- }8 U- _
  58. #define TCCHEN_SHIFT                22
    * a8 Y) t" D/ v* ^& K
  59. #define ITCCHEN_SHIFT               23* V+ R* ^5 i7 `
  60. $ O1 c. s0 M8 @7 m, W
  61. static volatile int irqraised1 = 0;6 M% o" U* a8 v( c4 F5 O  p
  62. static volatile int irqraised2 = 0;; c+ z9 M4 }7 ?( K

  63. : Y* e/ n" ^( c2 G+ M% v& \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s0 e9 T# S+ H" p! k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. r6 \  ]3 T  c. L/ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& `( w- U# |) t) |# Q
  67. 3 H# i) R2 {; M" f
  68. dma_addr_t dmaphyssrc1 = 0;
    7 l3 I& X  p4 o" _' ^$ x
  69. dma_addr_t dmaphyssrc2 = 0;
    / `7 r) M2 r+ K- a) V* E- s" T; E
  70. dma_addr_t dmaphysdest1 = 0;9 ]; e9 ^8 Q& W2 J/ b& j* a
  71. dma_addr_t dmaphysdest2 = 0;
    - V9 |/ P2 H4 `. Z9 {

  72. * k2 Y0 ~; Z9 S2 C% d8 o7 M" }6 b
  73. char *dmabufsrc1 = NULL;" ]) \8 A2 e* F+ z' O: ]) Y; r# I
  74. char *dmabufsrc2 = NULL;
    * i2 @1 q- E% U- d# Q
  75. char *dmabufdest1 = NULL;
    & s" R  @3 g6 X8 Z8 V: F; G$ Z: ~7 n
  76. char *dmabufdest2 = NULL;
    2 U0 P" k  J/ x  U6 g' z( e
  77. 4 |2 l6 }* w  h4 B$ a; h9 [
  78. static int acnt = 512;( T5 z/ Y! I3 d
  79. static int bcnt = 8;6 m  A) F: s1 ?6 \
  80. static int ccnt = 8;, _) {1 e- j& f2 y

  81. 3 e; [6 [6 m5 A' i5 v0 K
  82. module_param(acnt, int, S_IRUGO);: F7 z/ N: `' x$ a9 t
  83. module_param(bcnt, int, S_IRUGO);
    / l; [/ c& R8 u3 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 c1 K  a# Q- J2 ?
# _9 F, u/ k2 Z5 A2 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  c! o" [8 [8 G* F2 ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 X- ~+ Q3 h  ]) M9 B& f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! g# U  ^. n7 Y0 |, L
" t( ^. Z0 `, E. `& g
  ~1 o% Z8 r' O% g- ~8 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 05:21 , Processed in 0.039217 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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