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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; Z' w; V8 g: g; K2 g% z# b
  1. [code]EDMA sample test application* R) e  _* J% i3 C# U
  2. /*3 {& ?+ E- L5 k, _3 h
  3. * edma_test.c
    6 F$ A9 v& h4 {
  4. *
    $ k9 o8 c7 w3 j
  5. * brief  EDMA3 Test Application
    2 b- c/ }. @) ^- ]- d
  6. *( D! Y* q3 _2 _8 X5 ?3 o
  7. *   This file contains EDMA3 Test code.
    : R7 t* L9 s4 H8 f1 D0 }
  8. *1 U1 W- M) m: V& b- ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( P8 j" q% K0 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 P! }+ I" O- D  F+ D0 K, t+ D+ n
  11. *         TO CHANGE.
    , d* j$ [6 Z) K* Q# i
  12. *) F% a, s! R6 B4 W0 U3 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# j9 Y. Z' W2 G
  14. *! h" C3 D, u1 n# W
  15. * This program is free software; you can redistribute it and/or7 x% r/ t9 K% s2 H- ~0 H; w7 e
  16. * modify it under the terms of the GNU General Public License as
    ) ?, G8 Y2 O( |+ o* d
  17. * published by the Free Software Foundation version 2.
    3 m0 \) r/ o( p+ b9 {% T
  18. *
    4 c3 I# s" G, I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 C& x4 V3 }: l: c4 D9 B
  20. * kind, whether express or implied; without even the implied warranty
    % g, r  X& n; V$ j3 D% E: D  i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# i) ]( R/ w9 k8 {
  22. * GNU General Public License for more details.
    2 n8 M9 ^4 M1 F
  23. */. |# g0 y2 r7 u& P" d

  24. 8 [; k- U0 r4 }5 h5 x% Y4 h3 w
  25. #include <linux/module.h>* D. u$ c0 X) G" V4 z
  26. #include <linux/init.h>' I7 V* k. F& Z8 H* y1 E
  27. #include <linux/errno.h>7 {" ^6 t! m! o, y4 B
  28. #include <linux/types.h>
    3 V0 q9 C3 {" Y+ Z5 R3 J! k1 p
  29. #include <linux/interrupt.h>0 y, v/ H% [/ b: |/ p
  30. #include <asm/io.h>
    - u3 \  Q8 g. [( B$ o/ O2 n
  31. #include <linux/moduleparam.h>0 S3 a5 f% ^7 l+ h/ {; V0 W# m
  32. #include <linux/sysctl.h>8 w  X/ C9 s6 D/ a2 W  M
  33. #include <linux/mm.h>
    - \  v- x1 t. ]3 M' ]
  34. #include <linux/dma-mapping.h>) c3 p+ O: U5 y0 R: H" R

  35. 8 |* z  `: ~% E5 H2 d% ]" d
  36. #include <mach/memory.h>
    / L, i6 Y( `3 G
  37. #include <mach/hardware.h>
    1 t2 a) ?, \# I! ?# H5 ]) x+ U
  38. #include <mach/irqs.h>1 G: `. T$ V7 }* e6 U8 X
  39. #include <asm/hardware/edma.h>2 u8 |" S& M% ]* k# p2 c6 r5 b# x

  40. + H" I$ J. E4 d( @/ p9 X
  41. #undef EDMA3_DEBUG
    4 {) Q3 h' ?6 ]" n) a' V
  42. /*#define EDMA3_DEBUG*/% P3 a* ~2 b4 J7 ~& ~) d

  43. $ ^% x' h+ F0 H% M( `
  44. #ifdef EDMA3_DEBUG/ Y- ?% Q' z3 i$ n6 W( x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 @# }& A4 [, C( `$ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( X( q3 w9 ^* j+ T3 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 D7 \* z! ^' C8 c" S( M$ @
  48. #else
    3 R! v/ Y/ X+ c8 v; L/ z3 A# M
  49. #define DMA_PRINTK( x... )
    $ J+ T) d9 \6 \  X+ F
  50. #define DMA_FN_IN
    6 K  X0 ^2 l+ e
  51. #define DMA_FN_OUT$ C7 w: a6 w  i; L0 r: E
  52. #endif3 j* h# {1 g& A( N( ?' _7 p" n
  53. $ U" X, q2 O' l/ u: [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 M1 r# ?) V1 o+ Z5 Z
  55. #define STATIC_SHIFT                3
      D& [- Y# H1 I" l! k
  56. #define TCINTEN_SHIFT               20  p, Z4 @& ^" d( G' S
  57. #define ITCINTEN_SHIFT              21
    4 @. y) G3 ]' q
  58. #define TCCHEN_SHIFT                22
    9 g2 X# @- }9 Z
  59. #define ITCCHEN_SHIFT               23
    - ^* @# |. d, w  s3 s" T- ]
  60. 9 X0 o) D5 ~( Q+ X
  61. static volatile int irqraised1 = 0;
    0 {; t* a6 w/ t) i: ?  [& X
  62. static volatile int irqraised2 = 0;
    ; a9 K* t- z( u" Y3 [

  63. & i2 w, y. f9 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 d; G$ N! C, u' H& y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A9 U; [/ q- k6 P2 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* _& x1 d1 d* D0 |8 C4 j1 e! H

  67. . c+ D& ?1 V" U' Y  `
  68. dma_addr_t dmaphyssrc1 = 0;% b5 @+ i" e* l+ T. Z
  69. dma_addr_t dmaphyssrc2 = 0;
    & X/ u! \  h+ k
  70. dma_addr_t dmaphysdest1 = 0;
    2 J) J; B9 g, d$ m/ u' n- v4 c
  71. dma_addr_t dmaphysdest2 = 0;
    ! h7 }" \! [5 h0 ~9 d- @5 y& L
  72. 3 {- N2 `% g% v5 h, M  G
  73. char *dmabufsrc1 = NULL;
    6 {% b5 u' E3 V" Y4 \$ D
  74. char *dmabufsrc2 = NULL;: {/ J- ?4 h: K4 K  Y
  75. char *dmabufdest1 = NULL;
    5 R9 R* b& a6 E4 M( O: A
  76. char *dmabufdest2 = NULL;  l$ @9 s# i: [- b5 t3 J

  77. 8 u0 W% x, N) ?+ t+ F
  78. static int acnt = 512;: C8 ]. {5 \( a6 R) F& i
  79. static int bcnt = 8;7 [9 N1 W" M, d3 J6 d, r4 D
  80. static int ccnt = 8;
    ; N2 N5 @1 b, T2 G) P+ d1 t
  81. ' ?; C8 R3 R1 x$ Q" f5 M+ z2 l
  82. module_param(acnt, int, S_IRUGO);
    9 S/ D4 q/ x: ?/ ^( C1 k8 t  [
  83. module_param(bcnt, int, S_IRUGO);
    $ ^) M8 D' L5 d8 n; }$ z* y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- V' M$ D. W0 E: v

: [. e! O) ^8 Z7 K6 r: E; B1 Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 q/ C: y8 _& r% ?9 E- P9 ]% v& r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ A6 A5 T1 s/ \$ G9 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' L5 \# e3 Q4 ~
$ l( o% V. @& R5 W$ w- T: O! u$ j( H2 ]7 e2 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 00:14 , Processed in 0.046841 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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