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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , \0 z1 O3 K' @8 P% U3 I
  1. [code]EDMA sample test application0 W, ^- u, f( O) {
  2. /*
    2 H) {- [0 f  f3 r& P8 p$ K
  3. * edma_test.c$ S' i# r- b' e" V1 A
  4. *  {. y- ~/ r4 l0 D) H, u
  5. * brief  EDMA3 Test Application6 _. ~7 Q+ ]4 t  u0 W. p" `
  6. *7 a, x$ q) p: v
  7. *   This file contains EDMA3 Test code.9 v0 i$ L$ ^2 F# P. w  d
  8. *! w4 d; r1 }7 |" j9 w5 g% Q3 W' t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 Y4 U8 Q0 q- u' T4 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 M. i) l7 J8 E3 t
  11. *         TO CHANGE.
    ( ~6 z- F/ e3 k$ ?
  12. *9 w8 `" W8 X! I# D; M8 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 n; X5 b. D& U( S
  14. *1 q- o: \, z9 N# A, h* D. k9 t
  15. * This program is free software; you can redistribute it and/or
    6 a0 d; t, F7 w" w% k, t) U+ a
  16. * modify it under the terms of the GNU General Public License as
    % J  [; U& y3 X/ `/ Z" s' p
  17. * published by the Free Software Foundation version 2.. a1 p( I* Z, [( C# ]+ ]
  18. *
    : P4 G8 S8 w# w$ N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, o- u' h4 _0 M7 I( @
  20. * kind, whether express or implied; without even the implied warranty- w; i1 @: W0 I# L9 s& e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! Y. x& t0 i4 h4 Y' B! B, s
  22. * GNU General Public License for more details./ u' s: x7 D: h5 s& g8 e
  23. */8 z- d/ B0 L! x! b8 }

  24.   `7 y0 N6 F  f& ?. X- H( g# @
  25. #include <linux/module.h>
    % W% e4 P* D+ q! Y5 E0 S/ `
  26. #include <linux/init.h>
    ' g2 |7 z% A( F, A* N7 y
  27. #include <linux/errno.h>
    & E: r3 p. m3 k7 m
  28. #include <linux/types.h>. F7 C8 w" p$ G0 h2 C) M4 W
  29. #include <linux/interrupt.h>2 @' G- j. P1 @( R7 T. c: ]) _8 q
  30. #include <asm/io.h>
    : g: h' @: ~$ n$ g9 L
  31. #include <linux/moduleparam.h>
    ) d( \  Q- n9 J- v. h9 V
  32. #include <linux/sysctl.h>
    ) K' N5 ]: d6 ?! f4 Y
  33. #include <linux/mm.h>2 `7 ?/ f% L8 V  m
  34. #include <linux/dma-mapping.h># S% o3 N" W& \4 P
  35. 5 c/ Q$ ^& g! D: u
  36. #include <mach/memory.h>9 x9 p# C- `! }; z, g5 f, y
  37. #include <mach/hardware.h>' K5 l; _/ x" `6 j' _& X1 A$ V
  38. #include <mach/irqs.h>4 A- z) j0 M' W, Y7 c4 X% v3 ]
  39. #include <asm/hardware/edma.h>1 H( E( p+ Y5 R( L0 x! y) U

  40. - o5 i2 |5 L& z# R( A- ?1 \
  41. #undef EDMA3_DEBUG
    4 q2 N' p5 x6 P4 M% w: k
  42. /*#define EDMA3_DEBUG*/
    . v2 @  i( O" Y

  43. / P6 m0 k& M2 h  _/ @+ U
  44. #ifdef EDMA3_DEBUG
    $ @1 ?& A) \8 T. R, j3 R0 K7 ?$ `2 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! C9 F+ L9 ^/ u* d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 h2 X2 J% U% \7 H. y: k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 A% z$ h$ ~+ E- q& x( F
  48. #else
    " K  U0 C$ @6 e
  49. #define DMA_PRINTK( x... )- E# Z  R: b- D. }. J5 `
  50. #define DMA_FN_IN0 P3 P% H4 I' @9 z
  51. #define DMA_FN_OUT7 ?: I) {6 C7 _7 }% e4 g
  52. #endif
      h! B- @! P5 e6 i6 D  S. b

  53. ) ~7 Q( Y0 V6 w; C9 Y% \+ N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 ], r, e' p% @, g- u
  55. #define STATIC_SHIFT                3. ?$ w, d! n3 Q* d- W! n% u
  56. #define TCINTEN_SHIFT               20
    4 w" z* V$ x9 ^* D& R
  57. #define ITCINTEN_SHIFT              21
    & c& H; C! n# d# i
  58. #define TCCHEN_SHIFT                220 e$ _' r9 |4 w. F" {2 R- x) c
  59. #define ITCCHEN_SHIFT               23
    - b% ?# f2 Z+ L7 c0 U! h5 _4 T9 E
  60. / N0 E' T0 e) ^
  61. static volatile int irqraised1 = 0;5 D% B8 Q4 F0 }8 W- H
  62. static volatile int irqraised2 = 0;, W$ {0 z1 A  ]+ H5 P+ a4 u

  63. 5 |9 {0 b6 t3 y" }1 a3 ?4 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 J  X9 a) _3 r1 ~& Z! N7 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]0 X9 n4 d  L& N& P5 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s" {( v+ ]" r( f( s5 L4 `0 z
  67. ( v2 a/ d5 s3 p+ S8 d
  68. dma_addr_t dmaphyssrc1 = 0;8 j/ X3 H- D# J
  69. dma_addr_t dmaphyssrc2 = 0;3 \) }3 v% c) p8 e& {
  70. dma_addr_t dmaphysdest1 = 0;
      [- C! ]+ l- u
  71. dma_addr_t dmaphysdest2 = 0;
    ; |1 f( U& J9 ~9 P8 e
  72. , i2 l; A! U" S0 s& m5 M, P( @
  73. char *dmabufsrc1 = NULL;
    ! N* b* v) k0 g2 c6 f! v0 p
  74. char *dmabufsrc2 = NULL;: a% z- t) Y$ E# O
  75. char *dmabufdest1 = NULL;
    ; e- n. g7 J# @9 {, b- k* }
  76. char *dmabufdest2 = NULL;/ g+ G" s% G& _# b/ L
  77. + l/ U5 |4 ?' M: ?5 I7 |
  78. static int acnt = 512;9 k" W" [' j2 [1 L
  79. static int bcnt = 8;2 X; c9 X! ~! `4 k, ^# A
  80. static int ccnt = 8;
    ( n4 m! S' n5 v8 e9 V
  81. & B. l( c4 G" ~6 q8 F8 X
  82. module_param(acnt, int, S_IRUGO);1 {7 t7 g# h9 X2 ~) b9 h" Q9 \
  83. module_param(bcnt, int, S_IRUGO);
    / ]8 N1 y" ^3 m9 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 c/ J# D8 E; ~! \+ l$ x

' {2 d2 G9 a' |' b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* e' X- G5 O  K4 Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- p( N$ X' P9 l% d" S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' z- i2 F( K* e* E& I6 f7 x& c: x8 ]& [

& t: U( D/ u% F4 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 23:19 , Processed in 0.038335 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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