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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 p6 B) j; v; `- B+ i0 T* L
  1. [code]EDMA sample test application8 s3 o6 o9 }) F" ]* Y- c1 t
  2. /*3 @! S7 s# y' i6 s8 h
  3. * edma_test.c
    * I# S; u9 c6 A  `# \
  4. *
    3 A7 H4 w, A. y9 v
  5. * brief  EDMA3 Test Application
    : G/ |5 c$ t% v% p# ~+ \
  6. *
      d; {% B8 c- Z  I1 U8 e) Q2 w0 a
  7. *   This file contains EDMA3 Test code.
    8 R1 }* _/ }9 v% O
  8. *
    6 F) J( Q8 b0 E# E. w/ k! n/ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; |1 ?# i) I; x& n) V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! f6 h! o- ^0 w8 f  o: C
  11. *         TO CHANGE.
    : d; i6 x; X& \$ w; [( @) N1 u: [
  12. ** J, t! p9 d. H% W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( u& R# ]* ?+ `- P- ^% w; ^
  14. *+ Y" W7 d% K* H8 Z( r: g/ e* j* ~
  15. * This program is free software; you can redistribute it and/or
    5 |# Y( M# |& ?9 p* Y0 I% I
  16. * modify it under the terms of the GNU General Public License as
    7 W9 U/ d* M  F& w/ E  Z
  17. * published by the Free Software Foundation version 2.
    " Z6 J# t) [0 b2 x5 {6 L0 B
  18. *! k% o8 e  d$ q' s' e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 h( z! M) V2 N0 L, z
  20. * kind, whether express or implied; without even the implied warranty* m% c$ T! w- d8 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 k' M- _% R( j4 y, W: K
  22. * GNU General Public License for more details.
    ( |* i! @1 X9 R1 C# B8 @
  23. */
    * B) S  z  T8 {, P2 n7 }

  24. 1 d! n1 ~# ~  d, P! d
  25. #include <linux/module.h>1 c; ^9 \2 K+ k+ t
  26. #include <linux/init.h>5 F# }0 A$ w) z" A/ b
  27. #include <linux/errno.h>0 \" v6 o1 \3 d+ I& a2 ~! n
  28. #include <linux/types.h>, m2 ^8 A  j! m4 W+ o2 X8 u, z
  29. #include <linux/interrupt.h>
    # l* r0 U, T: h0 T" Z) c1 J! w
  30. #include <asm/io.h>% f9 q+ O" r8 _; I( x# |
  31. #include <linux/moduleparam.h>1 ^) x+ G1 G) [
  32. #include <linux/sysctl.h>% j- `/ W; ?# P; |. O& V0 Y
  33. #include <linux/mm.h>
    ! t6 x1 o7 z8 X% j0 E3 Q
  34. #include <linux/dma-mapping.h>
    ) V/ e  A# n4 m* H* |5 e  T/ w

  35. ! A8 o/ u7 E/ p4 x
  36. #include <mach/memory.h>
      }' W, @/ y% H( O+ @$ X
  37. #include <mach/hardware.h>1 K8 c/ j$ o  O
  38. #include <mach/irqs.h>0 S6 ~' g  o1 j4 `$ u/ Y
  39. #include <asm/hardware/edma.h>- N' B5 ?, K7 W; T- x7 \$ M
  40. 2 L+ d! V2 ^0 O8 O* K$ ^& [, p
  41. #undef EDMA3_DEBUG* B+ X+ X2 t! y0 u) G
  42. /*#define EDMA3_DEBUG*/
    * U6 M/ y3 V: d, f! o
  43. 9 A3 B' a! h5 _
  44. #ifdef EDMA3_DEBUG8 q# H2 }0 @! I& N! h, q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / b# S% @- `/ M  D0 i) c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ^, s# q/ E# v/ O' B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / Z$ V+ Q& ^1 N- h" c6 y9 [  E0 L
  48. #else* I2 }- Y, L  ~/ G3 L% w$ F+ l
  49. #define DMA_PRINTK( x... )8 A! e, U8 _' K- [; m& o; K
  50. #define DMA_FN_IN; j$ `  X( m! c3 t$ s* J8 L
  51. #define DMA_FN_OUT
    9 J. o3 ^8 [6 _; o8 w+ ]2 ]9 _" w
  52. #endif
    : G0 c4 v1 B1 W2 D) ^8 t6 D5 e8 _8 F- p$ |. E

  53. ' q; \( ]/ f- a3 w- X' ^5 S  U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" E5 s! K* M. z. }4 S) b& e
  55. #define STATIC_SHIFT                3
    : B' ?* W( P! Y0 n
  56. #define TCINTEN_SHIFT               20% @6 ^; |9 B( k7 h. p+ D
  57. #define ITCINTEN_SHIFT              21
    1 M  h7 e2 C% {
  58. #define TCCHEN_SHIFT                22
    ' p$ e& p) ?7 {$ R9 R4 X; C# j
  59. #define ITCCHEN_SHIFT               23
    ) r+ K9 l3 R6 G7 k7 m- h5 ?, Q
  60.   T8 E6 f! t" Q/ n9 q+ |
  61. static volatile int irqraised1 = 0;
    : Y  z2 X, I/ R
  62. static volatile int irqraised2 = 0;
    - c) v/ n$ i9 U2 }3 h7 ?  {% F( {
  63. , U$ p9 F8 B- f2 p$ N$ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( z3 @; i1 Q. @( `' b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . R$ f% d* b; s2 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 N4 A3 C- P2 O" f

  67. 6 Q2 A6 F. L: k  k  R
  68. dma_addr_t dmaphyssrc1 = 0;
    - ]7 L' _/ m7 Z9 `% [: p
  69. dma_addr_t dmaphyssrc2 = 0;6 {) m* \% o$ o1 P5 c
  70. dma_addr_t dmaphysdest1 = 0;
    . s, D* p6 d+ B: ?2 P
  71. dma_addr_t dmaphysdest2 = 0;
    / P1 @1 Z3 C' m, j5 m( ?* N

  72. % k; C$ o# J, D6 z, M
  73. char *dmabufsrc1 = NULL;
    ) M0 O0 ^% R3 S0 J( f
  74. char *dmabufsrc2 = NULL;
    ; M9 ~1 T* k$ \: M1 g
  75. char *dmabufdest1 = NULL;# l. a! l5 e, M. H
  76. char *dmabufdest2 = NULL;3 U: C* r3 ^8 x# G4 K. C7 y: a
  77. , I& F& h, v; J  j# ]' v5 }
  78. static int acnt = 512;
    - Z7 G' `3 R4 P" ?5 |
  79. static int bcnt = 8;) [; x8 r. D2 w' j. Q/ b1 E4 _9 t' J
  80. static int ccnt = 8;$ d+ l3 R% `! Q9 ^) t  I

  81. 0 O6 R8 V) M& T$ @1 ]1 H
  82. module_param(acnt, int, S_IRUGO);0 W! F' H- H+ U$ d  l
  83. module_param(bcnt, int, S_IRUGO);/ R9 J9 ^  ?+ ^# ^* C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ F$ m' x% n" J( ?- S8 l
, T- g% ~; G/ m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  E3 w* P' R9 B& f! U% J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- D  q' d8 q! h9 d. g5 o" r1 P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 m2 g$ Z2 ?; x- f
  g; X0 c5 l! \3 D

" J6 T- a6 R' e7 n# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-26 18:12 , Processed in 0.040249 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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