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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & ]2 e" y$ p7 E) ~
  1. [code]EDMA sample test application
      b9 T4 {2 `7 ]; n. y
  2. /*
      `  ?+ S) r: l6 ~, ]- ^
  3. * edma_test.c' ~" s1 ?) E' W3 U: \1 Z0 x
  4. *9 x& `9 P# r1 ^! o
  5. * brief  EDMA3 Test Application
    6 Q/ ?9 r9 r8 b. C* t8 k$ r
  6. *
    ; H  |# N" A& F: g2 l& Y  j
  7. *   This file contains EDMA3 Test code.
    $ @0 C# r8 @0 @1 ~
  8. *$ h5 o+ N" a+ g! B3 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 d9 @0 g7 `+ U( M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . T, d& ?$ [; I$ x
  11. *         TO CHANGE.: b% d) E- r$ f2 l3 g
  12. *
    / r5 t7 L4 c; c. z; W, m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - c3 D. e! E: e" x; R% r
  14. ** A* h; C0 ^0 l  Z: n# V/ J
  15. * This program is free software; you can redistribute it and/or
    * E6 W5 t- [7 p0 `& E
  16. * modify it under the terms of the GNU General Public License as. d' S; h5 R) f* P: R9 g! C
  17. * published by the Free Software Foundation version 2.
    % E+ b& I. V5 B, R
  18. *
    1 n2 _- J9 b" E, b- {" ^; O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % a4 v2 m- E  V. n. f. T
  20. * kind, whether express or implied; without even the implied warranty
    6 a7 O+ Q- Y2 a$ c, t6 n9 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 G1 r8 J) ~, i- I+ L+ j
  22. * GNU General Public License for more details.( T. X( d; |: ]/ Y/ V8 B; {. `: g
  23. */0 I8 q: ]# c6 E9 O6 N( a5 P: g
  24. 4 F- j, D$ @9 Q8 j5 `
  25. #include <linux/module.h>
    % C5 o0 H6 K9 Z; f5 |. ]) i
  26. #include <linux/init.h>: C, W3 |4 y) E; j8 q8 C
  27. #include <linux/errno.h>
    ) M$ e" [+ f4 J
  28. #include <linux/types.h>  q! _8 c3 s9 U  x
  29. #include <linux/interrupt.h>
    : c) {3 v1 l' e4 A2 B" f% u
  30. #include <asm/io.h>
    8 D0 f- T, A% W- F, t+ O# y( T
  31. #include <linux/moduleparam.h>2 P' h  V% y; ^; }
  32. #include <linux/sysctl.h>
    7 \- I4 @4 M5 }! i; v+ l% m
  33. #include <linux/mm.h>+ y) I  l( S2 H! e+ e8 B0 L; R8 a: ~
  34. #include <linux/dma-mapping.h>+ X0 u) N; q$ R; A$ P6 q

  35. 3 p" |; O9 t$ D0 Q0 [. P
  36. #include <mach/memory.h>
    / g' X1 s$ D# p* m
  37. #include <mach/hardware.h>6 o$ \  U( `/ A
  38. #include <mach/irqs.h>, p3 a; O: R$ P) t' K6 y
  39. #include <asm/hardware/edma.h>3 x: h* D/ O" y4 d5 ?, f

  40. 1 R" x- o* w( t1 R+ ]$ P4 y
  41. #undef EDMA3_DEBUG/ V0 Q6 G. H7 i
  42. /*#define EDMA3_DEBUG*/
    8 y# G4 I# A, G# h8 r, g# X0 a1 M
  43. 1 Z# o; d; Y/ ^. O6 l
  44. #ifdef EDMA3_DEBUG
      m2 i* c+ }% b1 \( c4 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : c- ~( f' N% {" q6 E2 v1 l5 i4 \7 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : U3 r% q! {, {% d; X- m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 U) S5 d. `# ]9 N# w
  48. #else
    4 f$ x' V) [  @1 ~
  49. #define DMA_PRINTK( x... )
    ) G  Y2 t: q- R) G4 x
  50. #define DMA_FN_IN
    9 \; u, ^( p( a2 v# n: n
  51. #define DMA_FN_OUT
    . z, {) X& T; G1 v# D1 j0 O
  52. #endif
    4 i, a1 ?8 A7 @( c& w/ K
  53. ) ^6 a% @. T( T4 O2 H" q* i' p% M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 A" Q- X5 _' _- W  D
  55. #define STATIC_SHIFT                3
    # \5 u' [8 _$ o; o) z. }
  56. #define TCINTEN_SHIFT               20" k4 x% W0 U. d+ r% ]
  57. #define ITCINTEN_SHIFT              21
    : x% f5 Y0 F0 t" W0 X. U
  58. #define TCCHEN_SHIFT                22
    - e. k' W" v5 \  L' ?
  59. #define ITCCHEN_SHIFT               23
    8 W, `/ L, _; `7 ]- T3 n  _
  60. $ [, k* Z& q0 q* I5 h: V2 L7 @. L9 d
  61. static volatile int irqraised1 = 0;
    % L" N3 Y6 C. a4 k+ ?1 l
  62. static volatile int irqraised2 = 0;
    % m) L; e' \; ]

  63. 2 B* C3 X; ^4 A2 L* _3 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Q  }, _' h4 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( h! O. x1 O  r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * F. y- P0 a; b# ^. t& m3 Y

  67. 9 K# B5 _# ^8 m1 S" D# c; w
  68. dma_addr_t dmaphyssrc1 = 0;1 E5 ~# c) ~' E% \
  69. dma_addr_t dmaphyssrc2 = 0;' P  t: G+ o. R! W0 j! v  s( P, y, M
  70. dma_addr_t dmaphysdest1 = 0;
    2 s! i% }8 W- a& R, _. l
  71. dma_addr_t dmaphysdest2 = 0;6 \% c/ D7 O3 N7 J1 q
  72. ( O9 K6 l, j# i& j3 X
  73. char *dmabufsrc1 = NULL;
    , w. F" G0 e4 ]0 S. h" q: ?$ S' l  r
  74. char *dmabufsrc2 = NULL;7 I- a* V$ P1 g! o) P% b2 Q5 z
  75. char *dmabufdest1 = NULL;4 s: F$ h1 n5 x5 T2 S
  76. char *dmabufdest2 = NULL;
    ! t+ z$ `5 S% r. G3 V/ j

  77. % l3 d4 A# \& N3 [
  78. static int acnt = 512;3 w+ S2 D: A9 G) s, {2 \3 {
  79. static int bcnt = 8;
    & P6 L4 F0 V( Z3 J$ M4 o* I& [
  80. static int ccnt = 8;
      \. {5 \7 Y+ ?2 |! [/ \

  81. 8 O" A2 m' `# r0 h6 A$ w* q
  82. module_param(acnt, int, S_IRUGO);0 U: O& j! _. M
  83. module_param(bcnt, int, S_IRUGO);6 R( A! ~& a2 B5 U+ {( w3 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 h' `* a+ Y  w1 T; |0 t
: Z" R/ v  g1 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 s4 H! V' F: t) darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ o4 j. Z4 M8 Q5 n+ ?8 i! a. ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) I# @7 z8 t3 q0 G7 x. V/ V& @5 z0 ?: j" n3 c5 E9 l3 e( F1 m7 X

) ~+ H% J1 F( c; {1 {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 23:35 , Processed in 0.047960 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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