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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  `, e9 w# `. D+ O2 X3 r# j3 U
  1. [code]EDMA sample test application  ]/ d! M  \1 C3 F' I/ k6 m
  2. /*
    9 p) j! w- N9 X+ c$ G
  3. * edma_test.c" E( d; W9 v/ d( w
  4. *8 J5 L. J5 n# y- T1 a
  5. * brief  EDMA3 Test Application, R6 ?" Z8 u+ I& @
  6. *
    ) N! h; J& X; z" |  `! s
  7. *   This file contains EDMA3 Test code.
    & e# {9 ]  {5 M+ y% P, y( Y- X
  8. *4 m7 S+ s* i0 q; o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  Q! _. j! e3 R1 M5 m5 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : P; B: p( s+ f3 F. m7 X# y* k
  11. *         TO CHANGE.
    7 F! ~% [+ y: p2 z" k4 ?7 j/ n: h
  12. ** n4 n" m. j* q9 x( X5 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 d4 V  l& A$ m
  14. *! T; f* c% {" m$ ^0 E
  15. * This program is free software; you can redistribute it and/or" R; i2 e& r- q
  16. * modify it under the terms of the GNU General Public License as) R3 m$ B+ q, S- K) v
  17. * published by the Free Software Foundation version 2.# n$ e8 [  v: f: J
  18. *- _/ P# ^1 r: k5 Y: b! W5 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 I. z6 i! V  L1 |/ o- M9 g
  20. * kind, whether express or implied; without even the implied warranty
    $ h9 S- I% w- Z* |6 |: [, |0 Z$ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % a, ~& f' ~8 D7 Z" E+ s
  22. * GNU General Public License for more details.' a2 @$ O' ^' @( m  }
  23. */
    " A3 o: N- s+ ?0 B3 @, O

  24. ; {2 k6 E' R* [; c2 E
  25. #include <linux/module.h>4 d( S# u0 T( R" H, S0 q: ^; y
  26. #include <linux/init.h>
    ' i5 l7 K% b& F' e
  27. #include <linux/errno.h>
    * A9 W: o! ^* y4 \1 F8 c# U
  28. #include <linux/types.h>! R- y7 Z) b1 {( y- h
  29. #include <linux/interrupt.h>$ v( i& v& J# F, L: ^
  30. #include <asm/io.h>
    - ?3 J% v! r* H9 r
  31. #include <linux/moduleparam.h>
    5 E  S4 V- Q3 H
  32. #include <linux/sysctl.h>0 B- J" F8 N6 c8 y
  33. #include <linux/mm.h>% L9 d+ o0 \; o8 Q2 u8 @# d0 R
  34. #include <linux/dma-mapping.h>4 K$ A. u1 h4 f: e

  35. 0 q8 D0 P" b7 O* A3 }; l5 W  m
  36. #include <mach/memory.h>/ L6 U# |8 ~! t# `
  37. #include <mach/hardware.h>
    ) I1 F( e! [, C4 j3 _
  38. #include <mach/irqs.h>: N1 l2 \2 v+ Z( q; U
  39. #include <asm/hardware/edma.h>
    - W+ L% c1 Z: R7 @. P% X% I7 `/ K

  40. 7 ^6 g, _' Y3 @2 {- I
  41. #undef EDMA3_DEBUG
    + O5 i* Q8 t# r5 G" Q- v
  42. /*#define EDMA3_DEBUG*/
      M7 P( Q" A0 f2 V
  43. 6 {2 Z( Y  B" G4 q+ W4 F/ b
  44. #ifdef EDMA3_DEBUG
    # @, }) a+ L2 z$ w( W0 f: q9 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ~" X1 F, n' T4 \( e4 `: }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 g0 m( c: c5 ?$ {7 ?- s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 {. p$ k/ m  _' Q3 U
  48. #else
    8 h! W* p) g+ I* U$ c
  49. #define DMA_PRINTK( x... )5 z& i7 @( j7 |. @, ?- E
  50. #define DMA_FN_IN
    , N- C- |- A& s5 t, F# d9 j
  51. #define DMA_FN_OUT
    - v2 `0 H# `- z% `( }  L% r
  52. #endif# _: K8 l! t3 F4 Q  M" t! \

  53. 8 x; c. b! ~0 i3 n- V) E- G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- q* _7 G# B, A5 c( v2 }4 l2 X6 n
  55. #define STATIC_SHIFT                3
    1 C0 @$ T# W* b& R5 R+ H4 x# x
  56. #define TCINTEN_SHIFT               20
    ' U; w/ w" V- S% ]& O) d4 F) a
  57. #define ITCINTEN_SHIFT              21( W0 o* j% w( u) m9 j+ }0 i& R
  58. #define TCCHEN_SHIFT                22
    - V+ ?# M  i) ~3 H1 |: t* t) O
  59. #define ITCCHEN_SHIFT               23
    2 r+ v/ D4 e9 n2 U" y. V- |+ y

  60. ( V$ E& X! |6 B6 G2 J
  61. static volatile int irqraised1 = 0;
      R6 ^" Q  l" O0 F
  62. static volatile int irqraised2 = 0;" z+ e8 }1 {: a$ h
  63. * R+ K! h, Z, A1 f- _) u3 c: E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % t5 S6 l' L/ r& o' O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 `6 m* V7 H% V3 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : q! G$ z! _/ e; c7 F
  67. $ P9 b$ t. O: r: h7 F
  68. dma_addr_t dmaphyssrc1 = 0;0 a) g3 }/ ?" W8 g8 K* Y
  69. dma_addr_t dmaphyssrc2 = 0;
    * K6 t. {/ V+ c
  70. dma_addr_t dmaphysdest1 = 0;
    . y' W/ [- w3 q
  71. dma_addr_t dmaphysdest2 = 0;
    ! @2 w. F2 b) n5 {1 b2 F
  72. : I$ A* `) K% Y: b% y
  73. char *dmabufsrc1 = NULL;
    3 y! x% h9 L' Q" L
  74. char *dmabufsrc2 = NULL;, `& t1 R" U  P8 x0 L
  75. char *dmabufdest1 = NULL;' h& `7 ]9 m5 O; @3 U
  76. char *dmabufdest2 = NULL;4 W3 o* C# T& {
  77. " T  @. f+ K, G  O
  78. static int acnt = 512;
    , n! E: b8 f* _& V2 a
  79. static int bcnt = 8;
    5 Z3 G8 b5 P  d/ C: @. h
  80. static int ccnt = 8;
    + W1 T1 r, [  a* g- m/ k

  81. , U1 ]* e" g% ]/ ]
  82. module_param(acnt, int, S_IRUGO);  y1 P  D5 [/ s) z0 T
  83. module_param(bcnt, int, S_IRUGO);
    ' n! J/ ]. o7 q, _' ?+ V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! v; D# j4 E! l) ]( `( U5 Z9 y/ N1 t% r4 m. m3 X  Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" o: z3 k- r+ I" c. ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 G( F/ g! P% Q! ^7 `0 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 k0 G! s1 c3 D9 K2 K* M! c! m, J
. q2 Z: _; w; V# F# m% n

: r' p/ o! v, j+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 10:02 , Processed in 0.038847 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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