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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 Q" w# v& e/ y2 l! I, e6 U
  1. [code]EDMA sample test application9 S% P$ D+ O" @% J/ m6 [
  2. /*
    & ?/ v1 O( u" u! Q5 D) D: b
  3. * edma_test.c
    . `3 ~% }3 Y7 I  ~% s
  4. *
    & `$ z4 q" O4 H' _4 o. @# b$ ~! F
  5. * brief  EDMA3 Test Application
    % j; E- j6 f0 m' `3 D
  6. *8 o; [% D/ f/ g# ]3 r  y  b) Q8 @
  7. *   This file contains EDMA3 Test code./ i8 ^- t, d9 z7 W! |
  8. *
    ; R3 d, X# l6 E& ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% f5 e4 e! T- w/ @: s  T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : Y1 |4 f% u, i1 E1 a
  11. *         TO CHANGE.2 }" w& Q! u# b1 t
  12. *
    2 }. I. U0 M9 a- A  D1 c/ e" L" N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 v7 N! ?- V( `' v# k
  14. *
    9 ~$ G( x$ r% _8 w5 y
  15. * This program is free software; you can redistribute it and/or( m4 r# D/ l  o4 P1 \% l1 a$ |9 P
  16. * modify it under the terms of the GNU General Public License as8 z3 N4 W) D9 N7 O3 f
  17. * published by the Free Software Foundation version 2.
      c3 K- [4 r. P9 ?/ I- `
  18. *
    # v! Z" T! o* p* Q! N- C% v% z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * A% w5 b$ h7 v; }
  20. * kind, whether express or implied; without even the implied warranty
    5 V* g# {; d4 ?) b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      ~0 L- ?; g0 m. I0 i6 `  T3 V
  22. * GNU General Public License for more details.
    1 E, a. D' R& Y+ F% @/ j
  23. */
    - |7 e$ w  I8 A' k) q3 Q  z4 l( y

  24. 9 ^2 r" m2 t0 A/ x7 ^9 a
  25. #include <linux/module.h>8 ~1 e* F* g" t0 F* D- |# L7 U
  26. #include <linux/init.h>1 S" l3 d$ H# J9 A3 u" U+ q& a) w
  27. #include <linux/errno.h>
    4 ~9 b) y, \2 v0 ?
  28. #include <linux/types.h>3 E7 X& b5 h6 |
  29. #include <linux/interrupt.h>
    7 h5 p: h2 Q$ d5 M& ?
  30. #include <asm/io.h>) @9 L! m: F, f! s- D+ R; p
  31. #include <linux/moduleparam.h>  W* i9 n; j* v" D3 \- D% P
  32. #include <linux/sysctl.h>
    / {8 I" }" |4 L9 r0 L
  33. #include <linux/mm.h>
    # F- u" v  k1 D! z0 T' \) ~$ T
  34. #include <linux/dma-mapping.h>* A$ P' X3 w, [2 S) U8 W1 K
  35.   {/ j8 s) x5 q; m! j
  36. #include <mach/memory.h>
    ! _+ l' q7 p- o, [9 V
  37. #include <mach/hardware.h>
    0 D! O+ s* n8 L* o
  38. #include <mach/irqs.h>: \3 O; ^4 T3 y
  39. #include <asm/hardware/edma.h>
    8 f% s# E3 q$ ^' s7 Z& J

  40. 7 L" s( O& L* N6 {
  41. #undef EDMA3_DEBUG! [* ^$ R2 G, e" I" _2 ~" w
  42. /*#define EDMA3_DEBUG*/
    1 w; [$ N0 C% {5 P& F6 ^
  43. 6 R1 l( A% m* V  \+ z- b) q  g
  44. #ifdef EDMA3_DEBUG
    $ H2 m7 t3 U- T. ?2 o# @. x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ s5 q$ u5 @8 Q+ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# F6 x3 I1 b8 D" z- N- O7 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ L4 D3 E3 N* w# b3 X7 O$ u
  48. #else
    , ^  R, w2 }; I( u# o
  49. #define DMA_PRINTK( x... )
    , \8 k2 [* G' h& K# h: }  [
  50. #define DMA_FN_IN
    0 o! E" C: w# k
  51. #define DMA_FN_OUT4 X3 B9 n7 K: e9 v
  52. #endif
    ; V: j. w. N. I  F( B
  53. $ S! X7 v6 M" f, _; p' V1 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 Q& C2 a' s, I( [' |% [9 j$ O6 L
  55. #define STATIC_SHIFT                32 E1 i0 {* S5 }' D
  56. #define TCINTEN_SHIFT               20
    ; g3 V- j5 p. D1 q
  57. #define ITCINTEN_SHIFT              21
    * ^) k( t3 Z  d% f" V6 @
  58. #define TCCHEN_SHIFT                22! b! x# [4 S2 V
  59. #define ITCCHEN_SHIFT               23
    ! P) _8 z3 A3 V7 s4 P/ @( ~
  60. 9 _5 [1 w1 f7 r" t
  61. static volatile int irqraised1 = 0;$ n& o! o. m  ^5 y: S% G
  62. static volatile int irqraised2 = 0;8 p2 o" n6 M& ^- z: [* Y2 o

  63. * s4 q0 }# h! ~) z0 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ o2 ~# G& P$ r3 h: E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) h- ]3 x$ `$ o0 L5 L% L2 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T6 j, y% X+ E; u" k9 `8 z6 Z6 E
  67. + Z& R1 [8 w$ h1 V1 a
  68. dma_addr_t dmaphyssrc1 = 0;
      {2 R% @% N  z2 b5 S& W
  69. dma_addr_t dmaphyssrc2 = 0;
    8 i- \, h) Z: |: F# q8 ]
  70. dma_addr_t dmaphysdest1 = 0;- ?" n. F3 O2 d5 [8 C
  71. dma_addr_t dmaphysdest2 = 0;9 U/ z3 _- K! @: E4 y1 Z

  72. % L* z6 j  `- k. l4 n
  73. char *dmabufsrc1 = NULL;
    ' ]0 J$ z7 @. p7 G" M
  74. char *dmabufsrc2 = NULL;4 J* Y+ H3 @5 f
  75. char *dmabufdest1 = NULL;% q) o. s; ~6 h) s! G1 C
  76. char *dmabufdest2 = NULL;, y! @7 S- J* B3 Z) Q0 Q- g: ~
  77. ) p. k+ E# f4 b9 u/ B+ s6 n
  78. static int acnt = 512;* \# m- s6 p& `
  79. static int bcnt = 8;  K1 y! ~" h1 Y' V  @( M
  80. static int ccnt = 8;6 f# M- c1 ~& R$ ]  t& E/ Z

  81. ; Z# L; _! ?5 q/ ?& |: s. p; D
  82. module_param(acnt, int, S_IRUGO);0 X5 M: f* y$ `& I2 S
  83. module_param(bcnt, int, S_IRUGO);9 h: H' |" |2 r7 L$ W' v6 }7 Z3 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 ?7 [4 o% j$ i
: h5 f, K5 Y# q, k9 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 |2 N' a5 Y: C! ]' }: H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" |" b5 u! [' y4 t! V/ b" [. l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 j2 @! q6 E% l4 U% z- v3 F
4 b9 M$ b- s( e' {5 U
! y5 \  K$ q3 U% U0 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-19 12:17 , Processed in 0.039937 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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