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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# X. j9 v* M5 }  v! w7 Q& ]( A
  1. [code]EDMA sample test application1 U, ^/ \& b, J7 _0 w. M& h
  2. /*
    5 I9 ~9 q) Y7 W. c  V
  3. * edma_test.c
    ; v- s+ j7 R+ ]+ ?& Q8 T
  4. *
      T7 P% X1 q3 `0 t8 T8 J
  5. * brief  EDMA3 Test Application& y6 ?2 X' q# }; j  A: m& N
  6. *& p# L9 K4 ^( S! n) [+ F
  7. *   This file contains EDMA3 Test code.
    4 J# P7 q1 V/ N7 T, X
  8. *2 V/ ?9 b& y' V* L0 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Y7 ~0 o  u: a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 i" [" j% d+ ~8 |" o. N. Y3 ^
  11. *         TO CHANGE.
    , T& e) l- M/ z; f  T# R0 e
  12. *9 \6 i& V' E. Y7 m  r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 |8 V: n4 [9 s/ s+ G' n
  14. *! @5 i! ]# u/ F2 ~" B: ~" R3 X
  15. * This program is free software; you can redistribute it and/or4 B/ T) j# |# W9 b
  16. * modify it under the terms of the GNU General Public License as  B: ^2 G# u+ S: m/ i
  17. * published by the Free Software Foundation version 2.
    - k& N! ~9 L3 F9 V7 C3 P  w, z
  18. *
    1 ]+ q. I" J+ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, T( c) [4 G9 r
  20. * kind, whether express or implied; without even the implied warranty% A& g3 Q) b$ a$ Y/ |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) x5 `, m# [: H' ~7 r, p" ?
  22. * GNU General Public License for more details.
    . ~, S/ f  }/ i# [% @
  23. */
    , r; _! V) {' e9 {1 c+ I

  24. . V- e( E- g6 V5 P; D6 o% ~
  25. #include <linux/module.h>; R: j$ e, h, g& d
  26. #include <linux/init.h>
    8 X  M3 Z$ t  ]* F, ?6 {. E' L$ ?
  27. #include <linux/errno.h>, Y2 j6 f. M6 m0 C- N) _
  28. #include <linux/types.h>( s$ b5 ?. ^3 z9 {3 _
  29. #include <linux/interrupt.h>
    4 i; l0 s$ n, a+ P- i* X
  30. #include <asm/io.h>% U- A% k# p! s
  31. #include <linux/moduleparam.h>% w3 C9 T' Y0 z$ @
  32. #include <linux/sysctl.h>
    - F& a. n. T9 |2 Q) c6 t2 ~* W1 b& y
  33. #include <linux/mm.h>
    ) b+ a6 O9 w/ S! q/ C) d
  34. #include <linux/dma-mapping.h>' M% J/ V" ^' c8 N3 j7 p5 n

  35. ! r$ t$ v7 |5 K7 |  t
  36. #include <mach/memory.h>1 V! d3 p& E6 U7 Q
  37. #include <mach/hardware.h>: k. K1 u/ i+ V0 m2 f* }
  38. #include <mach/irqs.h>4 c1 |: m3 ^7 a' {" w; c; _: ^" g8 G: K
  39. #include <asm/hardware/edma.h>
      Q: G+ Y- o( e0 |3 N

  40. ) \1 q) S- @! \  M/ K4 c& q5 J+ E
  41. #undef EDMA3_DEBUG! e! u, q. J7 p' B( S$ p) b
  42. /*#define EDMA3_DEBUG*/, Z- G4 X. o2 H5 \
  43. / w8 v  R) K1 [9 _
  44. #ifdef EDMA3_DEBUG
    & Q7 m! S" T: \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & g  Z0 h8 ~7 u9 \4 p) I# ^( A1 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 d) ]/ g$ e2 A6 A" I, V  ]+ p# ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# A5 }0 f* h6 N' @$ G
  48. #else
    * o4 k' _' m+ K! Z$ m
  49. #define DMA_PRINTK( x... )7 t7 S  t0 h& V  q$ ~# J# ]
  50. #define DMA_FN_IN# j: Q9 o+ b+ T
  51. #define DMA_FN_OUT
    " j: n( [# K2 B. Y
  52. #endif
    9 o0 Q3 G* O0 Z' D0 r
  53. ) l1 ~% U. W* c, n7 Z9 ~8 J# A$ [. C- v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) P( M4 P' b$ i3 T% S
  55. #define STATIC_SHIFT                3& c. U5 e: m( R
  56. #define TCINTEN_SHIFT               208 L. J7 U& T4 H# v0 w$ W' a4 @
  57. #define ITCINTEN_SHIFT              215 j6 V* _- F$ p8 `
  58. #define TCCHEN_SHIFT                22( f5 f* r7 o/ T4 |8 S
  59. #define ITCCHEN_SHIFT               23
    7 O& j) w% G' [7 _, s8 `# R
  60.   G- t# H5 S0 t2 O. h
  61. static volatile int irqraised1 = 0;2 o/ r0 n: j' N) S7 _/ P
  62. static volatile int irqraised2 = 0;0 L& m2 h& x* Q- k
  63. 5 q3 j* M  _) G( f' S6 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 A' Y  o, j3 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( f* d. A3 Q9 Y+ \6 O: Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; g* C( _- m! ^* F6 F/ r
  67. / [* w$ b6 M* O! ^
  68. dma_addr_t dmaphyssrc1 = 0;
    / Z. B  t7 `& R+ w5 H/ t$ D5 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ; w3 X2 M% |4 p/ y, l' f
  70. dma_addr_t dmaphysdest1 = 0;
    # G% ~# F, S# l! K) [4 h. n
  71. dma_addr_t dmaphysdest2 = 0;- x5 F& K8 \8 h
  72. 8 M6 A9 L* h' }/ i5 d6 ]& t
  73. char *dmabufsrc1 = NULL;( D) Z9 ^4 p0 B! ~/ N
  74. char *dmabufsrc2 = NULL;
      |; h" x/ Q% ?. z
  75. char *dmabufdest1 = NULL;% w- D2 ^& b. E6 e' o; a
  76. char *dmabufdest2 = NULL;0 `' j  q& {- A9 o" U! v- u

  77. $ w/ e  p+ `9 Y5 U
  78. static int acnt = 512;: D: _2 ^5 ^$ X4 ?3 i. ]' D
  79. static int bcnt = 8;0 q* {+ h" i9 l4 y3 U
  80. static int ccnt = 8;3 X: W4 {( x; X# M$ B
  81. 5 L6 x5 v$ @- ?/ W9 c( R* [
  82. module_param(acnt, int, S_IRUGO);
    9 R1 A  l  q1 ?3 m; u2 K# N" @  L
  83. module_param(bcnt, int, S_IRUGO);7 A  {$ m1 O6 R6 h+ G% X6 {! w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 h; E2 z% \2 z  d, x1 s2 Z
7 V- w# \4 S3 j  R% U) y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" |; d1 L+ y. y( ]0 m' j0 Qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; p1 j$ T5 b  w; C. ]2 P& v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 P, `9 H$ H  p: l, b) d
0 q6 X, B+ ?$ T0 [3 E
/ j; n6 j" s) p7 Y* W+ M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 10:15 , Processed in 0.039887 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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