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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + W0 P! T! Y1 R
  1. [code]EDMA sample test application
    $ L) C! a- R0 t: h! i
  2. /*& J, f* ^- S% q
  3. * edma_test.c
    & I' @! G, g4 p
  4. *8 C7 _( `1 O" u' [) [% V
  5. * brief  EDMA3 Test Application
    6 w! J1 N* b( v7 B1 t3 B8 T
  6. *
    & R, ~" X" W; P, U$ o
  7. *   This file contains EDMA3 Test code.9 A, ]3 N- `5 ]$ x' x+ [& b% X+ N
  8. *
    5 @. J0 ]! ^2 U9 T; a6 y2 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ~, j4 f3 q8 d( w% N& k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( t  S; o" N2 x. z( N3 m( b2 R8 F$ Z
  11. *         TO CHANGE.
    6 a7 Z( W1 |% X1 h4 P: U8 j' }
  12. *
    3 I( j8 l5 `7 s; d5 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 P! Y$ G1 L) D+ }6 |( I
  14. *- Z1 L; Q# K/ [8 t  P+ Y) D
  15. * This program is free software; you can redistribute it and/or
    4 X  H1 |/ t) B6 h
  16. * modify it under the terms of the GNU General Public License as& k( ]) m  ]2 R4 h
  17. * published by the Free Software Foundation version 2.  ~1 _# d& q1 J% n' l/ e- h3 ^+ s
  18. *' C' G# s+ O: o) R' }, D1 |6 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 u! X" ^+ p. h5 l
  20. * kind, whether express or implied; without even the implied warranty
    % Z& {4 R. h: y3 g# U, x; e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 F- {! z6 s9 n/ Q0 ~: D& w
  22. * GNU General Public License for more details.5 j9 g) T- N2 [3 [6 h7 E
  23. */# u. v% `" ]' |, l

  24. * W$ i8 }9 X- V! E2 T/ {; Y
  25. #include <linux/module.h>; J- C6 z* D; e5 b( a+ P% g
  26. #include <linux/init.h>9 o5 K2 S* N* {0 q8 l$ i, W) {
  27. #include <linux/errno.h>3 o; `( @3 J" N0 K
  28. #include <linux/types.h>
    4 N" C+ S. S, b8 j: @# Q6 C
  29. #include <linux/interrupt.h>
    " t. E; o. `+ b0 i: y' ^: b0 l
  30. #include <asm/io.h>7 m6 X* q; U- s9 W# m0 y
  31. #include <linux/moduleparam.h>9 h, \3 z4 J  x* b4 o
  32. #include <linux/sysctl.h>
    4 b" n* J% Y- m$ r* I2 I* S. ~
  33. #include <linux/mm.h>; ^7 B7 i9 @6 W) V$ @
  34. #include <linux/dma-mapping.h>
      M! z* A6 b; w! y
  35. + C7 W+ S" r0 I* T# m
  36. #include <mach/memory.h>
    & T3 h0 S( x8 A6 u+ x3 |
  37. #include <mach/hardware.h>
    4 j" z+ q# W5 S* o& q
  38. #include <mach/irqs.h>
    $ Q2 r- C& G2 |
  39. #include <asm/hardware/edma.h>) f! U4 l2 M, K
  40. 6 g: L9 g4 Q' d' K6 X
  41. #undef EDMA3_DEBUG( c6 H) y0 ]. g4 W
  42. /*#define EDMA3_DEBUG*/
    - G& ^; [) s1 _' h# k: I

  43. ( b' d( W& N4 p3 R
  44. #ifdef EDMA3_DEBUG
    ) B2 _# F6 E# k, Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 H5 _4 X5 N) l6 q- g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 A8 {, X9 S( V* M, ]# @" Z; m7 z/ ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 {: m0 g6 F' _' m# M: b" Q: E& }
  48. #else* {4 ]6 E' l2 w6 ~3 c# e$ o
  49. #define DMA_PRINTK( x... )
    . \7 B$ G( g5 `0 x% f
  50. #define DMA_FN_IN( b# V: I  ?% X& o2 G* Y, [
  51. #define DMA_FN_OUT! J( e( W* o+ w' _/ ?: J- o
  52. #endif% y0 z2 }8 n1 P& d

  53. - x# U9 P# r$ Q8 k" S$ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ a: \' K% z: b# B% ]0 p
  55. #define STATIC_SHIFT                3
    & V' t" _. a7 k1 M
  56. #define TCINTEN_SHIFT               20% `: \/ M4 R; B# B
  57. #define ITCINTEN_SHIFT              21$ @5 f4 O) P% a3 u3 L
  58. #define TCCHEN_SHIFT                220 C0 p( j! y) \$ _7 ?2 x
  59. #define ITCCHEN_SHIFT               23
    : M2 j- j8 D' v8 P9 i

  60. & H  c6 ?! F3 T3 ~; e) u8 u
  61. static volatile int irqraised1 = 0;0 w; p4 U: I, r: m* z" G' z1 ~/ h$ V9 E
  62. static volatile int irqraised2 = 0;
    / t* z' {& W' C& r5 ^- G* n3 ?

  63. # n+ A1 w( n5 S( E& R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , R! n  T; j4 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @1 N( y5 E* R$ s+ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^( {! d% Q( s
  67. 8 \, x3 E) |# s( Z1 x: y8 o1 R1 G
  68. dma_addr_t dmaphyssrc1 = 0;
    ( Z; [+ E8 J% W, p& u8 i2 }8 A
  69. dma_addr_t dmaphyssrc2 = 0;
    , r" Q" g% @3 W
  70. dma_addr_t dmaphysdest1 = 0;0 E0 |* f/ u  u% L  E0 ^. b) R
  71. dma_addr_t dmaphysdest2 = 0;' l4 `/ s& ^$ f* V$ C* _1 b) s
  72. - I; w2 z1 c6 l/ `/ w
  73. char *dmabufsrc1 = NULL;
    1 B& m7 R8 F' b
  74. char *dmabufsrc2 = NULL;; n0 N0 \# @) k1 `- K6 }
  75. char *dmabufdest1 = NULL;5 n7 Y5 y% \3 @; J5 Q- y
  76. char *dmabufdest2 = NULL;
    6 R$ W+ w2 s/ e* F( @" W, S
  77. 3 ~9 Y$ o3 w- I3 e# I( B) `
  78. static int acnt = 512;
    : ]: G: b: u! x0 W* k# c
  79. static int bcnt = 8;
    5 d( \% u: Y; n% i
  80. static int ccnt = 8;
    ; w, L, r, j  Z5 {& |
  81. - K# e9 T2 l+ [/ o( N: r
  82. module_param(acnt, int, S_IRUGO);* T, g  H1 e( g, X3 T( J5 o% C% V) D8 u
  83. module_param(bcnt, int, S_IRUGO);
    ( L. s0 G5 q3 v. U- _" p. f0 O4 T+ @: s: D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ x4 X) y7 w7 ?& ~
( ~2 h5 n! ?9 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" P9 H- A* {5 O' garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* |; g% q2 _1 e% ]5 u) t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 k- }, X5 @4 V! A! s
& O9 p! s, t* V: o5 d' R4 v

) I; e" {' @, i0 z6 A( G4 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-29 15:19 , Processed in 0.044089 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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