OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & \; B1 {- ~0 P  i( L: h
  1. [code]EDMA sample test application  ]+ G5 n# t- J, H+ s6 B" ]2 _
  2. /*: i) a* q- I0 c$ \: ?
  3. * edma_test.c
      r% c, P/ J" {" z
  4. *: E+ x% ?. M* J+ l) z3 Z0 Z
  5. * brief  EDMA3 Test Application
    " g9 N. ?2 O+ V3 x$ m
  6. *3 S, C8 O. s+ A$ q- ~- M
  7. *   This file contains EDMA3 Test code.
    0 K  X! s% j+ ]1 ~8 u9 j- _3 ?
  8. *
    - U* o% N& ]$ h1 q: u1 L4 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ `  S4 k7 v, j1 M2 W- k9 [( |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( {( I  s5 O6 |
  11. *         TO CHANGE., [8 @5 x8 @3 Q/ i
  12. *( \8 j. ~" h3 a1 Z: G/ p7 n  i2 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) B# t. f2 |8 Q* K$ w
  14. *
    4 v. S9 o% M( v/ r' ^
  15. * This program is free software; you can redistribute it and/or$ ]( G+ X6 T6 ?" b, w& O/ t
  16. * modify it under the terms of the GNU General Public License as. W8 M0 ~. r2 b& ~" Q
  17. * published by the Free Software Foundation version 2.1 o% p' L" A  p0 f5 Z7 |
  18. *
    3 }* r2 R% P8 o6 Y8 l! q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 C+ m! A  g0 ]& M  B6 U; F
  20. * kind, whether express or implied; without even the implied warranty
    ! @' ~  G1 R$ Q' G: k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 {; u1 \! I, B' {+ a& q2 j
  22. * GNU General Public License for more details.& ?+ A# c/ f% O) `6 x& c
  23. */
    9 Q3 M6 T$ _9 x/ D9 u1 p" Z

  24. : B$ |% P& y7 {
  25. #include <linux/module.h>3 @2 J( e3 m6 E- P
  26. #include <linux/init.h>( P  [( Q- x3 K) P0 ]4 v
  27. #include <linux/errno.h>
    " C- Y' R+ e$ J1 j( g  Y- R5 \
  28. #include <linux/types.h>5 b- I" Q. {5 |- b5 S: ~: H
  29. #include <linux/interrupt.h>7 b5 r1 k: w1 p8 @
  30. #include <asm/io.h>* @2 a+ ~% n( S, {- _) |, H; H1 i; H
  31. #include <linux/moduleparam.h>
    ; d6 c6 {8 ?+ D
  32. #include <linux/sysctl.h>) N1 x0 M5 Y" h% Q
  33. #include <linux/mm.h>3 a  W7 B# V: ?6 m
  34. #include <linux/dma-mapping.h>
    * I7 e, Y3 D7 [6 T4 K' z
  35. 3 k* q$ y+ m9 |! t
  36. #include <mach/memory.h>
    6 ~& N' `3 p2 H  V
  37. #include <mach/hardware.h>
    1 |2 A. B3 a% v$ g+ C% m; b
  38. #include <mach/irqs.h>3 s& s! ^- R6 j* R$ L2 u% |& p
  39. #include <asm/hardware/edma.h>% G# D4 s3 S. z( c
  40. * u7 g' l4 C* W3 e  M- d: Q
  41. #undef EDMA3_DEBUG
    . @& P5 @+ q/ g8 o: a, v+ J
  42. /*#define EDMA3_DEBUG*/4 g$ e$ w4 K2 ^+ [9 X/ o

  43. " @! ]& q$ G4 t$ h3 l( d
  44. #ifdef EDMA3_DEBUG
    - r) G2 Z# I' c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 d: X5 C( t/ b9 y* J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 e9 z; w( @4 _& U( ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , Q, }/ A1 ^8 Z/ l6 Y/ V
  48. #else& I( a0 y; j' K
  49. #define DMA_PRINTK( x... )
    8 j& A- ?, s. X! M
  50. #define DMA_FN_IN6 s& T6 L* T7 p  l. U
  51. #define DMA_FN_OUT
    2 K2 V- c4 p- }) H, j, d
  52. #endif
    5 R/ ]  l% n) X* O( y
  53. ! ^. @+ \! Q3 [3 `- J. \+ `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). d( V, @& _( f1 n- P% z
  55. #define STATIC_SHIFT                3# n9 K9 @( l5 R& y3 X
  56. #define TCINTEN_SHIFT               20. C1 l/ N! w5 O
  57. #define ITCINTEN_SHIFT              21! ]8 U6 g, z+ n. M
  58. #define TCCHEN_SHIFT                22. T: i  }  }; M& `- ~7 w
  59. #define ITCCHEN_SHIFT               231 N" F+ \1 Y, d; R) v
  60. 2 x6 e4 L! X7 o2 g. O
  61. static volatile int irqraised1 = 0;1 O, B$ |0 e1 H3 r- K
  62. static volatile int irqraised2 = 0;
    $ z; M  B: J; o% X) D; B1 v
  63. 0 x- `5 ^2 [( a* ?1 |2 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - h6 F0 H$ e2 s1 v5 s' K0 ?/ F& E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % }* y: ]3 Z+ q& I* @3 z' r# s2 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( g7 t3 e6 H. y6 j) q
  67. % G  F! j2 i2 E
  68. dma_addr_t dmaphyssrc1 = 0;
    ; R% D5 j4 S. I2 p, {4 m
  69. dma_addr_t dmaphyssrc2 = 0;* q% l4 a: o6 E( i% }$ E
  70. dma_addr_t dmaphysdest1 = 0;
    4 M3 e$ H3 n7 Z2 m3 e$ R8 j# d! H
  71. dma_addr_t dmaphysdest2 = 0;. [1 u) O% O. f0 N* r) G
  72. 7 W9 Z* W- ?4 x% y. M* Q
  73. char *dmabufsrc1 = NULL;$ X- ]; Q  C; Z' N( S
  74. char *dmabufsrc2 = NULL;" w4 S3 M1 `+ t* G# B
  75. char *dmabufdest1 = NULL;
    8 u1 `' `0 c9 t0 h# N$ _/ ?$ C* U
  76. char *dmabufdest2 = NULL;
    ; w9 I4 b" O0 S2 Z4 P4 F6 Q
  77. % J; j) i$ C# L+ \
  78. static int acnt = 512;; {' }3 G0 E- `
  79. static int bcnt = 8;  |, i5 T! c3 F
  80. static int ccnt = 8;5 M8 d* n& @: ^5 e) N0 e  B
  81. 3 a, D1 {9 Q3 B: w
  82. module_param(acnt, int, S_IRUGO);
    # `! b6 E2 z0 K6 U
  83. module_param(bcnt, int, S_IRUGO);
    0 I1 v- F& H6 F2 {2 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ @& L1 @* L  q' ~! H0 c. `! \2 v1 A. B; E" P9 i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' Z/ G1 e+ n# O: L. k4 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; P0 k. k) P' ^# l4 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) T; Q7 |4 K0 F8 d1 b

' U8 U9 O7 l8 {3 K
& ]: N0 F/ d; o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-19 23:41 , Processed in 0.035478 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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