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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 M$ G' T1 y" r
  1. [code]EDMA sample test application
    1 Y  U& ?8 p, @
  2. /*
    * Z! |) T. v4 @  D
  3. * edma_test.c' h, E: e2 t, i7 x. K2 n7 N" G6 z
  4. *) @) r, ~/ c' V5 b! v
  5. * brief  EDMA3 Test Application
    6 O5 }" l2 w! c
  6. *) g# V( N# W8 Q; [" f5 G1 v
  7. *   This file contains EDMA3 Test code./ g7 `4 m3 I+ w3 q/ Y7 V7 J  E
  8. *
    4 G- i$ W( J2 f/ E7 P' c3 F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- O3 T8 E9 @# j. d" Y; [7 ]! g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * }6 @9 U3 \- I# z
  11. *         TO CHANGE.
    7 E& d1 k+ F7 V- n
  12. *6 L7 \1 x9 Y6 J3 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 H: A  O9 U  L. [
  14. *; @& z* r6 y- d
  15. * This program is free software; you can redistribute it and/or
    7 B0 f0 i1 I2 `% n, N0 _
  16. * modify it under the terms of the GNU General Public License as
    + h. r6 K& \9 X8 v! W
  17. * published by the Free Software Foundation version 2.
    : u* R  L  D4 ]; t8 {( L' `
  18. *- t$ X1 D( j$ _3 ]8 K0 _+ A. J( B& B; L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 c$ r& W! P$ j; E. m; U$ N# `
  20. * kind, whether express or implied; without even the implied warranty
    + l7 _$ h5 b- ]# ]* d* Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 p8 E0 O; b* H" v; c8 u
  22. * GNU General Public License for more details.
    , _" W- \0 T* U
  23. */* L* c) ?8 ]4 T: W1 ?
  24. " `1 M2 c7 {( Y( @1 W; u
  25. #include <linux/module.h>- g& n2 D. a. c. T* U
  26. #include <linux/init.h>
      F" U5 \1 H$ N# Y0 s+ w3 X
  27. #include <linux/errno.h>
    ( a" r+ A5 f3 n6 y5 J
  28. #include <linux/types.h>
    : m6 Z2 D, h4 d) ?
  29. #include <linux/interrupt.h>
    . v6 E$ _0 M0 {# ^0 A7 _
  30. #include <asm/io.h>5 G3 y4 x* e0 a$ U9 \
  31. #include <linux/moduleparam.h>, u; n6 S$ B) ^4 y3 k8 Y
  32. #include <linux/sysctl.h>
    0 @" o* C8 {! K) V
  33. #include <linux/mm.h>
    : @/ j; T+ `8 n4 w- h
  34. #include <linux/dma-mapping.h>
      D* G" D5 o8 R& x8 D/ v
  35. 4 I9 l$ o# l3 s* @/ {2 o
  36. #include <mach/memory.h>
    . |) A% M; q7 E2 g. H3 h& x5 d/ c
  37. #include <mach/hardware.h>
    $ M+ ?! F  M( M8 d3 X: [6 g% a
  38. #include <mach/irqs.h>
    4 |4 \/ Z3 |  V5 b2 M& ~$ o& V
  39. #include <asm/hardware/edma.h>
    / Y. x( x. r! ]

  40. : k- A8 n3 G; W; T( U# L& ~1 Y
  41. #undef EDMA3_DEBUG
    & ^/ E6 ]' K4 F9 N. U" W8 k
  42. /*#define EDMA3_DEBUG*/
    5 l" Y3 C& N6 ]( T8 K7 o

  43. 1 P+ C( g4 [! t- h7 Y- w8 i: _
  44. #ifdef EDMA3_DEBUG- r. b; N  }' ~4 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ K. @0 v$ }( s" _: t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % {* V- w% ?% r0 R! Y! V+ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Z+ |  [4 y+ W' F
  48. #else9 i! z5 k: Q; s; l- {1 a* {7 Q9 c, h
  49. #define DMA_PRINTK( x... )
    - m! K8 k. N! P
  50. #define DMA_FN_IN
    6 g6 x  o: C+ X5 J  Y
  51. #define DMA_FN_OUT
    " o$ H! [6 _! z( [
  52. #endif( c  r) u, t6 f! R
  53. / b% q; y  D; p$ ]" A9 |% \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 ^0 I' |8 o' Q2 v  e
  55. #define STATIC_SHIFT                3
    6 {2 r7 Z/ h; N# d3 C
  56. #define TCINTEN_SHIFT               20
    0 P; u7 K( z9 R
  57. #define ITCINTEN_SHIFT              210 r/ h+ f$ A% X8 \+ H: Y
  58. #define TCCHEN_SHIFT                22
    1 d: {$ b0 `  p3 L
  59. #define ITCCHEN_SHIFT               23
    : ^% @/ ?: X2 B/ Q' H
  60. ( ?7 B7 H0 \3 K& Q
  61. static volatile int irqraised1 = 0;6 X8 J2 x5 {) ]& y5 o
  62. static volatile int irqraised2 = 0;3 W' t% t4 c0 h2 h' y. u4 [
  63. " V2 L# Z5 M- D, `9 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# `# W+ I# s: K' u5 H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 i+ `* K+ h6 v( l2 t4 t- ^! Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 i& x  d' s8 E% [2 S
  67. / L7 @  w3 }2 P' _, ]
  68. dma_addr_t dmaphyssrc1 = 0;: u9 i" Z1 {0 L& `
  69. dma_addr_t dmaphyssrc2 = 0;- }, n+ Y6 K9 m# n+ n9 b
  70. dma_addr_t dmaphysdest1 = 0;( \5 l1 R0 D1 g% p' m2 ]. A' a
  71. dma_addr_t dmaphysdest2 = 0;5 X# q) C2 y2 a$ E1 U  x! P/ c

  72. 3 c3 j' g) W! o$ Z7 A, l
  73. char *dmabufsrc1 = NULL;' }* F/ @! M$ H0 p$ W  S3 z' I
  74. char *dmabufsrc2 = NULL;
    # G8 n( Y' c9 S2 Q8 o! j4 [- q
  75. char *dmabufdest1 = NULL;+ L9 d" J% ]! X
  76. char *dmabufdest2 = NULL;
    , P( x+ O- \, ?4 x) ~( }- h8 I: H
  77. 1 d$ Y% A6 P4 H5 _
  78. static int acnt = 512;3 ^7 A5 z# r8 o5 `: i. g- h
  79. static int bcnt = 8;8 S5 L4 A' e! z0 l3 b2 V
  80. static int ccnt = 8;) l* y$ u. G7 Z% k
  81. * o% v; O  Y  ]6 R( O: G
  82. module_param(acnt, int, S_IRUGO);
    6 m9 X  @/ [" b+ J) c" ?# d
  83. module_param(bcnt, int, S_IRUGO);3 ~$ f: p1 Q/ F7 ]: l( {2 D% d; t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 i3 ^% s% h$ @/ k; _
0 |) a0 X" z$ Q4 [) \/ s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 g# T) m; c7 y/ C0 n1 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ b: n, `* m9 w& I6 U0 y* R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) l- Y. S! I' B& v1 Q3 d) j
9 `9 g0 Y! T0 K, w3 [: ]* E

$ S# @; B3 P  w; s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 05:20 , Processed in 0.045833 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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