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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; [  O2 m# w' a7 E# ^# N( C
  1. [code]EDMA sample test application
    ! n# N: \- A3 }
  2. /*
    . v" n, I' j4 g) G8 ^' T$ b& _
  3. * edma_test.c
    % u! @+ ^: F' r& @% Y
  4. *! R0 o8 ^6 A8 d5 ~
  5. * brief  EDMA3 Test Application
    7 H# f- o) `& ^6 z2 `
  6. *9 [5 e9 L0 y* z
  7. *   This file contains EDMA3 Test code.6 y# S* y/ [+ @% `' ?
  8. *2 y0 A$ N1 {- ?7 L1 k2 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' U5 i) ~. ^+ r( c( W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: J, N' t8 x  V/ `& W$ n/ q
  11. *         TO CHANGE.
    4 H9 R. y  Y9 B, B
  12. *$ H7 f! B3 v; M9 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - j7 K! D  R! K+ M3 q4 N: m
  14. *. r* a9 ~: F6 w) t9 n
  15. * This program is free software; you can redistribute it and/or
    % ?: U  v/ z6 k2 O9 ~
  16. * modify it under the terms of the GNU General Public License as
    # F5 r. K, A( l: Z5 t5 \, u; B4 K
  17. * published by the Free Software Foundation version 2.
    . Z- E4 m/ \8 W+ T5 v/ H6 r
  18. *
    . |8 u+ z; ~1 U4 }) n# l( G, u9 Z- z5 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! N- _. l! J" D  g8 a( ]# C) K
  20. * kind, whether express or implied; without even the implied warranty
    1 N5 J8 i# T6 R8 Q) {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! p3 F+ d9 W- `0 D! u# T' F
  22. * GNU General Public License for more details.0 U9 r7 J8 a# |$ a
  23. */1 @6 [7 P% ^% n3 I$ [1 W3 I
  24. # Y) X0 f2 H$ n5 F& \$ M& y
  25. #include <linux/module.h>+ Y. D! O  B0 t1 S
  26. #include <linux/init.h>, z  ]) a' r' O* y
  27. #include <linux/errno.h>; b8 s* r8 S* x" P$ m- Z0 s
  28. #include <linux/types.h>/ i! k- C, o. S/ p* j7 o' r' Y
  29. #include <linux/interrupt.h>! o1 e" W. t) k% H4 h% W( y
  30. #include <asm/io.h>
    * s$ q8 H! ~% J
  31. #include <linux/moduleparam.h>
    4 N( e! a6 j0 r9 G/ _* i" j- j
  32. #include <linux/sysctl.h>
    4 a% [& w  d9 M6 [
  33. #include <linux/mm.h>
    8 v4 x; k% ]3 T7 C3 D
  34. #include <linux/dma-mapping.h>+ w' V) T/ Q% m4 ^7 A- _1 t

  35. + w& m7 Y5 c: P
  36. #include <mach/memory.h>
    + ^9 |! e( u% e
  37. #include <mach/hardware.h>
    " @- ]0 f  x& ~
  38. #include <mach/irqs.h>2 N; [; R4 J0 A/ k6 V. d
  39. #include <asm/hardware/edma.h>
    2 y4 W0 N* i& Y
  40. : T5 o$ p) s6 ?! N
  41. #undef EDMA3_DEBUG
    : Y1 h/ f" X  n, N; c$ O
  42. /*#define EDMA3_DEBUG*/% p( [: U; C0 J

  43. $ Z8 R. Z% l, k* |# E
  44. #ifdef EDMA3_DEBUG
    ' Z& m  E$ j; O- P% W' b1 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - U9 y0 b* N# b' D5 i* s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 @2 Q$ M3 R1 F- r8 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  Z2 k( O7 Z5 G! `7 z
  48. #else
    ' f. b  Y2 i. |6 W1 P3 O5 K  |$ V
  49. #define DMA_PRINTK( x... )
    # T7 Z& M: D4 F( d/ V: M9 h
  50. #define DMA_FN_IN
    6 V9 H6 \/ u  P: u" c, N1 i+ ~
  51. #define DMA_FN_OUT( V6 ~) o- P2 X# G* Y* P
  52. #endif; I: s, a: H* ^& C' Q
  53. % ~2 B, Q+ M' w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - _% G% Q- O& w6 ~+ g
  55. #define STATIC_SHIFT                3) x/ D% P! T0 s; A1 c8 X2 l
  56. #define TCINTEN_SHIFT               20
    2 T# y" g9 K- v5 [$ O0 |
  57. #define ITCINTEN_SHIFT              213 B" ~; r. X# ~+ `) H/ b
  58. #define TCCHEN_SHIFT                22
    ) f" j  f7 X6 q! V( J3 E
  59. #define ITCCHEN_SHIFT               23
    ( u. N- }9 f, m* u

  60. * c  [- p: e3 C/ J! J, {
  61. static volatile int irqraised1 = 0;0 @9 M+ p3 m$ n- a
  62. static volatile int irqraised2 = 0;' p+ V& {. i1 c/ \

  63. & ^) o$ X4 w! l5 k1 i' n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ]3 @/ S  j. j" i7 s: |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 z) D" q/ p( p4 c5 }( k& z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ~, V9 r, c0 X; N

  67. 6 x3 A* E, {+ `' m: J* ^. H
  68. dma_addr_t dmaphyssrc1 = 0;
    # z, _& z5 P! |* ?/ W( f! o
  69. dma_addr_t dmaphyssrc2 = 0;$ U  h+ D; ]. n1 c* ~+ |' J
  70. dma_addr_t dmaphysdest1 = 0;8 w" i/ b% @3 P9 e
  71. dma_addr_t dmaphysdest2 = 0;# q- @& `7 ]+ u% ?5 q2 E
  72. # Y8 v* E9 ?+ `# [1 l" [# N. {# k
  73. char *dmabufsrc1 = NULL;
    3 ]" n) \! Q, J: ]
  74. char *dmabufsrc2 = NULL;
    " X, `0 ]( Q# p9 F
  75. char *dmabufdest1 = NULL;6 g7 Y- z1 }. s
  76. char *dmabufdest2 = NULL;+ Q8 N9 ]. ]9 [

  77. - U: o# K' j5 i0 p1 S5 @2 h
  78. static int acnt = 512;
      g. S' W1 `8 S: F
  79. static int bcnt = 8;6 Q  u; p  B3 t+ j- p2 m
  80. static int ccnt = 8;
    $ G: a, `3 z0 A' c$ S5 w
  81. ( T" f, t; o- ?, G
  82. module_param(acnt, int, S_IRUGO);
    , l/ T* i* d( Q- R. V$ Z
  83. module_param(bcnt, int, S_IRUGO);! c, q; c" g# @1 t' K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- ]& j2 E- }) O( l! I9 ^4 t& r, i$ c) F2 J. h3 y8 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 K0 j9 Q; r# J. a9 H4 X! ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- Q8 L. y% f2 [. s2 ~. W     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 w! P3 Z; v0 P% p' ]- \- v: s
: v0 [5 O0 b. |& z/ M

" X$ A9 h* ?" @  j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 07:02 , Processed in 0.038591 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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