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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * v! t8 _3 e" t
  1. [code]EDMA sample test application" W- R9 U1 n. `( \3 R5 m# C
  2. /*% l$ [4 T' `  y, U0 j- o
  3. * edma_test.c
    & H5 v" p, K$ K  j$ a
  4. *7 c- N+ e" D( U
  5. * brief  EDMA3 Test Application" q' p) v# E7 d8 o0 N6 q4 Q0 i
  6. *1 K" A5 Y3 p# z! o; x4 n
  7. *   This file contains EDMA3 Test code.
    " P: e: {0 G% H( A
  8. *
    / Z2 @) {' V7 d2 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 _) ^2 r6 j2 h4 i  @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 `: X; f% ]+ T/ ?& G6 H
  11. *         TO CHANGE.
    & K; Q5 @, r! ~9 M5 J
  12. *
    4 B. B8 p, n) O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ ]7 J' y& B! P; H$ r3 j
  14. *
    , {+ L3 ]8 u/ ^/ B* p& @
  15. * This program is free software; you can redistribute it and/or
    3 Y) a) z1 F' T& j" R
  16. * modify it under the terms of the GNU General Public License as
    , i4 |& k) B- `. B' H/ r; A
  17. * published by the Free Software Foundation version 2.# `9 Z0 S3 P5 W" Q' c9 A# S
  18. *
    3 n6 y6 q' Y# W. E+ @! `; m8 z/ |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 O" s3 ?$ i- i. M- H
  20. * kind, whether express or implied; without even the implied warranty) h/ h% J& H: \9 ]% I5 S8 d' m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 ]" j% H8 c& U' \
  22. * GNU General Public License for more details.
    % j' F1 A; R# v' Y) ~
  23. */
    ! c9 j4 O2 K' A4 W2 w

  24. 0 H: d+ l: `) \0 d
  25. #include <linux/module.h>5 i; O/ N6 }3 i+ t2 h3 p
  26. #include <linux/init.h>
    - e* @0 C% C( @! |/ }# r. O
  27. #include <linux/errno.h>
    / d6 l3 U; {, O. ]6 E+ M% E$ ?: q
  28. #include <linux/types.h>! z+ p/ ^: w, b' f6 ]: g
  29. #include <linux/interrupt.h># K3 {' [! D8 Y/ P4 M
  30. #include <asm/io.h>
    : Z6 {2 V8 H+ e
  31. #include <linux/moduleparam.h>
    8 o! m: j6 O# n5 T3 s: \5 a3 |
  32. #include <linux/sysctl.h>8 ~6 d& T/ _* ^/ Z& C
  33. #include <linux/mm.h>+ {3 x1 z- o  M' x) b
  34. #include <linux/dma-mapping.h>
    * ]; V4 A2 D; a0 V* L
  35. : h! Y) V# e# B; i  |0 r
  36. #include <mach/memory.h>
      d% `  C% Z5 {4 p
  37. #include <mach/hardware.h>
    + _( E" b- y8 D$ a5 |0 M* U8 t% C5 W
  38. #include <mach/irqs.h>% Z$ i6 U4 O. I
  39. #include <asm/hardware/edma.h>- b% P$ s5 J% b! Z8 O" g$ S& i6 `
  40. - O/ ]3 @1 P3 k8 C" q1 W
  41. #undef EDMA3_DEBUG7 ^" C8 V% H- _
  42. /*#define EDMA3_DEBUG*/
    * ^( m/ Y+ A/ N! S3 Z; M

  43. $ r5 r$ F# L/ M$ R  H
  44. #ifdef EDMA3_DEBUG3 q2 p, W  i# n4 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " Z+ }: B% C( Y# S. `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      s/ g" Z% \. {7 c5 S5 H0 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( {5 g! W- a  c
  48. #else
    ; J1 U3 ~& n$ f( y3 O" q
  49. #define DMA_PRINTK( x... )9 U" G3 }6 ~- s( h) k) Q; K$ Y
  50. #define DMA_FN_IN/ }/ f* h. _' y
  51. #define DMA_FN_OUT
    . f" y# d: t& Q( f2 J
  52. #endif
    # t! R5 z. t4 ?; {

  53. $ k* l- @' ]) ?" s) u; P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 W" N1 }1 `8 s2 m3 u& r
  55. #define STATIC_SHIFT                3
      h1 t! R' k& a5 }9 s* }
  56. #define TCINTEN_SHIFT               20  K' m" d- O( F, D& Y- |+ V( j
  57. #define ITCINTEN_SHIFT              21  ?* J1 F( e( D& A3 u5 o
  58. #define TCCHEN_SHIFT                22
      r% ~1 X. ^. b( }. a/ e
  59. #define ITCCHEN_SHIFT               23
    / m' b, [' k2 ~1 p/ K% Q9 ~- Q

  60. & a! v. O% O& [# n$ n+ q6 q  u
  61. static volatile int irqraised1 = 0;; q- x% s  a; ^# a3 X
  62. static volatile int irqraised2 = 0;
    1 S. g, d1 G% c' ~1 Q& J

  63. " Y# o8 x1 h6 z( r0 |- J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r( ^2 e5 E+ L' A' b! W; x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  {/ P. z) r9 C5 B* B8 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . v" \7 i& e) T& v) D2 Z9 M7 P) x8 O8 c

  67.   v/ Z! T6 ^" Y" h7 G3 ^* R- r
  68. dma_addr_t dmaphyssrc1 = 0;
    ! A% u3 a/ J! l4 o- R4 R0 T
  69. dma_addr_t dmaphyssrc2 = 0;
    7 m8 h1 w1 S6 S! \& ~" W
  70. dma_addr_t dmaphysdest1 = 0;
    5 v4 X' A( Y  p- |4 g# H
  71. dma_addr_t dmaphysdest2 = 0;- X$ ]/ w* @  }
  72. ; X& N: |' G( ]5 i6 k5 u' c' ?- m
  73. char *dmabufsrc1 = NULL;1 E0 J: M- K/ _
  74. char *dmabufsrc2 = NULL;1 j4 u! H& i& N3 e0 @( d
  75. char *dmabufdest1 = NULL;
      @- V6 O1 x1 |/ h  X) v, C
  76. char *dmabufdest2 = NULL;' D) n# v) j! \3 d4 p" t* Q

  77. ; V+ p3 Q7 Q- g$ T
  78. static int acnt = 512;
    . y7 O6 d+ K: M5 I1 Y
  79. static int bcnt = 8;# w: x: L0 ~( h2 a/ p9 q% A
  80. static int ccnt = 8;1 D: C" @& i- E# \" [

  81. ( }! F. F( u/ z! S( a0 V4 j- A
  82. module_param(acnt, int, S_IRUGO);& B! z5 e/ @! |2 U
  83. module_param(bcnt, int, S_IRUGO);
    . B9 T/ q* u9 o; N  b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 c' X4 I6 d4 O4 l# C. M) B7 S" U5 X# q: u- `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 c( h  k: U; g) t. O6 N# 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, k4 k$ {1 x; Z& j3 Q$ c) _8 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 x: j/ S7 M5 f/ r) {! Q% r# ^+ R0 G" T/ m: l  B5 Y
4 G% n+ p0 @6 p7 Z4 D1 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 02:33 , Processed in 0.039219 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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