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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 z+ W& ]9 a% b
  1. [code]EDMA sample test application
    - v/ l" G' w/ T' j3 G& E! d
  2. /*/ r. S. B' a3 Q. \
  3. * edma_test.c  }+ i" g" G6 W- d' I0 j5 ^
  4. *
    + v7 [  d  `% B( E3 A
  5. * brief  EDMA3 Test Application
    " Q# o# }, f, Q: N6 |2 b% N
  6. *
    , e' B; `$ ~6 \
  7. *   This file contains EDMA3 Test code.
    / g: y: o& X: B, N7 I
  8. *
      J% F. ]4 e: v9 N$ j' W8 h  f4 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* f  r( U! J) {5 I& Y6 c. E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. s2 x  [3 N9 H/ L7 h  c' N
  11. *         TO CHANGE.) }& n) W! ~" x) ~. J. w" o
  12. *& N  o/ v5 j2 B8 |8 O5 I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , ~+ L  m9 |! I! D
  14. *: I4 n% O# s8 M& B9 z
  15. * This program is free software; you can redistribute it and/or; }+ p4 ^' M7 b. n% W+ l
  16. * modify it under the terms of the GNU General Public License as+ i( Z% \# M6 [. z6 _. g6 ^) p
  17. * published by the Free Software Foundation version 2.6 \' D3 d  C4 N1 A: Y0 H( M
  18. *
    / M, g# N6 Q' G# r. T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! V- W- N8 |1 S' ?* j
  20. * kind, whether express or implied; without even the implied warranty4 K9 d/ ?& ~/ c# t" F$ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ D4 n3 _& z; K" E* r6 V* U
  22. * GNU General Public License for more details.
    1 R- H* s6 T/ T. I
  23. */
    2 Y# \  @6 X, j# `* O2 s0 h0 u! R

  24. 4 l- S6 n: o5 {% l
  25. #include <linux/module.h>
    5 w; l4 m0 F9 `9 [- ]
  26. #include <linux/init.h>
    # ]4 m' k. |; t4 I) d6 m! {
  27. #include <linux/errno.h>
    ! q- G! A. J: W1 {5 d4 Q& ~
  28. #include <linux/types.h>, B( Z2 _% m+ E$ ^0 D9 y! s" i$ G7 n
  29. #include <linux/interrupt.h>
    2 G2 V. e/ ^% e3 C
  30. #include <asm/io.h>
    / j7 m% J5 d" |/ P
  31. #include <linux/moduleparam.h>  C! R7 l3 ^6 i9 Z
  32. #include <linux/sysctl.h>" {( O/ K5 k/ L! E& g' m$ ~6 B5 d
  33. #include <linux/mm.h># w% I# k/ e5 y
  34. #include <linux/dma-mapping.h>) @4 ]2 {5 y# s( P, e6 C4 v

  35. 5 r' k+ \; N$ z/ q7 h
  36. #include <mach/memory.h>
    / G0 Z4 W( B( |  G# i7 }" b
  37. #include <mach/hardware.h>
    ) t1 }+ q; ~" F/ j- n# x! W3 w* ^
  38. #include <mach/irqs.h>
    + G! |+ l" R0 {; P2 Y
  39. #include <asm/hardware/edma.h>
    ( b1 [* {6 [6 L: g1 T, ~& f
  40. 8 R# a: C6 D% ~+ b. i1 }( g# ]1 N/ r
  41. #undef EDMA3_DEBUG, r' o, ]( q* k$ B7 k8 t, R1 F
  42. /*#define EDMA3_DEBUG*/
    ! q# z& Q$ N! H* ]

  43.   {" W3 A8 F5 T7 D" X# l4 [
  44. #ifdef EDMA3_DEBUG, o" m9 ^% j2 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * Y# l, j. h* ^. }  t5 P) D3 P" \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). I: E2 S5 d; E% z) w1 f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ s6 s2 ~5 j* j" r( F/ g+ U2 B
  48. #else
    * w, u% m0 G7 c% S' Z8 ~1 x, V
  49. #define DMA_PRINTK( x... )( g6 m. q! Q$ D3 @
  50. #define DMA_FN_IN
    2 r" @% a! }& R+ N, [' ~& k. l% r' B
  51. #define DMA_FN_OUT
    1 s8 n* N9 T0 i' W1 e1 }9 z
  52. #endif
    1 d: v) V8 L! F% }$ _( c& p- U

  53. ) ?: ?8 G$ v' B& T, H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ P( T7 S, B* F  z0 d# ^9 V/ o5 {, w
  55. #define STATIC_SHIFT                3# _- U5 A9 o; t: b
  56. #define TCINTEN_SHIFT               20# X- ?/ @6 [3 X' X
  57. #define ITCINTEN_SHIFT              21
    7 ?0 R& b) W& p
  58. #define TCCHEN_SHIFT                22! f# d0 J- L2 [4 h% t
  59. #define ITCCHEN_SHIFT               23
    " ^+ T$ R/ p2 S
  60. ( M$ ^; q  z9 {+ D/ I
  61. static volatile int irqraised1 = 0;* b/ ^; Y# @" X6 o
  62. static volatile int irqraised2 = 0;
    + R9 d2 X' X9 G; O# j4 T# J- _6 a

  63. 4 E5 e8 T3 p4 Z4 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ^/ N! |* b; N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 B6 E2 O; f% g* f* t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; ]& S. |3 S% k; y5 j+ e# C
  67. ; s( O& H- A% }. j
  68. dma_addr_t dmaphyssrc1 = 0;+ e* k1 ~& a7 L7 e
  69. dma_addr_t dmaphyssrc2 = 0;. E- x7 C9 R/ S, ]& @
  70. dma_addr_t dmaphysdest1 = 0;/ O6 }8 |. i6 B
  71. dma_addr_t dmaphysdest2 = 0;
    1 l7 F) _# a4 z% p- Y, z
  72. 2 f: p" K" N2 Z) j: G. l) R
  73. char *dmabufsrc1 = NULL;9 `% h" l* \+ I
  74. char *dmabufsrc2 = NULL;% S  U$ K& d. D7 f4 f
  75. char *dmabufdest1 = NULL;0 B/ B0 W- C+ K( h) t1 G$ j- F7 J
  76. char *dmabufdest2 = NULL;6 C% a% a8 B- Q. z7 |4 D5 q
  77. / ~6 ~. g, @- O2 Z# L
  78. static int acnt = 512;1 Z6 h$ r4 r  w8 x# {
  79. static int bcnt = 8;
    * c% t4 {6 {9 s# ^' C+ H0 }
  80. static int ccnt = 8;, w* _  H5 A+ d/ P& S+ D# K* z

  81. 5 o2 U( g) ^/ Z- t' M
  82. module_param(acnt, int, S_IRUGO);
    $ Z7 \8 j# v: P1 S- X
  83. module_param(bcnt, int, S_IRUGO);
    3 D" T7 C- \1 Z3 R" Q" o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; J) S3 [4 `) b$ s. _: c0 R  Q. X9 k  p7 _' @: i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- r; H0 E9 q3 g% `: H& i- qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! [% ]: W1 C8 M2 ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! z8 y/ I- G0 F9 X! W7 d: y
/ ?4 Z, [; u  P( j
; F) q9 H5 @/ a4 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 06:39 , Processed in 0.040251 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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