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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) M, x6 _" j7 f6 s: F* d7 a) c
  1. [code]EDMA sample test application; t3 w; w! L5 ~* b; T# S
  2. /*
    ' \/ L- g* r3 @: @: _# H( F2 ~, i. ?7 m
  3. * edma_test.c
    : f' r' l! |" w* j* y, b
  4. *7 g) N% j& T+ v+ U" `
  5. * brief  EDMA3 Test Application% K% u& d: r1 \  a, n- Y
  6. *
    ' P/ C' r' A- l% c/ e2 n
  7. *   This file contains EDMA3 Test code.
    , z9 J0 C+ p. a) x0 x
  8. *
    ) v2 C( |* I( |% |. d, C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # x) j6 M2 u+ b9 w. w$ Y$ a7 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . g' H: K4 s/ \
  11. *         TO CHANGE./ E5 q) i% r2 D+ k9 ?' U3 M1 B& i3 w
  12. *
      _9 m% `1 G, ^: f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! |- I7 K& e! T' m) i/ {! P' F3 ]
  14. *  G  g7 U; z( `( Q# c$ `
  15. * This program is free software; you can redistribute it and/or5 m; o! t4 `8 w) m. R
  16. * modify it under the terms of the GNU General Public License as% b( y7 L1 Y5 m/ l  t) u4 }
  17. * published by the Free Software Foundation version 2.; M& V& o& @/ \5 N9 w7 p+ ^2 \
  18. *
    1 B3 x# u6 ]. ~2 w  q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" \- b+ W' w7 U! X9 q$ r. G
  20. * kind, whether express or implied; without even the implied warranty
    + \3 |+ E2 d* r5 V- ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" C' l0 b3 r% W3 w; r  p
  22. * GNU General Public License for more details.
    6 K) i+ \8 j, d0 |: ~6 S
  23. */1 G' d* P9 \3 @

  24. . e- i9 B4 h. n' ]! P
  25. #include <linux/module.h>
    4 p% F9 c  y$ g( E. X# H& c
  26. #include <linux/init.h>
    . q. t( w7 ?* K4 A9 _: G
  27. #include <linux/errno.h>
    ' o+ ]1 `6 {+ e. u8 n" _
  28. #include <linux/types.h>
    7 @) P# d+ w' H0 Z" k
  29. #include <linux/interrupt.h>- Y0 I6 Z  G$ E
  30. #include <asm/io.h>
    5 C+ h8 U$ j# @* a
  31. #include <linux/moduleparam.h>( A$ j: E; G: h- d% k
  32. #include <linux/sysctl.h>
    ( _! G/ c, Z# U, y% G2 c
  33. #include <linux/mm.h>9 a" W2 R2 _6 u# X0 h. D& M! f
  34. #include <linux/dma-mapping.h>2 ]3 g& [! t+ K* C; \6 f
  35.   y% `/ L6 w& @( Z
  36. #include <mach/memory.h>, L9 w$ r  T; Q3 J" X
  37. #include <mach/hardware.h>
    1 e$ w$ a4 a# Z+ M1 K: r
  38. #include <mach/irqs.h>+ p/ H# g: F8 A" v
  39. #include <asm/hardware/edma.h>, n; S  J! [4 @/ I
  40. * Z- h* E% r3 T6 w/ B% G
  41. #undef EDMA3_DEBUG; }. Q6 ~" R& ]9 j$ S7 u
  42. /*#define EDMA3_DEBUG*/
    - `7 a+ `5 n' ]1 p; ^3 t

  43. 0 O' V9 w2 M# x' p
  44. #ifdef EDMA3_DEBUG
    / X. h0 u" ]9 ]* `$ X0 L  H1 |! f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& u$ u, @/ \) |/ u5 h% y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : U1 t% z  \9 u' [# H2 m. w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + g  i6 X' l" C( M  ]
  48. #else
    , O- Z9 U4 X1 t$ I/ C/ i% n
  49. #define DMA_PRINTK( x... )
    2 A) M0 t, d; U0 B+ R) A
  50. #define DMA_FN_IN
    ; l* F' V7 o9 I% I
  51. #define DMA_FN_OUT
    + H9 \, j$ W/ j
  52. #endif
    8 {2 @  @: i! h% f/ ?# P2 R

  53. + P& z4 F# g& W$ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 G/ F: b% c; J% T# P, K3 \. c! k
  55. #define STATIC_SHIFT                3
    ( o: [/ d1 [; e  x3 ]
  56. #define TCINTEN_SHIFT               20
    ) F, C, ^' ^: H# n2 ?* }5 b9 T
  57. #define ITCINTEN_SHIFT              21
    9 h4 E8 _1 m! t* D1 h  Y
  58. #define TCCHEN_SHIFT                22% f3 }; n% Z- P  C
  59. #define ITCCHEN_SHIFT               23) u9 i, p2 l# F* }3 ]2 v
  60. - [5 O/ w- s+ B
  61. static volatile int irqraised1 = 0;# l6 x! t! T- F0 @
  62. static volatile int irqraised2 = 0;
    ! h" o6 A% x+ X4 a! x: e2 C
  63. $ f' J' X0 c6 `: e, l: Z3 s$ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& v3 x$ n* @4 m6 j. C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ~8 |1 j- m* |: v' B+ ?' O/ E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; W0 c; T+ Q: R7 P7 Z. Q

  67. ( J7 e5 [" H* Y$ e& E) f3 F
  68. dma_addr_t dmaphyssrc1 = 0;
    9 R+ N% @0 L1 Z& f
  69. dma_addr_t dmaphyssrc2 = 0;
    # S! E; R7 \: x. O, Q. q. i
  70. dma_addr_t dmaphysdest1 = 0;' ~- W  M, ^/ i% A; Z2 r* q, P' P
  71. dma_addr_t dmaphysdest2 = 0;0 V3 X) N( F* m
  72. 2 \$ X( m# o/ O+ f
  73. char *dmabufsrc1 = NULL;
    4 v/ l: ~( P4 \$ V& H. s6 P0 {6 f3 |
  74. char *dmabufsrc2 = NULL;, [6 O( Z3 d$ O; K; s& ^# s9 s
  75. char *dmabufdest1 = NULL;+ E( a" T! u4 ^( ^4 D  N
  76. char *dmabufdest2 = NULL;
    ) F+ m8 Q: |6 h) Z0 T1 ~. i. ]4 ]

  77. 0 ~; T; E8 }/ M4 a
  78. static int acnt = 512;
    4 o* w: N+ B3 u7 j
  79. static int bcnt = 8;
    4 k; A  [! D3 _0 Z
  80. static int ccnt = 8;1 _+ B* |! O6 K7 \
  81. 5 F& Q+ W! _; [7 s. {
  82. module_param(acnt, int, S_IRUGO);
    + k* d/ j$ v* V( Z. N8 z
  83. module_param(bcnt, int, S_IRUGO);4 d8 X4 F$ t! B8 l; `7 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 B* [5 ^; t# o& T: G9 |; C) F
- b. ]/ m2 g3 Y$ A2 l% R! K9 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% v/ D* F" W# ]( x6 D; d: yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ C6 V- @; G- T" q, e# ~7 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; }2 R0 K' k8 f2 ]+ x5 f0 P, Z: c2 x" N( k
  t; f1 E) n1 b" f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 12:59 , Processed in 0.040144 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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