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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" f4 ~& I( c( b: |) }9 l$ ]) Q
  1. [code]EDMA sample test application
    ' u3 g6 a/ h+ S  A: K
  2. /*
    ; g3 v0 I* g* D3 }8 u
  3. * edma_test.c
    # P/ l8 y# K2 m* z4 D6 o& l
  4. */ F! a+ A* y; q
  5. * brief  EDMA3 Test Application/ o" w8 n, C) [! F3 p' e
  6. *7 n0 U, l& U0 j; ^9 i
  7. *   This file contains EDMA3 Test code.
    6 C0 s& f  {. e) @8 x; z
  8. *
    7 q0 x7 ~1 E( @# C+ U, L8 x* I+ L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# d5 l( v+ G* A/ F" S9 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 ]$ \  ]& w$ ~( c3 X5 m( h9 h
  11. *         TO CHANGE.+ U; \8 x' F7 d( ^
  12. *
    & e* _1 _2 C) {) [2 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 W3 A; H) a4 b* v4 z7 t4 h
  14. *8 ]0 O' b7 Q. t2 s# P
  15. * This program is free software; you can redistribute it and/or* T% @9 ?7 @8 b3 l2 W
  16. * modify it under the terms of the GNU General Public License as% P$ {7 K' h/ g/ m5 o& a  A5 E3 b
  17. * published by the Free Software Foundation version 2.; E% ?! Y' G+ J  \
  18. *
    $ ~$ o' u2 ^+ A& I2 C9 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Y( v- l  c( F( I/ M
  20. * kind, whether express or implied; without even the implied warranty
    & V8 h5 |. x/ v4 |# ?7 D1 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 {5 N7 V, Y) x/ S, ]& y; e
  22. * GNU General Public License for more details.& t& J" z: ~& R' ^
  23. *// A( t1 l' v: t; P
  24. 2 V3 j! p" P3 u9 m" E
  25. #include <linux/module.h>) h1 i% b3 ?9 D% }) J
  26. #include <linux/init.h>
    . m9 y& ^! J- e, ]8 m; }) U
  27. #include <linux/errno.h>8 F6 f7 N# g5 s) ]6 N8 g: y; g& J+ H2 Q
  28. #include <linux/types.h>, I/ d* F( \7 f3 M
  29. #include <linux/interrupt.h>1 O5 I+ ^4 p8 v1 O; n, E* f
  30. #include <asm/io.h>
    : w: Z' q: t7 b2 E( O& f
  31. #include <linux/moduleparam.h>
    : p  e8 r$ ^7 O! ], ?6 W
  32. #include <linux/sysctl.h>7 R, J! w3 T: ?9 h; X4 f0 o, w% H
  33. #include <linux/mm.h>
    ( R9 e9 E3 |* |* x5 ^+ P  }
  34. #include <linux/dma-mapping.h>
    + q$ J) L+ I9 L! T

  35. ' s, q5 f% `9 X* I8 @
  36. #include <mach/memory.h>
    2 }) W4 T4 Q) z# Q! }8 Y
  37. #include <mach/hardware.h>- A6 m$ Y& r& Q' O7 V, r: t
  38. #include <mach/irqs.h>
    $ [( k8 X. H% I0 u) W6 F) u
  39. #include <asm/hardware/edma.h>& E2 m( k5 U( y

  40. 0 w, t9 n0 |  c  S
  41. #undef EDMA3_DEBUG
    $ F, q1 _2 I3 R% m
  42. /*#define EDMA3_DEBUG*/1 ^! m1 Q% {( `

  43. ! N' D$ a1 V" r$ v1 z4 @% s; G2 ?
  44. #ifdef EDMA3_DEBUG. l" w3 e( `# F" {+ C0 T* }' @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), ^  E( t: p' @) C9 p3 a" U# }9 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " B+ R- ~2 q! f) P- x( v& H1 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; o8 L1 f$ P+ {3 R" V3 O" Y7 c
  48. #else0 e6 g  ?0 N$ ~0 P9 L5 Q
  49. #define DMA_PRINTK( x... )& R% I: Z) F! r7 s; `+ M
  50. #define DMA_FN_IN1 {3 G9 y: ?9 m$ q
  51. #define DMA_FN_OUT9 R# z8 e7 e. ]: W
  52. #endif
    & W" \( E4 q8 R# H2 Y  t9 O

  53. , Z$ U. B# x9 N9 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 ?' v  s. @/ X( Q, j
  55. #define STATIC_SHIFT                3! d. W# E2 P) l
  56. #define TCINTEN_SHIFT               20
    . J) D. P& S7 N% }) q; s
  57. #define ITCINTEN_SHIFT              21
    # x: m" @" ?( j
  58. #define TCCHEN_SHIFT                22
    8 d9 J; v% I  x5 \2 \
  59. #define ITCCHEN_SHIFT               23
    $ F( L5 E/ m. W9 o+ o
  60. . l% U" \# z: n( }
  61. static volatile int irqraised1 = 0;
    / d9 o. f% l+ F
  62. static volatile int irqraised2 = 0;" M5 H, t3 p, v& ~% a- D# }

  63. ' Y  H4 E4 s* |* A' ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# K% n. Q8 t( r$ |" H1 j/ g9 ~5 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " F  o( l6 q1 \5 i; w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , O' h. Q8 g9 @+ g1 _

  67. 4 J' h+ f* N$ a- R! \
  68. dma_addr_t dmaphyssrc1 = 0;! M; c0 N7 c8 {2 S3 I
  69. dma_addr_t dmaphyssrc2 = 0;
    * y8 ^3 W: M- E! i4 b0 [( s
  70. dma_addr_t dmaphysdest1 = 0;- `- }- j! g! c, G5 L
  71. dma_addr_t dmaphysdest2 = 0;6 e, E: y% F7 c! {! K( h$ d2 Q

  72. 7 S! Y6 N1 H, m; B5 M
  73. char *dmabufsrc1 = NULL;" {3 p0 E  H- |/ u" y* ?
  74. char *dmabufsrc2 = NULL;
    : }8 C" \$ z/ {
  75. char *dmabufdest1 = NULL;3 [* j- j- Y! l( _. {
  76. char *dmabufdest2 = NULL;
    6 \# c8 S' i; l) C& E$ w

  77. 7 ]; l- e' ^5 ]; X6 X
  78. static int acnt = 512;
    ( n$ S# F! _  n4 S
  79. static int bcnt = 8;
    4 `' V' M2 z. V. C: D4 a" b
  80. static int ccnt = 8;. j2 u( Y: t" w5 o/ h9 m" h
  81. & L# A7 r% N9 a) J; @" p+ \
  82. module_param(acnt, int, S_IRUGO);
    * |5 V' \4 r: O1 X0 c) K
  83. module_param(bcnt, int, S_IRUGO);  ?. K4 m& b# I7 N2 f  q7 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  l% Q+ D1 d- Y
: \6 K7 W& v% k+ N" l! J# ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' F- n6 h4 ]& Y: O8 [$ t4 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) i( `/ Y: k' m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( R" N) A/ D. J2 ~" `0 o" L" ]9 h6 h% ~

! l, L0 S4 S  `; e: A9 e% N7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 08:10 , Processed in 0.039141 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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