OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 z  \( Q9 ?0 _/ S  s" s
  1. [code]EDMA sample test application
    / ^3 r) ]+ |9 b, x" Q, c
  2. /*
    0 D3 f. x) K" p6 H
  3. * edma_test.c
    0 i3 ]0 A* P8 z2 n& \; W
  4. *. Q! m7 l8 \# F0 Y
  5. * brief  EDMA3 Test Application* ]. ^4 u7 p! n0 P6 k3 L" I
  6. *. G# V5 [, R3 @; T
  7. *   This file contains EDMA3 Test code.
    , Q+ K: e, x3 z8 V% b
  8. *
    1 t1 q; l4 H8 N9 p7 e6 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 s: n+ {. e0 j% N, L, y$ _7 s7 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) }. J! r, z2 t" X; P" u
  11. *         TO CHANGE.& \% O( d5 n5 p2 w
  12. *. N9 g4 R1 p! ?9 H4 B& p1 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  R5 }5 _4 i+ _5 M2 U
  14. */ [# a* H; T5 w+ b9 T
  15. * This program is free software; you can redistribute it and/or- y2 ^4 A1 r1 t4 i2 I
  16. * modify it under the terms of the GNU General Public License as
    , L' B9 Y2 T" P2 g' R6 @0 D- K
  17. * published by the Free Software Foundation version 2.
      p& ?. a9 r+ n+ L* ^$ I
  18. *
    1 @. H. T/ R) ~2 B: Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 c) U; m4 n  q  E* [
  20. * kind, whether express or implied; without even the implied warranty
      n" l$ I& }/ p+ s- l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 N6 [$ f& o0 O: `4 }' R: N
  22. * GNU General Public License for more details.# D6 h- a1 C& ], U& S8 W
  23. */; c5 b" ?4 V0 M" g
  24. 0 g  m# |9 W7 f! G$ E( Q3 K
  25. #include <linux/module.h>! G$ {: o! Q2 U
  26. #include <linux/init.h>
    . `! H+ V; r0 P% H* o8 E$ c
  27. #include <linux/errno.h>
      ~: S% d  G% u
  28. #include <linux/types.h>1 D9 J: d& I: U  Q9 l' @1 G
  29. #include <linux/interrupt.h>
    8 ]0 C. T. O0 E6 k) f
  30. #include <asm/io.h>
    ) t4 F+ h8 Z! X! r
  31. #include <linux/moduleparam.h>
    3 p) o- y% D6 _4 f5 e
  32. #include <linux/sysctl.h>
    , Y8 ?4 e. u3 P7 [- J
  33. #include <linux/mm.h>6 |9 N6 ~" {. O7 \
  34. #include <linux/dma-mapping.h>
    1 r: \% m  R5 V" A# _% w
  35. - }. X& [4 s3 x' Q1 ]
  36. #include <mach/memory.h>
    5 g' R6 K8 ]4 E4 |
  37. #include <mach/hardware.h>5 n8 @- i0 p4 e* l
  38. #include <mach/irqs.h>
      V* J" Q1 c6 z7 J; g6 F
  39. #include <asm/hardware/edma.h>5 T" j: q$ J1 o
  40. , H; u5 \3 p- d! z! i
  41. #undef EDMA3_DEBUG% r+ j5 y$ M) l  b' ]0 I: I" \
  42. /*#define EDMA3_DEBUG*/  Y+ W1 g! W7 q! C' t" y
  43. 3 |5 y5 y1 @3 t' I1 D6 l- a9 s. f
  44. #ifdef EDMA3_DEBUG  l: |7 s5 @% b1 ]' K7 G  v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % j. K3 K- m; P5 {9 Q) t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ v9 p2 {3 [* D0 `1 Z) z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 P6 m& N, e+ K+ B8 _
  48. #else) e( m9 n' n3 `8 w8 ]- Z- ]
  49. #define DMA_PRINTK( x... )
    ) {1 Q# H$ U& Z- N
  50. #define DMA_FN_IN  R6 m# K, `; q6 m
  51. #define DMA_FN_OUT
    7 J6 S& t1 ^& I% V* J  O8 v
  52. #endif
    : i: X6 R" f4 F

  53. ' Z6 q( a7 c; _. ?; g0 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # {) U# ]$ A. d5 V* h# p( z$ c6 V" N
  55. #define STATIC_SHIFT                3& M; @* w: y# P0 [4 m6 ^3 v' S8 E
  56. #define TCINTEN_SHIFT               20/ q, ^& k8 G# a* C+ g4 t  k
  57. #define ITCINTEN_SHIFT              21& x! b* ~2 E( K$ D
  58. #define TCCHEN_SHIFT                220 j* e7 Q' a& U0 Z/ T1 q- [. O/ D
  59. #define ITCCHEN_SHIFT               23
    : h1 P' [4 W8 O" p9 p. J- n- m
  60. ; I+ E5 H1 a* w7 j
  61. static volatile int irqraised1 = 0;
    , Q  E( z/ F  Y& p
  62. static volatile int irqraised2 = 0;
    : h* m3 p1 I- G, I3 K
  63. 6 z, _7 ~: o( c- v# W& b( ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' m: M& g( d3 m! A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) O: B# o2 Y$ W( e& Y6 @5 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* k' J: Y+ h! q% A9 S
  67. / O) I* b+ h6 p8 i
  68. dma_addr_t dmaphyssrc1 = 0;1 E, H; b( D* l3 z+ x' p
  69. dma_addr_t dmaphyssrc2 = 0;& P9 q8 N! A; g9 S$ i) K! M9 c; ?
  70. dma_addr_t dmaphysdest1 = 0;
    7 L* s! M3 Y+ n* \1 }
  71. dma_addr_t dmaphysdest2 = 0;  W; _  N; \  d

  72. ( s1 @8 |$ R6 B4 O9 e
  73. char *dmabufsrc1 = NULL;/ g7 I- G% P" f4 b
  74. char *dmabufsrc2 = NULL;
    5 z$ K- f- ~1 T' \* S
  75. char *dmabufdest1 = NULL;- O! |- U5 {% y! M- b
  76. char *dmabufdest2 = NULL;0 }/ X" ~* G: T, y- z
  77. ; T! d$ V1 L$ Z2 G, X
  78. static int acnt = 512;
    9 m5 Q3 y) ~  `) a  N( o$ i9 s
  79. static int bcnt = 8;  n+ A7 {! \3 t! G7 e3 J( ~" v$ L5 y
  80. static int ccnt = 8;
    # d" ]; h! L5 [9 g- ^& m  _
  81. : l7 {- d7 G, y% w: [
  82. module_param(acnt, int, S_IRUGO);  }0 v" t: y: F  }( p
  83. module_param(bcnt, int, S_IRUGO);
    & n( z  r+ B) w9 j; H. Z5 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 x* T4 o4 ^( }! o9 @$ f6 m' }- k: x1 N6 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ r1 K( m: Q& Z1 l; O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 g; _$ D4 [2 R- N3 |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# s& C6 L/ p4 r- w6 t3 d6 C$ C- S7 A- g, u* s
: ?! t- K  T+ B+ E3 y- ~8 ?( |) p: b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 13:32 , Processed in 0.039541 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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