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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ n) p/ f+ A. Q9 ~- k% r, E
  1. [code]EDMA sample test application1 g% Y. ?7 s" P3 k( b* ?+ ^
  2. /*
    + y/ R. ^1 ?+ H2 d$ B, Q3 Y
  3. * edma_test.c
    , G; T! _- _& H3 W" K( K
  4. *
    ; v) c: D" [- q  X
  5. * brief  EDMA3 Test Application
    8 M% W* w# f  g$ S
  6. *! P6 W: X" O: X5 l6 Z) M
  7. *   This file contains EDMA3 Test code.( l4 P$ ]6 F3 _/ S: r/ _. Q
  8. *5 t! W- _1 {5 }$ t0 }8 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h3 n3 N- U: `! H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ c0 Y7 s& x' s; D7 ?8 ?5 ~$ T
  11. *         TO CHANGE.3 M) M' y# q$ U8 n( S
  12. *
    1 x  \2 y  m1 I- m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 X2 h0 B% G& W2 E
  14. *
    $ X" T" {+ b7 S$ @
  15. * This program is free software; you can redistribute it and/or
    # K' q* ~8 x' F& _7 U
  16. * modify it under the terms of the GNU General Public License as
    2 Z2 o+ G: v3 c0 ?
  17. * published by the Free Software Foundation version 2.
    / U# D3 ]! F: y( X- W+ Q
  18. *- I0 c7 z4 F+ F1 z& ^, W9 c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # }$ p  L# N+ Z% H( |) k: S8 R
  20. * kind, whether express or implied; without even the implied warranty2 U' w  l: |! [7 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% s8 ^' B2 X- ]3 P& H
  22. * GNU General Public License for more details.
    * r7 E' o( G7 b2 i6 S  N, S
  23. */9 ^3 T6 d3 a3 K+ A" b: H
  24. # Z0 I0 {8 b- I+ F9 H9 R( ^' E2 P
  25. #include <linux/module.h>' D. {: I. }/ @
  26. #include <linux/init.h>1 t- e) ]6 m8 d: y
  27. #include <linux/errno.h>
    3 ^7 ^' a5 Q) L- n3 [
  28. #include <linux/types.h>
      F  x5 _8 L( g8 z
  29. #include <linux/interrupt.h>
    & L. ?4 Y$ K! ?+ {0 t7 Q  {; F5 P
  30. #include <asm/io.h>
    8 ^6 Q  t/ ]* q8 e
  31. #include <linux/moduleparam.h>. N6 B! u3 H3 e! _% D6 f
  32. #include <linux/sysctl.h>
    ( v+ d7 S* O# \# w
  33. #include <linux/mm.h>8 }1 K8 `- b5 V9 k+ M+ {
  34. #include <linux/dma-mapping.h>
    1 ^6 i# A; s) E! u7 d& Q

  35. % P! ]/ `6 x! O2 K+ A: w' P$ a
  36. #include <mach/memory.h>
    ) l- {/ g7 `" P  |
  37. #include <mach/hardware.h>
    $ m; k: ?: T6 s
  38. #include <mach/irqs.h>
    ( H& U7 _2 R% E3 v# b' M6 h) d
  39. #include <asm/hardware/edma.h>
    ( C# B/ y; O. K1 W5 T6 h

  40. ; d/ W1 J1 Z7 G& `  c" o
  41. #undef EDMA3_DEBUG! Z( @! Y. V5 o! a) e; [6 N
  42. /*#define EDMA3_DEBUG*/; R/ W* I! B; S% T8 _( X. W- @
  43. 9 X: x% m6 K; }9 X
  44. #ifdef EDMA3_DEBUG6 o5 O, F& L* `) ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 R  D& B0 G, w6 z. `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      z$ s* b* v2 W$ X* I- b8 W! I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / ^3 W: O3 G, X/ f2 t" l  @
  48. #else/ C' _! c9 b" o3 l+ p6 l6 h5 r
  49. #define DMA_PRINTK( x... )8 r1 l) t- Z8 \3 k$ S( }8 V2 O
  50. #define DMA_FN_IN  K2 r" {, i) S$ {3 A- G0 X
  51. #define DMA_FN_OUT
    " o' s5 H0 L- }- c$ Q
  52. #endif
    - @' @) v1 n, p% N# L# [& ?' _  H1 Q
  53. ' O( y1 b. V  v. i0 i( M0 [, _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* S5 Q" C8 }2 X5 {
  55. #define STATIC_SHIFT                3( N+ c6 Z- X5 o. Z
  56. #define TCINTEN_SHIFT               20- W" b" `+ `& k
  57. #define ITCINTEN_SHIFT              21
    * A! t& M' G) u, _# ]
  58. #define TCCHEN_SHIFT                22
    ! G# |2 v) p: R) C; h; L
  59. #define ITCCHEN_SHIFT               23
    2 X8 Y- \) G& N- ^9 a
  60. ; `) |) D% g. A* |7 k6 Z( Q, t# W2 T
  61. static volatile int irqraised1 = 0;2 P* M& g+ Z4 o# _$ t. _- g, A
  62. static volatile int irqraised2 = 0;
    * S$ g. p& c9 g1 _9 K# q1 A# ]
  63. 5 _2 m. e* V+ O: f# X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j& S0 ~' s7 R: y; Y; ^! C6 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! i1 R: z& w( |& h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! V4 }. x+ K' Y: X# c
  67. ! y; m8 I- U5 I+ ]5 G1 M/ `: Z
  68. dma_addr_t dmaphyssrc1 = 0;
    1 U  }% q; V0 y. [
  69. dma_addr_t dmaphyssrc2 = 0;
    8 \8 ]5 V- {5 p. L* u& M
  70. dma_addr_t dmaphysdest1 = 0;2 X% r5 A. D8 y
  71. dma_addr_t dmaphysdest2 = 0;; `/ X. p) w9 y9 r4 ~( M* n
  72. ! E# b; I" q' w+ i& @" g
  73. char *dmabufsrc1 = NULL;
    + b; Y3 A1 P% v+ W8 E
  74. char *dmabufsrc2 = NULL;! x* Z4 \( ^" ?2 a8 H
  75. char *dmabufdest1 = NULL;2 q6 b/ |0 p/ r0 ?' H
  76. char *dmabufdest2 = NULL;
    " u' k9 c  F! Y1 a) r1 ~( `

  77. : _- i: A& u" d" ?& _$ @. k
  78. static int acnt = 512;
    ) x: T( l4 g. a+ x
  79. static int bcnt = 8;
    * v: R. Y$ e  c/ X6 S5 _6 q$ ^7 F6 `+ c
  80. static int ccnt = 8;
    8 v& y' J  _9 `& M7 C
  81.   _: ^- D& b" p
  82. module_param(acnt, int, S_IRUGO);
    ; |* X) d! g  W) D4 K6 Q2 n
  83. module_param(bcnt, int, S_IRUGO);% Y; `6 O& j* D3 d$ F$ A+ a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: G* e, D! Q6 _6 M: ?+ `: a0 R! M0 A& k$ G4 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ?* S7 w1 v$ A( }5 [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 u$ D8 a* r) _6 }$ z& ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ~( N: o( ~5 t, G( A* U

7 E' e, K+ r* H, T: G
. o1 v6 u+ y8 B# k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 01:50 , Processed in 0.042297 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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