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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 s3 g) U; [, R/ Q" v. l
  1. [code]EDMA sample test application
    " [0 r" T4 x$ X$ c8 s! ~4 \
  2. /*0 |3 A* l1 J& C1 f. h1 ?
  3. * edma_test.c2 l7 }6 w3 @! N$ L
  4. *
    - J4 `% M4 c: ~. d3 V. [
  5. * brief  EDMA3 Test Application% Y; j* q$ t) B2 D: V6 E9 K' Y7 G
  6. *
    / A' G& d0 w: o$ P
  7. *   This file contains EDMA3 Test code.+ ?0 l# ~* N8 r8 i$ h  i6 }
  8. *( e, g' u$ `+ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ?3 M5 H6 X! r) h0 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ n# u/ J+ C$ H4 c$ g4 R
  11. *         TO CHANGE.3 h- a; h  q- q; h/ A
  12. *1 P2 ]$ M1 w+ }# [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 y2 W4 Z8 N4 B+ p2 q
  14. *
    0 J" M; |- C1 D
  15. * This program is free software; you can redistribute it and/or+ ?0 i. n9 L7 i- w
  16. * modify it under the terms of the GNU General Public License as* U7 ^, g8 l7 F1 _2 u% W4 O
  17. * published by the Free Software Foundation version 2.
    2 E/ ]) z, x8 b6 s' Z5 ~) |
  18. *3 {) x$ _$ r# }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- L) Z' O4 r$ ^1 g+ j4 W
  20. * kind, whether express or implied; without even the implied warranty# J  g2 K( Q2 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( v! i# K6 b% P, i
  22. * GNU General Public License for more details.5 V  ^, O) K9 G0 q: H& J. U& h6 l
  23. */
    * i) O+ m% v; g. w8 ?# V/ ?/ V

  24. ) d( f6 _, Q* I. M0 |$ D
  25. #include <linux/module.h>6 M. h" G5 {! _! F9 a/ |: u6 y  }1 {
  26. #include <linux/init.h>- x3 Y9 X. a/ f+ K/ z# i2 [) r3 Z
  27. #include <linux/errno.h>
    # M' \$ J( s6 A. {! u( @# r
  28. #include <linux/types.h>. Q: d5 Q8 R$ V! o  _% q: V
  29. #include <linux/interrupt.h>
    8 d- L4 G- C! S4 K# l+ e% Q
  30. #include <asm/io.h>
    9 y# b( i+ ?6 z% T% Q: {6 e- W
  31. #include <linux/moduleparam.h>
    ) o' T' u0 B: B
  32. #include <linux/sysctl.h>8 [  _( U; z5 y2 A& g
  33. #include <linux/mm.h>
    + y* _. @( @9 G: D- Q8 S; x8 X
  34. #include <linux/dma-mapping.h>
    ( p6 f* d' h8 g9 a

  35. - y) J) u$ ]. H. r1 x0 i6 W, f
  36. #include <mach/memory.h>
    ) F2 G, b: M' ]$ B) Y
  37. #include <mach/hardware.h>7 Q: {" H0 M9 m
  38. #include <mach/irqs.h>
    : O( i8 w" o7 K- r- a% w
  39. #include <asm/hardware/edma.h>+ V) V' O4 L. O8 p
  40. 6 p, W) i2 F( ^3 e3 F
  41. #undef EDMA3_DEBUG
    / t+ N- ?! F6 G! }# f
  42. /*#define EDMA3_DEBUG*/
    . Q+ l; K$ r+ y: p
  43. 4 G! `+ {+ }! w6 v+ `
  44. #ifdef EDMA3_DEBUG
    ; o0 Q! q* A) f& R9 J: T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 S2 \) t# F  {- R) ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & X+ t! c, [; p( L1 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ Y8 y( O: S4 s% S- a, V
  48. #else, W$ N; P" U8 d* F# J$ N7 m& d
  49. #define DMA_PRINTK( x... )
    + ?! L5 _- g5 n
  50. #define DMA_FN_IN
      V% `' }$ I, q4 \% a4 R
  51. #define DMA_FN_OUT- @" _% r% s! q: S
  52. #endif$ C( Z& |7 m( s* g2 v
  53. - F8 Z: v. I- [/ e, V7 e8 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 P  A* B3 O- d7 x
  55. #define STATIC_SHIFT                3
    5 r  E0 ?: m7 w1 j
  56. #define TCINTEN_SHIFT               20
    8 f; n/ T- \* ?* C
  57. #define ITCINTEN_SHIFT              21
    " d) g: J0 [; Y; x: ^, j# H! |
  58. #define TCCHEN_SHIFT                22: B' \  W; O; {1 ?7 r
  59. #define ITCCHEN_SHIFT               23
    5 O" l) U* b% U' R

  60. : R: @% t& ~& {; o$ l' ]! G, c
  61. static volatile int irqraised1 = 0;% `: A+ q; z& x% j
  62. static volatile int irqraised2 = 0;
    / y' W2 R) `4 p) P* A. }+ ~

  63. / E, O7 a4 ?# T' E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" \2 R8 H) C8 f/ q+ m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N0 \' _0 Q; C- n4 j9 t( `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% r& v) b9 q6 H# L+ J+ O& O
  67. 6 t( l9 E$ ~5 Z0 D( V3 ^' D* W
  68. dma_addr_t dmaphyssrc1 = 0;
    5 T8 n. o  C3 v) T* m! J0 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    ) L# Z( w8 U1 k/ Y  Z9 j$ G
  70. dma_addr_t dmaphysdest1 = 0;& ^0 u  P! K$ a8 e4 t
  71. dma_addr_t dmaphysdest2 = 0;
    : A( ~5 b3 H+ D- q3 a$ Y, |
  72. 8 q8 |9 h" _3 P+ |8 Z
  73. char *dmabufsrc1 = NULL;
      U+ @) a" }9 u  q
  74. char *dmabufsrc2 = NULL;
    " ^( W2 ~' Y& R( h: R- @
  75. char *dmabufdest1 = NULL;# R; ?( K" p& l1 s* X" o1 r
  76. char *dmabufdest2 = NULL;
    * z9 g% {3 ^' s

  77. " }- Q0 u6 K* d7 L
  78. static int acnt = 512;
    9 Z' e% l2 r! U) g3 p
  79. static int bcnt = 8;2 w4 {: U" R7 t$ L* ]! m2 j
  80. static int ccnt = 8;# ?# R! O% w7 Y3 W* n- C) v

  81. " E7 p% Q% {- H* Y+ U6 q+ _
  82. module_param(acnt, int, S_IRUGO);
    : L" k1 ?/ s# f7 o6 Z+ v+ T2 k4 [
  83. module_param(bcnt, int, S_IRUGO);
    2 O5 V5 {: V) U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 j( Y% l9 {2 G  j- n, l; P6 L! V7 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' q  l9 q! @; u/ h, h
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% Q. F9 w2 A& }6 A/ b0 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# J5 E0 f8 |4 @. Q+ }' X% {  N1 j% C0 L# P" f
/ |9 u% o* @1 `+ Y2 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 19:39 , Processed in 0.044875 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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