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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   D: D, x& K/ s7 r2 I* k
  1. [code]EDMA sample test application
    & ^6 D, |( ^" M; S( A
  2. /*
    * a) x' E$ v+ G$ K% o" j7 h9 M
  3. * edma_test.c
    " o) K, P3 m9 N) |, P( A4 ~
  4. *: X3 k( L; ?/ K4 Z$ P7 M0 U
  5. * brief  EDMA3 Test Application% h; i1 G) O  {- j0 Q1 |  h' L" h
  6. *
    ' c  W9 o2 W, W/ k. ?- I& x$ [
  7. *   This file contains EDMA3 Test code.) V$ E* n& t+ N' ~
  8. *
    $ `* e0 b6 M$ J- D& X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' w* m% C* c# B  j" g0 d1 O; |1 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # t. `4 i* p1 _- k$ z% W# g' a1 \% f
  11. *         TO CHANGE.! T1 q9 W" q4 P: v- ^
  12. *1 \- r2 q* E- `4 C) p# m2 K' q( l( K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! s) O) v; H* [5 {
  14. *
    9 c7 B0 i% ~9 b7 W  y9 M9 ]
  15. * This program is free software; you can redistribute it and/or7 ~; q( U' q; R% v1 C
  16. * modify it under the terms of the GNU General Public License as
    6 s2 `% |( B; w2 x! ?
  17. * published by the Free Software Foundation version 2.  |& [" f, c8 z2 y& d
  18. *, [/ D8 T9 w$ \+ Z3 X! H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 T& ~" N9 T& j1 @9 d
  20. * kind, whether express or implied; without even the implied warranty8 r2 ]( a8 `8 C8 q. \2 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " _  y& \6 ^2 R. f& `
  22. * GNU General Public License for more details.
    4 H/ ^' ^- L9 l/ z- D5 t) a- a$ x
  23. */
    4 c3 g) [# w+ k# P9 \+ Y* _
  24. ; c; w, _/ W" C& m
  25. #include <linux/module.h>  a$ k5 P0 |6 ^
  26. #include <linux/init.h>3 k* h- w; l2 B) p, s3 `
  27. #include <linux/errno.h>
    % o* p. K8 z: J# p* q" c+ I  @
  28. #include <linux/types.h>) s- A( E/ H# @7 B1 v- M; |
  29. #include <linux/interrupt.h>/ d, G, G. F4 Q- c  ^+ q  e7 `
  30. #include <asm/io.h>
    7 {5 V5 _& Y0 ~' h% [8 X
  31. #include <linux/moduleparam.h>
    6 r- g; Q* B: e2 J# L/ i
  32. #include <linux/sysctl.h>
    6 P- h; @. a0 p  I" g/ m
  33. #include <linux/mm.h>/ Y0 a+ J# Z2 F/ q  I
  34. #include <linux/dma-mapping.h>
    # I, T- c& S4 k3 B8 [& z, c$ g

  35. 4 L2 M8 k5 F+ u' ~! x9 z. ~) ~: S
  36. #include <mach/memory.h>1 x8 M" V7 `6 o3 c
  37. #include <mach/hardware.h>
    $ t* y6 S: M7 W" A
  38. #include <mach/irqs.h>
    5 V+ A2 R, N0 d: Y, }2 x9 p
  39. #include <asm/hardware/edma.h>
    9 r3 L; X: w( p/ e7 X
  40. 3 o8 ]! ]: |; d4 L: J4 j7 n
  41. #undef EDMA3_DEBUG
    - H, B  L0 o! R. `/ @
  42. /*#define EDMA3_DEBUG*/. _0 M0 @* I4 B5 T
  43. / v# {0 {% F, B
  44. #ifdef EDMA3_DEBUG
    & @$ K3 X7 W" R' Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! j( l/ e) C1 n; r  u* D8 n; Y" l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 B+ g) N9 d, R0 A+ V) z  ^* d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      O- P0 m- z$ K6 u( s
  48. #else# ?: N# l8 h- g- ]& G- w" z
  49. #define DMA_PRINTK( x... )  r" L4 s  `, B# t1 b: y/ R9 v
  50. #define DMA_FN_IN
    # x# |7 f9 y8 [1 u. `: b
  51. #define DMA_FN_OUT! W" O3 B5 X/ t7 W# b2 q9 B
  52. #endif9 E. ^- x5 b. z: Q& h' ~; @

  53. ; b$ V) K7 q, a1 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), q2 G2 I% K( b; ]$ [
  55. #define STATIC_SHIFT                3; m) P- R- v, d4 y: t
  56. #define TCINTEN_SHIFT               20
    7 _* N+ O3 T; m: _9 x( J
  57. #define ITCINTEN_SHIFT              21
    1 y8 }5 J* M! d! `: T
  58. #define TCCHEN_SHIFT                22- t9 X! w4 u7 h: b
  59. #define ITCCHEN_SHIFT               23* k3 h. @9 n1 ?0 J9 u* j" ]

  60. $ D9 I! ^: Y& G7 P9 a
  61. static volatile int irqraised1 = 0;. ^8 N; P% t/ \( u2 T+ Z
  62. static volatile int irqraised2 = 0;- m# g1 |. R  ]! w

  63. + W# ^2 p0 F8 F! Q4 R: t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 k7 `& X7 L) w+ q9 U. B( H9 ]1 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D) a4 r, j4 K% }0 ^5 W# C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 \! c6 e% o( j! H

  67. ' ]$ w3 Q: i9 _9 Y  x% M5 V: k
  68. dma_addr_t dmaphyssrc1 = 0;, ~8 N7 W) y& c8 p: u4 s, n
  69. dma_addr_t dmaphyssrc2 = 0;
    + D$ p9 Q5 m# |2 q; S
  70. dma_addr_t dmaphysdest1 = 0;( h+ v1 y5 \  l; \2 O4 ?% C5 K% [; U
  71. dma_addr_t dmaphysdest2 = 0;# Y0 c6 x# l' x

  72. 2 t  t9 {5 P% o$ a1 N, ^" A
  73. char *dmabufsrc1 = NULL;
    6 p! ~9 j8 b1 ?( w* p0 i$ i! e
  74. char *dmabufsrc2 = NULL;1 ~: B7 [( i* E* h% a5 @
  75. char *dmabufdest1 = NULL;( J6 _* s2 [! l! R( q
  76. char *dmabufdest2 = NULL;# W1 t1 v, t( J! A

  77. 2 C+ t8 j( P4 V
  78. static int acnt = 512;9 Q, W$ N3 Q: |& y' J4 I9 p: M& R
  79. static int bcnt = 8;
    / u: y" s3 p/ U6 C
  80. static int ccnt = 8;
    " W4 n( H0 N0 Y
  81. & O+ K" R& \0 n/ ?
  82. module_param(acnt, int, S_IRUGO);: X% i! z. A1 y0 T
  83. module_param(bcnt, int, S_IRUGO);& E8 t' [2 F7 N0 p/ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 V6 ~- h% V, `: p( j/ o( ~% w( s5 P! \# D% ~
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ i, G) ~, U% w( @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 q* k( E2 h  @/ p. w( X: c* j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, c  e8 [3 }# d+ R$ M) k
: H, Y7 X8 h  R" j

4 z; o# L0 |# b5 ?: v, h( Y) k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-30 17:51 , Processed in 0.043085 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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