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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f2 Z0 l/ e$ q- y' _. l4 c
  1. [code]EDMA sample test application
    ' T2 A! a) P+ V* `
  2. /*" M$ M, L) l% S! E" V' Z
  3. * edma_test.c
    ( e$ g5 m) R& y/ j5 ?
  4. *
      i/ x: G: X% R- H  p+ i$ h* T
  5. * brief  EDMA3 Test Application" X4 f8 j( C+ M( N6 e; L% t
  6. *5 y/ m( j. g% A/ R+ \+ @0 [
  7. *   This file contains EDMA3 Test code.
    ! m, ^+ V6 o. L1 j; B% D2 Y! x
  8. *& S7 S' Q* D, Z. k$ F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 p% n$ y* t/ ]' V5 I9 K1 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 v4 @$ `$ v0 ~8 l
  11. *         TO CHANGE.8 `  x+ m4 o5 H, T$ r
  12. *7 k. w8 H% S& C$ a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # S4 j  z7 j2 g6 P
  14. *4 p" i3 s1 b- c
  15. * This program is free software; you can redistribute it and/or
    ( }" J7 f8 W4 E: O0 x; E0 R* v
  16. * modify it under the terms of the GNU General Public License as
    * b& P, |$ j) q$ B- @/ Y
  17. * published by the Free Software Foundation version 2.' R8 e- U$ g, Q3 o% O7 x
  18. *. E1 V: |  Z. Q: g& A1 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 G% K1 t# M% W
  20. * kind, whether express or implied; without even the implied warranty
    ' c& L" Z. b4 n& h. ]; A, R8 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ i( a7 r$ F  g1 @! ]
  22. * GNU General Public License for more details.# C+ K3 k# W, J/ }, g4 ]
  23. */
    & u& E' U+ ?& o& J

  24. ( ~$ }0 T5 s+ p$ M# E, m* V
  25. #include <linux/module.h>" T# F" d  s( \- q
  26. #include <linux/init.h>0 n0 G% A1 @5 L$ P) t
  27. #include <linux/errno.h>
    0 j) m, p. N9 B2 C8 s
  28. #include <linux/types.h>
    9 m5 H  C3 m, t) ?2 P9 j& ^3 k
  29. #include <linux/interrupt.h>1 _8 {6 k- L" F5 \0 P0 `
  30. #include <asm/io.h>) t1 n& v5 r& V, b4 k
  31. #include <linux/moduleparam.h>
    9 R" V7 e0 _/ e" _. d
  32. #include <linux/sysctl.h>; g' \1 V8 r1 p* z4 \
  33. #include <linux/mm.h>
    1 }- }: q* ?' w1 t2 q% p7 I) s# W
  34. #include <linux/dma-mapping.h>: d& u% A. f5 f( ]
  35. . ?% r3 d0 z; F1 @' z
  36. #include <mach/memory.h>
    : ]1 o2 Q; d3 Z( B/ T. ~
  37. #include <mach/hardware.h>
    ; @  X5 ]$ _$ L/ }
  38. #include <mach/irqs.h>
    ( r, i: B4 {4 v) @3 c6 _" L
  39. #include <asm/hardware/edma.h>
    ' m5 c4 Y0 e" l  j% [

  40. : @3 f" x: D7 X
  41. #undef EDMA3_DEBUG: }7 V. u7 A9 l1 W& X- }7 ^4 e
  42. /*#define EDMA3_DEBUG*/5 C5 M0 l% X8 F+ n" q1 J* ~+ d$ x
  43. # o4 ^6 z0 T' Z1 F8 Y
  44. #ifdef EDMA3_DEBUG
    % u6 ^- d6 \* {' H+ `& H* Z) `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' o6 E7 p- c  a: [, o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 Z. ]  X* x( Z( N. z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); M$ L: k0 V  C- t
  48. #else
    % q, y* Q& D" z( ?# t* e6 \
  49. #define DMA_PRINTK( x... ), W' i- Y8 I" P
  50. #define DMA_FN_IN& X, |, }7 p+ O% f
  51. #define DMA_FN_OUT
    % u1 X4 i' G% a
  52. #endif
    2 U8 K0 D0 c& \5 x* j) r7 M& r
  53. " |( B9 n4 f0 |6 z/ V5 [5 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' x  X" ?$ c( L" g" j
  55. #define STATIC_SHIFT                3
    ! T4 i4 s' v) a* l1 L7 \1 f4 ?& y
  56. #define TCINTEN_SHIFT               20
    6 N+ ^8 ?7 E- p$ ~2 P) ?
  57. #define ITCINTEN_SHIFT              21& H' s+ _+ j* p7 X+ B7 y+ A  ]
  58. #define TCCHEN_SHIFT                22) E; \( i) i& @6 {5 @5 D2 r* `
  59. #define ITCCHEN_SHIFT               23
    . y, J% Y3 s, P9 w% U. {2 K9 U
  60. - Z7 c. y, y" B" f
  61. static volatile int irqraised1 = 0;4 c6 Q) R9 v; y( g3 h4 r3 D( C0 u8 s1 w
  62. static volatile int irqraised2 = 0;
    4 G7 V0 @. d/ p% d: J( F5 S

  63. . P2 `4 S& x0 {/ A4 J# z& B8 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 o! h: n; x! B$ x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c3 i" ?, X. P  N8 V- t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; y! \2 }9 o8 t4 f, W& P

  67. ( R! K  s/ d& @7 X% r
  68. dma_addr_t dmaphyssrc1 = 0;
    3 |, C9 |" x/ N+ _* S. \
  69. dma_addr_t dmaphyssrc2 = 0;
    8 x% O7 [" E3 z) m1 w
  70. dma_addr_t dmaphysdest1 = 0;/ P: z* u* l% O* W: p+ V1 t
  71. dma_addr_t dmaphysdest2 = 0;
    4 h* W  F3 r1 Y( N/ j' r
  72. * s) [# W! ~# B( B2 j: q
  73. char *dmabufsrc1 = NULL;; i2 l0 ~% N0 g. ^
  74. char *dmabufsrc2 = NULL;# B8 Q. c4 ?+ A
  75. char *dmabufdest1 = NULL;
    6 z+ ~6 f2 f# j" E& `! A; A
  76. char *dmabufdest2 = NULL;$ v5 c" n, P1 ^' z# g# d

  77. ; r' q/ [$ y* p7 Z, A7 |* W' `  G5 O
  78. static int acnt = 512;$ H: X7 h! V' z* t& U5 g+ P
  79. static int bcnt = 8;
    ! T0 a8 z9 L) o! g2 E
  80. static int ccnt = 8;! a% \( d, Q( `. C$ Y
  81. ( t4 T3 F( g# L6 X* j+ U5 w
  82. module_param(acnt, int, S_IRUGO);
    ' \: n6 t+ T3 E
  83. module_param(bcnt, int, S_IRUGO);
    ( X  h9 N/ L/ e( l+ |. T" ], [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 H- [; [% x3 l7 p& I/ N% g; M
* [' y& ~4 Y- ]# c7 x1 Y; g6 H1 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, e7 D) F, u+ S/ a! E- k- ]0 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 A# _8 C' L. O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% j- Z" U! |8 ]2 J: q# \
6 w: }! M/ _$ T, Q4 L. ~8 T

# l( V, B% N% b5 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 21:45 , Processed in 0.037621 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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