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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % o3 _( s# C& R) Q: B( D* s3 I& E
  1. [code]EDMA sample test application8 T: K% I( q  @* ?' D9 t3 k3 g9 E
  2. /*7 N2 l7 n5 ~; T3 K% j  C9 O2 C1 Z7 C
  3. * edma_test.c
    / b3 b/ F. K) D1 z& @7 x- r
  4. *
    . E3 R0 v6 I% l! |' c
  5. * brief  EDMA3 Test Application
    ; g$ \( Y" E7 p! x( }
  6. *' z) t) W$ X% v+ M
  7. *   This file contains EDMA3 Test code.
    . P4 [& A( Z$ [5 r4 y9 c
  8. *. H1 i9 W0 \$ i* W- W+ t; c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m0 t8 f7 ?. B- Q! \. P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) ~$ z1 j8 L' j( o* \
  11. *         TO CHANGE.
    3 }1 m$ S0 n& q. H0 z( G7 I! l
  12. *
    ( ]7 U; H' ~6 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . `/ H1 W6 W5 T5 L
  14. *& x, Z3 d6 Y# r% s8 w! ?6 ]
  15. * This program is free software; you can redistribute it and/or, i; Y$ `% J6 l, N
  16. * modify it under the terms of the GNU General Public License as9 l* H5 H9 e/ y& a; u. `( o, Z
  17. * published by the Free Software Foundation version 2.
    6 ~3 B0 u+ a1 c% x
  18. *
    ; z/ P: g& y/ |# M" ?+ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ t3 ?  t3 D2 G9 ^7 K: k, [) g
  20. * kind, whether express or implied; without even the implied warranty! p8 V0 y3 g3 R4 a1 ~1 E5 n  \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! a" u7 a  ]7 q, X: K* J& {! J8 z
  22. * GNU General Public License for more details.: n/ e* ~3 n" H$ b. h$ s
  23. */
    : f% v# R8 z- \
  24. 8 C; J1 I0 J1 J( `, U4 k' i
  25. #include <linux/module.h>. ^/ {' C3 b! S: p9 E( y
  26. #include <linux/init.h>1 ?* a' }0 K" B6 t! F+ B
  27. #include <linux/errno.h>) j% z7 y& _" H# z
  28. #include <linux/types.h>
      V0 v7 N+ M9 r! f
  29. #include <linux/interrupt.h>" u  j: ~" [# u  Y
  30. #include <asm/io.h># T. K; h/ U! }+ u* k
  31. #include <linux/moduleparam.h>" f! q* Z/ b+ p3 \8 m! f2 i
  32. #include <linux/sysctl.h>
    . x9 L& k2 b" F% A
  33. #include <linux/mm.h>
    0 ?  R% g' v! b
  34. #include <linux/dma-mapping.h>
    . }0 M6 }: i5 }. Y- C/ V
  35.   T( {& {' w3 ]3 ~6 e9 L
  36. #include <mach/memory.h>
    9 C7 ~1 K( x4 i
  37. #include <mach/hardware.h>
    9 l; d( C* E5 F4 m2 D) G" W
  38. #include <mach/irqs.h>
    : ^) Z$ \# ]8 ]' g% v6 Q
  39. #include <asm/hardware/edma.h>
    9 U: t- W1 m# A, y1 f, O4 e
  40. % U  Z% m: j3 i, l. ]
  41. #undef EDMA3_DEBUG
    0 w0 G. V; v- Q: {
  42. /*#define EDMA3_DEBUG*/2 o9 Y$ U4 }; c' Y6 \' h
  43. . B8 i7 `# D! _0 a
  44. #ifdef EDMA3_DEBUG- L- M3 @3 r& |, ?& R( P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % V9 W1 n  A8 R. h5 N( Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + i/ c5 J7 B2 z: w8 T  @" ?5 n8 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ O: B. }( F3 U0 \! y' Y+ `
  48. #else
    # @6 C& K1 O7 ~5 H( M4 [
  49. #define DMA_PRINTK( x... )
    # _+ e* a; y: D2 S" Y
  50. #define DMA_FN_IN  o" g5 v! \9 Y" j! ?! K
  51. #define DMA_FN_OUT
    $ {" k+ w8 _' r
  52. #endif0 U( Q9 R5 I' a% D0 b$ V) b- C
  53. * c7 M6 h! R: a$ n! w' u# H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) o- }) O3 B4 N4 W
  55. #define STATIC_SHIFT                3
    9 L3 W) P1 `+ @3 X
  56. #define TCINTEN_SHIFT               20
    ' g8 j5 _  x! n! `/ H
  57. #define ITCINTEN_SHIFT              21
    / ~) g( [+ n, b
  58. #define TCCHEN_SHIFT                22
    / o; t- I) X/ Q
  59. #define ITCCHEN_SHIFT               231 t" K1 d4 B  |/ O2 v2 ?
  60. 1 V! s& @1 @1 M* o
  61. static volatile int irqraised1 = 0;+ `: X* v1 X% y# x
  62. static volatile int irqraised2 = 0;! }6 l( F/ u5 ~+ z9 x8 O1 t
  63. 7 p; t0 L+ y3 ~+ D$ w; E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 x  v" D, ?% q/ i( K) g- }" [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S  }0 i# S5 B# `* _9 A0 G& }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" t) s' ?- ^. a( A, f

  67. . ^/ A* X8 F1 W" v: \1 y
  68. dma_addr_t dmaphyssrc1 = 0;
    / v$ `, v8 J2 f- ?; ^
  69. dma_addr_t dmaphyssrc2 = 0;
    6 P: Q/ Y. N# T/ }
  70. dma_addr_t dmaphysdest1 = 0;+ k9 I* a% ?8 m3 ^. f
  71. dma_addr_t dmaphysdest2 = 0;3 h9 n3 _$ X4 W
  72. 8 F) d0 l, F2 O# r
  73. char *dmabufsrc1 = NULL;/ g* ?+ u! W9 d$ d, q) N
  74. char *dmabufsrc2 = NULL;& V, ?8 h, ]3 W% J
  75. char *dmabufdest1 = NULL;
    8 A# \. S/ N# T2 h4 _$ v8 `
  76. char *dmabufdest2 = NULL;
    2 y- F' q4 i- x5 e3 N
  77. : g. ?6 y0 ~/ i
  78. static int acnt = 512;
    8 M% m8 h, S/ s! J6 F3 Z6 Z1 m
  79. static int bcnt = 8;+ Q4 j8 b* B- M9 d# d' z( B
  80. static int ccnt = 8;
    & J# `. _$ I8 _! D) N, u! D7 C
  81. 9 V. F& W7 B3 l3 h% H2 z% _& w. F4 N
  82. module_param(acnt, int, S_IRUGO);
    ) H' e0 ]" H0 s1 I! z4 d2 g; p
  83. module_param(bcnt, int, S_IRUGO);
    ) A- p% O% y5 N1 E. y% E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 G/ M* {5 M: X
/ g3 s, ^9 l1 o0 k  g! y9 g" E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, v" G8 x6 i) L0 j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: W4 j/ e/ c3 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ Z2 n- o  k1 t6 W: _* U( D8 s# W; D, f7 U
/ U; O+ t. x6 [+ W9 ]+ {" ^3 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-12 18:37 , Processed in 0.049050 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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