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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 o% _, M2 H5 }6 E* u/ X
  1. [code]EDMA sample test application# P: S" ~9 l/ F+ o* B5 U" x% \) A3 l
  2. /*
    * V9 x: z* v1 y4 \# b9 N5 r7 A9 y
  3. * edma_test.c
    6 j7 n* f5 K- {: [3 [8 J
  4. *
    + t' s4 b7 f- o2 k7 Y: M! O1 P
  5. * brief  EDMA3 Test Application! d3 ^( z+ t  W$ C" ^. W
  6. *! x/ S3 H% |3 F+ F
  7. *   This file contains EDMA3 Test code.
    6 x) ^( A4 d% X5 J* A+ h9 j
  8. *
    ! f: M& ~' W+ x8 _% g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 U- H( |6 Q$ U/ u, L; v* `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 {5 B; n* q, Z: V) I+ o
  11. *         TO CHANGE.  `; C  U% s2 d7 x+ f
  12. *
    # n3 `2 b( a, Q& O; o' }5 H' L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  Z, R! V$ _# }
  14. *
    4 n  {! ?8 r* l2 S9 X% c0 g/ t6 g
  15. * This program is free software; you can redistribute it and/or( t9 C  M% i) E0 }- s" F5 q& c0 p( B- x
  16. * modify it under the terms of the GNU General Public License as. d# Z$ c5 D7 a6 p( P
  17. * published by the Free Software Foundation version 2.1 j, O% M/ F  G6 c; f
  18. *
    5 v9 ?- {5 P  w, ]  Q8 J) s& Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 K) Y# z0 f& s1 z
  20. * kind, whether express or implied; without even the implied warranty
    : z$ i, d. n8 |' j1 b7 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - s  B) O: |3 @, C/ l3 |3 J
  22. * GNU General Public License for more details.
    3 K( T$ j$ c; g$ |
  23. */
    2 q0 K/ k4 t* V  p4 L

  24. : [, `' p' n, E' Z1 f: X
  25. #include <linux/module.h>' X) q- E. @4 ]  P8 b0 Q
  26. #include <linux/init.h>
    ' l1 I7 W0 c7 J* F9 x; ~
  27. #include <linux/errno.h>1 e0 z" {/ v1 t, y. a( H3 D! t
  28. #include <linux/types.h>
    6 Q9 x- U. _: [9 M
  29. #include <linux/interrupt.h>* o, c/ K6 T6 C2 T
  30. #include <asm/io.h>
    " |( W1 I7 c) Y$ e7 E
  31. #include <linux/moduleparam.h>
    4 L3 q0 x1 @7 O7 Y- I
  32. #include <linux/sysctl.h>
    3 n4 ]$ k7 [, r6 G6 I- m
  33. #include <linux/mm.h>
    $ M% [) T6 h& z0 _' ~( g" ?
  34. #include <linux/dma-mapping.h>, {9 }0 M9 o$ v; A& c
  35. 7 s, ?3 |& }# `
  36. #include <mach/memory.h>' V  i3 u; ~! L9 C
  37. #include <mach/hardware.h>
    * `! a! G+ G9 R, J5 H0 e9 Y' C
  38. #include <mach/irqs.h>; f( q0 d9 K) M- E6 l9 D
  39. #include <asm/hardware/edma.h>/ s, L$ C& L1 v" [" Q
  40. " y9 V. ?* F, T/ r0 c
  41. #undef EDMA3_DEBUG/ m# X& h) b, L  @$ ^+ m4 C7 U
  42. /*#define EDMA3_DEBUG*/
    9 E4 |& D; C5 D% w/ u2 ]

  43. 5 x" a+ ]# w* i8 G
  44. #ifdef EDMA3_DEBUG+ M( K4 G* A- _# }( o, Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 F5 J- r$ E) C1 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 S1 Z6 S1 Q& f4 m. Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 T, A8 y/ z9 k4 U: h
  48. #else
    : R. s) W. k) M8 B. h
  49. #define DMA_PRINTK( x... )
    6 `. w4 w& P* [# `6 p6 U
  50. #define DMA_FN_IN( K2 x2 j  u  @2 P; l5 t
  51. #define DMA_FN_OUT
    6 S( T- G$ k" d( ]2 _' d5 j9 u% e
  52. #endif
    * W; q3 Q! _. n/ S- g) }' u* _
  53. 6 E. K9 W: s. Q2 x, w; b( Y2 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / W1 n) g! P, l: X$ p
  55. #define STATIC_SHIFT                3
    ! t) o2 p; Y" v8 X6 e
  56. #define TCINTEN_SHIFT               20
    9 x' M& g' h- Q+ t. t  v! p
  57. #define ITCINTEN_SHIFT              21
    # b/ y, m7 g1 L; B, _$ Q- R2 ~
  58. #define TCCHEN_SHIFT                22
    : ]: ~8 B' L( C2 C8 X
  59. #define ITCCHEN_SHIFT               237 w2 a5 L8 Q5 N* `" _

  60. & E- U; u7 o5 C; H: c% \& A
  61. static volatile int irqraised1 = 0;
    4 m+ Z: c& r) Y! A9 x. ~( `
  62. static volatile int irqraised2 = 0;2 p* i. S' S$ V8 M
  63. ( d2 f9 \  K  F5 C0 `6 s1 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 _; R( |  u& A7 v: G; `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * `1 L" Y" f. |. k4 w7 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, j9 u$ u& ^# Q; v5 z& A
  67. ( v' \9 d9 K( H! }
  68. dma_addr_t dmaphyssrc1 = 0;. }2 C! o3 G  `; i5 `0 C
  69. dma_addr_t dmaphyssrc2 = 0;  l4 k! {( U% c7 x9 J+ S
  70. dma_addr_t dmaphysdest1 = 0;4 ~! @" ?, m1 z
  71. dma_addr_t dmaphysdest2 = 0;
    # S5 ?* O" Z0 |
  72. 4 m$ _+ I) |; P6 N# Y
  73. char *dmabufsrc1 = NULL;
    . a$ ]0 m8 W5 }, v2 q" A/ z
  74. char *dmabufsrc2 = NULL;
    2 L" D2 W2 w, P' a1 n
  75. char *dmabufdest1 = NULL;$ ^% A5 R& u1 D7 a
  76. char *dmabufdest2 = NULL;% H# I- Q0 G3 C7 v; [# V. d2 T- o  W

  77. + c0 f; O( s* h: _* E
  78. static int acnt = 512;: D: E$ T: B- H" T$ W9 P( ]
  79. static int bcnt = 8;
    9 q0 ]5 O5 q  X! ~- X$ H. E
  80. static int ccnt = 8;
    6 e* f6 I+ ]: b# M' s3 t
  81. " j$ I, R# i$ X+ B/ G
  82. module_param(acnt, int, S_IRUGO);
    ' G0 N9 k& ]# n8 W
  83. module_param(bcnt, int, S_IRUGO);: o1 K) n  `+ {' a1 j9 ]: {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ e. F( ^/ n! I; y8 E; P( N
2 \& K' Z' _- e& J' P# l* O# l8 }0 L$ }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( H7 c, X/ ]' _0 J8 q4 o0 k2 Q! S- b
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, H' Y/ G% Z' T7 X) l# g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' t. Z6 G; f6 I* Z  G/ A

9 e$ s. d7 Q# @& F
6 {0 q: l' D+ \2 w: K( U" n5 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 16:58 , Processed in 0.040839 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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