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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) r- D3 ?( v; w5 C$ a6 h8 z
  1. [code]EDMA sample test application" K7 o( _' V# j* m$ Y
  2. /*
    # _! m7 d% U& T6 l
  3. * edma_test.c
    / l4 u4 |- O- ?; T" K2 C; Z
  4. *
    1 Y( p; S2 A6 O3 h& u& X' m
  5. * brief  EDMA3 Test Application: m) G3 b' P0 ~; ~' w4 O. z1 h
  6. *
    $ E4 R3 }3 ~+ X9 S" |6 ~. {
  7. *   This file contains EDMA3 Test code.
    / ]3 Y2 F! P4 V
  8. *
    9 B3 w1 E8 X; \5 b( ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% U7 V3 [+ k! {2 U* Z3 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! j. f& ?; I+ t# X1 ]& H
  11. *         TO CHANGE.7 x0 P" ]5 i$ ]
  12. *4 }3 X. Q3 C" ~- [* z- s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( X: O- H' ?6 p, }
  14. *7 x# c1 g; _* U
  15. * This program is free software; you can redistribute it and/or
    / \, ]6 @- [$ o0 T, }
  16. * modify it under the terms of the GNU General Public License as9 r( K! Q3 d$ @1 U
  17. * published by the Free Software Foundation version 2.
    ; Y+ D: F5 ^) F; P, S" @
  18. *
    ! o- N- L9 z! H! b8 K( K. B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # K! j7 f4 a* Q$ r
  20. * kind, whether express or implied; without even the implied warranty# Z4 M( F/ L9 q* _: X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # x, e7 S2 D0 s- U: h& P$ @
  22. * GNU General Public License for more details.
    2 F4 Q7 P. U4 y2 \% A
  23. */
    5 S4 L, r0 C3 \  [% o4 b2 p
  24. 4 ]3 H$ G$ m" C! _( y: m
  25. #include <linux/module.h>& o* D. j+ ~- `: q2 N
  26. #include <linux/init.h>
    + C/ q+ S6 ?; n. }. A6 L
  27. #include <linux/errno.h>
    ' \# i+ P4 c  Q0 ~
  28. #include <linux/types.h>
    ) k& F! D( O  N% X$ b4 W+ o
  29. #include <linux/interrupt.h>/ {4 O; ~, k/ a) [. \6 k" W) q2 d
  30. #include <asm/io.h>! u1 e3 T3 u% h8 L0 H# ~2 Q3 g
  31. #include <linux/moduleparam.h>$ R. o5 v5 {" N& t* L
  32. #include <linux/sysctl.h>
    4 ]) ~+ b) `9 M! ?
  33. #include <linux/mm.h>
    ' M- \0 k5 z  n7 ^0 W* R% t
  34. #include <linux/dma-mapping.h>
    , P! _2 a  l$ ]3 N# x

  35. " t- w1 r  i' T% p: ^/ R: b( E( ?
  36. #include <mach/memory.h>) C( P( J0 j7 [
  37. #include <mach/hardware.h>
    / M1 n6 q8 L& q  x2 [4 ?! z
  38. #include <mach/irqs.h>
    - j1 ]0 O( A: y, ]
  39. #include <asm/hardware/edma.h>
    9 s' `2 f0 c  a: X

  40. $ J" L- H; c3 ~5 V; C; f
  41. #undef EDMA3_DEBUG+ t! ^! s! D2 v# J
  42. /*#define EDMA3_DEBUG*/8 a. F- t$ N5 m3 \9 g
  43. 1 q( @8 m" n" A- Z; P6 S
  44. #ifdef EDMA3_DEBUG9 @9 @1 Q6 ?1 O( ?* C1 y1 B$ V$ l1 O$ c9 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 {& _2 d( y5 x  |* R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), E9 ?$ o: X/ E7 K" Q" |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 _6 a9 Y5 w" A& \6 c. ?* N
  48. #else# y, E+ Y6 u6 W
  49. #define DMA_PRINTK( x... )! U3 o& n$ r( h  W9 j
  50. #define DMA_FN_IN7 u4 j- [, B/ j6 G2 T
  51. #define DMA_FN_OUT
    . |" ^* O- [/ a. P
  52. #endif
    / n+ s4 l' u  F3 H' @& g8 `
  53. + G4 y8 }$ E: v! y7 R3 o- H/ @* G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! g2 |' X4 l& J! P0 p* b$ X
  55. #define STATIC_SHIFT                3
    0 ^  E5 v9 d( d3 ^7 L8 `6 {
  56. #define TCINTEN_SHIFT               20
    . s5 s( ?7 [, f* ?) D
  57. #define ITCINTEN_SHIFT              21
    . z$ q+ Z+ r/ U
  58. #define TCCHEN_SHIFT                22
    + V. B  m5 }( @4 p! \8 O
  59. #define ITCCHEN_SHIFT               23
    8 O" K% k2 D" t
  60. $ Z* `% X% O0 q" ^
  61. static volatile int irqraised1 = 0;" r3 S* ^" h. l9 n* s  i0 }4 L
  62. static volatile int irqraised2 = 0;
    ! {- n5 Q) N+ Q, B

  63. * a0 i, Y# ~2 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : G1 o9 a7 g7 z1 e) U, G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! S2 o2 Q& o( X! |& y2 }: v7 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ \/ y9 i* k- m
  67. " @1 ^& p( w% P5 _3 r
  68. dma_addr_t dmaphyssrc1 = 0;
    0 d  h+ X1 o! b8 y6 l
  69. dma_addr_t dmaphyssrc2 = 0;! l' A' q6 x6 `$ f  w
  70. dma_addr_t dmaphysdest1 = 0;
    + ?/ b: w! m' L, C6 T
  71. dma_addr_t dmaphysdest2 = 0;+ V8 l% p- ?  {! |) t8 U" f: S
  72. 6 Z; e3 U6 p; u" g( z3 }! P5 p! v
  73. char *dmabufsrc1 = NULL;
    $ Q- i1 a; T7 ~( k  f/ b
  74. char *dmabufsrc2 = NULL;' k- f' ~6 x7 y
  75. char *dmabufdest1 = NULL;
    & D) a5 T% D- e: E$ Y( T2 H
  76. char *dmabufdest2 = NULL;
    & x% T$ l1 e) h% P( V
  77. 9 Z2 t) P, G7 {
  78. static int acnt = 512;/ J6 C( @5 V! @. z
  79. static int bcnt = 8;& i) G  S5 W) N# Z0 `) k
  80. static int ccnt = 8;
    4 ~, b) O* A/ M9 c% t

  81. 9 F3 O; l; d6 G& ~0 U! l
  82. module_param(acnt, int, S_IRUGO);7 b) {3 k. z" ]5 x0 Z7 k3 u
  83. module_param(bcnt, int, S_IRUGO);
    % F  t% @* p/ K& A+ e: A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ w" O: e' Z6 G  L, M

) q/ b- U6 `9 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 o4 P7 f) j2 i& u2 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* Z7 }; ^0 I' F, V2 L9 p2 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& C1 Z- J5 n2 ~1 G3 d  e% u& B' A- C
7 N8 s* F7 ]/ p1 y4 U4 V8 t8 W7 N: e, W( k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 18:35 , Processed in 0.039780 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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