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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 H* P  r! |7 r/ G+ {/ i/ o
  1. [code]EDMA sample test application5 r; o, J# o  h9 z6 V6 e
  2. /*4 f* l7 g3 w  l* f+ X
  3. * edma_test.c
    ) E, t  C1 K5 r5 A: z
  4. *
      l; n$ z* x$ w" {
  5. * brief  EDMA3 Test Application6 l, [7 \  X( d4 H" H' Q5 K- W
  6. *3 Z+ O+ v; ?  s6 `, R+ R- D
  7. *   This file contains EDMA3 Test code.
    4 @& }+ p) g0 M* B) g
  8. *
    3 g: I6 u9 [$ U$ s; t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: M/ \2 g  G! y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( D3 I2 X) k; e! c3 H. ?  P, L
  11. *         TO CHANGE.2 e. A2 T: t5 ?2 T/ ~
  12. *" x, }0 S9 v( p( y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . ~3 Z: G6 v% u& @  i7 }( D
  14. *& S5 t; [! l7 q, [' E( J# _' f
  15. * This program is free software; you can redistribute it and/or
    6 m. }5 \7 c: x0 |! U
  16. * modify it under the terms of the GNU General Public License as8 ~/ L9 h* e, ]8 P
  17. * published by the Free Software Foundation version 2.  [+ i$ C% H, Y8 n8 |5 Q2 O
  18. *( F. P8 E4 @- }  B% H9 u/ q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" R; W4 U% ]" H2 j
  20. * kind, whether express or implied; without even the implied warranty* V. U' a5 n5 I: N( c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) j" h- W# p5 M& m9 u" T
  22. * GNU General Public License for more details.
    2 b' @/ d+ c  Z( |7 s) p; _# \
  23. */
    ) l8 n- s% c& W4 B
  24. 0 `/ X) J# P% x$ @3 |# p9 L
  25. #include <linux/module.h>, l2 m. Z0 v) T
  26. #include <linux/init.h>" z) w" u: ~2 e  p
  27. #include <linux/errno.h>
    * m+ g" t& ?9 d" w. w
  28. #include <linux/types.h>- R) O  _; d7 z  u
  29. #include <linux/interrupt.h>
    + ~! _" m1 v1 u
  30. #include <asm/io.h>/ K; o2 K! M0 A* n$ v
  31. #include <linux/moduleparam.h>. z% r; n0 Z- b0 X/ N2 T# a; u' O  X
  32. #include <linux/sysctl.h>8 k# H/ ?; q7 ~
  33. #include <linux/mm.h>
    9 v$ l5 Q/ n$ X, J
  34. #include <linux/dma-mapping.h>; _/ G+ c# b8 e( b3 j1 q
  35. 0 h8 ]7 i) V; c) h5 F* n2 K% K
  36. #include <mach/memory.h>  i/ S4 ^2 }. B1 l
  37. #include <mach/hardware.h>1 o. A5 F" w' G; y7 }
  38. #include <mach/irqs.h>
    $ C' N, G0 k# b1 t; N% h
  39. #include <asm/hardware/edma.h>9 L: o; j+ G; f5 p% k+ G' i4 o

  40. & F3 S: ?8 d+ r; Q2 S, Z" s, _9 x
  41. #undef EDMA3_DEBUG
    : @3 u5 y8 x: y' A
  42. /*#define EDMA3_DEBUG*/
    ' Z4 @7 q% o2 L: H' I: t! I. L$ Q

  43. # j5 g' D% _6 `
  44. #ifdef EDMA3_DEBUG
    : q# \/ C5 z2 G2 L+ B5 H8 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' k3 ~, ?7 W1 [6 u3 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , H; E2 [7 G- r# x; [- L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # Z& E4 J0 d: i; v. f4 i# r" c; i3 F
  48. #else9 d  V8 y: G" Z9 N
  49. #define DMA_PRINTK( x... )
    ! _( C4 u  o5 ^% |, L
  50. #define DMA_FN_IN
    . K0 U) B; Z) [. b6 x( V
  51. #define DMA_FN_OUT
    ) k& a# F6 m' q( d  [7 o" J0 Z
  52. #endif
    ' h+ X' _9 q1 d5 W$ o) i/ M- v7 ~3 }& I
  53. , A6 F" H0 Y4 F1 B6 H$ ~2 {) e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ F8 ?0 k# w  Q( V
  55. #define STATIC_SHIFT                3
    4 W: \4 y$ X9 z, n
  56. #define TCINTEN_SHIFT               20
    1 @5 L+ @4 I# w( A1 u( U6 o
  57. #define ITCINTEN_SHIFT              21, Y: B$ Z+ Y! S6 |
  58. #define TCCHEN_SHIFT                22& F  A/ V/ K5 h) z" q: L" j
  59. #define ITCCHEN_SHIFT               23
    5 r3 y1 l* @0 y

  60. " Q1 ^- _0 s2 ?% ?  q( B$ S% I
  61. static volatile int irqraised1 = 0;
    ( l( H2 u6 J$ p' ]) @! a. ^
  62. static volatile int irqraised2 = 0;
    6 E# T1 _& \! u* S, M/ D
  63. # A; T+ s9 ~: B$ n+ I7 y# O+ C" d3 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v+ q; C2 l0 J- a6 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 M0 {0 z! X; o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q* u) v: N% ?+ r

  67. * A1 z4 z4 _/ Y
  68. dma_addr_t dmaphyssrc1 = 0;5 b$ ~) J0 B9 D& o( r6 M4 F- w
  69. dma_addr_t dmaphyssrc2 = 0;
    ( j6 P! k5 I9 m! O
  70. dma_addr_t dmaphysdest1 = 0;
      [2 E/ T( V8 b3 U0 a
  71. dma_addr_t dmaphysdest2 = 0;
    9 L: n8 {! a% k1 v

  72. 7 `: g/ [) z& G6 [. q% A) e/ d
  73. char *dmabufsrc1 = NULL;. c; X. z+ X& S: f4 Z( r! z
  74. char *dmabufsrc2 = NULL;
    3 h& I9 H* Q0 q# J4 k' j' G
  75. char *dmabufdest1 = NULL;6 e0 x' x9 u1 W7 Z$ ~
  76. char *dmabufdest2 = NULL;/ t& I( l7 B+ r: \) J4 V

  77. 4 G, x; ]; f2 F( O4 f7 M, b2 H
  78. static int acnt = 512;9 G* S8 s3 x' Y
  79. static int bcnt = 8;  ?2 o7 B* @% z0 l5 }9 F# B
  80. static int ccnt = 8;
    $ \1 H7 a9 ^4 n( @# i
  81. ; Y8 h8 U" ?: @3 C$ X
  82. module_param(acnt, int, S_IRUGO);
    : y9 `$ \. {6 m4 f/ Y- @
  83. module_param(bcnt, int, S_IRUGO);5 {5 Z% [. t) j1 W- m0 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( L* s' i' x" M* C5 w7 j, O1 ^+ C3 E# ~- u( `8 J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- b7 _6 c0 ^5 ], L9 s& `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 b. m/ c3 Y' U% R/ x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( U  n8 T) x: ?0 B. b8 e3 X3 m- ^7 W1 Q% [# m" H7 }  X3 d# B; C

, U7 d$ c3 W2 T* L4 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 11:51 , Processed in 0.045079 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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