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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ z6 b6 G* A) l- ~
  1. [code]EDMA sample test application7 h5 t. D& q6 u2 L, m% J
  2. /*+ r# _' i; W/ Q0 b6 W2 v  f4 I
  3. * edma_test.c7 F: q: [7 P% c5 X2 c
  4. *
    + t$ C! n) c8 i; v: I6 Q
  5. * brief  EDMA3 Test Application
    ! _% U$ \5 h/ m& K' U  g1 ?2 O- O4 v
  6. *
    # l9 x5 V' [+ v
  7. *   This file contains EDMA3 Test code.0 b& P( _. d0 p* e7 F
  8. *
    ) ~! w9 I' y' x* k7 W9 V+ T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ ^1 ^6 B3 k) s( S/ P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' g9 |! w6 u$ Y4 H; C) ^9 R, R% ~
  11. *         TO CHANGE.
    - {' b/ T# `! ^/ W: ~/ g
  12. *: i* H: X. i+ _, t. |$ }* T8 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 F8 c8 Y" t$ g3 s
  14. *
    , q& w( {* W" z8 B7 i  z  d$ A
  15. * This program is free software; you can redistribute it and/or: E9 F' I2 v$ C% V. j$ P7 z
  16. * modify it under the terms of the GNU General Public License as
    % R; P& |5 X- K; Q) w8 X
  17. * published by the Free Software Foundation version 2.
    4 {* B8 B1 W2 c. B1 @% ^7 b3 [) Y" O
  18. */ O/ @& H) K# U0 ?+ a& T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 x4 @+ ~  u; ^* c
  20. * kind, whether express or implied; without even the implied warranty9 L% i& [7 ?' m# F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 M) c, V4 y8 a
  22. * GNU General Public License for more details.+ m: l4 w0 P, D9 z& L, E4 i
  23. */) @& `8 X7 ]  e" f  A

  24. ! [/ ^) q4 |) G; \5 Q( M7 P
  25. #include <linux/module.h>0 Y) a; N  A) S: r' e
  26. #include <linux/init.h>( c5 V; G9 o6 }2 E1 R9 f. ~, @
  27. #include <linux/errno.h>/ f7 }% D! H- k& p: m- H- e
  28. #include <linux/types.h>
    ) `8 F6 G3 f% A$ ~/ l& l+ D, g
  29. #include <linux/interrupt.h>' w6 a4 f  W( }
  30. #include <asm/io.h>( C4 J( B  \7 \: {* b9 B. ^, e
  31. #include <linux/moduleparam.h>' V3 f- [- @) ]; d  V1 n# \9 y
  32. #include <linux/sysctl.h>) H8 R2 o8 k, h" `
  33. #include <linux/mm.h>' _- w. U" @6 o# u! D- J
  34. #include <linux/dma-mapping.h>
    ; c) C: p( U+ J' y

  35. + j  b* z3 Z0 C$ o% q
  36. #include <mach/memory.h>
    # {- B' I2 K0 F# o3 J+ |
  37. #include <mach/hardware.h>
    ( l) D  l9 B% S3 H5 C
  38. #include <mach/irqs.h>$ I; C  f! z" l1 `
  39. #include <asm/hardware/edma.h>. P/ ^( ^; D- @% ~! _& t; o

  40. 2 b( O5 f& ~& s8 E8 r6 B3 g
  41. #undef EDMA3_DEBUG9 F# u5 ?1 S! Y, f$ Q. q
  42. /*#define EDMA3_DEBUG*/9 D+ Y  l3 i0 |& A
  43. : H; W0 X) _* ?2 a7 G
  44. #ifdef EDMA3_DEBUG3 Z; R5 N6 g0 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 }& \0 ?7 M- [* ]+ F3 _- H: L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). g% n5 J+ g  w9 }& B. i8 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ G8 k  ^  m  ?- N5 l
  48. #else- r6 o9 c  h, G* J
  49. #define DMA_PRINTK( x... )
    1 z9 C( B# @  \' s: [" w$ n
  50. #define DMA_FN_IN+ h( q  l/ t$ z3 }, E; U* ^
  51. #define DMA_FN_OUT* b0 b; u, {3 q1 `; D
  52. #endif
    5 n* L5 W" g& q5 g

  53. . }0 F2 }" U+ z* m# n" B0 @6 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * z7 z' A, \1 l; F3 }9 W) Q
  55. #define STATIC_SHIFT                3
    . y- r5 q1 E4 ^# B) K, n
  56. #define TCINTEN_SHIFT               209 h& Y. T. [  {' W4 u# L  S
  57. #define ITCINTEN_SHIFT              21
    * t% t8 V6 s% _) H2 h4 b" H  g
  58. #define TCCHEN_SHIFT                22
    ! f9 u* M4 c/ G0 U+ k' L
  59. #define ITCCHEN_SHIFT               236 P7 _+ Y/ q9 n

  60. " @; z( c& F4 B; p2 _
  61. static volatile int irqraised1 = 0;3 i# g$ K! @! f. k1 i
  62. static volatile int irqraised2 = 0;& _% k" q: q1 Z" k3 ~' z

  63. ; |& N8 N0 A" D+ |# A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 F* I' _6 v& q, M; M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% n8 l6 q4 D7 S$ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * }) d, E( w) J, u- }

  67. ) ]+ j( ^* p$ A# ^0 D
  68. dma_addr_t dmaphyssrc1 = 0;# `. M  J' ^) Q2 r. B# S
  69. dma_addr_t dmaphyssrc2 = 0;& D5 b" X5 X: u1 O9 V- r9 Y
  70. dma_addr_t dmaphysdest1 = 0;3 _' r5 n1 b6 C6 h9 |, g
  71. dma_addr_t dmaphysdest2 = 0;
    6 D& n# d& S# ]& G. t. z1 Z
  72. & }  x/ F  r' u$ k1 `1 j
  73. char *dmabufsrc1 = NULL;! l) B$ u, |# O6 F
  74. char *dmabufsrc2 = NULL;  X+ D# g5 X' Z, Z; }
  75. char *dmabufdest1 = NULL;+ j7 M! g0 g  h% h; `' E, B
  76. char *dmabufdest2 = NULL;/ E# k. `* V8 u
  77. ' z) \+ u/ _# T1 Y) U/ X7 m
  78. static int acnt = 512;
    0 ~: ?1 N$ p3 _- H
  79. static int bcnt = 8;, |2 p) G2 d' V! q6 c
  80. static int ccnt = 8;
    8 v! v" ~& A, j9 u# D
  81. $ D) Y4 w/ C. Q" B& W2 L
  82. module_param(acnt, int, S_IRUGO);
    3 O0 X! X) b9 E# U& S- k
  83. module_param(bcnt, int, S_IRUGO);
    2 s' Y  S9 V0 T  H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; n# o8 A5 n( b

! l  Y$ `# i/ |- w! q. g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& t0 ^' {7 W* h# L6 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ z! ?& O+ o2 ^7 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" b; \/ q  E. s5 \1 N# K$ A( @6 h5 l% ?- \

* u' l3 O% O# \. x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 13:26 , Processed in 0.041946 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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