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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 U, c1 i, ~, h& ]$ U+ i
  1. [code]EDMA sample test application
    / {! O9 t8 `$ d" M# f9 u
  2. /*
      q8 A  v* I5 K" w1 I: w$ V1 ?
  3. * edma_test.c
    # t6 x' F: E) b& G' a/ ?
  4. *; x5 S2 ~% p- J: y- i0 F. w
  5. * brief  EDMA3 Test Application9 [" N  Z+ Y' `7 t# l0 O, U
  6. *
    $ l4 L$ _: K$ f: U9 r
  7. *   This file contains EDMA3 Test code.5 J/ y) V' j( d
  8. *  s0 \8 L# P+ T- C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, g- g1 ~) O( P/ c. A( A. S9 y) B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 Z- s- K8 P: G
  11. *         TO CHANGE.
    + |4 V4 l# X8 C
  12. *
    9 Q% _0 g8 p# t0 ^9 y9 f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 Y. z, ~. {5 @5 J
  14. *5 ?8 M, F+ d# w, f* U# \) H
  15. * This program is free software; you can redistribute it and/or) F& `9 e4 \4 S6 \) B+ O
  16. * modify it under the terms of the GNU General Public License as& |3 C! y7 c: `
  17. * published by the Free Software Foundation version 2.
    + Q8 J7 m9 q) V' ~6 }* b" K  M
  18. *
    # j, e8 s! {$ ~3 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ^4 w8 V# S: I' D* i: V
  20. * kind, whether express or implied; without even the implied warranty
      W4 Y3 F3 U+ X1 k3 U4 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 c$ k/ O( g/ O3 Z, K/ E4 p
  22. * GNU General Public License for more details.8 B  X, R! j& V3 z
  23. */
    % R- z! Y8 R# ^

  24. 6 F0 x( B7 F( c) c. X) h
  25. #include <linux/module.h>7 h+ M+ Z7 `+ r$ r& A. i1 j
  26. #include <linux/init.h>
    1 w8 ]( a4 x% ?# q
  27. #include <linux/errno.h>
    1 X5 N. s# @- p6 W) |
  28. #include <linux/types.h>4 \2 j5 D. X' G$ ]# \
  29. #include <linux/interrupt.h>1 O6 S- C. l' H5 V0 u
  30. #include <asm/io.h>
    9 z2 l; j+ @4 l' O2 N
  31. #include <linux/moduleparam.h>, ?' a% n+ J/ H, e, _' D
  32. #include <linux/sysctl.h>1 |. c8 ^1 G: d# Z
  33. #include <linux/mm.h>
    + D8 X; u7 |6 Q; i
  34. #include <linux/dma-mapping.h># @& t( X+ C- l+ {3 h
  35. & W8 ]' q% {" L- W% S/ s( n
  36. #include <mach/memory.h>
    - G  h* T" {9 }( u3 a( m0 a
  37. #include <mach/hardware.h>) ]7 `6 L0 R: D6 _9 r% W
  38. #include <mach/irqs.h>
    7 ]# `$ O- E5 G6 Q2 F6 E
  39. #include <asm/hardware/edma.h>
    2 E! T# X6 _5 _9 X. u
  40. & _$ ]+ ]5 a! u; R0 |( Z
  41. #undef EDMA3_DEBUG! g1 |- t4 {! Q. ?2 u. s) S5 l- ?
  42. /*#define EDMA3_DEBUG*/
    0 S! }8 Z4 {6 P$ L, Q3 u
  43. # L4 P/ u4 u, W# E
  44. #ifdef EDMA3_DEBUG& K" Y5 U2 D2 Q+ l/ J( u) a+ J2 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# z2 W: i' S: z' w8 i) \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 M5 K% {1 h0 q9 S# K% d+ J, z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 L8 }4 \. l- Q: Y  R9 f, w# t$ P
  48. #else* p+ R: \! G  @" _2 Z/ ~8 k& J, G
  49. #define DMA_PRINTK( x... )
    $ k9 R2 t: {( g! g* h% `, F
  50. #define DMA_FN_IN
    6 j$ B" I: E4 j: v
  51. #define DMA_FN_OUT
    / @1 y: x/ G1 j' z
  52. #endif5 {& S' s+ }, P+ a7 ?/ f: }. L

  53. ) B; S$ R: O. C9 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 f3 f6 [" s% {: `
  55. #define STATIC_SHIFT                3! l% S" D8 b6 n+ C3 b
  56. #define TCINTEN_SHIFT               20& ~. q3 d# Q% ~' L
  57. #define ITCINTEN_SHIFT              21
    2 V8 S% I0 K" G9 A* ~' @% d% a4 v
  58. #define TCCHEN_SHIFT                22
    2 Q$ p' M- L  B/ N
  59. #define ITCCHEN_SHIFT               23
    ! L# G$ _; d; v
  60. $ h, g/ Q# e1 }+ E1 V) z
  61. static volatile int irqraised1 = 0;" G/ X; i6 X4 x/ M8 z
  62. static volatile int irqraised2 = 0;; B8 O4 ^% v- e% \& w4 Y; D, N
  63. 8 z- B/ o2 Y- `8 f1 A' p& m# X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * t& F6 i2 c# L( r' u0 V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 V, E+ l- T0 ^# M* ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P. U6 b1 C4 d5 z/ N+ P  m& G5 ?

  67. : E: E4 V3 V# t+ S: Y1 k
  68. dma_addr_t dmaphyssrc1 = 0;
    # Y. I1 R; t  {6 O: p3 g# D* i
  69. dma_addr_t dmaphyssrc2 = 0;' r, X+ s7 U( s* D
  70. dma_addr_t dmaphysdest1 = 0;
    6 |8 y  q: D9 ?) `; Z) Z
  71. dma_addr_t dmaphysdest2 = 0;" ], x5 m0 Z6 p* `
  72. " i, ^& ~" _) k' g2 N; U
  73. char *dmabufsrc1 = NULL;
    - @* l( w+ ]$ F% b6 V* C
  74. char *dmabufsrc2 = NULL;
    0 B6 d3 q# p5 V
  75. char *dmabufdest1 = NULL;# @2 D) }6 E& a# M' ]" n
  76. char *dmabufdest2 = NULL;
    4 y, }& V1 u) d7 Z3 g

  77. 0 A  ]9 _6 w% }# t
  78. static int acnt = 512;
    ' N2 `4 E7 C! a7 S6 F; q1 W; T
  79. static int bcnt = 8;
    % Y; i! }" Z2 U5 G
  80. static int ccnt = 8;( D% V3 i0 H3 u! i6 w  V

  81. 9 B& c. N( D$ a; o) E
  82. module_param(acnt, int, S_IRUGO);
    . [0 T9 e& m, [, l
  83. module_param(bcnt, int, S_IRUGO);
    : ~* N) R0 |( L" X/ @) p: k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 K. z6 i$ h5 C6 ]( _, ]- y0 s, Q, p" [- |6 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, b, Y1 ~9 p$ i5 u7 R8 Q  b; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 c$ g2 r! v4 F4 ]4 E% _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% O; u& o7 `$ `9 @; v4 i( z5 ?, \) I* t. {- G8 ]4 K. d+ y
, i# C) k: m# M3 Y" }, r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 10:19 , Processed in 0.039582 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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