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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + w  G' {, Z* F6 }1 `" ^1 x2 X% ?
  1. [code]EDMA sample test application2 k, ~- U9 u- @4 e) V# s1 F
  2. /*
    4 t3 Q- @' ~% W0 c4 ]1 k* s
  3. * edma_test.c
    1 N) y7 U$ O# K1 |0 T
  4. *
      J! Y$ r3 O! \' }2 ?" y
  5. * brief  EDMA3 Test Application# u: F* V& d/ j( @
  6. *. y+ v, z& l. O* t- p
  7. *   This file contains EDMA3 Test code.
    % |3 M5 X8 ^3 Z" H: S
  8. *
    , S6 l  H5 d7 }% R8 ^+ y2 Z+ V, \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " w. o) _) U0 B; f0 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 S$ p# c% E& u/ T. x7 ?
  11. *         TO CHANGE.
    , ~: L* @( o' ^8 H
  12. *
    6 U- E0 Z+ R% s% J: U# i3 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% R0 r- a) \6 g8 P+ \
  14. *
    6 x- t* D' ^% E( P5 I' Y: Z
  15. * This program is free software; you can redistribute it and/or: S& X5 V- A( ]! T2 ~
  16. * modify it under the terms of the GNU General Public License as
    % ~& \, [9 @) l7 c" F
  17. * published by the Free Software Foundation version 2.* i' k& T- p7 ~
  18. *
    # b# f& ~* z( }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- b+ G4 S$ }* |
  20. * kind, whether express or implied; without even the implied warranty% r) n$ o" K8 V  r0 ?5 R& f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 n' @; C' X& N4 M" u5 m0 b
  22. * GNU General Public License for more details.0 D, `4 X1 @/ `( L
  23. */
      a" T" `, g! [: N, D$ l
  24. 9 m2 ^( T0 B! T1 Q2 M+ h' d) v
  25. #include <linux/module.h>
    ( c+ e" c) Y. @! B% g6 }
  26. #include <linux/init.h>
    ) y9 N5 A# T( p; d
  27. #include <linux/errno.h>
    3 N9 `0 E  [. m3 @$ {
  28. #include <linux/types.h>
    3 k1 X  ]8 |6 F8 [# @- E3 m
  29. #include <linux/interrupt.h>
    3 g2 f+ h+ C. O7 @' @
  30. #include <asm/io.h>+ G+ m& J8 g4 G+ k% e
  31. #include <linux/moduleparam.h>" |8 f0 [" J& T8 K' B! L
  32. #include <linux/sysctl.h>
    6 Z* u; L; {- r' z% `8 m. _- H6 r- L
  33. #include <linux/mm.h>$ ?) t7 p7 i2 l: I- i: E
  34. #include <linux/dma-mapping.h>
    $ ^# K& b$ c0 w; u( c6 K
  35. " Z/ E4 k! w7 r1 T9 j
  36. #include <mach/memory.h>  K+ ?9 r% x. m6 q
  37. #include <mach/hardware.h>2 [, O2 z8 K) C* q' q
  38. #include <mach/irqs.h>1 I1 D2 t- C% {1 b! q0 w: H5 V- k% V
  39. #include <asm/hardware/edma.h>
    3 I, v* ~2 F- E1 l1 }0 l

  40. % T/ u3 j# K0 `% f$ J" q0 @+ A
  41. #undef EDMA3_DEBUG
    0 m8 L) H- @* O7 y5 t
  42. /*#define EDMA3_DEBUG*/( F4 x, X6 E; e% ^

  43. 2 L0 \" n1 {) ^8 n( t
  44. #ifdef EDMA3_DEBUG% Q, V6 |* V$ y, r) T7 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 ?& S" F  ]' i' ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . K0 b6 C: _% f' @3 _; l) C6 L8 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 q! y8 I& s7 M7 j
  48. #else
    * F0 Q$ n: U& R: n0 i0 u
  49. #define DMA_PRINTK( x... )
    / D5 ]) f# f$ N4 V( D+ a* ]
  50. #define DMA_FN_IN( ^5 i! N2 ?: o0 z' f3 q! Y
  51. #define DMA_FN_OUT6 C' H; |3 d8 w2 f5 n) W& Y4 I, A
  52. #endif# [0 d8 L3 x; I# q3 H4 y2 h) U
  53. ! k! D  u( L7 W1 p  s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). X6 |: [3 @8 B( H' K& e1 i. u3 Q
  55. #define STATIC_SHIFT                3! h; F' H+ [5 C( }2 X+ g. o1 M
  56. #define TCINTEN_SHIFT               20
    * d+ k# N1 _: |' b* A. Q* f+ g& p, [
  57. #define ITCINTEN_SHIFT              21
    & E3 l& Y/ P9 p. W5 Y6 M! @
  58. #define TCCHEN_SHIFT                22
    / T: M: w, Z  q! w- I. z* Q/ C
  59. #define ITCCHEN_SHIFT               23
    + p2 D7 f5 H) z2 ^
  60. 2 @: {1 F, }) A% p. N% n
  61. static volatile int irqraised1 = 0;7 C% n& F+ y. y1 w1 l. y; Z
  62. static volatile int irqraised2 = 0;
    $ E6 U- e3 K  y7 q% C
  63. " A) [- v; b7 W8 S' H' R  i, e6 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 {4 s8 Y3 ?% g2 D! K! O! f, h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + T6 x7 O9 _+ a4 q0 c9 b6 w+ ~0 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! _) }1 o0 v+ @5 F3 [$ a, }4 T& {
  67. 7 u4 c! D4 v- V+ h
  68. dma_addr_t dmaphyssrc1 = 0;
    0 f4 m( m2 m3 z- B/ o+ @5 j
  69. dma_addr_t dmaphyssrc2 = 0;
    * R9 |) D9 X# R' J, ~' b
  70. dma_addr_t dmaphysdest1 = 0;
    / z$ C8 d# @( f1 M% L8 c' G
  71. dma_addr_t dmaphysdest2 = 0;
    . `7 ]4 d! n4 D2 m) S" v+ n

  72. ' h3 T' k- N$ m* m" n+ f  I- x; ?
  73. char *dmabufsrc1 = NULL;$ E5 e, N5 F- E; U9 d" B% Q
  74. char *dmabufsrc2 = NULL;
    ! u% V, e# Y9 @1 c/ Z
  75. char *dmabufdest1 = NULL;
    2 l& v  t8 ~3 N3 B0 \
  76. char *dmabufdest2 = NULL;
    " l( L0 K3 }2 E7 Y
  77. 6 T9 c; y- ?% a. s
  78. static int acnt = 512;
    7 \: Y/ a7 g1 t$ B- d/ V8 H- r5 m6 g
  79. static int bcnt = 8;3 S7 ~' u" [& ]
  80. static int ccnt = 8;
    6 I$ Z6 Z3 J2 ^+ P1 m+ f! s: w

  81. ( O8 _3 k0 f; e9 v  w
  82. module_param(acnt, int, S_IRUGO);
    # Q# k2 ]2 V( c% G4 f6 s/ t. V
  83. module_param(bcnt, int, S_IRUGO);
    2 M3 r4 ^  @1 ^- d, a9 `# a  d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  d) a) Q# e0 l* Z6 X' T; C! {7 K1 |  g5 u: z' o8 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& ]! u2 x) y  o6 p" j, @. e1 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; k5 S' l, t" R% n7 z7 Q) \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 I/ x' m5 ]3 H$ M
* T' u+ n5 i4 @' _6 w1 c* F3 A* F
3 q8 B$ r% c! T" m+ K* \) s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 19:30 , Processed in 0.040272 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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