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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; p% r2 t0 X& t; h, q
  1. [code]EDMA sample test application
    , g# ~! n# {( k9 U
  2. /*
    5 l, o$ C0 ~6 n6 q, p2 n
  3. * edma_test.c# r- V" X8 P2 B8 y
  4. *
    ) y6 B0 K8 M2 E; t9 Z9 r' R. G
  5. * brief  EDMA3 Test Application
    : h) d1 H; j$ {: s9 Q
  6. *
    . D% F6 m- }; ]
  7. *   This file contains EDMA3 Test code., c4 u1 e1 e/ H. ~$ R0 U7 T
  8. *
    2 F$ s7 j$ g1 w+ B, k2 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ V1 m0 ?+ D% F& x; D& T7 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # Z: W. _- \3 k1 V" l/ a2 J1 G( r
  11. *         TO CHANGE.; e6 ]* v8 ^9 r1 K3 C" g
  12. *' p) }$ u8 O+ ]( g# }; {0 P9 e3 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 H. ]" `" J  K. }) m9 k/ S
  14. *
    / F$ E2 \" e( o1 P1 j
  15. * This program is free software; you can redistribute it and/or
    : Y) s  V* ]" V. H1 s5 c. y1 {
  16. * modify it under the terms of the GNU General Public License as: d2 l# c0 ^  D+ ^' r. H! s2 G7 i
  17. * published by the Free Software Foundation version 2.$ u: o/ m& r; N0 N) O$ `
  18. *$ P; ]0 w* L) S8 s2 g& x1 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ?7 m8 x- ^  E1 u: e! l( e* k
  20. * kind, whether express or implied; without even the implied warranty) i% Z) x) T. M" r4 c2 s. j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      z" x6 M. |6 o* G' D& R7 e
  22. * GNU General Public License for more details.! N' K1 S6 k! q) L3 S0 R& C' U
  23. */
    , r4 [* K7 Q$ \2 Z; |8 k3 q  D

  24. 7 T7 _% u" |  i. _: j
  25. #include <linux/module.h>7 I: H6 i' B0 J; l
  26. #include <linux/init.h>, m9 x  b, Z" R0 K  P/ ~# ^
  27. #include <linux/errno.h>
    5 B5 }! ^7 W$ _( n' Z3 O
  28. #include <linux/types.h>) x6 F5 E% e% n/ T. N$ q
  29. #include <linux/interrupt.h>
    ' P, A# i" O1 w# A, Q
  30. #include <asm/io.h>8 w, M: q& K9 d, D3 l; f- N
  31. #include <linux/moduleparam.h>
    8 I: r8 C. [1 f: E, Q; q) |
  32. #include <linux/sysctl.h>
    0 ?2 J1 r( Z0 x1 d) U
  33. #include <linux/mm.h>
    1 a1 Z2 b! L) @* l1 Q* H! m: A# U, t7 s
  34. #include <linux/dma-mapping.h>: m4 X! r3 d5 H$ Y

  35. ! K- r0 ]; c6 I2 r2 Z
  36. #include <mach/memory.h>$ f% t# M1 i3 @
  37. #include <mach/hardware.h>
    8 ?  `) M& x6 W" ~
  38. #include <mach/irqs.h>
    + v. E/ @; {% }6 R% o- c; |
  39. #include <asm/hardware/edma.h>6 v( E9 H5 A- o1 |( h$ s' G

  40. 4 l# s" [  q/ H4 S7 ^) Z0 D5 H. @
  41. #undef EDMA3_DEBUG! }/ v: M) V7 k& c" V7 z- C) l
  42. /*#define EDMA3_DEBUG*/
    7 v2 X4 c+ `) b- e

  43. ) s2 q" _- P9 ]- C0 p6 s! Z" j, D
  44. #ifdef EDMA3_DEBUG3 h3 z! b3 Q5 v- \+ U; Y, L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* U' s/ c7 b! k5 F& {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 s- n) [# S( Y6 @  O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 f4 {% n2 Z! l
  48. #else8 v8 p6 M$ F5 W+ p# Q
  49. #define DMA_PRINTK( x... )
    - b/ R/ s5 i+ D7 ]3 ]; Z6 l* t
  50. #define DMA_FN_IN
    + q! i( W$ Y" G3 ~, u7 g8 @
  51. #define DMA_FN_OUT! }' W; N' y  x) |# z* E
  52. #endif
    9 C: O7 b8 H" U' n
  53. & E: a% c0 `' `& O, l" S: @/ t  l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& ]5 [9 A1 K9 J( r5 @. ~
  55. #define STATIC_SHIFT                39 G( e; u0 M8 `+ A" |0 R! E; R
  56. #define TCINTEN_SHIFT               207 w2 n* b8 u/ M! N- A1 q
  57. #define ITCINTEN_SHIFT              211 w3 S, `1 `% J! u/ d
  58. #define TCCHEN_SHIFT                226 _, ~( W- @, T8 f
  59. #define ITCCHEN_SHIFT               235 n7 m' |1 L) c; r( r

  60. " E, o% a; q1 m. q
  61. static volatile int irqraised1 = 0;
    3 {1 y1 I& F3 E
  62. static volatile int irqraised2 = 0;; W5 y8 x1 e% ^. `' F7 `

  63. 0 I# B' B* t3 H; l  B  A# p: ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% o) W; V, X7 d# P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # K9 j2 y' }( e" Q7 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 I* Q: X- r. O! P
  67. $ d! b: N$ A6 A* _
  68. dma_addr_t dmaphyssrc1 = 0;
    , `3 o/ \* x: G, \5 }
  69. dma_addr_t dmaphyssrc2 = 0;
    . y/ t% f7 ~' r0 p6 h. J# W
  70. dma_addr_t dmaphysdest1 = 0;
    3 [( b+ R$ A( h8 p8 u1 a" A
  71. dma_addr_t dmaphysdest2 = 0;
    3 O: O% v7 M+ C) {) S. Q

  72. : W/ B* w' Y. J% X  q3 V5 Z
  73. char *dmabufsrc1 = NULL;
    ; T& K. p' a4 ^1 I8 M# H# y% H
  74. char *dmabufsrc2 = NULL;
    ) e+ D9 F6 k4 a; d. f! {) d, c
  75. char *dmabufdest1 = NULL;3 Z+ F  P- d$ H# {* S0 Q( G
  76. char *dmabufdest2 = NULL;7 _4 t& _* W& T! I) q7 L6 X

  77. $ f8 t! T2 L$ @  ^3 r8 `' H8 v
  78. static int acnt = 512;
    # g* E- d$ _+ p2 i9 {3 ~& b5 h
  79. static int bcnt = 8;! z1 w# y' r8 s( _
  80. static int ccnt = 8;
    - o7 k5 S  O3 V2 V/ V$ ^

  81. 3 f- Q% \" O- c# ~2 ?  z. q
  82. module_param(acnt, int, S_IRUGO);
    ! m, z& n  Q! c& G3 d
  83. module_param(bcnt, int, S_IRUGO);+ l; |7 D8 `% ]5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. F! `: o' f5 `# b: D! O$ y5 Q; I7 @, E0 @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% Y) p! q) K) y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 F3 o9 l4 V8 V2 m( {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- x# M1 ?; V2 C( x5 k

7 g8 p+ S* N; Z9 d- N4 n& l' a5 s: d: o" a& L, ]; D/ E$ p& E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-5 03:15 , Processed in 0.044960 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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