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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 ]" J) ~7 E$ h' t7 h$ ?
  1. [code]EDMA sample test application9 C% `6 `0 O! \
  2. /*% R7 k7 b9 K7 v
  3. * edma_test.c: p5 R$ R0 M' q; W) }$ T/ z
  4. *8 }) N. H+ T3 I* [. O! x3 T
  5. * brief  EDMA3 Test Application
      L3 T3 g5 y( ^
  6. *8 R) B9 }6 X. C( y# v5 r! f
  7. *   This file contains EDMA3 Test code.
    3 d" J: F( P& U& m
  8. *
    0 j2 V7 |3 c" z5 K3 B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* \2 J1 f# ^2 z+ b, T0 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      r5 f2 b. C2 T4 }6 M: b2 M# `
  11. *         TO CHANGE.
    : L) f2 {; `2 \6 ?0 v
  12. *2 v, K" Y* {2 k9 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . H1 `3 i; ?( B
  14. *
      _" t$ W, m; ?
  15. * This program is free software; you can redistribute it and/or
    4 A, u2 @6 q" g# X9 q
  16. * modify it under the terms of the GNU General Public License as
    " S2 H- w( H$ A0 P# Z
  17. * published by the Free Software Foundation version 2.# X2 s/ R. i: p! H3 |
  18. *6 ?( s( t3 R2 i# W( ~- A; d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# E/ v* g4 L9 X! \/ a/ M2 n
  20. * kind, whether express or implied; without even the implied warranty% }- G" I# G% x) c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * S+ r* U3 ?, u' h+ K( |. F
  22. * GNU General Public License for more details.! z! Y& U, k0 n/ }8 k; ^. X
  23. */+ V* ~  ~; V, S; Y& y: B9 G  U, L

  24. # D4 j+ r5 X% `2 P& y/ D1 A! Q7 P8 I
  25. #include <linux/module.h>
    . ?3 a; h; N' G
  26. #include <linux/init.h>
    8 B/ t& l4 N3 G8 _" h* k% V
  27. #include <linux/errno.h>) S4 |9 g2 r: c6 R4 ]' O1 w
  28. #include <linux/types.h>  b3 ^# t* k7 v9 \7 |, r% H! }3 `
  29. #include <linux/interrupt.h>0 S& N4 ]6 u8 ^: G
  30. #include <asm/io.h>( W$ `" ]- N' j3 @
  31. #include <linux/moduleparam.h>$ `5 s/ L$ B& Q( o3 r% h4 B6 Q
  32. #include <linux/sysctl.h>
    ' j9 {% M2 M: D4 o
  33. #include <linux/mm.h>
    - V; ?6 p+ w' Q( w
  34. #include <linux/dma-mapping.h>$ ?4 O' A2 m6 d( p5 T! h
  35. 0 b/ _1 h: X, J+ H" |
  36. #include <mach/memory.h>
    0 f+ l' d+ }6 @$ E* X
  37. #include <mach/hardware.h>
    + S( k7 R6 h- U4 F6 G) N  @
  38. #include <mach/irqs.h>
    7 W* e& E# q7 k0 B
  39. #include <asm/hardware/edma.h>
    # U/ J4 B: i& I( v

  40. ; R3 w: ~1 U$ ^: Y
  41. #undef EDMA3_DEBUG
    " f* G- P9 p3 F: j+ {; @4 ~
  42. /*#define EDMA3_DEBUG*/( A. Z7 g3 z4 _+ g( p" [# \) Y* m
  43. " ^, p  A. m( Q* R6 A' D* k: p. e
  44. #ifdef EDMA3_DEBUG( T9 ~0 F# P9 V4 U: ^4 F  k, G+ m6 ?# O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 K5 |! ], K  c9 g# e/ I1 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ z# w* e& P2 G- w7 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : W3 n6 k! @* ^  l3 Q, D
  48. #else
    " _* l  }; |8 F9 @6 W: \: k
  49. #define DMA_PRINTK( x... )
    & M( H. [" [9 G  n' H' [* f
  50. #define DMA_FN_IN$ M9 o* _2 \! D* \; T% v5 K9 B2 T4 J$ Q2 V
  51. #define DMA_FN_OUT7 R- q3 P- D; i: m. m9 {
  52. #endif
    * w; T- a! J" a2 A7 M

  53. 9 u; L5 k- Y+ ?6 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( v: v- F- W/ Y% m6 H7 f
  55. #define STATIC_SHIFT                3# o/ f$ Y% O' h8 I
  56. #define TCINTEN_SHIFT               20
    ( T6 ~" J5 p9 G" l- x: O% Z1 i
  57. #define ITCINTEN_SHIFT              21, W  ^/ {  D7 V- T7 a+ h+ n
  58. #define TCCHEN_SHIFT                22
    8 X/ Z' }9 }! K# i$ t
  59. #define ITCCHEN_SHIFT               23
    2 D( I* I: Q  _

  60. * {& r" f# y% O4 k8 f- M+ }
  61. static volatile int irqraised1 = 0;1 }2 l6 v" b3 S7 j, p% R& Z
  62. static volatile int irqraised2 = 0;! o5 G3 w8 r8 f* V. z, I
  63. # K" {7 @3 D# x( M# A3 g2 ?* l* Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Y4 N4 D5 Q( u4 A7 H% X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , A$ S2 `! n* A0 _' n7 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 S+ }3 T. f6 q( Y* J  u8 b
  67. 6 h/ D; L5 s/ n1 W
  68. dma_addr_t dmaphyssrc1 = 0;& |( C( l2 y% P- j( ]/ y' z, H
  69. dma_addr_t dmaphyssrc2 = 0;
    + W8 z% j, \3 l; N/ y9 E
  70. dma_addr_t dmaphysdest1 = 0;5 @/ M* u- L" ^+ D  ~$ o5 p) {
  71. dma_addr_t dmaphysdest2 = 0;
    ! h% W/ O9 O: O8 D% \$ ^

  72. " K( J" R4 R' ]8 g' D# {: m
  73. char *dmabufsrc1 = NULL;# l5 c7 G/ ~+ F5 \) J1 I
  74. char *dmabufsrc2 = NULL;
    2 K4 U2 R, G4 m  B4 c' v& W6 @2 k
  75. char *dmabufdest1 = NULL;1 o" y7 m& \9 W* y2 L
  76. char *dmabufdest2 = NULL;
    + F2 s% q- b3 l  M7 v6 r; B( X5 }- q$ u

  77. % C5 X2 j+ X+ p% L: `- K# D
  78. static int acnt = 512;( ~9 W6 X9 h& e. U
  79. static int bcnt = 8;5 }7 K9 c2 U% N6 m5 v$ {
  80. static int ccnt = 8;
    # p, ^. r: @! s; r6 I

  81. ( q. P9 n% D5 w
  82. module_param(acnt, int, S_IRUGO);, r. c, x+ Q; k5 g! a: Z: u$ j
  83. module_param(bcnt, int, S_IRUGO);
    % U1 D- x- p$ {6 B1 _$ L8 C6 g
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# y- R6 i4 a* J/ Z$ Z; C$ ]
- b4 k; N, ?; E. t- {! J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 G( |# B  ]# B* T
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) v' J1 L% q( q4 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 P7 _3 E) ^% s* H2 n5 n6 e4 h
& L7 V# y- n6 U- f+ l" m

1 _. R2 I# g. |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 13:54 , Processed in 0.039860 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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