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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& s# ^7 i2 S# n- J  y) u4 {
  1. [code]EDMA sample test application- l& q5 G5 ~, g: r+ S% x) [" p% z
  2. /*
    & g( b8 _0 i8 U% f1 \
  3. * edma_test.c
    ' B* `8 q. @+ {. w- Y# b
  4. *
    . b& O4 U& K' b2 x
  5. * brief  EDMA3 Test Application/ i3 s0 T6 G4 u; T
  6. *3 U! [  w; _% T/ r6 Y5 W
  7. *   This file contains EDMA3 Test code.2 b( {% ]! @+ ]4 h" U
  8. *4 o: l: u' L" R; B0 ]3 Y! g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 d: j/ ^5 D- G% g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & [. {" y9 |3 i, `& [9 p! t' s6 K' f
  11. *         TO CHANGE.
    # K* m& ^  X0 m2 D+ {) V7 ^6 f
  12. *) y4 A7 E- Y$ h7 n" |* c* ^! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      G( B! k$ H( T
  14. ** c4 G( G" }3 Z7 E- n
  15. * This program is free software; you can redistribute it and/or
    ! I$ c" {2 p+ V- b* A: \3 M
  16. * modify it under the terms of the GNU General Public License as
    0 O$ E9 c0 O, p1 n5 U3 X3 Y' O% l
  17. * published by the Free Software Foundation version 2.
    " d0 j% N* w- r
  18. *
    8 N: G3 Q" y5 V  N" b# x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      x5 g$ l+ S; H
  20. * kind, whether express or implied; without even the implied warranty
    ; ]# H; p! \  p/ E' d  _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , @& j* l1 N. G8 t$ A9 ?9 ]
  22. * GNU General Public License for more details.7 F$ O; k4 ?& z* E$ A
  23. */) ^$ `# n6 N( |

  24. : U' ?# L9 n: s8 |. S
  25. #include <linux/module.h>
    # K. d& `2 ?, H. z7 C
  26. #include <linux/init.h>
    $ I8 L  b4 K5 [* S0 n8 \2 q
  27. #include <linux/errno.h>
    . S( B: u+ F' }& u% ^' ?5 l+ j
  28. #include <linux/types.h>+ W4 f/ ^9 a: ^7 Z9 g3 S
  29. #include <linux/interrupt.h>1 G# O4 o2 ]9 q" B2 |
  30. #include <asm/io.h>' b# D8 r; M6 ?  j
  31. #include <linux/moduleparam.h>
    4 R9 ?7 n0 \1 a. O2 {* L. D& n
  32. #include <linux/sysctl.h>4 S. s0 A- B/ U9 q$ a0 q
  33. #include <linux/mm.h>
    2 z/ k: [! _# G, t7 `
  34. #include <linux/dma-mapping.h>6 h* m# D3 F- `$ }$ P# Y1 L5 C2 H( R
  35. 8 y& i$ E* t4 H/ z! _) u) R
  36. #include <mach/memory.h>
    ( T' @; `! g# @1 k1 T; K
  37. #include <mach/hardware.h>2 k. _8 E8 x, t; Q
  38. #include <mach/irqs.h>: e* ?( c+ p4 m, k- `
  39. #include <asm/hardware/edma.h>1 A5 k& V% R% u# l! j% Q7 d/ g( p7 ~

  40. 4 b4 S: [0 v- V4 p8 F8 u6 t. S
  41. #undef EDMA3_DEBUG
    * ~7 ?5 H( S! @7 t6 h
  42. /*#define EDMA3_DEBUG*/; H$ |# z, K& x. X

  43. ' X; G. e/ F; L
  44. #ifdef EDMA3_DEBUG
    ! m4 U0 j" c- n/ n0 T  T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      R& ^0 j: |" M( S% h  m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): ^; U1 N( x/ o* B: C: I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * c! q! H5 G. a
  48. #else/ g$ u+ f0 w, ~
  49. #define DMA_PRINTK( x... )
    + y+ \; M1 M( a/ t
  50. #define DMA_FN_IN: r, F! _, Q) [4 |
  51. #define DMA_FN_OUT/ b/ g$ X, ^8 z$ s
  52. #endif" v" V- h8 V3 E2 ?9 j: I' L
  53. 2 y( y4 X5 K; F+ Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 j. V! }& N% P: H- L1 U
  55. #define STATIC_SHIFT                3
    2 v( S4 y' {+ s) M
  56. #define TCINTEN_SHIFT               20* N& \# J" _# x( m
  57. #define ITCINTEN_SHIFT              21
    ! @! m7 i- a5 ^
  58. #define TCCHEN_SHIFT                22% t7 T( ~9 q  D' ?
  59. #define ITCCHEN_SHIFT               23
    ( f6 r& e: z' o$ M+ X; J- o: |

  60. - q: w" E, T; h0 `& ^; n
  61. static volatile int irqraised1 = 0;
    3 ?) i% r  C6 B+ O2 ?1 v! A
  62. static volatile int irqraised2 = 0;3 v; \6 S& ^! m- Q
  63. ' S- S: y1 E& o1 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; y% }3 N! w+ d; ?+ C+ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* Y  U2 p0 r; z: E/ j+ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . K( ^6 t1 j) O- {7 W; G6 X( }- g! R

  67. 4 z, l, ?( p" ]  R" R- T
  68. dma_addr_t dmaphyssrc1 = 0;
    , Y9 F5 S9 j  o/ Q
  69. dma_addr_t dmaphyssrc2 = 0;. C$ ^( H. Y, x2 Y$ {
  70. dma_addr_t dmaphysdest1 = 0;
    : ^! K! t1 ~  m
  71. dma_addr_t dmaphysdest2 = 0;. _5 C1 D3 t7 s) K
  72. 0 c$ A" p3 m8 u/ b+ j
  73. char *dmabufsrc1 = NULL;
    * C4 L3 W) F$ ?7 \7 N7 _' Q
  74. char *dmabufsrc2 = NULL;, C4 I& |: R( I5 ]. a5 _
  75. char *dmabufdest1 = NULL;
    - c- ?4 [' z$ s4 U
  76. char *dmabufdest2 = NULL;
    . B  B8 `1 j4 q) |9 D! T  q

  77. $ U8 Y, e4 `7 B$ B
  78. static int acnt = 512;
    . u+ B; W! y" t9 z! u6 u8 q2 t
  79. static int bcnt = 8;
    & N5 O# E2 Q' H; ^2 V$ U4 j
  80. static int ccnt = 8;
    / E2 }7 u/ N6 o; P0 o, z
  81. 9 Z5 v* h5 d- ]* v5 j1 u
  82. module_param(acnt, int, S_IRUGO);: w- ]7 t5 R# I# ~! w( J
  83. module_param(bcnt, int, S_IRUGO);- S6 [6 J& }$ W1 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 o7 K% ~5 Z0 t2 V- E7 b' A' d7 {% z2 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 P# p2 @" B5 t5 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& h" F# g5 M& H  p$ ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% N8 k# f4 X# G- T4 [) ~
3 v: f1 h* P" ^* o9 z4 J; S# `: d4 H: z  h0 q3 J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-21 00:30 , Processed in 0.044592 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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