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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ?4 l/ u+ S6 l, {1 y- Y
  1. [code]EDMA sample test application  B8 b8 M9 A4 Y9 X5 ]- [# x# n5 o
  2. /*! m. {* B# X8 h/ t
  3. * edma_test.c* u9 l. a6 H1 }
  4. *) j7 N* R, d$ P% F
  5. * brief  EDMA3 Test Application  _9 g) |/ a, b
  6. *
    + Z" Q( n7 y6 i+ _
  7. *   This file contains EDMA3 Test code.
    9 G; I) e# @, k7 ]6 w/ Y
  8. *
    ; V4 @; j0 w( X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % U2 m9 c0 ?* ^5 m* v5 B/ J$ y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, B/ t6 L' Y5 t3 v9 p
  11. *         TO CHANGE.
    : G3 v. [: D! M
  12. ** _7 |/ l' u# c% C* H( V4 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . {2 ~( B2 }) u7 u
  14. *5 Q0 d% L. I% C' x
  15. * This program is free software; you can redistribute it and/or& ^* {& [/ h  K0 V
  16. * modify it under the terms of the GNU General Public License as
      G1 @" q1 A; U( B
  17. * published by the Free Software Foundation version 2.
    ( h. O  b  ~4 E  g
  18. *
    + Y. y9 L2 ]" E$ W2 Q4 ~2 Q8 P9 y! Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : W) B( s- H. N+ \. I+ o; J
  20. * kind, whether express or implied; without even the implied warranty% N, k0 F' S; l- o, {4 f! s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / X6 i" X4 H1 N5 d
  22. * GNU General Public License for more details.
    & Q1 E6 c5 Y6 V" t
  23. */
    + o) ^! C' K% j& f* L

  24. - U& K5 Y. R& v4 Y
  25. #include <linux/module.h>" t) [" Y: r  |: e$ W
  26. #include <linux/init.h>
    * D: n  }- H1 x: g4 D' Q7 X# o# N
  27. #include <linux/errno.h>
    ! S! h7 r7 V: U; ]" ?
  28. #include <linux/types.h>
    6 j, W# ^. w2 i8 c
  29. #include <linux/interrupt.h>
    8 k* m; ?/ D4 |( q6 U6 W5 l
  30. #include <asm/io.h>
    * h6 p, y+ D3 ~; s' a) _
  31. #include <linux/moduleparam.h>8 y4 p; Q; z' }1 T; L; n4 z
  32. #include <linux/sysctl.h>
    4 q: ?4 O6 q# c2 A; A2 z. {& q1 C
  33. #include <linux/mm.h>
    1 ^/ z4 _$ V# P5 C! s
  34. #include <linux/dma-mapping.h>- ?/ X9 B1 s% B4 U. W2 U

  35. 6 J4 K; f# g0 P& Y- K1 I: A
  36. #include <mach/memory.h>
    # s3 T9 R$ J: v, O1 E( I4 V2 u
  37. #include <mach/hardware.h>  v1 ]5 Y! t/ j0 ~
  38. #include <mach/irqs.h>4 j( G" G6 {+ W
  39. #include <asm/hardware/edma.h>
    5 a) ^  i, G1 m/ J" ^7 A

  40. 9 h* m: L8 P. g% H: U( x
  41. #undef EDMA3_DEBUG
    2 k% o4 A8 v7 d
  42. /*#define EDMA3_DEBUG*/
    ! j+ W) r! h# P/ |3 Z' S( X* c6 j
  43. ) f! W( \6 @, [; k$ N: m
  44. #ifdef EDMA3_DEBUG
    : o2 @8 e& d6 v) t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; ^) k/ [# E4 o" K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / `; Y" V1 z& s2 ]3 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ^3 E1 J& J+ Q0 z
  48. #else
    0 O" f( c4 D% ]8 ?' e
  49. #define DMA_PRINTK( x... )* g- y9 d) W$ h
  50. #define DMA_FN_IN4 a& |- \/ n3 k# o  c$ y4 B8 U
  51. #define DMA_FN_OUT
    % l' m2 L, E+ N, d4 |+ Y5 y
  52. #endif
    4 j  h4 {# ^1 n1 W. [" b. Z8 a
  53. - }# |- ^. M1 c$ d  A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " Y' Y( ^0 W4 I9 c* }3 f
  55. #define STATIC_SHIFT                3) a8 q8 Q4 B$ x4 k* O
  56. #define TCINTEN_SHIFT               20
    % e1 X* S- [: ^- e$ ^! f: K
  57. #define ITCINTEN_SHIFT              21
    ; H+ u0 q7 _( ~/ ]' T+ b
  58. #define TCCHEN_SHIFT                22
    2 d" N! h% K  J. o3 q: s
  59. #define ITCCHEN_SHIFT               23, j! {5 f2 Y# z
  60. + R7 V( A% T9 i* T+ \( v
  61. static volatile int irqraised1 = 0;  v1 ^0 `( I! y4 h
  62. static volatile int irqraised2 = 0;3 D  k6 n! J: a& C! B6 q' A' r4 @
  63. 1 E: X! C" p, ^1 F4 r# W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: O4 Z# m; x5 o' ]0 K  u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! K0 z4 D: `$ ?% q, Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: A$ h5 c/ j! S

  67. - q: Y8 E% ]0 l  q* w$ C# ~8 {
  68. dma_addr_t dmaphyssrc1 = 0;8 a, P! K$ ~+ N6 @, ^
  69. dma_addr_t dmaphyssrc2 = 0;
    2 s# s5 ^" m1 _8 |+ k' Y
  70. dma_addr_t dmaphysdest1 = 0;4 ^& F( N7 F/ s
  71. dma_addr_t dmaphysdest2 = 0;
    # X7 b5 K3 O" a9 u- H. F
  72. 8 [5 j! @4 G5 l- B. P. @
  73. char *dmabufsrc1 = NULL;( {$ J  y$ H: Q' X  D( B: [6 e, a6 R
  74. char *dmabufsrc2 = NULL;
    4 ^8 A: ~5 t, z* P/ t
  75. char *dmabufdest1 = NULL;
    / L4 N+ C& ~0 C: i, v$ w& L
  76. char *dmabufdest2 = NULL;
    - J9 P; D5 j& m: i

  77. : H1 P# x) k) c$ @
  78. static int acnt = 512;
    " ?; Z5 C+ _5 E& U5 ~
  79. static int bcnt = 8;
    1 [6 t3 f3 K& L- K) K
  80. static int ccnt = 8;
    * m4 I! J- x" Q& G! [  s

  81. 4 W  Y" P; F+ \) b4 t  `; [, A
  82. module_param(acnt, int, S_IRUGO);
    - H9 M1 H+ S. b& l
  83. module_param(bcnt, int, S_IRUGO);; O2 R1 X7 w: C: l8 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 V$ W/ c' W8 W" ]4 _0 }0 S; @
* d+ [6 |: c: ]! V' T! Q! P% X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) J4 N- Q9 n  n2 h4 k* p9 n4 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ l& E. S) t' U% T  \- {$ s2 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 u, c  J. c) ^# ~
6 ?* [/ G4 U7 `2 Y

# ^+ q8 U- M2 Y' e  }: @, ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 14:13 , Processed in 0.040239 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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