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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   r' Q" T& Z) P
  1. [code]EDMA sample test application8 D& A4 r+ t1 E9 b- [
  2. /*! m( r9 l5 [+ z
  3. * edma_test.c
    : h5 P9 }8 M4 M: C4 h
  4. *
    + h# t! Q5 a! y" Q6 l
  5. * brief  EDMA3 Test Application& j9 i- H5 s) t8 Z2 m
  6. *
    0 J1 V6 l7 I# s( j( @8 F6 ^7 B
  7. *   This file contains EDMA3 Test code.
    / z# P& }0 |% I( `: b% x* T  m9 b. p
  8. *  {+ z4 G( p4 W; k; }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( u5 Y. L" _) f- w. C3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / h7 C8 Z0 z$ B/ f2 u
  11. *         TO CHANGE.( g* T! r5 y7 |$ m: {2 [, T/ `
  12. *
    : R8 S* p: b/ i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , H* R) s# }. D
  14. *
    3 w4 D. d2 G4 A4 V: R
  15. * This program is free software; you can redistribute it and/or
    / O# I2 l& L6 J1 f0 q
  16. * modify it under the terms of the GNU General Public License as
    5 `2 f& A: [; T$ x0 o* x% l4 a8 @
  17. * published by the Free Software Foundation version 2.
    " B0 [9 e6 n. b4 [
  18. *3 J: l+ O. f' j4 C( t$ J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 r+ M) k4 X8 b7 X: g! T( K
  20. * kind, whether express or implied; without even the implied warranty9 l4 _) C' P: x. q5 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 D4 w5 `1 `% J6 w& d
  22. * GNU General Public License for more details.
    9 U0 n& j5 Q% U* Q% x" y
  23. */
    8 ?* C- v4 W! X8 E! L

  24. 5 k+ D  @" A% |# O
  25. #include <linux/module.h>
    $ Z, N4 h7 o: v
  26. #include <linux/init.h>1 W/ E& b* @/ K: T6 G
  27. #include <linux/errno.h>
    ! g0 l/ ^+ [# g! _2 e, T$ v: _
  28. #include <linux/types.h>
    5 ~& q' N! Z. C( _
  29. #include <linux/interrupt.h>
    7 r0 Q/ K5 r# @) I* K! p# ?, W
  30. #include <asm/io.h>
    9 U  c5 V& a1 G" J* v5 F
  31. #include <linux/moduleparam.h>( V9 r- v+ y7 G( H* l: w; z
  32. #include <linux/sysctl.h>
    & o! X- N  E9 V1 t9 p
  33. #include <linux/mm.h>  t) C1 z( |- z
  34. #include <linux/dma-mapping.h>( f7 P$ _# d! \0 S
  35. % I# @! A6 b0 w
  36. #include <mach/memory.h>! ~+ @& _* ?7 C! @! X
  37. #include <mach/hardware.h>
    6 X) R% u" w0 ^, `( }+ I$ x! K
  38. #include <mach/irqs.h>
    4 D8 J3 Y: V0 C- I5 H/ h9 A2 Q
  39. #include <asm/hardware/edma.h>5 R, Z+ x2 L, `/ P3 i
  40. ' {( S8 V  @# l. e4 S
  41. #undef EDMA3_DEBUG
    + e9 ?& R, t! {! b  O
  42. /*#define EDMA3_DEBUG*/% W' {" I2 z5 t% Y2 R
  43. & |7 ]) x# ^) Z9 k
  44. #ifdef EDMA3_DEBUG# b7 a5 L) c) k1 x, I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 J7 r. I: i7 G, }$ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 n/ i2 g, l. c- d# V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 ~2 O3 \: w$ ]
  48. #else- l' C( {  z8 v2 L  Z
  49. #define DMA_PRINTK( x... )
    6 D1 w' O3 s' F4 i  c, d- @. j
  50. #define DMA_FN_IN8 ]  d* K5 e1 u2 z- L* R% i
  51. #define DMA_FN_OUT
      `1 O& r  g( |
  52. #endif
    " _7 H& J- ~% k& C+ h; Y. g4 Q6 }
  53. 0 l: k  M% `0 e/ A+ V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 x; V( f" c" ^- g& x
  55. #define STATIC_SHIFT                3
    & ]# y* K$ k, R+ \1 H3 p
  56. #define TCINTEN_SHIFT               20
    1 b; B8 M- [) Z! m# D! Y, S
  57. #define ITCINTEN_SHIFT              219 q9 K/ d4 S. Y1 _: n$ N
  58. #define TCCHEN_SHIFT                22: f2 ^* C5 @: W1 z8 u. c0 o; d) m
  59. #define ITCCHEN_SHIFT               23& |7 O0 m; S# ^8 c' ^
  60. . y7 i$ t$ p  {
  61. static volatile int irqraised1 = 0;& I" w7 i+ A; N* h8 p' Y5 C2 @
  62. static volatile int irqraised2 = 0;# x, g* g, m4 g0 m

  63. + g0 h1 ^. t2 ?3 [9 s+ {4 i- F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 S. Y" m% w: G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# M9 L& j- o, K; K% b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {3 w- v/ ~* S* U) q6 w; r# L/ y
  67. , s  a- \) `! F5 E
  68. dma_addr_t dmaphyssrc1 = 0;
    # o! r; \- V  {
  69. dma_addr_t dmaphyssrc2 = 0;
    7 G5 p- R7 I( p+ t" ~8 P$ R
  70. dma_addr_t dmaphysdest1 = 0;0 k$ @, p+ S& L
  71. dma_addr_t dmaphysdest2 = 0;
    # @( d7 ^% b7 ?

  72. $ @, c# p  |) ?. x6 P
  73. char *dmabufsrc1 = NULL;# {$ B7 Z3 b+ n2 R! ~$ \$ }
  74. char *dmabufsrc2 = NULL;9 ~' q: B  z  j9 y0 s
  75. char *dmabufdest1 = NULL;' P. h. i& R9 y7 Z: ]6 Q8 c# A: G
  76. char *dmabufdest2 = NULL;4 O5 Z5 B# l) ~  \
  77. . a+ m! G8 a1 {* Q$ F
  78. static int acnt = 512;8 ]: y7 Q6 ~  i# S2 P# H4 Q2 ?
  79. static int bcnt = 8;
    ; B/ D6 {6 L( u* p
  80. static int ccnt = 8;
    2 |+ _6 J" A& ?+ }) k/ Q
  81. # {4 X/ w. W( a0 J: r; H8 U
  82. module_param(acnt, int, S_IRUGO);
    6 W7 \3 p; X; T7 M
  83. module_param(bcnt, int, S_IRUGO);3 A- K1 s  ?/ f9 e% P& p% ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 Y8 n) a0 c: x" i8 V5 Y/ ~
) R* C3 ^5 q" y( h0 P( i- C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- V( G, g6 b4 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" F8 P2 o, ~, D4 c& \$ j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) t9 F. w" S% ?9 N0 g& H# Y5 P$ V# y' F& c+ @& k" O! P. m

1 I! K6 n" Y1 K4 s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 07:23 , Processed in 0.038104 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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