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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# t- B. L: \- o2 {7 R" C, Y2 C6 y
  1. [code]EDMA sample test application
    : h% J7 ~: t& v( j
  2. /*
    " _) S3 U  n" c$ G' ~' u
  3. * edma_test.c0 f: q* h9 S4 D" H( ]+ }' e
  4. *
    4 r2 \9 ?9 V- O% ?9 L% M- O
  5. * brief  EDMA3 Test Application
    : H0 z$ |! a- N1 ^8 l+ i6 b
  6. *
    - ~! R0 P: w- l& Z' j
  7. *   This file contains EDMA3 Test code.
      [5 B# z" p8 r& Y
  8. *# z$ U; A) g8 K5 X$ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# v4 q/ O3 T5 ^6 k; v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% g) }" f7 N# ~5 l8 f$ s
  11. *         TO CHANGE., J' U: E1 V4 S& p
  12. *
    + e! @) r' V, v: |% z8 h6 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " H3 s/ X5 q" V+ b
  14. *' i0 I" h8 |- \( q4 c
  15. * This program is free software; you can redistribute it and/or
    5 t7 D% `% {, e
  16. * modify it under the terms of the GNU General Public License as8 C& n8 A8 d# |+ f( Q: m' S  F- J" L
  17. * published by the Free Software Foundation version 2.
    2 ^/ a* i! L# p! X7 x
  18. *
    ) `3 k/ I$ x4 d: d+ t! j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- X9 q$ D" h- ~. K7 s
  20. * kind, whether express or implied; without even the implied warranty* X& H3 T" b& [0 v! \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ Q9 f: c) ?* x8 y
  22. * GNU General Public License for more details.5 [4 _5 J- D+ H, _  Y4 n0 R+ [
  23. */0 k- R8 U( K  V" j$ s1 y
  24. 7 b0 L% J! n* D1 G2 h* j; e( f
  25. #include <linux/module.h>
    0 R0 x+ p% a+ h3 n0 c
  26. #include <linux/init.h>0 ^- }! C; u9 @: i7 D  d* l- P4 Z
  27. #include <linux/errno.h>
    ) P. \7 g2 D! s# y+ c
  28. #include <linux/types.h>& A* k2 Q) y2 g# J: g- U
  29. #include <linux/interrupt.h>
    * m7 N# f# |; q9 M
  30. #include <asm/io.h>
    6 v1 o; \6 H3 `* C6 K
  31. #include <linux/moduleparam.h>3 \( S$ \$ U& f0 X) y1 l
  32. #include <linux/sysctl.h>
    ! `. \5 i* a1 l; J  [" p
  33. #include <linux/mm.h>1 i8 ^9 I% S& T( ^9 U# `
  34. #include <linux/dma-mapping.h>
    5 u3 A$ l6 `5 a) n: c

  35. * o  @. J* m( Y
  36. #include <mach/memory.h>
    ( K3 h( H( H$ \
  37. #include <mach/hardware.h>, w3 w' W) W1 Q* _0 @' Z8 h
  38. #include <mach/irqs.h>1 P" ?. y/ E% k% `" h
  39. #include <asm/hardware/edma.h>
    8 f0 a2 a8 Z! o9 R% J' o6 z% J
  40. 3 m# |4 A6 ]' E5 H
  41. #undef EDMA3_DEBUG
    / _4 y- u7 |8 q! {1 e
  42. /*#define EDMA3_DEBUG*/
    " {3 b1 I9 e1 ?
  43. 7 L+ d/ ?0 |' i1 S* j+ B
  44. #ifdef EDMA3_DEBUG
    9 y: J' F, B5 y$ i' t) v1 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 }) D5 j  \4 b9 E) [# m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! P5 n" r  j5 B2 ~# r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ [; n, ]9 \' e( x3 @
  48. #else
      I  X$ f  g0 E0 \0 F1 D
  49. #define DMA_PRINTK( x... )) C/ N) g2 E# @
  50. #define DMA_FN_IN
    ) N" u) P/ S9 D& a
  51. #define DMA_FN_OUT# L& Z) r3 x# v& n  P7 t4 n6 i: f
  52. #endif* r% O) q: r# P. E
  53. " ?: E2 r0 ~# O: M! h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 {7 H/ k; y- y% @, z0 L& [; F
  55. #define STATIC_SHIFT                3
    # V% J  @3 f5 y1 p: b
  56. #define TCINTEN_SHIFT               20
      F/ J; e/ L% R5 ]' U% t
  57. #define ITCINTEN_SHIFT              21
    7 \! C% Q! }5 [4 L! D  i: Y5 u( m
  58. #define TCCHEN_SHIFT                22  L% b: f' K. s. M6 d
  59. #define ITCCHEN_SHIFT               23* _, q; i% Z4 W

  60. ! F& }9 t5 f: P% J  I
  61. static volatile int irqraised1 = 0;
    4 j3 r8 b- _$ j/ z, c5 s# f
  62. static volatile int irqraised2 = 0;0 n; w0 T' x: D( k: h

  63. 4 m7 z0 G+ V, L5 B8 a+ u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% e* |, \2 s, l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; t2 O3 _' f7 l* Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # |& N; M/ g: F
  67. 3 W: C. [: C3 F; c5 ^! n
  68. dma_addr_t dmaphyssrc1 = 0;/ r; ?+ J4 z) r9 G
  69. dma_addr_t dmaphyssrc2 = 0;
    4 q7 P* z" R3 @# e0 K7 N% V5 o4 e3 R
  70. dma_addr_t dmaphysdest1 = 0;9 D) O* |8 X0 c4 K
  71. dma_addr_t dmaphysdest2 = 0;
    : @4 m0 l, T* e# t6 g

  72. , U  o  n$ E3 t
  73. char *dmabufsrc1 = NULL;
    ) y# P+ l; T/ n& ]9 @
  74. char *dmabufsrc2 = NULL;/ P% Q) N! |5 n/ m
  75. char *dmabufdest1 = NULL;' @5 C" ?/ k9 t6 W' E
  76. char *dmabufdest2 = NULL;
    + w% M) W6 ]5 M# P: `" N8 j

  77. ) x  H& h' ^; I  }# q4 O* {
  78. static int acnt = 512;
    . G3 a0 r2 _+ _) V* O" [* r
  79. static int bcnt = 8;
    ) o. [9 P+ w' _& Z  C
  80. static int ccnt = 8;, K9 s3 H2 G, L1 Y. O

  81. " t) G6 ~& j* O
  82. module_param(acnt, int, S_IRUGO);! V6 }' c' c0 P8 ?; v9 G: g
  83. module_param(bcnt, int, S_IRUGO);
    # M4 a% ]8 k& a9 S4 j) n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 |7 |& h' R; q5 M
( G* V& |4 ~5 `1 H; c4 M) y% F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N( U& f  A( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# d* N9 u; K, H+ z" A: Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; s8 d1 Q0 {' }, s9 I+ H7 J1 K8 |

; W+ P6 z/ z! D7 x! P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-20 01:26 , Processed in 0.036991 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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