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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 Q' K9 W: r6 p+ y7 I8 u" a
  1. [code]EDMA sample test application/ ]. M7 }6 b) U6 \9 [
  2. /*
    + X' B  E0 a+ }+ h
  3. * edma_test.c/ u. ]% b9 h0 e, D: @& D9 `5 I8 _
  4. *2 O( p8 x( A) I; ]0 h3 z
  5. * brief  EDMA3 Test Application' q. \  R+ u5 x8 T( M3 G
  6. *, j7 @3 Z- B  r# z# b3 V% N8 I
  7. *   This file contains EDMA3 Test code.. Y$ @8 _7 O, n. q  a$ V+ D
  8. *
    . X, G9 f' U0 f; l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + ?3 M3 a5 n4 Q5 Y( k/ Z' q6 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & }1 ~) C5 X& }( S
  11. *         TO CHANGE.8 a, x1 H$ n1 j, N  `
  12. *0 O& k' h) t2 ^  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& P' n" C6 D! z" l# n5 W9 W
  14. *0 b4 Q$ v, I  N8 e0 W
  15. * This program is free software; you can redistribute it and/or! o3 m0 [- t8 S, |; \! t$ l' N6 ~
  16. * modify it under the terms of the GNU General Public License as1 H$ \% `- J5 d7 j; K, G7 h; g
  17. * published by the Free Software Foundation version 2.
    $ V" W  ^/ x8 f& r0 s+ y( h8 G% A8 N
  18. *
    ! y- d' y' l" q/ V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 c2 {/ z: v# f0 k7 E. y% h# Z
  20. * kind, whether express or implied; without even the implied warranty
    8 ]/ v) g) o0 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " F, N) |& Q3 O0 Z# C8 j& Z
  22. * GNU General Public License for more details.
    / w( \  }: q3 \) c  L& y
  23. */
    9 q. A( ]5 L9 s# u, \1 v) t0 x

  24. 4 K7 P9 c+ j8 B- x5 f; P
  25. #include <linux/module.h>9 Y1 h' ^# \" y- w% o7 M7 j* Y
  26. #include <linux/init.h>
    " Y0 r8 G& Q' y
  27. #include <linux/errno.h>6 e& A/ m* A$ b+ h
  28. #include <linux/types.h>
    ' A" A: Y+ T( V
  29. #include <linux/interrupt.h>' K- k7 {& O- J" g
  30. #include <asm/io.h>
    # W# w& D# d- A# K
  31. #include <linux/moduleparam.h>
    & Y) u+ G' n6 y4 t# k( v4 u
  32. #include <linux/sysctl.h>) [2 R) h" T7 U- f+ {
  33. #include <linux/mm.h>) h% U& A' E0 m
  34. #include <linux/dma-mapping.h>1 c" n9 c& s4 f8 A) n+ r

  35. ; Q1 P: t9 _! Q5 q% {
  36. #include <mach/memory.h>
    # Q6 d7 d; g) b7 f, J
  37. #include <mach/hardware.h>
    5 W& J) Y, U+ o! C+ F5 n: H
  38. #include <mach/irqs.h>
    : M3 C, y, k8 M( h' L3 `7 M: P# x; h) n! o
  39. #include <asm/hardware/edma.h>
    8 g: F8 D6 _5 ?
  40. , K; E/ C7 A& A& N1 b( m( I0 [
  41. #undef EDMA3_DEBUG0 i1 v8 r, c8 [4 W$ q# n' t. Y
  42. /*#define EDMA3_DEBUG*/
    % E- e: v  B( E8 e: [
  43. : Z0 N  ~5 S2 S' L% v3 K5 P
  44. #ifdef EDMA3_DEBUG
    2 h$ h2 d8 Z' e( F1 F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  l5 p5 D; @/ g9 N9 u+ j' P7 s, e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( R: j, H# b- [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f% Q$ J. W! ]- z' T4 p1 D! ]
  48. #else
    1 B& E. w5 r& L5 G( a) a$ V: \
  49. #define DMA_PRINTK( x... )5 d2 L& |* @0 X4 E% o
  50. #define DMA_FN_IN# u5 p  a# X/ r
  51. #define DMA_FN_OUT3 p. t0 V. Z/ u( D+ S
  52. #endif& L4 i  G9 }0 l

  53. 7 u4 M& Q1 K, Q/ e# D, x' c0 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' H! w5 v" p# j9 A# Y
  55. #define STATIC_SHIFT                3
    + o" J; @6 M* q6 M
  56. #define TCINTEN_SHIFT               20+ Z% S4 G/ M' q) t" r. n
  57. #define ITCINTEN_SHIFT              21
      d1 W, [5 F2 [3 g
  58. #define TCCHEN_SHIFT                222 H' O9 N; u. B$ x! W8 ^1 I, ~
  59. #define ITCCHEN_SHIFT               23- H- T! t0 O2 F1 K+ S- A- R

  60. 2 }+ @' W7 f6 g" u, U8 ]
  61. static volatile int irqraised1 = 0;
    / M$ h3 M0 l, b- `; [
  62. static volatile int irqraised2 = 0;
    & u2 X# J/ x) [8 q
  63. 3 V. u! e7 @8 g( U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      j1 R8 @& l* M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # K7 u3 E, r0 t, p8 v! C1 M+ o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z5 C2 y% ^2 X9 K# Q* l; G" {4 Q  \" k

  67. ( T" v/ g! s- y
  68. dma_addr_t dmaphyssrc1 = 0;
    & O8 L) \2 `) i/ \  a, E# n
  69. dma_addr_t dmaphyssrc2 = 0;2 {5 e& ~5 w: l# o
  70. dma_addr_t dmaphysdest1 = 0;9 V! x9 _4 O6 n% H8 w: L' F0 T. H
  71. dma_addr_t dmaphysdest2 = 0;: G4 L6 E: M8 p5 n+ o4 {2 l( T

  72. 6 e! `& _/ V3 ~1 e6 `
  73. char *dmabufsrc1 = NULL;
    ' N- I! t( K, |; L7 v7 }) S4 _' \
  74. char *dmabufsrc2 = NULL;
    ) k& C  C! a( q9 X% s6 s1 P
  75. char *dmabufdest1 = NULL;3 P  }+ Z0 s1 ~# W8 u5 P
  76. char *dmabufdest2 = NULL;6 Q, x% I$ f4 O, z$ F3 q, z
  77. 9 ]! Q4 d& C) e6 t  F) ?
  78. static int acnt = 512;
    " I& h3 e+ B. ^+ C  i0 z3 A: Q5 T
  79. static int bcnt = 8;
    , K; B" x* h. B5 w- h
  80. static int ccnt = 8;
    7 T" S0 ~$ J9 C% q2 ]7 c
  81. + @* ?9 f' Y, B; E. g* k2 |
  82. module_param(acnt, int, S_IRUGO);8 E5 z% {& d9 b# H% a# N0 L# T. T
  83. module_param(bcnt, int, S_IRUGO);6 X& }; ~- w+ t8 t9 \! c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 j( C( W, N$ Y; r3 }

# H( A* k5 N( B+ O& y+ V1 [1 K6 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 t; G6 x' A' v: E+ I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 Q" I7 J  L) [" t* S8 z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ K7 s. i" K4 \; S. z( X
* k0 s0 {4 r( M6 H, y: _2 ]) a) W" y. S1 g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 14:52 , Processed in 0.038965 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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