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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  F. k- \# I5 J5 n' y; n6 Z: d
  1. [code]EDMA sample test application7 I. H/ Y7 x* X! e# K
  2. /*
    / \, J/ |+ v& V5 f8 s: J8 i
  3. * edma_test.c' g2 N3 v" Q5 y; @& m2 N7 T
  4. *$ |5 i- Q. z$ F* K, X5 H' C' |
  5. * brief  EDMA3 Test Application
    9 R3 U4 X' l9 l# e( \/ h; X
  6. *
    * k" t4 t- I& C& W$ H" ]
  7. *   This file contains EDMA3 Test code., E9 X+ t6 }& [7 Y5 e' P& l: {! T
  8. ** ^! `. z" K9 }' ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' Y/ ^! Y) W. L$ n/ ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - _9 j2 M( W/ ]4 P
  11. *         TO CHANGE.
    - |8 l/ r! P) F2 i/ e) C( |
  12. *
    * n. z& O1 a1 Z8 K, j" {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 X5 ]- @' Y0 ?& Q; z6 e
  14. *
    % i, q2 M; _7 o; T
  15. * This program is free software; you can redistribute it and/or. E: V9 J- b7 j) o) n& l8 B" W
  16. * modify it under the terms of the GNU General Public License as* T) L2 \  C; t: f5 _9 G% K, g- W
  17. * published by the Free Software Foundation version 2.
    / w) K, c4 z% D* D( g5 ^. G
  18. *
    & q0 k' u0 T5 [% v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 p8 m8 w3 |; I% t& Q. d. S: d
  20. * kind, whether express or implied; without even the implied warranty8 C; a$ W" s8 R6 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , r6 M' _" u% z- W9 F& J
  22. * GNU General Public License for more details.5 X! G/ @1 Q4 a- U6 U
  23. */
    $ J( K/ v& E: G- Q( [

  24. 5 m" R  X* z0 I- b
  25. #include <linux/module.h>
    / z! l& C( f* f* d; q4 c
  26. #include <linux/init.h>
    : E7 w7 x+ i0 Z. j' T; |( m& y
  27. #include <linux/errno.h>2 F2 m# q/ p/ C/ @
  28. #include <linux/types.h>
    ( W, K/ q9 e6 @" w
  29. #include <linux/interrupt.h>
    $ \' [2 j7 l& k4 z* Y7 g
  30. #include <asm/io.h>
    # K1 c' M2 A8 f. k1 J9 B. @: B
  31. #include <linux/moduleparam.h>
    ; Y- P6 [, F& O- E5 ?2 x# Q" Z9 I, ?
  32. #include <linux/sysctl.h>
    ( A7 O0 @7 N( R  \/ _( ]2 a1 `
  33. #include <linux/mm.h>7 T. Z4 V9 ~% ~- ^  d
  34. #include <linux/dma-mapping.h># l% m4 H3 P9 Q5 U1 h

  35. 7 v3 n2 k% ?* C. {& @
  36. #include <mach/memory.h>0 {2 J3 i' D7 g! s# }) ], M
  37. #include <mach/hardware.h>. E' @' |/ a" ^) s' Y$ x) S8 H
  38. #include <mach/irqs.h>
    5 Y& O1 C& ?$ f
  39. #include <asm/hardware/edma.h>
    ! G- h% c) l5 D" ?; N& ~8 L
  40. - D0 w) F) s  M$ b, B, H
  41. #undef EDMA3_DEBUG* ]; k) Q9 i9 s* `
  42. /*#define EDMA3_DEBUG*/
    - U3 g( V) t9 u

  43. 0 U, Y6 I& z! N/ Y% c% q% Q
  44. #ifdef EDMA3_DEBUG; |+ u: q) j  d7 s  I+ R4 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), j8 |& o2 v0 P( v1 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 s% B% q7 p' ]$ A7 `) p. A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 S' u8 p( f. E) K
  48. #else
      D' H5 i& A) q" I$ e; P
  49. #define DMA_PRINTK( x... )! u) G. a+ q8 w& H6 O
  50. #define DMA_FN_IN
    " G+ @/ z7 |$ e2 C, g5 [, O
  51. #define DMA_FN_OUT
    1 P- M( K9 ~4 Q( s: s6 V5 w
  52. #endif
    % T7 E* @" N2 L
  53. 4 {0 W1 s, _- r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): E, x( R& o. V
  55. #define STATIC_SHIFT                3
    ' j4 a5 s* M  x: ~
  56. #define TCINTEN_SHIFT               20
    ! A& x- O( k$ @2 o" u- c
  57. #define ITCINTEN_SHIFT              21
    7 c  O: ~* t$ \# H" y" Q
  58. #define TCCHEN_SHIFT                22
      o$ D. |: A6 ?- c
  59. #define ITCCHEN_SHIFT               238 A. |9 ?- c  N5 ^
  60. + Q" P# H& }, X' g* s7 g; O! a
  61. static volatile int irqraised1 = 0;; m0 O' `- t* K
  62. static volatile int irqraised2 = 0;- J4 Y7 M5 c8 Z2 E0 p' p5 V

  63. $ P9 P9 |2 w: c3 q& k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 j8 A/ a; K  b4 \" M$ t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % x1 }: ]' h5 N3 c, q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Z' k, e" C# I5 M
  67. ' g& J- s  r" a  Z# g
  68. dma_addr_t dmaphyssrc1 = 0;6 e; k4 ]1 l& d. R5 |9 J/ W
  69. dma_addr_t dmaphyssrc2 = 0;2 w% Z" f& ^5 P% F$ Z
  70. dma_addr_t dmaphysdest1 = 0;
    ' l0 @% j3 M  F1 r0 }9 _; b
  71. dma_addr_t dmaphysdest2 = 0;
    ! f2 |5 ]' C; r+ x
  72. 3 A( \4 c9 A8 d* P& ~0 A& ]
  73. char *dmabufsrc1 = NULL;
    6 J2 \& p/ F. i% B7 {
  74. char *dmabufsrc2 = NULL;
    7 b) s+ y& l' \3 r2 S
  75. char *dmabufdest1 = NULL;
    " X0 N( _- s+ y7 F; j; k
  76. char *dmabufdest2 = NULL;
    % ?! X7 V' }4 V% X6 _" r8 r4 u

  77. ( b: @7 O6 A/ d$ f
  78. static int acnt = 512;  O2 ^  z0 I% F; d' R
  79. static int bcnt = 8;+ e$ W7 D3 I% x8 T( S
  80. static int ccnt = 8;  p9 V$ N* {4 v2 G2 S3 f7 L& Y, F
  81. & o. i9 Q/ T/ g
  82. module_param(acnt, int, S_IRUGO);8 z: I& n/ v# ^' ]" R
  83. module_param(bcnt, int, S_IRUGO);- ^, [& \+ |: l$ p5 a; j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 s9 M. x+ c! v' C
; O  r% V+ M# u. h) K8 w, n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ V: [. W/ K8 a  Y5 P! Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" [# {: P& b: `9 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& z8 a. x2 g1 c
# V2 F# E6 i! I; a

6 ]+ r- y1 V2 s" N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 21:39 , Processed in 0.042454 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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