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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 U, W/ P$ R) k0 |7 |
  1. [code]EDMA sample test application4 t. |- c9 W$ F# I  R' p% k
  2. /*
    4 l- ^- s; i* v$ I& y/ G  x
  3. * edma_test.c8 v5 j. {, ]" n( m7 ]+ H
  4. *
    9 r9 x% S! Q# ]$ C9 f' C
  5. * brief  EDMA3 Test Application" V# S- `8 f( O# c) d0 @
  6. *; e/ g) ?" A: `  n" n
  7. *   This file contains EDMA3 Test code.
    6 Y& C* C- ~/ J) {$ t! v5 \
  8. *
    8 G* b0 l  m$ Q: }% J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& e& j& F, r3 ]2 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " i$ a- L0 y" \: F5 X) L# }
  11. *         TO CHANGE.
    2 \5 w2 I0 @4 M
  12. *
    ; J- J5 m% I; q3 J, p% T$ W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ w0 p3 h" D9 m% p/ v4 r2 g, m& [
  14. *7 R2 Z( c2 O! S: H. M3 ^* ?9 L
  15. * This program is free software; you can redistribute it and/or
    : v2 m7 n8 H6 f9 M/ e" ]
  16. * modify it under the terms of the GNU General Public License as) H, F: e: |  p# g
  17. * published by the Free Software Foundation version 2.( ]+ t& l. B3 k2 l! W7 }& c
  18. *' w  w, k  u: l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 H) d( ~! D$ A3 Q
  20. * kind, whether express or implied; without even the implied warranty! x2 T; J3 g* h! m! [% _8 p* U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 i8 m" D$ h  p1 v
  22. * GNU General Public License for more details.- U! d# ]% U1 r) Z4 f6 D5 ^, G
  23. */
    9 s  X  C0 |9 y# L

  24. / Q7 C) B0 o" i9 @
  25. #include <linux/module.h>
    : P* n4 H1 S, E. T
  26. #include <linux/init.h>
    - j  R0 {. u! A
  27. #include <linux/errno.h>
    / S# r2 c) M8 j3 t
  28. #include <linux/types.h>! P. F) }- \* W3 z
  29. #include <linux/interrupt.h>" y7 C0 x" j1 a5 Y' |
  30. #include <asm/io.h>
    9 f9 p( T  w' s1 o( n
  31. #include <linux/moduleparam.h>
    9 N' P" b$ r2 q! x) Y- ^+ F
  32. #include <linux/sysctl.h>5 q0 M7 P2 G2 t" U* Q0 o* r
  33. #include <linux/mm.h>! ]% p# F4 O0 r7 f9 _
  34. #include <linux/dma-mapping.h>
    6 t/ @/ C. V+ D% \
  35. # l. p2 l$ J( v) `
  36. #include <mach/memory.h>+ [6 O: E& B( q0 L
  37. #include <mach/hardware.h>
    ( U, Q# z) x! n. C0 j. \
  38. #include <mach/irqs.h>
    5 k- Z: y2 K* E% s" _* n# N. |6 i
  39. #include <asm/hardware/edma.h>) N/ p# |8 c) @1 c: _

  40. ' A" ]9 p+ P5 O! y$ N  g! C
  41. #undef EDMA3_DEBUG
    ' o  @& f2 q/ S. v. }1 N/ T+ o" r
  42. /*#define EDMA3_DEBUG*/6 d3 U# B1 e. k1 o; P. B
  43. - g7 f! D; c. l' V
  44. #ifdef EDMA3_DEBUG
    ) @+ G& J* x5 Q: O9 T9 s. L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 X1 Q% Z5 L+ J- v, k& {1 ^/ r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 w- j; h% c0 l' G0 h) [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % X- j0 R6 _# |/ Z5 o" B/ w, [
  48. #else2 H  `( }, B1 N( }
  49. #define DMA_PRINTK( x... )% p# ?" [" j4 Z+ O5 o3 N
  50. #define DMA_FN_IN  T1 F9 U5 I! k3 \. X1 c9 x5 w% e$ \
  51. #define DMA_FN_OUT
    8 ]# o! ^) Z% k
  52. #endif5 [. x  P% O4 D$ Q* e& d' M6 N& [

  53. # b/ d7 F" Q+ [2 B0 ]& b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * D% q! b* `, i8 u5 L* G7 Z* E
  55. #define STATIC_SHIFT                30 o3 ^; e8 W1 y7 Z; f$ L: _4 B# Q
  56. #define TCINTEN_SHIFT               206 o7 O& X4 a7 ~6 `
  57. #define ITCINTEN_SHIFT              213 h* L, ]3 X" _( V" z
  58. #define TCCHEN_SHIFT                22
    9 _; x. w5 H, h! y
  59. #define ITCCHEN_SHIFT               23
    : ~' a& }) T7 M7 t7 R$ E
  60. , P' c' b  U4 b
  61. static volatile int irqraised1 = 0;- I7 n: D- r4 s+ O0 U
  62. static volatile int irqraised2 = 0;: A, u+ |% w& `& q' C8 ]: _5 c
  63. ) }" n6 u6 Y' A( n. U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Y8 L& K  ~) B. y4 I0 {" c# }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ]2 c% Z( E/ u& U& V7 b6 [# C7 E* _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 u7 t& q7 l! T& V

  67. 0 t( z, U# H( u+ I
  68. dma_addr_t dmaphyssrc1 = 0;
    - S& ~( W6 k7 b
  69. dma_addr_t dmaphyssrc2 = 0;
    % o2 T( q0 G$ n! }/ h
  70. dma_addr_t dmaphysdest1 = 0;
    0 b+ H! o0 V' o6 I+ ^' J
  71. dma_addr_t dmaphysdest2 = 0;. J3 e3 r& s3 M6 ]

  72. 9 B& N4 R# [, |) P! `6 [3 B5 a
  73. char *dmabufsrc1 = NULL;
    $ p. l; l, p+ k: j4 l* u% d
  74. char *dmabufsrc2 = NULL;
    8 [2 S: ^5 x: d' g& Z# T
  75. char *dmabufdest1 = NULL;
    4 t& }* b5 E% ?- `+ T( _3 r- |
  76. char *dmabufdest2 = NULL;
    2 B+ @3 z% @# J2 D5 `2 |

  77. : |( M* i& x/ A9 q, Z+ Q' T9 k
  78. static int acnt = 512;
    # L3 N) [! i2 r# W
  79. static int bcnt = 8;" D; `" m0 E5 O- q, \+ H7 |# M
  80. static int ccnt = 8;" y0 j7 ]* S  R  i7 ^6 V, V. R
  81. * }2 ^) z: C; ?5 z) a: W) a
  82. module_param(acnt, int, S_IRUGO);. Q- Z3 U4 L# W7 I3 I
  83. module_param(bcnt, int, S_IRUGO);
    2 V! i. V* q3 b# m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" ]' G, n* m* J+ l/ R' H- |8 c' t' d0 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y' W8 b8 M+ ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 v3 u. z. b6 I  i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 |2 A- y$ B1 j
; Y  d- k/ {% g7 ?

+ f5 A0 `3 d8 F: g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 16:49 , Processed in 0.040904 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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