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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - R* y" M, t- }
  1. [code]EDMA sample test application; G" r" h' J% O
  2. /*
    , e+ C  j0 i8 c/ k& ~: s  U
  3. * edma_test.c2 b: D" M* O) [5 m6 \
  4. *
    3 u+ }+ `) d7 i; _; p) K+ T5 h
  5. * brief  EDMA3 Test Application" X7 i! |" Q/ @+ Q/ g& D
  6. *
    # T0 }$ o0 P1 K
  7. *   This file contains EDMA3 Test code.
    + r' _* W6 u( I+ W: a
  8. *
    $ d4 R* e7 V4 N1 ?2 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 E, Z0 b- ~. l4 K/ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( l$ k5 A+ k& D+ U- H
  11. *         TO CHANGE./ G+ D$ }) e3 g( F
  12. *
    ) [. v* d, ^. b# d4 i! @- c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- {% r9 Z5 A' s9 b, e! `& B7 p
  14. */ |0 J' L7 O2 \0 |
  15. * This program is free software; you can redistribute it and/or
    ' Z; x0 Y, W% m( j! E' ?( ^- g
  16. * modify it under the terms of the GNU General Public License as' B1 N& k+ r1 q, o8 ^
  17. * published by the Free Software Foundation version 2.
    5 ]+ C+ d* v2 ^
  18. *  s/ N, S' @! _* C$ @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! d" D: ~5 q0 \" t4 C. E" @
  20. * kind, whether express or implied; without even the implied warranty
    ! I: a8 L) o+ b, J' _( C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! @$ K8 v. q1 _
  22. * GNU General Public License for more details.; r- P( k* J5 a$ G% K- \; o- h& N
  23. */
    ' X: n+ I% T. e2 _
  24. 4 Y6 U" Z, f( [6 R* F$ ~) n
  25. #include <linux/module.h>' G6 q% j2 u3 h6 h
  26. #include <linux/init.h>1 W' D( t* D! L
  27. #include <linux/errno.h>, k; e/ R, F2 ?. c7 A8 r, D
  28. #include <linux/types.h>9 ?: j6 f8 a- g
  29. #include <linux/interrupt.h>5 P2 ?# a: [4 ?* W% v: `0 y
  30. #include <asm/io.h>
    & i3 o% t# s5 c& {9 q, T0 J
  31. #include <linux/moduleparam.h>$ D* J. r: r9 D, L8 l
  32. #include <linux/sysctl.h>  j. T* Q1 f  H* d( }4 \2 c0 _! ~0 n
  33. #include <linux/mm.h>2 h. l. J; K8 @. v. ]0 K" N7 ]
  34. #include <linux/dma-mapping.h>
      _8 d9 A0 [" ?/ c) [
  35. - }5 S2 z% l9 v$ Y% g" y/ X
  36. #include <mach/memory.h>
    : q  |1 S. m. ~! w
  37. #include <mach/hardware.h>
    / @: m* F* o) C2 p. Q( H, [
  38. #include <mach/irqs.h>: {( g; T9 Z, z# G
  39. #include <asm/hardware/edma.h>4 F/ y0 {; ^$ M

  40. 6 P+ u6 o. {  \
  41. #undef EDMA3_DEBUG
    2 S$ j1 t1 g* _$ ?- ?8 x  _
  42. /*#define EDMA3_DEBUG*/2 ?# [; F+ g6 T  K" u

  43. , u- q- l4 P; y$ r
  44. #ifdef EDMA3_DEBUG
    ! j$ C- P4 K# i& |* G1 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! p! a) E* {) g3 f3 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 {: f3 c' h- h3 B! `4 X  |) K+ a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : j, A9 H! h% |$ J6 L. P, w
  48. #else
    - Z) L# ~, t2 m: Y! q3 |, G
  49. #define DMA_PRINTK( x... )* V6 ~# }. `  k9 R. ~" [# b
  50. #define DMA_FN_IN- ]5 l0 v2 H' c5 c( S$ D$ y
  51. #define DMA_FN_OUT
    2 x$ J$ @$ K# Y9 D. @, r
  52. #endif
    ( i& f! ~5 D! G" P

  53. " X, q1 o% d: R  S$ p5 z3 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / |. X$ R4 G5 u/ j8 S2 ^
  55. #define STATIC_SHIFT                30 W8 |9 I; C5 K6 t% o
  56. #define TCINTEN_SHIFT               20
    1 k4 v7 H0 ~% E3 R5 y
  57. #define ITCINTEN_SHIFT              21; D" ~3 @" }+ j8 T- c- J9 C: l
  58. #define TCCHEN_SHIFT                22$ B8 }' s1 z1 n  r
  59. #define ITCCHEN_SHIFT               23$ n+ G! n7 ], k* D* f' i
  60. 5 U' I8 \; F- |
  61. static volatile int irqraised1 = 0;# W0 W6 S- \. L" Q% u
  62. static volatile int irqraised2 = 0;, D( q5 Q- ^1 J0 \
  63. 3 c* o3 M% V* P, R# E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! A; [, X$ `' N( V- e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      _  L' f7 ?# I: }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 x  Y& `9 k4 u8 T8 h6 [- q
  67. ' _  n7 G$ d$ l6 [
  68. dma_addr_t dmaphyssrc1 = 0;( Q  {) _6 G1 p1 _' u/ d8 G
  69. dma_addr_t dmaphyssrc2 = 0;
    2 b7 u- j. P; G% v& F& ?3 f2 K& ~
  70. dma_addr_t dmaphysdest1 = 0;
    , T, \! d2 e+ H3 q3 y$ _
  71. dma_addr_t dmaphysdest2 = 0;
    - @( z9 q# E6 s+ f% u. M

  72. ( \0 n: U: T, M3 o6 G- [. A
  73. char *dmabufsrc1 = NULL;& @' A2 h4 F" R8 a$ M: L! [
  74. char *dmabufsrc2 = NULL;
    6 i" H2 ~+ ~4 G: q5 Q, T+ {
  75. char *dmabufdest1 = NULL;7 _& h9 q2 u2 h: |3 z5 d, @8 r- `
  76. char *dmabufdest2 = NULL;
    ( Q8 c+ F+ b7 ?0 B' Z0 i, C

  77. 9 F( B1 L- g7 n
  78. static int acnt = 512;4 M3 Y5 P8 L* {, \2 r
  79. static int bcnt = 8;6 ?1 f* V0 n) k, Z  f6 Z: ~
  80. static int ccnt = 8;
    8 ?! d  ]. ]! B  [1 A
  81.   b0 c# }  l& P$ e% [  M2 `
  82. module_param(acnt, int, S_IRUGO);
    # \# k0 v4 k2 H# n" v+ c
  83. module_param(bcnt, int, S_IRUGO);. {8 P- G3 `4 A; s, @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! \# Z; T& w& ?5 i9 Q, k$ V1 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: K. z3 ~: x" p; Y8 }7 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 y8 i( S1 n1 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& M+ ~/ }9 w$ i0 O

1 }! M) g+ K- X( j( y+ |! d4 W/ ^6 R% S. b3 l: o& S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 12:02 , Processed in 0.039376 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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