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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 H' w. Q, q! |% @. t: R5 H- M
  1. [code]EDMA sample test application( |' P. C! P  n$ C$ Q
  2. /*
    . J5 H3 W7 L+ I: c6 X* W
  3. * edma_test.c
    8 R+ N- J1 C/ }6 s$ a# `' l
  4. *
    . D+ }9 A& \3 F8 i; U/ K7 X$ X8 W
  5. * brief  EDMA3 Test Application
    ) d# z# H6 g. n' w
  6. *
    / R' n- k5 z# Z
  7. *   This file contains EDMA3 Test code.
    . N0 v* l) p+ s7 J9 x+ |
  8. *
    1 ?$ o! R  L+ N4 g" [* z# `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 G4 E$ b0 t& U- o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" k* c. ^) H- d& k4 d& \
  11. *         TO CHANGE.# G& P" D7 e. H
  12. *+ R' q* P  d! Y* d# Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 x; ]- r* c9 t$ p9 m
  14. *5 [# \" y" u) t3 o
  15. * This program is free software; you can redistribute it and/or& ?/ ~& v7 @8 _+ r
  16. * modify it under the terms of the GNU General Public License as
      O3 ]5 V# P9 n8 D% F+ r7 ^
  17. * published by the Free Software Foundation version 2.3 H5 K! v0 I! ]( F
  18. *# G+ ?+ e( h/ l. V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 ]4 |* {: t$ ~4 [  U$ c
  20. * kind, whether express or implied; without even the implied warranty# @8 M) |8 p' @, i( x6 ]3 ^. k) s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - F  T" P/ P. H/ ]4 g7 ^8 q9 v( D
  22. * GNU General Public License for more details.
    , A9 V0 a8 D5 A0 @7 @8 p! U! t- z* v
  23. */, O0 B" d6 \( d0 S' w- G7 Z* z
  24. 0 B: U# ~  r& n( a  g" ]0 p$ k4 G
  25. #include <linux/module.h>( \) o2 r0 N% Y
  26. #include <linux/init.h>: p1 B' |- o% @5 o5 X$ s$ z( ~
  27. #include <linux/errno.h>
    - y, z/ E# m& q( I' P5 d7 f3 D2 z
  28. #include <linux/types.h>
    . }! h% q- C! d* a
  29. #include <linux/interrupt.h>, K0 O: C. b& w
  30. #include <asm/io.h>2 O" ?2 x1 a1 X# b. h6 y+ h
  31. #include <linux/moduleparam.h>) k6 i& a9 J$ a2 Z: |( G; B
  32. #include <linux/sysctl.h>, o5 l2 g2 U, a2 u
  33. #include <linux/mm.h>$ m- t2 k& B# _4 e* X
  34. #include <linux/dma-mapping.h>
    ( [" \- H/ g' y" z+ U

  35. 5 N+ C% X( v5 ~' @7 s
  36. #include <mach/memory.h>
    4 }) L  `/ {+ s# d6 t; B: t/ n
  37. #include <mach/hardware.h>
    0 X7 {+ \* Q5 o
  38. #include <mach/irqs.h>
    % R5 T  [# v4 o4 T7 ^( U
  39. #include <asm/hardware/edma.h>
    ! j+ r& z. \; y5 c" W  {# q
  40. : v, V0 k( C! D- Y) R0 `- n# p% A
  41. #undef EDMA3_DEBUG3 A! D: v  t4 ^" k
  42. /*#define EDMA3_DEBUG*/
    * ?+ p6 i5 G# G3 V$ g% l

  43. , o- W. V6 @7 t) {, p
  44. #ifdef EDMA3_DEBUG
    & o0 S$ n. g& |% F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & m) @2 Y3 x( _( }, S! D; D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + O$ t1 s8 T: x7 c+ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 r: W& d8 Y: o) }
  48. #else9 z+ \( r) ^1 q7 C. n7 u" P6 Q$ S
  49. #define DMA_PRINTK( x... )
    % C4 E  r* ^; e, _3 \* j0 T
  50. #define DMA_FN_IN) k& Z6 [5 D% q/ }( v: `
  51. #define DMA_FN_OUT
    ( e- J' B  h4 p1 h4 Q/ l( |
  52. #endif
    # `- p, g' F7 V) f
  53. 7 \6 K/ p6 A6 u* `  y* p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ K' s: P' y& r6 O) S
  55. #define STATIC_SHIFT                3
    " l; }; ~/ x2 O( D0 z! u6 c2 X
  56. #define TCINTEN_SHIFT               20
    4 W: G- ]$ _1 Z' w
  57. #define ITCINTEN_SHIFT              21
    5 e. z, F& |5 q  o, r7 x1 M1 t/ M
  58. #define TCCHEN_SHIFT                22
    ' V& _( Q1 V7 N" a( }
  59. #define ITCCHEN_SHIFT               23
    " i! q: e; ]2 R* X5 k/ o

  60. 6 z& q! n6 Y/ T1 J3 c
  61. static volatile int irqraised1 = 0;
    ' M7 ^3 T# F3 o  B3 u
  62. static volatile int irqraised2 = 0;
    ' \  C; {* [" Y

  63. - G1 N. J4 t+ W; M$ C8 N6 H$ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 W% L/ B8 |" s4 x+ U8 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) Z& X0 G8 M- t8 |& i& L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ D) z/ E3 g* B( g0 V) |

  67. / h' m5 ^3 o2 V  \3 y. D8 u0 c! W
  68. dma_addr_t dmaphyssrc1 = 0;
    1 F5 a: F, M' p$ l
  69. dma_addr_t dmaphyssrc2 = 0;7 o% K1 H0 g$ Z' V1 i
  70. dma_addr_t dmaphysdest1 = 0;
    / G; f8 I& d6 j  d! }- B
  71. dma_addr_t dmaphysdest2 = 0;: ~' f$ l# p8 E: m

  72. 7 k0 e" c6 F! q( O
  73. char *dmabufsrc1 = NULL;" B# p3 D  ?$ N1 c5 y
  74. char *dmabufsrc2 = NULL;
    " _$ U2 ?- b4 u2 z6 ~, K0 v$ K
  75. char *dmabufdest1 = NULL;
    - A4 ]1 I+ r, v) J" c
  76. char *dmabufdest2 = NULL;
    4 {3 h9 l3 T: }

  77. 1 l( Y, W5 H  e1 V
  78. static int acnt = 512;
    9 g8 T; d8 n( f3 h! z  a: r0 p
  79. static int bcnt = 8;8 {% M" A) }  P
  80. static int ccnt = 8;6 f4 p1 c3 J0 I5 Y1 d; P$ D
  81. 9 Y# ]$ W/ @" |  P
  82. module_param(acnt, int, S_IRUGO);
      Y: f% u, v7 Z+ t: `3 G
  83. module_param(bcnt, int, S_IRUGO);
    , U- G  [7 N# I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ D' M' G6 _$ u: \4 V

' ~* b/ O( l1 h' J/ U7 ?# W' S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' w9 e$ d4 a% [( X* P' d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 z7 U8 j* y) v* o
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 ^9 Y6 E9 n. y0 P! T# d) M) w' V
; [% l# v8 x0 ]2 }
8 s6 O& z1 q& }: r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 16:08 , Processed in 0.040480 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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