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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 K  ~1 |* g6 d$ R
  1. [code]EDMA sample test application
    8 {1 D" \+ J/ @, H5 h  r, y
  2. /*, P) B5 a& K  o- G$ B) Z8 |) j, d7 G) M
  3. * edma_test.c
    * S$ @0 K4 t: M/ d
  4. *
    . U- V% O6 J* }5 m; Q; d; w
  5. * brief  EDMA3 Test Application
    ) F) }7 M, m  _2 s4 Z+ l
  6. *& f2 t* W* M" B5 z
  7. *   This file contains EDMA3 Test code.
    3 z# J0 x% U+ \6 p
  8. *
    # ~/ e9 h" Z1 l; `( b  i8 d) R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 Y& N, l7 ~" c% \2 a' T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ h* c5 x& Q) o$ K% U
  11. *         TO CHANGE., G+ j: d; V) c- [6 z' ]- T: L
  12. *6 z$ {3 ^4 }: v, u1 t, _' k/ t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # U0 s, M3 M4 l4 _( N2 z
  14. *4 ?9 G  v' e/ H; U2 q8 b: r
  15. * This program is free software; you can redistribute it and/or
    & B) i, D8 ~2 Y3 K
  16. * modify it under the terms of the GNU General Public License as" P) }8 l5 ]( B9 [
  17. * published by the Free Software Foundation version 2.1 B) e3 T- M# Z6 N6 W
  18. *' R! j1 M1 Z& Y; o, ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* y5 }1 h/ L  T% c
  20. * kind, whether express or implied; without even the implied warranty: l  E8 d/ Y9 L% ^0 o$ G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 T# M, e  U* S. Y$ x
  22. * GNU General Public License for more details.
    2 ^+ g. k4 |) m; m% ?
  23. */. g) U$ N4 C8 g# i; k  Q
  24. 9 G3 i; p% o) C# s6 W
  25. #include <linux/module.h>
    3 [0 y0 m5 z! s0 r9 q5 k
  26. #include <linux/init.h>
    2 ^* x* f  w1 v
  27. #include <linux/errno.h>
    # }; l' f# x& ~- f8 d9 x
  28. #include <linux/types.h>9 N2 T0 h( k8 C' k% v
  29. #include <linux/interrupt.h>! d, e5 S5 U7 S" k5 e
  30. #include <asm/io.h>; W: `& }1 J3 ]7 S
  31. #include <linux/moduleparam.h>
    - M; Z- e6 ?9 c- h' P) J6 n# R
  32. #include <linux/sysctl.h>  w: B# [5 ]% r/ k& j0 m  k# M6 ~
  33. #include <linux/mm.h>
    3 \$ [7 O6 Q5 s. `  R
  34. #include <linux/dma-mapping.h>
    $ g( e5 c. k: s7 V2 U1 j" i
  35. & m2 P( @0 _* G, t0 I% q) b
  36. #include <mach/memory.h>3 b0 {8 f( O' G
  37. #include <mach/hardware.h>3 u! `# M( c2 P  _/ H
  38. #include <mach/irqs.h>
    " m& ^3 _8 M' o
  39. #include <asm/hardware/edma.h>
    9 R6 h* f  K* h$ n$ c3 \) ?9 T" L
  40. ! @0 U1 q% f; L8 h
  41. #undef EDMA3_DEBUG- n. o  H9 q3 w  H2 }$ q. W, g# W4 Y
  42. /*#define EDMA3_DEBUG*/' |/ M8 z* B9 L; l5 t

  43. 1 F, C- {) f" M! q) Z! j
  44. #ifdef EDMA3_DEBUG1 ]% j+ f" U- x; A$ \2 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 L8 |( a' l) S" }! [- V1 V# b, g% C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); c) v! t/ j: C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . q$ _4 K; }8 C" _
  48. #else+ G1 j4 U% L* F3 Q
  49. #define DMA_PRINTK( x... )
    ; O; D  _: x, y  y: A3 t% W$ ^. J
  50. #define DMA_FN_IN, A$ S4 r$ f' X9 X( v" V) F: f$ h
  51. #define DMA_FN_OUT
    ( H8 k( l: [& d! [( e0 s" N( ~
  52. #endif: e1 {5 `! s& r1 w* g5 p

  53. # A% `% A' U, E& R! I" N( r0 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ J5 y/ R1 V' _  K
  55. #define STATIC_SHIFT                3
    * o( t7 g9 y6 Z# c
  56. #define TCINTEN_SHIFT               20
    . ~9 Y' |: s8 O
  57. #define ITCINTEN_SHIFT              21
    " }' `# r2 z& q2 a6 R- U
  58. #define TCCHEN_SHIFT                22
    1 B0 C$ A" D  l7 ]6 V+ d
  59. #define ITCCHEN_SHIFT               237 q5 `3 m/ s  x6 W6 l8 s
  60. ; N  h% j8 F/ k7 j: E# a/ K; u
  61. static volatile int irqraised1 = 0;
      A8 H4 _0 |! L7 G6 |7 y
  62. static volatile int irqraised2 = 0;7 x) @& X* H  j

  63. ) d$ w0 l: w. w2 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 K6 A$ I! Y3 h6 V, ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% e  A2 M/ d  e2 r1 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; |* f/ r2 r% U' i1 @; U+ y+ G9 k; ?
  67. . m0 n9 O" Y" D# q
  68. dma_addr_t dmaphyssrc1 = 0;8 u4 f6 x0 _- ^( t& ?6 [
  69. dma_addr_t dmaphyssrc2 = 0;9 a; ]" e  t" J' ^3 g: x
  70. dma_addr_t dmaphysdest1 = 0;2 T; k# k8 Q7 F: K% |
  71. dma_addr_t dmaphysdest2 = 0;( J6 d/ s% Z# ~0 [( Y, h' B

  72. 5 B  d4 Z$ {+ r
  73. char *dmabufsrc1 = NULL;" S; M- t3 G6 y3 @
  74. char *dmabufsrc2 = NULL;2 g- _7 t4 m3 |. A. a7 d+ }' _
  75. char *dmabufdest1 = NULL;. ^! X  `& e3 ?; S
  76. char *dmabufdest2 = NULL;
    - ~1 A7 I7 S" b0 D" i6 K7 k' f8 J3 h
  77. / x1 V' X/ A: ?2 P
  78. static int acnt = 512;
    0 W. \7 d! {7 n2 H$ I4 [
  79. static int bcnt = 8;
    . W$ Z+ d7 ?" j; X' B
  80. static int ccnt = 8;
    5 r; {+ [" _# p% \. U! k( \
  81. % s, w, ~7 Z4 O. p5 q* b4 r/ H
  82. module_param(acnt, int, S_IRUGO);5 d+ ~' }& Y) X& ^0 V9 V9 `
  83. module_param(bcnt, int, S_IRUGO);
    ) y+ F4 j  t3 K0 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# q* P; w1 n  K5 T; F: `! S% c
' A/ z: B4 W5 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 V2 j) J# [. E9 o! K& d( Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ O$ W: n0 _- i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ G* L' h7 }& q
2 G) Q0 X8 Q! ~
) G/ B6 X! [7 o: g6 x7 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 04:28 , Processed in 0.042278 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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