OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % |+ n% h' p. F2 k/ H
  1. [code]EDMA sample test application# C  P! _1 s* V5 |9 Q; j
  2. /*
    # ?6 J% D& ~3 e
  3. * edma_test.c
    ( b% f7 R5 T% a) i/ u* _* _/ v, s6 l
  4. *7 u9 V9 H# ?5 x1 G9 y$ h* T& D
  5. * brief  EDMA3 Test Application
    $ \& C3 T" S4 e; x' W) O7 i
  6. *
    & f+ G. t6 x9 @, L6 D
  7. *   This file contains EDMA3 Test code.
    & V. E( o1 ]* \8 O4 I. h8 Q/ ]
  8. *# @- h0 F: q  b0 }3 ~6 n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ]! z! ^/ @" T: Z2 B7 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . c( i% C) ^$ ^* X$ G/ E0 t
  11. *         TO CHANGE.  L- ?6 y( A" t2 z
  12. *
    , r' \$ I$ z: G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & A8 i* M6 f/ ~
  14. *5 x& D% a6 [; G4 n* s& K
  15. * This program is free software; you can redistribute it and/or0 D9 q& m. z) _4 [% Q" j2 G) z( g
  16. * modify it under the terms of the GNU General Public License as, U! j5 W) R; Q: f% I
  17. * published by the Free Software Foundation version 2.5 {" {1 ~3 h6 |' Z" X
  18. *  s# x4 f$ L9 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 V7 j' A+ N' F8 t& Y; U9 M: q+ J
  20. * kind, whether express or implied; without even the implied warranty& v& M" B1 O% y2 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, c+ j' U; J6 @- d% k. ]
  22. * GNU General Public License for more details.# a* h1 U- E/ ]1 _  U) n: N  s' D) R
  23. */
    7 N- Q# g- \( j8 p, D! c( w, {& M( @

  24. / G: {; O" [9 j: s
  25. #include <linux/module.h>' e8 T: W" s7 h! t8 G. W
  26. #include <linux/init.h>
    * l7 C6 B0 n# c/ v3 N
  27. #include <linux/errno.h>
    7 C2 B$ Y  o. o& p/ u% o
  28. #include <linux/types.h>: k, p0 N( s5 X1 s4 z( g
  29. #include <linux/interrupt.h>/ `& v6 }) ], Z9 Y- ^" S2 g5 q
  30. #include <asm/io.h>
      C: Y/ ~) L0 l( R& ?
  31. #include <linux/moduleparam.h>
    ! }: u, q+ r* \% N1 C. T' N
  32. #include <linux/sysctl.h>; h, `8 W) E2 `7 d$ H
  33. #include <linux/mm.h>
    ; O5 K$ H* t3 f8 M  P! D
  34. #include <linux/dma-mapping.h>
    5 t- @3 ?- i4 P5 q3 [
  35. # U# f2 f8 t( H7 I! U3 u8 l: Q7 F" N
  36. #include <mach/memory.h>
    7 d  ~+ u  m# h" N  E# n- k
  37. #include <mach/hardware.h>' _, |) U' k+ r! z
  38. #include <mach/irqs.h>
    4 J9 o% j' m; }/ Z5 T7 g) i! _$ @' J
  39. #include <asm/hardware/edma.h>' V! G1 t+ I( v* W. s6 ]
  40. # u5 ]+ B) m# z
  41. #undef EDMA3_DEBUG
    0 q3 Y. P0 Q0 d3 y& Z
  42. /*#define EDMA3_DEBUG*/! Q/ ~6 a6 I, @9 i( a% U( s

  43. * {$ ?/ Z# F5 H( z, G
  44. #ifdef EDMA3_DEBUG4 E4 r& |* v# K) W5 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& T5 e, w# `0 p8 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) O6 c" k$ W5 c) V; F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 A0 V" C, ]+ }& M6 `
  48. #else
    7 X" y: |- W# v4 V
  49. #define DMA_PRINTK( x... )
    : m8 \! R( Y3 C; l2 f, H
  50. #define DMA_FN_IN
    - ~8 g$ ]3 ~) o6 e% d3 G& ^8 H3 z5 S6 U
  51. #define DMA_FN_OUT
    6 I5 s8 w# _5 A# r/ d
  52. #endif
    . R4 @. E" `8 X. A& e' g7 }( t& E* [

  53. $ O- |5 t: K6 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 j; G  ^% ]& O  p6 K. A* k! f
  55. #define STATIC_SHIFT                3! O2 C1 A; t7 T/ S7 L
  56. #define TCINTEN_SHIFT               20
    . i" c  a* U( {& ^" b% v* r2 s7 N
  57. #define ITCINTEN_SHIFT              21
    , D& e8 V% M% f
  58. #define TCCHEN_SHIFT                229 u4 e/ I  ~! {6 t
  59. #define ITCCHEN_SHIFT               230 }! u& f7 x0 k8 Z/ N, s

  60. $ @6 g& S9 j+ I# Z& M# \9 x3 W
  61. static volatile int irqraised1 = 0;
    ! K2 G" M) \7 H* i, b
  62. static volatile int irqraised2 = 0;
    # j0 f7 F2 C1 h, l5 B

  63. 7 T$ D, L2 b$ @+ @8 R/ Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 \# s5 @* ~, O. v5 |7 R0 T' h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ V+ V- B3 M! v  A- B  }! t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% I6 }, j  B7 J: n( P% t
  67.   }' {; \; I" k1 @9 @
  68. dma_addr_t dmaphyssrc1 = 0;
    8 j8 q$ ^1 O+ l; h/ ^6 S& a9 i
  69. dma_addr_t dmaphyssrc2 = 0;
    , j5 [( ^# Z" }
  70. dma_addr_t dmaphysdest1 = 0;) Y0 V/ x- A9 b& x' U" A
  71. dma_addr_t dmaphysdest2 = 0;' u  I% C8 F8 x3 P& I

  72. 3 I4 o( _, H# ?
  73. char *dmabufsrc1 = NULL;. q3 s+ ?1 s% c, `! q
  74. char *dmabufsrc2 = NULL;  _" a( i. `, D; ]8 r4 f
  75. char *dmabufdest1 = NULL;
      m+ y# ^$ ]- o
  76. char *dmabufdest2 = NULL;
    4 g/ W, I8 m4 T: @
  77. ! k2 x- s7 q' ?( M) ?& N! K/ j
  78. static int acnt = 512;% @/ f" F& N" r& E2 p' d6 e  t
  79. static int bcnt = 8;( j# p! @3 O/ A# _: \5 e* I, R
  80. static int ccnt = 8;2 X& ?0 R$ p1 h  K6 R

  81. * p- i* M6 k" w6 S
  82. module_param(acnt, int, S_IRUGO);
    $ Q& v7 ]: P6 h
  83. module_param(bcnt, int, S_IRUGO);
    5 }! _2 c- l; A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# @5 c$ P# T. `; B
5 b. b+ o' u$ N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( c' E0 F. }+ e. U% Z( |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; W& r2 \4 Z% r0 S$ \* G! b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 |: N$ D2 l7 ]( g) f

% V! V# W+ L4 V- D2 M, r/ G2 p
' n7 u( {4 z7 S# Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 02:55 , Processed in 0.038035 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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