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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + w" d/ M4 b0 H& _
  1. [code]EDMA sample test application
    2 L4 Q, L: V2 K# l
  2. /*$ K% O( p" \/ P; X1 _$ Q+ o
  3. * edma_test.c' h( x, L+ H  G
  4. *) j$ O! M5 E$ E* P$ j
  5. * brief  EDMA3 Test Application
    + _7 X" t3 l% ^
  6. *: x% p3 s% ~. ]$ \1 o- h+ G6 ]
  7. *   This file contains EDMA3 Test code.9 U& |7 u( g2 T! P! |! r
  8. *
    ( l/ l' \' E  s8 w( @% K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * z8 N. U7 A0 v8 V/ ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 `; V1 T) C1 v
  11. *         TO CHANGE.
    0 p6 l, K" E7 Y
  12. *
    & c  T+ w% l# f9 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Q# T9 N) h9 N2 L; W! R
  14. *
    , o) m  s. D! T* l
  15. * This program is free software; you can redistribute it and/or. _+ I8 S* m5 ~9 s& R5 H% s! @
  16. * modify it under the terms of the GNU General Public License as! S2 V5 y: K* ~' T. T7 E
  17. * published by the Free Software Foundation version 2.
    $ c& j) d8 |! a0 Z, L6 i5 b
  18. *2 d5 S2 z" t$ g4 M2 `( H7 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Z+ N6 H* ^) \$ P* W
  20. * kind, whether express or implied; without even the implied warranty( J7 z8 r. b& i6 N3 F$ p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 q  j, \7 Q+ v1 x  x2 E4 W& ?
  22. * GNU General Public License for more details.
    ) G4 |7 w; K( [4 i4 r( f$ R
  23. */
    7 ]( N" ~$ y" o4 g2 Y" a  }

  24. + |0 g; @. ~. ~) A: n" g6 Y5 K
  25. #include <linux/module.h>
    & {' o" o, p# m$ Q5 O* C8 G
  26. #include <linux/init.h>
    - }; v  i7 J# c3 ]; y2 t
  27. #include <linux/errno.h>
    : R$ B: U" L( m: r
  28. #include <linux/types.h>3 P# b/ b9 O, b% L
  29. #include <linux/interrupt.h>' Q- }' x, J0 v4 B
  30. #include <asm/io.h>
    8 C& `- o2 V9 Y# m
  31. #include <linux/moduleparam.h>3 h4 Z8 R5 F) C7 I5 [
  32. #include <linux/sysctl.h>' {8 W; m  x4 M4 ^; ^- f- W, f
  33. #include <linux/mm.h>
    ; ?* ~/ O" ]6 {0 a9 z
  34. #include <linux/dma-mapping.h>
    $ f2 {, N7 E3 ~  @$ @/ C" Q% e

  35. 5 |: ^) K" `0 ^! @! x8 `
  36. #include <mach/memory.h>3 [0 G3 S7 N. K& ^7 H! i1 j  I
  37. #include <mach/hardware.h>* t5 I6 T0 Y, Z' S
  38. #include <mach/irqs.h>3 U& E& {0 g; s. H1 H1 K. C  G) @& {
  39. #include <asm/hardware/edma.h>6 }$ f7 l- @! G- P/ X' v$ i' c
  40. / e" O: z: C, p$ t
  41. #undef EDMA3_DEBUG3 E% F6 D+ [4 Z  A' I$ L$ L
  42. /*#define EDMA3_DEBUG*/* `- N& L* j4 J

  43. 7 w4 b0 g; z+ d1 @7 X1 p+ F9 W7 f% y
  44. #ifdef EDMA3_DEBUG, Q' z! w* y- S9 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 [4 T. W; }3 C7 p+ \5 F2 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* o2 V# i, j3 T* u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 e1 X4 g8 q! d, @) A1 n
  48. #else5 }, M' @+ j9 x3 A; j
  49. #define DMA_PRINTK( x... )# {7 w9 d4 ~% Y! V' ~$ a& c- C8 z# ~
  50. #define DMA_FN_IN# z. n1 J# ]3 ^
  51. #define DMA_FN_OUT
    ' D, e0 z+ y3 |" a& z1 A. A9 H# v
  52. #endif
    & W$ h) u$ `( k2 G/ M
  53. ' @: y# R# j6 n: Y/ M+ u0 `, W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' B8 q; A# H  [* M
  55. #define STATIC_SHIFT                31 K( I. i; \7 c! C% @/ F# _3 R. z
  56. #define TCINTEN_SHIFT               20; |9 G6 M' U. Z/ \3 T$ F+ V
  57. #define ITCINTEN_SHIFT              216 G) v, \6 B9 |6 ]
  58. #define TCCHEN_SHIFT                22; b  s5 K! o/ b% b8 t
  59. #define ITCCHEN_SHIFT               23
    * j) {& Y9 I( w

  60. * N5 I7 m9 h' E7 ^) G, o4 o
  61. static volatile int irqraised1 = 0;
    / B8 b1 J& \9 l  L' B& i' Z
  62. static volatile int irqraised2 = 0;; I+ @; E) o% L9 l
  63. + P1 F" z1 }, w  N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; V! b+ B# l1 b! t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M" a1 M9 u0 ~8 g9 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - G" e* @( {3 _7 m: ^9 v- c- a

  67. , g3 S$ H' t: e/ t
  68. dma_addr_t dmaphyssrc1 = 0;
    - P' v6 E( U/ I  o! M( i. b$ O
  69. dma_addr_t dmaphyssrc2 = 0;
    : d7 J) S8 y3 Q" u. e9 L
  70. dma_addr_t dmaphysdest1 = 0;
    9 U$ Z4 q8 }1 v( z* q
  71. dma_addr_t dmaphysdest2 = 0;$ u# z5 G3 Y" G/ w+ u; i3 u5 L

  72. 9 v$ W. V1 h% y' m4 R) [6 `' R
  73. char *dmabufsrc1 = NULL;3 u, P( ]0 F: Z( T5 F, N& L( a
  74. char *dmabufsrc2 = NULL;
    . u+ q* g: l: B6 K. R+ a; `1 [$ h
  75. char *dmabufdest1 = NULL;
    3 V) }* I: ]: q
  76. char *dmabufdest2 = NULL;7 o2 F5 x) F+ n
  77. 8 z& l% H! Y4 J* c9 u; l2 f$ u
  78. static int acnt = 512;
    5 [) y8 w6 _4 d
  79. static int bcnt = 8;, x" N* D- o4 h% I3 B6 U* j
  80. static int ccnt = 8;
    , c% v8 i6 n2 I

  81. 7 j8 b0 {/ y0 v0 ?
  82. module_param(acnt, int, S_IRUGO);
    ; q* n: Y2 s8 {
  83. module_param(bcnt, int, S_IRUGO);+ q5 J( P" ~+ T9 I2 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 m, k1 Z, {: v: l3 N# m9 i+ e; n* X+ u, V, i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 j2 E( `, Q* e4 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 B4 r4 Q8 Y! S/ Z3 c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& E; m6 p. R- C8 F
5 Y/ y. K0 l3 P! {; y+ U. [
7 z& l( a8 W3 l2 c7 r" s: F1 y# ^' `9 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-9 20:14 , Processed in 0.043787 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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