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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & @6 P, p) w9 [* S8 w
  1. [code]EDMA sample test application7 d$ O. }! [5 ?, l, D/ [& R5 T
  2. /*
    2 T. u3 J6 `$ B6 Z* ~
  3. * edma_test.c$ h' _3 z2 L* u& C1 d$ Y
  4. *( d, Q8 z& r8 p4 x( k( Q9 n
  5. * brief  EDMA3 Test Application" @' I' z0 c" _
  6. *
    2 a! n6 F; d9 H9 Y& O; s9 x% b5 k
  7. *   This file contains EDMA3 Test code.
    / Q) j- F% j2 x1 m/ k9 G! y, L
  8. *" D; d! V( b; N* B0 w$ |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 O- n0 A, |7 c( ]: G8 Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, R7 ~; B. i: v
  11. *         TO CHANGE.- Q# i' v' j( T1 `6 S! X3 H( ]
  12. *
    ! j$ S, W! k, f8 @1 A5 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      @( Q/ r7 g7 d* k6 }! a7 b0 a4 X
  14. *
    ) n" w2 E( G7 ]
  15. * This program is free software; you can redistribute it and/or
    0 j5 L, W2 }, y
  16. * modify it under the terms of the GNU General Public License as
    9 P  B2 H6 g) k" p# Z5 `+ s
  17. * published by the Free Software Foundation version 2.3 ?( ]# |+ g2 P3 B! |3 r2 H. U
  18. *: W- A; }! L* A9 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 P; W: ?1 d& y) ?
  20. * kind, whether express or implied; without even the implied warranty
    ! [8 i1 o, \7 g# W% k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - `, ?5 K. D9 N0 B5 w; W- V, N+ m
  22. * GNU General Public License for more details.- U& g+ L/ ?& f
  23. */8 O2 F% w& @' ^1 i; T/ I0 o  |

  24. & t4 n$ g: r0 v+ }3 f4 |! a  Q( z
  25. #include <linux/module.h>$ ^+ o* \" Q. B  O& z$ J/ ?
  26. #include <linux/init.h>! ]" {, h0 u. c4 M
  27. #include <linux/errno.h>. p$ R! \' O/ w$ g
  28. #include <linux/types.h>
    $ h% H7 U4 ?3 I3 k
  29. #include <linux/interrupt.h>
    1 r8 g! i9 r. p  q% w& M
  30. #include <asm/io.h>
    4 u8 ^* C3 y6 S* [& y. `! x5 n
  31. #include <linux/moduleparam.h>
    - h2 |" w6 X: u* {, g# v
  32. #include <linux/sysctl.h>
    / b3 F5 Z- i7 p3 n+ i
  33. #include <linux/mm.h>
    $ k. B4 F5 ?9 e7 A( I8 n! q
  34. #include <linux/dma-mapping.h>
    ( e1 d7 S4 N& M  P0 H4 ]1 P" W6 x" [
  35. 9 Y  N# Z; i" [$ ]( V: a! q9 k! q  J& g
  36. #include <mach/memory.h>
    . H+ u, X( H* w- m- S
  37. #include <mach/hardware.h>( p! e# l% u  v1 R
  38. #include <mach/irqs.h>
    4 X# Z0 V1 K+ `
  39. #include <asm/hardware/edma.h>
    1 h- D4 U+ e3 K# A1 L
  40. 7 V3 O) K! p8 B) X; u
  41. #undef EDMA3_DEBUG
    & p& w5 w. n8 I" e/ ?
  42. /*#define EDMA3_DEBUG*/+ a' J: o3 g1 y% L4 C
  43. 9 J) I; J8 ?. ~) T7 i/ a5 D
  44. #ifdef EDMA3_DEBUG% w4 h8 o& h$ W6 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 H3 C: e# i* ^5 `. i* b6 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 c( V; }( N( b2 U# |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S, A8 V; T& C- z
  48. #else
      E+ T9 w0 ]1 k
  49. #define DMA_PRINTK( x... )
    # `3 l& Q" k/ Z) A+ y5 }  c
  50. #define DMA_FN_IN, F8 t6 X- }6 e2 j# c+ c
  51. #define DMA_FN_OUT9 X$ f! |* g8 X9 n5 C, R7 a" P4 t
  52. #endif
    6 d9 d+ ?- ^, m, T8 l7 ]
  53. + G0 T4 l8 `' D" l' r, b: L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). g1 w* x, ]5 [- P
  55. #define STATIC_SHIFT                3/ g+ x' W7 D6 o7 d+ _, U% V6 v
  56. #define TCINTEN_SHIFT               20( f4 I8 D+ X* r$ d
  57. #define ITCINTEN_SHIFT              21
      c2 x9 ~2 s2 C! n
  58. #define TCCHEN_SHIFT                22/ K5 ~3 ~0 U- \2 @; C
  59. #define ITCCHEN_SHIFT               23
    ; r) X6 S  X3 |9 ~

  60. - l8 L& i, m  V+ R
  61. static volatile int irqraised1 = 0;0 ~5 f* Q& n+ r" V# [/ ^. `, X
  62. static volatile int irqraised2 = 0;9 V& T  i4 {  g# C
  63. & ^/ i; b0 t6 U! O( i. l" D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( s: j! h# ^9 Z* H, j! m0 b7 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - k$ r) K$ P4 v6 r4 H  Y7 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s3 |* }! A% h
  67. 7 Q+ X# H3 ], o  y1 h4 _
  68. dma_addr_t dmaphyssrc1 = 0;7 Q# d9 x( `; p
  69. dma_addr_t dmaphyssrc2 = 0;6 ?2 l+ x6 ]+ Z
  70. dma_addr_t dmaphysdest1 = 0;$ x. a& S+ c" o. V$ x
  71. dma_addr_t dmaphysdest2 = 0;" ~7 K" q% g/ D) k
  72. ' }: a, \- U  E6 t" L1 ~  s
  73. char *dmabufsrc1 = NULL;
    , N6 F6 N0 q1 j- e. v/ S6 N! \+ J
  74. char *dmabufsrc2 = NULL;; F) B; F& T+ N) ]( p: M5 h2 c/ q
  75. char *dmabufdest1 = NULL;
    + `. Z; a( L6 B1 M. R- A6 V4 ?. l
  76. char *dmabufdest2 = NULL;* P3 @  \$ P; n/ Y0 f: V

  77. 7 I$ G; w7 b6 {  _% t' w
  78. static int acnt = 512;
    ' A' z0 W. \: u
  79. static int bcnt = 8;
    $ v: D& o# [) s4 R
  80. static int ccnt = 8;
    / N) x9 T, G" w( ^- B: ^/ f# ]

  81. 3 d$ e$ M* Z& x" M
  82. module_param(acnt, int, S_IRUGO);: |  ?/ \* D! {% N  R% `( y  d1 t
  83. module_param(bcnt, int, S_IRUGO);
    ; G/ }. Y* l8 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) I* [0 P- K0 t
4 _- Y: m5 r" ~& N4 T9 A  Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* j- L1 B* D) ~: Y8 O9 {
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! A, t6 T# D0 ~" m1 T/ ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! {4 \" V6 I- C2 v' @2 `

3 {/ ~- o# `6 C  \# w( }6 ?& W% y" S: F! h* k& }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-4 04:26 , Processed in 0.043715 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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