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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 b3 Y3 l- w) S
  1. [code]EDMA sample test application
    & Z" d' ]8 N" b/ F2 ?# _7 }" c
  2. /*
    0 Z2 i. |& \. E
  3. * edma_test.c
    ' O1 l( P8 p  i
  4. *
    6 f/ k( {; ~  c& |6 j" ]
  5. * brief  EDMA3 Test Application
    9 m& h8 B2 C: O' x( M" [
  6. */ W% r: B3 K) I& I
  7. *   This file contains EDMA3 Test code.
    3 e) K. W9 c) ]5 ]
  8. *) q( |% ?: [, d: q2 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 h6 @2 c) H" c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F6 ?# a' e% B
  11. *         TO CHANGE.0 J( h4 t6 _, J4 g
  12. *4 l: }- Y, B5 a* s6 k6 H, r7 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  }' o) i, S! r
  14. *3 I2 e+ n3 i0 b
  15. * This program is free software; you can redistribute it and/or
    ' I! O' Z* K* C8 @2 p& w- B
  16. * modify it under the terms of the GNU General Public License as: M* r1 p, A% P' m# A
  17. * published by the Free Software Foundation version 2.
    7 p$ p! w2 ]( q! \5 p5 O
  18. *. B1 f+ q# }8 ]2 P- b5 L, ]* i9 X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 a) _8 d+ K& Y* b
  20. * kind, whether express or implied; without even the implied warranty
    5 Z! X2 b/ W0 G% m  X' K/ Q$ z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* I6 d# b9 h8 N0 m1 s
  22. * GNU General Public License for more details.& U1 \; x1 r2 c# N
  23. */# d3 q# W: y( y0 L" R0 r

  24. , S3 Q- n8 C$ [2 ~. W% \- s
  25. #include <linux/module.h>
    4 D! @, p2 X* x) N3 M
  26. #include <linux/init.h>& t& _, W) J: h* a( I2 ?5 j" a' ^% K
  27. #include <linux/errno.h>
    4 U' S- `0 H/ }" V4 A: a
  28. #include <linux/types.h>
    & K4 O/ d% w  e+ u
  29. #include <linux/interrupt.h>3 I" f  Z! p3 Y( Q# c% g
  30. #include <asm/io.h>
    8 M& [) v, u. o2 Y& f6 q. F
  31. #include <linux/moduleparam.h>2 {0 k4 G# f0 t9 G1 I. z
  32. #include <linux/sysctl.h>" V: n  c) I; l3 B
  33. #include <linux/mm.h>
    % f$ `# Y' S' h! i1 @. ~
  34. #include <linux/dma-mapping.h>
    ' R6 u9 {% S2 N

  35. 7 L* s7 H5 l" k, P6 m
  36. #include <mach/memory.h>6 L' X  j/ J& g$ w0 y
  37. #include <mach/hardware.h>
    ( C6 T( ^" a+ O" A8 @' Q
  38. #include <mach/irqs.h>/ O3 X/ l# ~% @: ]
  39. #include <asm/hardware/edma.h>7 b$ F) l" s7 O, A! P0 l0 W1 I$ O

  40. % Z+ ~& Z9 x" V7 e
  41. #undef EDMA3_DEBUG  \: g7 c0 g, ~0 C) {5 V
  42. /*#define EDMA3_DEBUG*/
    4 G- H' y% R  z* V' w  t. F" |

  43. : c0 S5 W7 x" s0 A
  44. #ifdef EDMA3_DEBUG
    , F0 y% W- X$ O! \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      m& W" P7 i' z& i! _9 b) U5 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 p( W6 f) R( \) C3 ^* _+ m: E2 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), L; I3 n0 H2 \  i4 F" h
  48. #else
    2 {! V) h$ p# m# Y# |* k2 R) @
  49. #define DMA_PRINTK( x... )
      `1 T  u" a6 P4 o
  50. #define DMA_FN_IN; u6 c& W% }- [, z0 O
  51. #define DMA_FN_OUT
    , I5 }) l5 b3 f
  52. #endif( b7 X4 i6 ]; r* @/ S- k- H$ i

  53. 0 ?. f, I) r% y- l$ ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) u/ ]% i& k. @8 h7 I% g5 C2 g
  55. #define STATIC_SHIFT                3
    & J. |) r0 U' Q2 y# f4 C
  56. #define TCINTEN_SHIFT               20
    4 ?7 P' ?/ r8 J! @; l
  57. #define ITCINTEN_SHIFT              21( v- P+ u- v( |4 a
  58. #define TCCHEN_SHIFT                22
    ! B1 q2 j: f* r' l+ Z6 P  P
  59. #define ITCCHEN_SHIFT               23
    . o5 l3 ^8 o" J- P" U9 ?+ K5 v
  60. , `0 V! l6 w5 M: t$ ]; d8 b
  61. static volatile int irqraised1 = 0;7 n/ ~3 B# n0 Y, g( r
  62. static volatile int irqraised2 = 0;
    ; }# P2 B3 {' S' o' \! N0 H
  63. % Q( L- d8 S$ p1 I( ]7 s* J+ v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 h$ v5 b) ~# S6 ?* ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! c- @5 q8 C3 O9 u: R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 T' D- H: k: u! S% }* U4 G$ P+ b

  67. * _. O5 g. E# T+ Y; p, m
  68. dma_addr_t dmaphyssrc1 = 0;% M7 T9 |# X) [) {' q
  69. dma_addr_t dmaphyssrc2 = 0;8 ]9 Q8 Y! s- V
  70. dma_addr_t dmaphysdest1 = 0;
    $ U1 J; |- A3 |. f5 D! S; m
  71. dma_addr_t dmaphysdest2 = 0;: @; ~4 ~- q: E3 p( t% E1 Q
  72. & p. v& X  |) J) S$ O. c0 L
  73. char *dmabufsrc1 = NULL;0 F1 O+ q; Z' \, D, C
  74. char *dmabufsrc2 = NULL;: O- t1 E; E3 F# i% q
  75. char *dmabufdest1 = NULL;6 N! `) c" O. e! ^8 U5 B  M% j. p
  76. char *dmabufdest2 = NULL;
    # L+ P- N0 G: v& Q* q  {) @

  77. + ]+ W+ U2 q4 F: y+ H, @% y
  78. static int acnt = 512;. p: i- D  E5 d1 u& d9 D0 s
  79. static int bcnt = 8;
    $ j8 A( X7 L, U# ?9 q
  80. static int ccnt = 8;3 O+ L: t  F' ^
  81. ! f, a; k1 X% ]
  82. module_param(acnt, int, S_IRUGO);3 w# k0 E) ^" N. H* K
  83. module_param(bcnt, int, S_IRUGO);
    5 ^# V' V0 ~: z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. C1 Y- S! E% F8 H1 M* B
, C2 {2 W5 O% _/ @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  |8 H6 H$ q0 O1 r5 w" t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 [5 K; }  ~$ {& W' N6 N4 G& ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u! _+ ?& }6 q! L" \( V- j7 J3 c
4 M! n0 `, Y* e

& W% o/ [0 O5 V1 A) Z' ^8 m: W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 07:47 , Processed in 0.039276 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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