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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& N5 c' W4 g1 t* h7 f
  1. [code]EDMA sample test application
    5 R1 l: X+ p6 q2 ?. D( ^4 C
  2. /*" @. Q5 g% C: S1 W% H; I& a! N
  3. * edma_test.c
    6 E& P# w& B- O8 F5 g* i/ C, y% C
  4. *
    $ U: n2 s$ v% ^, V5 W' N
  5. * brief  EDMA3 Test Application
    2 ?8 u6 K+ Q7 X+ g+ r
  6. *% [1 `' S: R7 n5 S( L7 {
  7. *   This file contains EDMA3 Test code.4 l% h& t; D/ U0 }4 F, X
  8. *
    0 C; |1 A/ \* ~) E! M# ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# W# f& _2 o' w* j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 Y+ C$ @5 H3 T! X
  11. *         TO CHANGE.
    8 Z8 {9 F. a4 {
  12. *
    # d% l0 d, d5 t) @' c; z/ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 g" e4 F* y7 e3 B8 l0 W: ?
  14. *
    0 H5 g. N+ Z8 |& ^) Z2 U) M; u
  15. * This program is free software; you can redistribute it and/or  q# Z3 I6 a5 T3 s9 M, g
  16. * modify it under the terms of the GNU General Public License as/ U) C- Q! M" n2 N
  17. * published by the Free Software Foundation version 2.9 o, M2 y0 P! o7 i
  18. *9 ?6 f; y3 S( Q9 I% o5 K' S: l8 b" d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; w" d0 O7 i: |$ x
  20. * kind, whether express or implied; without even the implied warranty
    + b, y( u+ T) f  V; G' O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; E% `  y% I, A# S
  22. * GNU General Public License for more details.
    ) [& y: f" d- {9 B4 e
  23. */
    - P3 t& @2 }! P/ @% G

  24. ' m$ U0 v9 I" M
  25. #include <linux/module.h>  _# r! u' {6 i0 x; @4 g3 ]
  26. #include <linux/init.h>
    # j2 Y6 E- _9 B5 U4 T" q4 d$ n8 o
  27. #include <linux/errno.h>
    2 l+ z$ F, y1 Y. n% ~
  28. #include <linux/types.h>
    # ~7 L9 ?  P# \* g. O/ L2 w' {$ z7 L% w5 ^
  29. #include <linux/interrupt.h>
    8 r7 N: U* Q2 L5 b
  30. #include <asm/io.h>) e" H8 J5 Z2 J
  31. #include <linux/moduleparam.h>
      Z4 b1 y; B  q# S
  32. #include <linux/sysctl.h>
      I* S/ J" u* ~4 n& Z& d
  33. #include <linux/mm.h>( r% Y3 @" R/ e' n! L0 @
  34. #include <linux/dma-mapping.h>! I7 o) C) E1 R6 R- x9 d
  35.   W& X3 B8 ?2 u) s) ~1 K
  36. #include <mach/memory.h>
    , j6 |) R2 A! {0 B: X
  37. #include <mach/hardware.h>9 l  [: I! V: Q" I2 N4 f9 z
  38. #include <mach/irqs.h>
    + ^; @3 l5 R* ~9 ^
  39. #include <asm/hardware/edma.h>- ?, d2 P9 E6 i( N$ b

  40. 3 P8 Y+ I( Q8 k4 @& F
  41. #undef EDMA3_DEBUG. S- S$ P) s; B# g$ A
  42. /*#define EDMA3_DEBUG*/
    2 e# I( j+ x+ s" S
  43. : y) x8 r/ S/ g7 X! m
  44. #ifdef EDMA3_DEBUG
    7 {& ~. C# o8 |) M' t$ U4 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 J7 a! s0 w3 Y" m" R$ Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): g# ^% R. G6 P  y$ H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ j* |6 @1 _8 I
  48. #else
    * c7 e. b- `5 Q
  49. #define DMA_PRINTK( x... )
    7 O- Q& l. F. G$ I, j5 Z
  50. #define DMA_FN_IN, p4 Y6 m5 x" E. q7 M
  51. #define DMA_FN_OUT& f0 n# U) _- H) p
  52. #endif, ^" ]  V. L2 S

  53. , d4 v0 }" K/ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' {1 _" I. ?' ]- N3 ~
  55. #define STATIC_SHIFT                3
    7 Q1 |# S5 X+ e
  56. #define TCINTEN_SHIFT               20
    % y9 M  ]% N- e
  57. #define ITCINTEN_SHIFT              21* U* p- C. q9 \  r3 {. T
  58. #define TCCHEN_SHIFT                228 {0 p$ ]4 u4 \/ y) Q; e( m
  59. #define ITCCHEN_SHIFT               23) p3 T7 y3 j/ j6 ]3 [! m5 `4 Z
  60. : Y' p3 F$ l- A& [8 E# Z
  61. static volatile int irqraised1 = 0;
    : N3 S+ y" T( W. z% j/ |. z! v
  62. static volatile int irqraised2 = 0;
    # l; Q( }3 Z% I' @, r0 G. p# H' q
  63. 9 W+ b# ^# t' W7 p: G) S5 o  }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 @6 W0 D" e. n. J% R4 v) b9 u+ S* N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H9 l" H! l8 c/ _: n. J8 z, H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , L9 j; Q1 O0 ], P4 J
  67. ( f7 m, H/ L9 ^
  68. dma_addr_t dmaphyssrc1 = 0;
    # N2 Z" M2 T; D6 Y) H+ x, h
  69. dma_addr_t dmaphyssrc2 = 0;  @) z9 g# I! [, H& \
  70. dma_addr_t dmaphysdest1 = 0;) U" Y7 f) Q+ V! k% R
  71. dma_addr_t dmaphysdest2 = 0;4 ?, ^2 r! _2 f2 Z7 i/ l
  72. 9 R: q1 a' \3 L" U* F7 P9 s
  73. char *dmabufsrc1 = NULL;
    % P" b; ]% x& F; n
  74. char *dmabufsrc2 = NULL;) G6 [: I- j1 a4 w" F' l
  75. char *dmabufdest1 = NULL;0 P' h/ Q( D2 X2 I) w# @- T
  76. char *dmabufdest2 = NULL;
    7 O( A4 D' _2 j' y$ d
  77. ' j, J# ^  `& p
  78. static int acnt = 512;, _5 \% @& ^% Y, v/ A6 F
  79. static int bcnt = 8;
    + r. R: ?# c% |) ~, V0 b4 ]
  80. static int ccnt = 8;
    0 A5 v# \5 y- |- `$ C) {

  81. # ]* i4 x6 ]8 p, i& [. I$ ?4 o" Q
  82. module_param(acnt, int, S_IRUGO);$ [5 L) {; e8 g" ]' }. v/ E, b
  83. module_param(bcnt, int, S_IRUGO);. z+ F, m* ?9 x* V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( `  B. `. Z6 d- B5 w4 U+ [* g8 I: R0 x" p, R4 o
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" H- U3 V! V* }- d, ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( X, N. z& a2 E. z8 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# o# t/ m  K8 I
; E5 |( x8 L% I+ H# B2 c5 ^
( F1 V% w; V4 a& ?6 @' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 10:11 , Processed in 0.035681 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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