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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# }) E4 b: {, ?6 w8 P# _0 E
  1. [code]EDMA sample test application7 B- R- a$ X4 \
  2. /*
      Q. h0 ~# N2 F& ?  D
  3. * edma_test.c
    ; B5 `6 ^6 R( {* K* ?$ q
  4. *, X. r- }3 n- p, \( r* y
  5. * brief  EDMA3 Test Application6 ?# `  p7 ]- l! `
  6. *; w. q+ v  A$ N2 j( Q, `& B
  7. *   This file contains EDMA3 Test code.1 k0 Z6 e* y2 N7 A' K6 Q; o
  8. ** d: F5 U  k2 Y' ~3 o1 p' R0 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      c/ z+ x* r6 l+ m9 }5 U' w0 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + q: [" g; M* }% D7 j# \" P1 O
  11. *         TO CHANGE.
    . M0 U2 A$ I/ R" a5 O- {4 G. B" G! D
  12. *
    0 m: w1 T% N3 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + U. _+ H  \. z0 v% {
  14. *) E  K5 q  p" f2 C6 J3 F/ J* O$ t
  15. * This program is free software; you can redistribute it and/or
    1 K9 D/ j( ~' W; y, Y) w+ A5 [- P6 Q
  16. * modify it under the terms of the GNU General Public License as
    1 M& _# J4 S, A& h4 W! x
  17. * published by the Free Software Foundation version 2.
    % T. h% m/ ~5 y: N- ]
  18. *
    4 u1 p2 p& M1 p- M* ?0 u  }8 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 e$ t! h& ^  `
  20. * kind, whether express or implied; without even the implied warranty
    6 i: ?( u2 P2 y- c. Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' c+ o' w$ n& Q$ X! `- ]2 L
  22. * GNU General Public License for more details." o1 X3 C+ @/ L+ x
  23. */8 I- b, D( l9 M; W8 S. T
  24. / T5 R1 T6 N! h9 y4 O# J5 e
  25. #include <linux/module.h>
    ( w. `& |& M2 e& @
  26. #include <linux/init.h>
    / h4 E7 m) j2 d# S$ C! t) u8 I% k$ w
  27. #include <linux/errno.h>
    : k& R+ w+ g# O: n4 K- p: l( z
  28. #include <linux/types.h>
    * \/ R% ?: C5 T3 _4 L, i. x5 g
  29. #include <linux/interrupt.h>% U5 ^2 O. w3 ~) U$ V. ^
  30. #include <asm/io.h>
    2 g9 e$ d4 `7 u5 P
  31. #include <linux/moduleparam.h>
    4 {" K9 d- g3 Y) D* @& w) U$ z
  32. #include <linux/sysctl.h>. {2 W1 {# \. I( }, L) n& L- ~4 e
  33. #include <linux/mm.h>. O5 @1 W: d# [, p2 M7 h+ }9 n- B  K" b
  34. #include <linux/dma-mapping.h>' A' N0 v" {' s( C( P; c

  35. 3 A$ }, ?6 h% v+ y& I. W2 h
  36. #include <mach/memory.h>
    ' a% l, K: z4 I6 b6 N5 I
  37. #include <mach/hardware.h>
    & I, K/ X/ J: L8 b- E* k
  38. #include <mach/irqs.h>
    ; E5 _* v, \3 X9 N8 W' H% v
  39. #include <asm/hardware/edma.h>
    , p  X0 H% S5 O

  40. ( C  \, l, E+ e( L. Y* \! q
  41. #undef EDMA3_DEBUG, \0 Q7 A# F" v+ p! b  a2 }# a7 H
  42. /*#define EDMA3_DEBUG*/* _1 r: u. T) m( z: R/ f3 {

  43. 8 I0 H1 K" o0 @! |5 @
  44. #ifdef EDMA3_DEBUG  P$ ~& s1 w7 I& }) k, Z5 v3 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 M  |% v1 b# w( V; J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & ~4 O! h2 E. u& k' |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  Q" g0 ~! [3 }5 W& P# z) F$ a8 l
  48. #else
    3 b8 s) k0 _& s: b- x" F9 F
  49. #define DMA_PRINTK( x... )
      V* e. k& ]9 @
  50. #define DMA_FN_IN& c' O; V$ j7 k$ `6 t& o7 ]& \
  51. #define DMA_FN_OUT
    ) a; r4 {8 B: J6 }( v/ c
  52. #endif$ I! u6 [/ {; ^, \2 H& M9 q, c
  53. 7 k( J6 G) v6 G+ D; s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 x" w3 E1 Q- [( b' L) s7 o
  55. #define STATIC_SHIFT                3
    ' f0 ^! m& H" _8 c2 b
  56. #define TCINTEN_SHIFT               20
    " A7 }. T/ l! I
  57. #define ITCINTEN_SHIFT              218 d5 H: g) Y; j  |
  58. #define TCCHEN_SHIFT                22! w8 I; `# @0 d' {+ |$ G( {
  59. #define ITCCHEN_SHIFT               23: y+ N9 l- t; ^* n  q

  60. & h- L& ^- p( ?) A1 ~8 _
  61. static volatile int irqraised1 = 0;
    , F2 c; e; C3 s7 ^+ c
  62. static volatile int irqraised2 = 0;0 Y: `- b/ @' B

  63. , E! X2 c: v% H0 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 _, h1 r# z" m6 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * w3 H& I  j8 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h! h  V( U% _2 ?7 m

  67. # w5 B2 f0 b7 z& i
  68. dma_addr_t dmaphyssrc1 = 0;
    : I9 I" a. d; O
  69. dma_addr_t dmaphyssrc2 = 0;
    ( K. ~+ Z! D! S8 R5 m
  70. dma_addr_t dmaphysdest1 = 0;
    ) l6 Q# p  J& n% S. ^, s
  71. dma_addr_t dmaphysdest2 = 0;
    0 c  a% m) _8 b) q- x1 z, ^/ ~
  72. 5 B, O) t) v, E# c# n
  73. char *dmabufsrc1 = NULL;, D+ L! o9 [6 X
  74. char *dmabufsrc2 = NULL;
    ! K! }& n: y, y5 q0 X  z3 Y. o
  75. char *dmabufdest1 = NULL;0 l9 {: _# G) T: O& Y, g; W1 n
  76. char *dmabufdest2 = NULL;" w- \1 c. m. g( u/ Z. B
  77. + S$ p1 E( H: ?$ p) P' T) ]
  78. static int acnt = 512;
    & w  B1 _' b) L# ?
  79. static int bcnt = 8;: c; }. o) L, ]) Z- P6 S- _1 @
  80. static int ccnt = 8;
    % e! p  k" [4 a% B7 x& e

  81. ( [4 a0 A& [) ?2 X1 t
  82. module_param(acnt, int, S_IRUGO);7 V; E" ?# |$ U2 X
  83. module_param(bcnt, int, S_IRUGO);8 ~3 Z, V8 }5 f! A: c9 L+ I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 {4 V9 B9 R4 D) T1 q! h9 h
& @* H  ~( \' i# ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 Z# y" ?1 L% }5 }1 U: i; earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& R$ O, Q; J2 C1 L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# i; Y- r5 B$ _2 z  ?

" ~+ Z% k3 O  v' o) q5 C
3 x# _4 C  M# @1 F8 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-30 17:38 , Processed in 0.041703 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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