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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( d/ ]2 O' M/ j" c
  1. [code]EDMA sample test application2 ]2 @4 H( N  o' F. c' k9 f( x
  2. /*
    * a1 Q  p7 O. x) S6 c: W
  3. * edma_test.c* \6 j. ]" u7 m8 W
  4. *
    : N" d* f: X6 }+ G- \3 ]
  5. * brief  EDMA3 Test Application8 C  ^. \$ T* d4 S0 T
  6. *
    . g. ]4 R6 W) _& C9 m. j8 F
  7. *   This file contains EDMA3 Test code.9 X- G7 h1 t3 }* ~- r+ D& O
  8. *
    " d+ ^8 _. [' j5 O' \+ x: X. p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" E- I$ |; {7 ~* K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & `# ^& L6 b6 E5 }$ i. a8 |
  11. *         TO CHANGE.
      C5 ]& I5 K- w' \5 U
  12. *
    , J2 w; l( x+ P0 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* O$ B  [5 T$ x) |
  14. *
    * F6 ?7 W; _) K8 W) ]
  15. * This program is free software; you can redistribute it and/or
    1 A: }8 w8 M' v5 p
  16. * modify it under the terms of the GNU General Public License as
    $ D- D) E  U; j- ?& G" w
  17. * published by the Free Software Foundation version 2.
    9 M. }4 e, m3 e! N" S! e+ N- U
  18. *7 E9 x2 j' {0 R" g( E5 Z4 r! G( Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 z0 O* l$ S8 f. X0 p) {
  20. * kind, whether express or implied; without even the implied warranty' k, V! Z: e; S' S, |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ H/ J0 J9 S4 Y3 n2 ^; q. T
  22. * GNU General Public License for more details.- i: W) I( A/ G2 s8 E8 {/ v* F. f
  23. */8 W/ {( w4 q0 W
  24. : A5 e9 ]* d3 z  y6 [, m0 m
  25. #include <linux/module.h>
    8 [7 B) ~2 p0 f) q! @
  26. #include <linux/init.h>" Z" X2 t1 D: J8 W8 W
  27. #include <linux/errno.h>
    2 q; l: v# I' L: h$ d, l3 v
  28. #include <linux/types.h>, @+ G" Y! |6 @1 Y: l1 H* q! K
  29. #include <linux/interrupt.h>9 ?" Y. T5 `# H
  30. #include <asm/io.h>
    6 P/ h! Q; N, W2 `$ q# E
  31. #include <linux/moduleparam.h>
    % {6 ]& ~/ g4 Q2 c. U" @& J
  32. #include <linux/sysctl.h>0 q! c1 f8 @3 S+ w% \
  33. #include <linux/mm.h>$ i' ^4 }9 L( t* K( o: g% ?- V; E# [
  34. #include <linux/dma-mapping.h>
    ; s; b. v4 d: ^

  35.   S# |5 `/ o; d# w
  36. #include <mach/memory.h>
    ; G5 @' F$ t7 {) z8 G
  37. #include <mach/hardware.h>% u8 b: r) o' s7 U& O  D
  38. #include <mach/irqs.h>
    ! L/ e6 f9 ]6 o4 y6 o
  39. #include <asm/hardware/edma.h>
    $ T* x4 }% {# X% B) j
  40. 5 |& e  I$ Q7 Z) }4 I
  41. #undef EDMA3_DEBUG
    2 N6 X) ]9 S7 R7 a5 Y8 U3 o8 \0 }
  42. /*#define EDMA3_DEBUG*/
    ) l9 a# ]. N! G

  43. 4 j* P9 Z; r) Q- b
  44. #ifdef EDMA3_DEBUG( r) C, C2 U' E2 `9 w* z& D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): a$ @% o4 A1 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* v/ l0 y/ h+ d- M4 N7 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ O+ D8 ]1 g! Q0 q. c& P* A
  48. #else
    5 X$ W5 o$ H* {6 h& g, Y0 ]: ^  ]
  49. #define DMA_PRINTK( x... )% J" s3 u9 w$ w
  50. #define DMA_FN_IN
    , e$ a0 f9 ?2 V& t  Y2 S
  51. #define DMA_FN_OUT
    * ^: F8 y. u2 v9 |+ D& }# p$ V! r
  52. #endif. _8 p: X' p1 I5 [' h" k
  53. 3 @7 _9 |; Z* u% I) J2 Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + Z! e" K- G  R3 u8 Q6 |5 j
  55. #define STATIC_SHIFT                3
    9 h6 {5 a! _# ^& O% N6 i5 P; D: {6 O. W
  56. #define TCINTEN_SHIFT               20
    " Y6 e! `) u% Q1 X/ ]. _4 O" Z
  57. #define ITCINTEN_SHIFT              21& ?' q# r: E3 u! m" T3 w
  58. #define TCCHEN_SHIFT                22- d3 N, x# z4 F* O7 h' n1 y: M' ~
  59. #define ITCCHEN_SHIFT               231 e1 ]: _& R% s. E

  60. 2 _4 Q" N7 {# }  q9 w: w
  61. static volatile int irqraised1 = 0;
    + M, w& k! D- R: `  \) c: ~1 I5 H: q
  62. static volatile int irqraised2 = 0;
    0 `' t6 Y" x# W: f

  63. % D2 \8 N8 u0 U6 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ I' N% N2 {; |5 G4 V3 l7 W: K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F: s/ Q8 d9 @+ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 H) a; `4 {2 B* R  N  Y
  67. 8 P5 Y+ |% g8 e$ ~9 ?1 w: l0 {+ O
  68. dma_addr_t dmaphyssrc1 = 0;; B& t# q2 W6 i' P
  69. dma_addr_t dmaphyssrc2 = 0;
    3 T& t/ S2 L% L" L8 t
  70. dma_addr_t dmaphysdest1 = 0;
    1 J& j( z; S1 O5 i( Z
  71. dma_addr_t dmaphysdest2 = 0;
    8 U. x: J+ a6 [4 }' i, N& O

  72. & |$ ?- [4 w+ Y! t; C. \# T
  73. char *dmabufsrc1 = NULL;
    / p' l; W5 P7 @6 X5 ^
  74. char *dmabufsrc2 = NULL;9 T! D  @! K& M! \/ F) K5 F
  75. char *dmabufdest1 = NULL;8 s7 b$ o0 J* O3 y: z; m
  76. char *dmabufdest2 = NULL;- z0 x# k( O" y1 i- }
  77. 8 e8 L6 L6 T: X* N7 [0 `' H! o( a+ ~
  78. static int acnt = 512;7 ?! S" h. k* s# O0 h! t
  79. static int bcnt = 8;
    5 m, ^) u; x, |$ `1 l3 i' P
  80. static int ccnt = 8;
    * t5 ]- z5 T, H" C

  81. 6 _8 L8 q2 C6 c8 D
  82. module_param(acnt, int, S_IRUGO);
      A' O1 m$ t* L; i& n. f5 O# b3 k
  83. module_param(bcnt, int, S_IRUGO);7 C- o7 u' M( k' q1 t& Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 u! k, F- p0 V/ l# a$ W
7 S; f: l3 J& W7 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( v  J4 Q6 g6 z8 \7 ]& T; 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" O( I1 @9 h0 r/ z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' Z2 ^( @% X: [0 F$ k7 K2 E, a
* Y& y9 e" t$ k' n0 Y  c

. [0 H' Q; q" t1 V0 I- b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 04:40 , Processed in 0.038059 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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