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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  J: f2 m4 H5 I/ C' J" {" j3 q5 s5 K
  1. [code]EDMA sample test application
    4 ~1 n0 C" S+ Z) B: N& @$ [
  2. /*, J0 `' I; L. s! }: y
  3. * edma_test.c4 J8 ^. J- `; g3 p, F
  4. *, g- a. j. d+ I. A0 P+ y& |( n+ C
  5. * brief  EDMA3 Test Application1 \! G2 J/ {0 e9 n$ e9 x0 O" F
  6. *
    ; O6 O7 A( @. J8 Z6 W( t
  7. *   This file contains EDMA3 Test code.
      q; l( Z3 J- ^* P  u0 t/ u9 l- d
  8. */ n2 Z1 @! F3 i; C* j' L$ e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) y5 D; [6 a! d" Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 A; \. S. Z$ F* l5 p
  11. *         TO CHANGE.3 w7 Z8 H1 u( |  ]
  12. *
    ( f0 M. k2 \; H  O' D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " o$ l% n1 j8 f/ C  |* X
  14. *# M5 R  u: s$ T# W% _8 t, |
  15. * This program is free software; you can redistribute it and/or5 M/ b' l# X7 }# Y5 s3 ^  `3 p3 p' J8 b9 G; L
  16. * modify it under the terms of the GNU General Public License as
    6 N( ^! q4 g8 c  }0 {) `4 Y
  17. * published by the Free Software Foundation version 2.
    , H( e! B" H7 |% b; a  x; \
  18. *. M. w& s  ]) y; w, x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 b# x2 i; U4 u
  20. * kind, whether express or implied; without even the implied warranty
    0 p; p- Z+ O$ q0 o+ Q( i& O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y$ T2 J& z3 f: W
  22. * GNU General Public License for more details.
    7 E& [2 x, U( E/ T. ]& w
  23. */
    1 o. {) r$ r/ G; K" |3 k

  24. % b$ u1 V) F7 A! h* E
  25. #include <linux/module.h>) K$ Y# v, s& z. d
  26. #include <linux/init.h>
    % |$ \( @9 W# V) Y
  27. #include <linux/errno.h>
    . Y, U7 O& k$ P0 o$ ]
  28. #include <linux/types.h>
    1 K! A0 ?2 t% R5 \2 B
  29. #include <linux/interrupt.h>
    6 D# }4 s/ d& S6 g! q, w+ u% @9 w- J
  30. #include <asm/io.h>
    $ P1 @0 j8 s0 p: n4 ?' l$ V' }4 O
  31. #include <linux/moduleparam.h>
    + H/ c- w% \5 }9 ]) `# |
  32. #include <linux/sysctl.h>8 p6 M! i* a$ m- f# B* i
  33. #include <linux/mm.h>
    8 N* G0 f2 b0 q% g5 R" H8 Y
  34. #include <linux/dma-mapping.h># V* w$ X! j5 C  Z* u

  35. + \/ s6 s% l9 y
  36. #include <mach/memory.h>
    ) {& C/ B: d0 B8 p2 D* d
  37. #include <mach/hardware.h>
    8 I' |: e) D; M7 H
  38. #include <mach/irqs.h>4 T* C) c( A) X. m9 N
  39. #include <asm/hardware/edma.h>
    + @. z! O1 o/ G

  40. 4 p2 D5 b/ @3 ?
  41. #undef EDMA3_DEBUG4 n1 H  p7 `4 j9 t
  42. /*#define EDMA3_DEBUG*/
    $ j  r1 z+ H* q* _

  43. ; M8 B- T' m3 |) r
  44. #ifdef EDMA3_DEBUG: S6 O) r' q) p0 H1 m9 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L. w6 Q9 d# z4 ^# ^( d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( U% t* [: [: ~" V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % |2 d" ], J4 n) S
  48. #else# b/ m4 V! R* X* R0 y# T! V, i3 x
  49. #define DMA_PRINTK( x... )
    & Y5 J  x( @$ T; Y
  50. #define DMA_FN_IN; J9 L  z( |1 t  f
  51. #define DMA_FN_OUT7 B* i+ F  ^2 f
  52. #endif
    3 [- K2 O4 w* v! r2 _' H" u2 i; S! F

  53. 2 }5 I3 U  q8 a/ i7 i! n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 n2 e9 A, H1 B9 L* F9 R& H
  55. #define STATIC_SHIFT                3
    0 p' }- U4 q) v6 q1 V$ f
  56. #define TCINTEN_SHIFT               20+ |  T4 j+ N5 V) O% P- C. F! s
  57. #define ITCINTEN_SHIFT              21' D* `5 t9 h4 f+ v# @
  58. #define TCCHEN_SHIFT                22
    7 ~$ {+ i- q- L5 a5 z
  59. #define ITCCHEN_SHIFT               23
    , Y( F; r3 m+ o! ~

  60. 4 a5 u6 Y8 k9 o2 e) b
  61. static volatile int irqraised1 = 0;
    5 C% z. }& ~. K+ B5 N
  62. static volatile int irqraised2 = 0;
    . ]* W, p; t5 I: F. |
  63. * j* s! u7 z  T( {. E; C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! g' ?9 S3 o- P  L$ W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # @8 X9 j- d  O$ P0 B& F! f6 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# j5 F8 s$ L; O2 ?, ]

  67. : R8 @" M8 ]% O; w% H
  68. dma_addr_t dmaphyssrc1 = 0;
    ; C; K4 [) D  B( a8 E
  69. dma_addr_t dmaphyssrc2 = 0;
    ' i4 H; B& f0 o7 Y
  70. dma_addr_t dmaphysdest1 = 0;
    / U: J( w9 |: R( m9 }
  71. dma_addr_t dmaphysdest2 = 0;6 J  O6 i3 A3 B% Y! _$ {

  72. ! e" _# u. H! s. n! i: {
  73. char *dmabufsrc1 = NULL;
    3 n  W/ |$ G3 Q, v' ]. T- I
  74. char *dmabufsrc2 = NULL;
    6 h; M3 L0 {* S, ^3 ]' j
  75. char *dmabufdest1 = NULL;
    9 P' ~- |, I7 ~& T! O
  76. char *dmabufdest2 = NULL;* R- {. R6 b9 J% \' S

  77. 6 J( g+ x: v" o
  78. static int acnt = 512;
    # w% E  ]4 ]6 |% C5 o6 X
  79. static int bcnt = 8;7 s5 c' b6 j: C/ L* \: @) r, }
  80. static int ccnt = 8;
    ' W  O. U1 {( F  d4 ~0 Q1 [

  81. ' o7 q5 ^% N9 v0 \
  82. module_param(acnt, int, S_IRUGO);
    # g/ Q3 U1 S1 ?7 g! O
  83. module_param(bcnt, int, S_IRUGO);* b( Z5 ~& v2 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, K( ]) S- [) L0 q) w; U0 Z
2 C4 c- K- ]6 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 T7 H  ~/ [* j: G& G9 _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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ~3 J# |8 A) I0 o: w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 w- G! Z0 ?1 r; B  N" t
" E2 O% [) Z4 v& S

1 o/ ~! m( x' x( X: Y& q7 Y# q- E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 04:24 , Processed in 0.041197 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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