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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ E& ^  E$ \! w9 z, }5 Z
  1. [code]EDMA sample test application; _, I# }* d: r& a* ~/ G3 g
  2. /*1 m& j+ g7 W; w0 ?* R
  3. * edma_test.c
    / U" Z4 I1 ^1 n
  4. *
    3 _; z, i+ L6 _+ W9 f
  5. * brief  EDMA3 Test Application1 y2 L8 }/ a. D3 S* t6 b* t9 u
  6. *0 _, p8 D% u6 Z/ Z
  7. *   This file contains EDMA3 Test code.* |; u/ g$ o4 ~* r1 j% T
  8. *7 B6 h2 [" U* K' s1 T" o0 }; R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- X9 }* j' ^& ]9 y) B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ?$ |0 s3 E4 \  m. x
  11. *         TO CHANGE.; I' D; o. x0 B  p
  12. *, R1 \6 V) ]- e- Q2 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ _4 U- s9 u! f% A9 y) q* e' s
  14. *& R9 J* R7 u& I% b) u
  15. * This program is free software; you can redistribute it and/or
    5 g( e# N/ b9 P6 F
  16. * modify it under the terms of the GNU General Public License as8 [. X9 b; H1 _' v; [) p
  17. * published by the Free Software Foundation version 2.
    ) e& B5 J' o( `
  18. *
    $ L2 y2 |3 e  }( b, ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ I! E3 ~1 r; M. g2 f) n
  20. * kind, whether express or implied; without even the implied warranty
    " B5 ^$ s2 e2 ]6 v: p7 b. q* u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " y) L6 J' }8 p$ f8 I5 o
  22. * GNU General Public License for more details.& G9 Q, Y; e& G
  23. */
    - x/ i: z6 t  Y' X% ^# a

  24. ! t: m! O% o& |. k0 y+ b
  25. #include <linux/module.h>! S: p6 {- v  l: G, O& j$ a
  26. #include <linux/init.h>
    5 b% H0 }, }0 R. p
  27. #include <linux/errno.h>, u# d! d/ r* Z! z
  28. #include <linux/types.h>
    " y( `6 c' w. j' h9 q
  29. #include <linux/interrupt.h>
    , Q9 \' @9 J" u6 |, @0 o- z0 I. m* ]$ b
  30. #include <asm/io.h>
    - v3 Y! O7 G- M) C
  31. #include <linux/moduleparam.h>
    ! i6 `5 C, s. S9 _: ?& d! v
  32. #include <linux/sysctl.h>
    9 o( y6 X5 r  R
  33. #include <linux/mm.h>! w" `9 o* A8 ?
  34. #include <linux/dma-mapping.h>0 R8 U, f5 V7 [  ~( k/ }& ]: M- p; j
  35. ; @( J' K1 H. ~- h
  36. #include <mach/memory.h>
    4 Y# h) t4 j2 T# q
  37. #include <mach/hardware.h>2 K( V0 d+ w' Q, ~! L- l1 b  D: h
  38. #include <mach/irqs.h>
    % e" P4 U: r7 m+ y5 |3 V  x0 B
  39. #include <asm/hardware/edma.h>; R4 q( K) j- X, C. O+ T( E! R4 N
  40. ' m4 t; z% e. H: j$ V8 L2 K9 g
  41. #undef EDMA3_DEBUG! K' k4 F  c& U
  42. /*#define EDMA3_DEBUG*/2 G; p8 f9 M  I9 R

  43. 4 S5 F8 q: I7 y, n/ I
  44. #ifdef EDMA3_DEBUG  `, T1 u9 J) _1 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 t* g' @* m0 l& n: P. `# P- w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 R" G1 K" N0 }( R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 k) w& O! c3 V% }) {, v4 @
  48. #else
    ! U# ~' z- u1 s7 r4 z+ ~
  49. #define DMA_PRINTK( x... )
    - I7 Q% a( f/ x( U5 I, J2 E
  50. #define DMA_FN_IN
    + g6 ?# D* H! Y8 D7 {0 s2 F
  51. #define DMA_FN_OUT
    , y. {' o3 O  b+ J: Z% w5 y6 |
  52. #endif$ z. F, O, q  R+ i+ |9 q, l

  53. 7 [7 U4 ?+ O/ j5 L1 }6 ~1 v  a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ^. b* o* N9 D0 E  I! n' h
  55. #define STATIC_SHIFT                3
    6 t$ i1 X. V  H3 K) u- h, c# q
  56. #define TCINTEN_SHIFT               20+ n0 a; k6 U0 P
  57. #define ITCINTEN_SHIFT              21
    3 N, u) Z* L2 N
  58. #define TCCHEN_SHIFT                22/ r- [( X7 w8 g$ b
  59. #define ITCCHEN_SHIFT               23
    ' q7 {) j6 j4 q- {

  60. 7 x/ k" I4 e9 h/ `  [' R
  61. static volatile int irqraised1 = 0;# Y2 w/ D1 U! m- u5 v
  62. static volatile int irqraised2 = 0;5 Q. L/ u! z6 b' L  m' S
  63. ; M# A+ z& Y. W5 w7 z5 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G" n! `1 w" k) K' |6 d- e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 H$ w& Q0 p- h: n- W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _, m, _/ f, d

  67. ; o, _) b& y( r$ N3 J( x( ~
  68. dma_addr_t dmaphyssrc1 = 0;; F4 D3 e* W$ ^; D
  69. dma_addr_t dmaphyssrc2 = 0;
    4 R2 j+ J  K9 R, H/ L2 Z
  70. dma_addr_t dmaphysdest1 = 0;. T) K" @& u; z& v- D
  71. dma_addr_t dmaphysdest2 = 0;# @* k, |) \7 a( j5 y4 S4 S
  72. . b) C  P5 r  c+ W8 S$ `* @
  73. char *dmabufsrc1 = NULL;" S+ J1 a# Z4 F; o5 k. c# }1 v* A5 Z
  74. char *dmabufsrc2 = NULL;
    0 a0 f# N! i# j6 f" S
  75. char *dmabufdest1 = NULL;4 M% [' U8 I1 X( a( \' Z+ m
  76. char *dmabufdest2 = NULL;* y- J" e" Q& R2 s2 Z4 e8 [
  77. ; o0 U* I; _4 W7 ]' n* c
  78. static int acnt = 512;0 O/ w2 O* K2 u/ W  K# v- R
  79. static int bcnt = 8;5 U# ?+ L6 a  v
  80. static int ccnt = 8;
    ) P" d+ \7 T; I, P/ i& j
  81. 7 I; k" U/ N5 Y" ?1 c
  82. module_param(acnt, int, S_IRUGO);
    * J+ n+ T: {; d" e  T
  83. module_param(bcnt, int, S_IRUGO);
    : n) T7 G6 F+ C2 x! p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ M. m" ?& L( c( V$ E2 c

" _9 |9 K: P- M! y3 P# g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ J' V/ n" f* P, b' s' xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& }" V; x+ E# r8 F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. E7 M( q0 Y; o$ B% u9 D' ?# z/ s3 V2 ?

" d7 x5 j% S4 x8 ]# [  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 07:19 , Processed in 0.042228 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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