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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 B. h& c; ^$ C
  1. [code]EDMA sample test application) O% i. n* l' T" r4 B# m3 i, Z3 t
  2. /*
    1 \4 i3 M+ Z! Y# A( e
  3. * edma_test.c
    3 S7 ^" [: v1 d. `
  4. *
    $ o4 j; O  P7 ]6 y
  5. * brief  EDMA3 Test Application4 y  V$ u3 j0 S0 y. w4 G# }
  6. *( h- f. X. E* c4 q
  7. *   This file contains EDMA3 Test code.
    & r" |$ T% e) |: V; P3 e: d
  8. *3 w( n/ H+ n# {0 Y: T  K0 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 c3 ~7 @) A, A4 _' T5 q. Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 A' @0 C9 ~9 y- ?4 D
  11. *         TO CHANGE.0 k: B6 o$ E$ h$ s( L# \; w6 y( _
  12. *1 v6 r4 w/ J0 ~' l* r2 O% X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v' r/ d5 v3 Z# k* Z
  14. *
    ' @0 M) i! ?* b. q. u
  15. * This program is free software; you can redistribute it and/or% p, W7 i, }  _0 H. z8 C4 }
  16. * modify it under the terms of the GNU General Public License as# Z2 X' H# [$ |: @% v- S- F
  17. * published by the Free Software Foundation version 2.
    2 J. Y$ p+ `* h* _3 J( u
  18. *9 I; U2 v0 X5 k7 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ [- {% i6 l: m% U( c
  20. * kind, whether express or implied; without even the implied warranty; n1 M3 ]9 X7 z/ H% s* H6 m/ U9 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * t# n( M# q6 u" [7 @
  22. * GNU General Public License for more details.
      r/ J0 ^* G, {$ H
  23. */% c# t" J& T3 V. ~3 m6 {6 z: L
  24. ( d, n8 @# {: O+ k" Q2 @9 R) q; U
  25. #include <linux/module.h>7 u" C5 S- v/ B
  26. #include <linux/init.h>
      Z$ R7 E5 _9 U. G6 C, {0 E- n9 `
  27. #include <linux/errno.h>
    % e5 A5 k) t, u1 z& _
  28. #include <linux/types.h>( a7 x4 E$ F/ Y0 u
  29. #include <linux/interrupt.h>: S7 ]% T% O' m) L
  30. #include <asm/io.h>
    " X! v, R2 v* b6 r2 ]7 \
  31. #include <linux/moduleparam.h>; j: @* f0 J  E# y: V4 p
  32. #include <linux/sysctl.h>" E% n* q' I5 A& H) Q7 U
  33. #include <linux/mm.h>3 q- a- s& _, D$ S
  34. #include <linux/dma-mapping.h>
    $ y% |8 a# o6 v% Y- \  O4 j
  35. ' a% ?9 c7 y% \  d
  36. #include <mach/memory.h>  V6 F& A% K3 b% R8 Y. Y! ^* G
  37. #include <mach/hardware.h>1 k0 A7 ~- i( r/ |. z
  38. #include <mach/irqs.h>; b# G8 E; I$ x: B0 j0 H6 w0 W
  39. #include <asm/hardware/edma.h>
    9 ?" i+ Y( Y) T! d" q- @
  40. 9 D/ k  l2 j. `8 v
  41. #undef EDMA3_DEBUG
    ! H+ e( `. O! U3 _
  42. /*#define EDMA3_DEBUG*/& V5 [, m5 _: R
  43. 1 j4 [* X( r3 l* t2 M
  44. #ifdef EDMA3_DEBUG. J% d: [4 c  N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- c$ @# _. U' L* |1 O7 i; P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 c2 w( w( q/ Q" b3 Q4 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 x5 e% H9 P: X
  48. #else( J2 ?, f+ J4 L& U8 q# D
  49. #define DMA_PRINTK( x... )( O1 r3 B. C: e0 \8 |3 \
  50. #define DMA_FN_IN
    % x$ F8 {' ^6 O: ~0 d
  51. #define DMA_FN_OUT
    0 i! ?, ^) M* {0 V7 {
  52. #endif1 |& H7 i, ?7 W+ L2 v  e
  53. & E/ B+ @' F; y4 e8 O7 [; ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 ~) @1 d( x# A$ @
  55. #define STATIC_SHIFT                31 L- f9 x8 f& _/ x# ?+ _  c
  56. #define TCINTEN_SHIFT               20: t: V& M5 {; K6 p
  57. #define ITCINTEN_SHIFT              21
    . `7 j% I# ~! h$ B6 E1 l0 K! M
  58. #define TCCHEN_SHIFT                222 k5 a% q( l" N" U  q
  59. #define ITCCHEN_SHIFT               23% P8 e3 V7 ^7 ]+ g" _8 P

  60. * @: @0 E2 k4 M* Y- @4 w+ S) S
  61. static volatile int irqraised1 = 0;
    5 {) z4 V! P: h2 x4 G8 u
  62. static volatile int irqraised2 = 0;' e: b) |# t( Y9 f/ p  J
  63. 1 r4 _2 v6 Y  {+ i+ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! q# `& i& s7 w3 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * K3 o4 ^% i* s# N! h  p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . A* _; |; ]* W3 a6 A

  67. & @# i8 o5 H# S( P
  68. dma_addr_t dmaphyssrc1 = 0;! W+ w. \8 w( s( Y7 \" T8 y
  69. dma_addr_t dmaphyssrc2 = 0;
    0 x- ~, A3 Z/ ^6 R+ f3 o0 [8 W
  70. dma_addr_t dmaphysdest1 = 0;8 f* ]; Q, n9 p! S
  71. dma_addr_t dmaphysdest2 = 0;
    8 F8 C' M+ ~; W( g3 S2 V
  72. + ?3 u' u9 w5 ~- ~8 d
  73. char *dmabufsrc1 = NULL;
    / M  \: o; A- K% q( e  e% h
  74. char *dmabufsrc2 = NULL;2 ^, ]# p/ A+ T
  75. char *dmabufdest1 = NULL;  `+ o' l8 V. S
  76. char *dmabufdest2 = NULL;
    1 |0 d: D8 ~2 C  w9 m7 R. }8 L

  77. ( ]7 w6 P2 O- P6 e; S! n: `
  78. static int acnt = 512;
    ! x! d4 W* y  ?9 g6 {$ r5 }
  79. static int bcnt = 8;
    : v  r1 U6 S! c! C: v# ^1 e) d5 E
  80. static int ccnt = 8;0 |: g/ C$ x6 {3 o: ^3 Z

  81. & q- C" x. t1 e6 G0 e; g6 A
  82. module_param(acnt, int, S_IRUGO);6 c; L, U' ~* y, @" |; F& G
  83. module_param(bcnt, int, S_IRUGO);- f# D1 ?- T+ c1 \" l: W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  H. f/ u$ I( ]1 h
0 U) A2 P; l7 l0 z: W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 I/ X6 P' T" S/ I' t! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- R) Y  L8 n4 ?$ ~) d8 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" H) M% H0 q  `* T, w
3 l! @/ x1 N$ p  N& ]2 d. s9 t( W9 h; C. d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 01:58 , Processed in 0.039189 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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