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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " W# x/ _8 b8 x5 G/ J. M7 d# c
  1. [code]EDMA sample test application& J! Y1 M: g- ]9 r* ~+ Q5 ?4 Z
  2. /*
    ; |+ O1 V/ h' _" y$ l
  3. * edma_test.c$ W4 C- f+ w' z4 s, Y
  4. *- l2 }) Y7 J& I+ w
  5. * brief  EDMA3 Test Application( e- O: ]9 l- ~7 Q0 V  i
  6. *
    . m# K& E% V) X
  7. *   This file contains EDMA3 Test code.
    4 v" {. z5 k& i! g/ l' j8 O: g
  8. *& q  a9 t% t: f# D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 \; ^  E8 C2 ?2 y4 C+ R4 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 o' @4 F/ ]1 o' {
  11. *         TO CHANGE.
    9 v  }, c2 H9 t; {  S  U- N
  12. *5 B1 V, z$ S0 ~) b* E0 z& I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' E3 a6 V! u0 j2 N/ G' c# p
  14. *7 ~4 Q6 m3 i8 j1 y0 ]$ N
  15. * This program is free software; you can redistribute it and/or
    % |3 s& M% K, g! G0 @
  16. * modify it under the terms of the GNU General Public License as
    + w/ ]2 V& [: \8 m/ `  p/ B
  17. * published by the Free Software Foundation version 2.  q7 Q7 [# E  z& N2 ~" L/ E
  18. *
      u' q. l0 s, j9 A5 n( C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- D4 U! U) [% x4 g* D: P$ t
  20. * kind, whether express or implied; without even the implied warranty2 ]0 H1 `+ i( l7 U" L  A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( |3 s( H7 z1 z) S: U, g  w" l
  22. * GNU General Public License for more details.
    1 U4 C, L7 D/ J2 m+ A% `
  23. */
    & g, B( X. m5 b6 X6 U
  24. 1 o8 u+ [8 Q  w
  25. #include <linux/module.h>
    9 L- T, I" ], N. [
  26. #include <linux/init.h>* j  t/ E/ T, v5 k% y) B& @
  27. #include <linux/errno.h>2 j: I# W) H% ^+ T/ Y
  28. #include <linux/types.h>
    5 H1 N' ^0 w9 f
  29. #include <linux/interrupt.h>
    ( N/ Y" b+ `6 ]# e' P- V
  30. #include <asm/io.h># c0 g2 {( ]2 Q, N# y
  31. #include <linux/moduleparam.h>
    # q$ U; H* H( ?7 v( q
  32. #include <linux/sysctl.h>
    3 C# ?: h( ^8 {+ a# P
  33. #include <linux/mm.h>
    9 g) h2 z! z) m2 ?9 B, b  e& E; s
  34. #include <linux/dma-mapping.h>
    ) L8 I) y6 G0 z
  35. 2 ]% y& D  p0 @- _
  36. #include <mach/memory.h>5 G  p: }; y! G# B
  37. #include <mach/hardware.h>
    0 L1 {$ s  k# O: n% T
  38. #include <mach/irqs.h>
    5 t' ?6 m5 {) a/ i" Y; y
  39. #include <asm/hardware/edma.h>
    / l# V+ o8 z6 k4 u# P! @

  40. 9 W% e* I& i; u1 l) ?* U% Z- j8 ^
  41. #undef EDMA3_DEBUG) K! t9 h$ q9 ?/ e) d0 h  i2 g
  42. /*#define EDMA3_DEBUG*/) s8 ]1 v& M6 r$ j( x( v3 ^* m
  43. # A+ ~4 B' z+ P/ U* K: `7 O% M  |
  44. #ifdef EDMA3_DEBUG. Z1 u5 s' b; D  t6 q7 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; x' a8 M7 w5 E/ c; t9 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # _5 H: k( `9 j0 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% I% _5 v2 D% t4 E
  48. #else& J/ \) y, _+ o& `- s
  49. #define DMA_PRINTK( x... )
    $ b- V8 u4 D6 W) Y! F
  50. #define DMA_FN_IN
    & B. F* T/ ?! Z6 W5 v  S
  51. #define DMA_FN_OUT
    ! g, S; F$ ?, ^
  52. #endif' ?' e) |- M5 {4 @: C; J# ?9 J
  53. 9 o+ v6 o& s! G/ p# R. y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% r( A1 b8 W9 q7 G
  55. #define STATIC_SHIFT                35 g; H" z* Z% q/ b: t0 v
  56. #define TCINTEN_SHIFT               20
    . b* O8 C7 m1 n6 I2 S
  57. #define ITCINTEN_SHIFT              21) Y+ {6 w- l% X
  58. #define TCCHEN_SHIFT                22& Z6 J% z6 L6 F5 u8 \' x8 o8 S
  59. #define ITCCHEN_SHIFT               234 L* s  n( M+ \# G- t- {& y; d! J
  60. " K7 M% o5 z1 q0 |
  61. static volatile int irqraised1 = 0;2 l# n6 X9 |3 ~7 s6 W* F# B
  62. static volatile int irqraised2 = 0;
      j) _8 ]7 W$ p. B: v1 _7 }
  63. , j0 \: b9 Z9 E. s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m2 B  ]5 K& p3 z" v$ ?& ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 M) L5 {9 E9 U6 |+ }& n9 [' D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 m' ^; g2 ~; b9 k4 X* k

  67. 7 J" E$ U  _( N
  68. dma_addr_t dmaphyssrc1 = 0;
    * N& Y, r; m# O6 O1 [7 \* B' Y
  69. dma_addr_t dmaphyssrc2 = 0;
    9 M" N- @- l4 V. J$ E+ L
  70. dma_addr_t dmaphysdest1 = 0;) g8 o( Q$ A" j' T  ~7 }! L- Q' Q- d
  71. dma_addr_t dmaphysdest2 = 0;+ N- p. p0 L# x; S
  72. 0 M1 Q9 ]2 B3 R  I6 D) Z; m% X
  73. char *dmabufsrc1 = NULL;" R# d) a* U+ t) N
  74. char *dmabufsrc2 = NULL;. W0 ~9 ]- `" Z; y
  75. char *dmabufdest1 = NULL;& N# h# Y1 X, ~! N8 u! h( J
  76. char *dmabufdest2 = NULL;
    1 M0 S! f9 }) }, X. C( j/ V

  77. 6 K) f8 l! E" C5 O$ p: e3 r- w5 C
  78. static int acnt = 512;$ Z0 l8 l, L$ D9 v) D  L; _
  79. static int bcnt = 8;
    / p+ b2 {: t+ c: X
  80. static int ccnt = 8;, _6 H9 M2 t+ T; q

  81. 6 _/ B% r8 {$ V$ ?3 _& Y* W$ i8 G
  82. module_param(acnt, int, S_IRUGO);1 B( J, r# `1 }7 T9 i  s5 t$ ]5 r
  83. module_param(bcnt, int, S_IRUGO);2 D6 H3 C$ z2 W& z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. W* s) U+ i& b" ]# C) r

: d, E+ ~7 j3 h2 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' b* k, P8 |+ w1 h: Y: u  \
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' `: s( f3 ?0 r2 l5 g& X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 O2 j( n9 \3 M" S2 R0 D1 B2 j- F) q) J  {* @

5 k. i# ]5 [$ ]+ W; |* o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 14:55 , Processed in 0.045851 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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