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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 \2 A, N! N) \" I1 v) g" I9 q
  1. [code]EDMA sample test application
    ! ]# \/ f& ~5 R8 d% d
  2. /*
    2 m) E: \# y$ T* ^
  3. * edma_test.c  c$ s) }( e) }
  4. *- j2 L* l1 o* a5 Q! b
  5. * brief  EDMA3 Test Application
    / m6 `  x! J  _- V
  6. *" j+ c6 _& w" C2 ?0 S
  7. *   This file contains EDMA3 Test code.
    0 b4 N# @! k+ Z& n" N: x; D6 k( v$ N
  8. *
    4 K  G0 ^5 U8 {0 \$ G  w+ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 H6 T( D" j* |# I7 |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 P! W/ Y* J! ?' X, r
  11. *         TO CHANGE.$ _4 O& v2 F0 x. G9 N
  12. *
    % \2 p/ `, {0 l" l5 P4 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( L1 k' o  V9 t# a/ W
  14. *
    6 m% k1 b* u* E
  15. * This program is free software; you can redistribute it and/or
    . A7 [+ M) Z. l+ G
  16. * modify it under the terms of the GNU General Public License as" ?1 p" V( R3 d8 [7 |
  17. * published by the Free Software Foundation version 2.
    ' h6 D: ?9 N8 Y4 E2 v
  18. *; @- J* q/ `$ n" J( B3 i* L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 d! K& B7 @. x6 _4 D
  20. * kind, whether express or implied; without even the implied warranty
    0 p" h: ?$ n/ d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : {4 q4 o5 g) U8 }
  22. * GNU General Public License for more details.5 j8 h- w4 q1 Y
  23. */# U! ]# _0 m0 q- b

  24. % y% _1 e2 i( d4 M# }
  25. #include <linux/module.h>
    % Q! `' J( N1 j; u1 x6 k5 N: V5 X, q
  26. #include <linux/init.h>
      r& ?2 g, q0 G5 _0 I: K# F
  27. #include <linux/errno.h>6 M6 `2 ~+ Z/ S- l. m' b
  28. #include <linux/types.h>
    8 c0 o% v8 f7 M
  29. #include <linux/interrupt.h>
    9 ^# {# j6 Y; O+ ^5 N! X
  30. #include <asm/io.h>
    9 v: z8 d  a6 Q# G
  31. #include <linux/moduleparam.h>
    % E; l& m+ h! I, Z+ o
  32. #include <linux/sysctl.h>: x( y9 M' @4 i: O, a3 Q* U9 l
  33. #include <linux/mm.h>3 G3 o9 I0 e2 j4 R1 j
  34. #include <linux/dma-mapping.h>3 w# b7 P' ?% O9 H! f' M% V
  35. $ _# q0 g- t  l! z. y9 F+ O7 A
  36. #include <mach/memory.h>! @! x$ A  \* L3 l$ [, x0 r# z1 I; s
  37. #include <mach/hardware.h>
    3 a  b3 g0 `# e3 x9 s7 o" I: v$ U" s
  38. #include <mach/irqs.h>( |2 O& k* i. B3 e. N: M0 L( L6 j
  39. #include <asm/hardware/edma.h>
    7 I5 x- M& ?& g& b7 v
  40. & @" ^, a2 K9 o$ m1 Y5 x
  41. #undef EDMA3_DEBUG
    " ^! n6 @/ K0 x& ~! Y. E
  42. /*#define EDMA3_DEBUG*/% Q8 W+ H" s8 f: x# D

  43. 0 i5 u  O3 S7 {8 {, v; y) B
  44. #ifdef EDMA3_DEBUG0 j9 ]4 @1 V+ C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / T% ]" u" z6 `+ W# R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 x7 |+ D+ t0 C7 w6 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 {" h. q; |& @/ P( g
  48. #else
    1 p) G" D$ `1 c
  49. #define DMA_PRINTK( x... )' ?' d& k, m7 b" {! ~
  50. #define DMA_FN_IN
    " Z& D) G& B! G, a  l6 @6 ~
  51. #define DMA_FN_OUT% E2 n3 R- Z2 J
  52. #endif
    ) w+ ^1 X. h4 Z. ]. _$ Z2 h

  53. 0 F. c" p# P' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : g: K* T2 D, ^- J) p: w
  55. #define STATIC_SHIFT                38 F& e# f- _9 w, y8 i5 Y8 h1 M
  56. #define TCINTEN_SHIFT               20
    , B1 x$ G4 Q: n: {* \2 M
  57. #define ITCINTEN_SHIFT              21
    ( K. }0 o' ]2 W. M- H
  58. #define TCCHEN_SHIFT                22
    2 m. S9 t0 y3 U( _- J3 N8 w; T
  59. #define ITCCHEN_SHIFT               23* T# D% N8 M9 v3 B& S# B- p& x

  60. ) Y& B# U9 H- K( P# p
  61. static volatile int irqraised1 = 0;0 W; O# c) z4 F$ `+ o
  62. static volatile int irqraised2 = 0;, v7 q0 E- L- T2 C+ R* ^. k7 ]' q

  63. $ }% L# Y8 A! U" y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N/ \" Q" b2 H( \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , v& `5 A( @, H9 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J! f; Z" y& X# h1 j; \% w$ C
  67. & J3 Y' g' y. F: I0 `  f
  68. dma_addr_t dmaphyssrc1 = 0;! y9 k) k: H  S, o% _
  69. dma_addr_t dmaphyssrc2 = 0;
    # R* y' j7 C2 f1 g
  70. dma_addr_t dmaphysdest1 = 0;
    4 a% o9 v6 V2 s
  71. dma_addr_t dmaphysdest2 = 0;5 W2 P6 R/ {0 Y
  72. " P9 Q" q# y" V4 W9 S9 a1 F9 m* v% p
  73. char *dmabufsrc1 = NULL;, A% R6 h) W" f" I- s
  74. char *dmabufsrc2 = NULL;
    + P- C) w2 w% m
  75. char *dmabufdest1 = NULL;6 v5 l+ e0 \' Y8 K0 S
  76. char *dmabufdest2 = NULL;+ ~! d( _- K' E, h: J
  77. " j9 K9 Z# L' F' J- c
  78. static int acnt = 512;
    " ~, R6 L! Y6 B
  79. static int bcnt = 8;
    1 t( o7 J) m8 y
  80. static int ccnt = 8;2 g# S, G$ t% P/ }! l! A
  81. * ~3 ^. T; q- ~, y9 n, f/ x, \5 H
  82. module_param(acnt, int, S_IRUGO);
    ( R& k* t2 Z5 N, S' L0 F8 b/ A8 h
  83. module_param(bcnt, int, S_IRUGO);
    * i2 _4 k/ J$ @% B6 a5 c; h* K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 U3 z! f: j( s( b# _- S

& i8 \4 J( n! A8 J: r8 {3 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 M: I: v5 I4 H5 P; e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ R$ u8 p8 K! U) J- D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* m  u: o/ X+ l( ?
* Y( q$ f' D0 t5 x+ F2 W) q8 h, W8 |
) W; }9 M$ p* k4 I3 l% l6 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 09:42 , Processed in 0.041223 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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