OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" Q) L- a& V- |" _* A7 o  }
  1. [code]EDMA sample test application
    - |* m$ d& w, I" k% W
  2. /*7 v% y2 m8 Y0 b+ K
  3. * edma_test.c& ]) ?* X  v  o, K* E
  4. *
    , M; V& J1 i# v( |! @
  5. * brief  EDMA3 Test Application% ~, Q& c; W7 c# c( W: ]9 s& ^1 b* s( f5 t
  6. *9 v$ z& U4 v9 t7 i
  7. *   This file contains EDMA3 Test code.
    & T  O5 o) a4 X3 v
  8. *
    ! |+ j0 c" f; k; P4 l$ A1 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 I5 V; k  B* {& \! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " D! Q; C/ H; Z+ f6 l5 o; `
  11. *         TO CHANGE.' y" Z! K2 s/ T3 ^$ g  o
  12. *
    . p6 Q/ _3 c5 m& ?) M$ r# E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , Z: I, h9 M' t  o0 a1 D
  14. *% l6 K* O( |/ ~
  15. * This program is free software; you can redistribute it and/or
    " E/ L: y! e8 ?9 @6 F& g
  16. * modify it under the terms of the GNU General Public License as
    1 m$ t  g' e0 x4 _
  17. * published by the Free Software Foundation version 2.
      J# w7 V  n7 ~  [& V4 t
  18. *5 n' {  y& \% y( X" P6 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* a) b1 k" ?& y! W5 K# J/ R" K
  20. * kind, whether express or implied; without even the implied warranty
    / k- _; G* I) g5 I' E+ \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 M% T4 C, E2 ~/ F9 [9 z* i5 W
  22. * GNU General Public License for more details., F7 e5 M- P' R/ g2 H. O
  23. */
    . ?$ L( m$ b& G, [% I  [$ c5 J
  24. ( j! A1 }$ [  ?& X" y; e
  25. #include <linux/module.h>$ U( [# E; L1 ~& U9 q
  26. #include <linux/init.h>8 x! Q8 T1 w. w& P  e5 S7 T  G5 p
  27. #include <linux/errno.h>
      a# V% l. Y3 ]% e
  28. #include <linux/types.h>
    0 J. E6 R* b# j& W) J9 ~( b. R7 X
  29. #include <linux/interrupt.h>
    + d  c$ B% Q) |; f
  30. #include <asm/io.h>% M+ e3 O, X1 M
  31. #include <linux/moduleparam.h>4 l  ^0 {" n0 L, K5 L" ?0 b( n
  32. #include <linux/sysctl.h>
    6 Z  G# A& B0 D; Y
  33. #include <linux/mm.h>
    2 A% s! v3 W0 \2 e' m* F
  34. #include <linux/dma-mapping.h>
    % L: c0 o9 [( i& v7 z
  35. 7 \, T, k2 ~( n; m
  36. #include <mach/memory.h>
    , S) G6 j& g! ^$ }! H! r- j) z
  37. #include <mach/hardware.h>
    5 G/ p2 {. E) }$ `" h  n/ x# J
  38. #include <mach/irqs.h>
    . x% ]8 h. h. K; |; B
  39. #include <asm/hardware/edma.h>+ G: z2 {. O/ J! r7 l8 Y  s! U

  40. 6 ~- L2 n: U, S
  41. #undef EDMA3_DEBUG9 g$ w* |2 ~. c) C% d( C
  42. /*#define EDMA3_DEBUG*/) o0 w) r# S2 K

  43. * z4 `! q- }8 n  e
  44. #ifdef EDMA3_DEBUG8 A% Q3 c/ @& r2 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & I$ X  e! H: u3 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 t$ d  `. t; o& F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  x1 j/ I7 i! [4 ~
  48. #else
    % q( p6 R0 o9 O  @: ]( C9 d
  49. #define DMA_PRINTK( x... ), f2 W. k$ A7 `2 \
  50. #define DMA_FN_IN. D. u3 l! A/ C/ b* u
  51. #define DMA_FN_OUT
    / Z7 W. T: o9 L, x0 @  ]
  52. #endif
    3 C+ o) T" F# K

  53. ! V( t/ S) [1 R5 U; y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), \% R! w. u" d) g
  55. #define STATIC_SHIFT                3
    + Z9 `2 x* Y7 T" O
  56. #define TCINTEN_SHIFT               20$ T% m, }6 }8 O. L" Z  t; q' q/ |. z; j& U
  57. #define ITCINTEN_SHIFT              21
    " U0 [( T2 h& g( K
  58. #define TCCHEN_SHIFT                220 s# x& S; e3 ?& F/ f- a
  59. #define ITCCHEN_SHIFT               23( k- n# ^+ N  O8 d# m
  60. $ h! M( M6 x6 L/ ]2 Z" m& k' K
  61. static volatile int irqraised1 = 0;  P3 b; e3 Q7 t7 E% S# K
  62. static volatile int irqraised2 = 0;
    . M& e4 R0 l5 w6 n

  63. 6 I8 R) y+ Z: a; m" i2 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f9 t' ?" `/ r' z6 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# u( {1 |6 ~- J3 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 o/ y: q) h7 k8 Y
  67. 3 _& O0 J7 g" f8 N5 }4 E$ S* t
  68. dma_addr_t dmaphyssrc1 = 0;! ~$ U. P) P% \+ m2 p
  69. dma_addr_t dmaphyssrc2 = 0;1 e$ N# ~. T& s/ x2 @$ j' z% s4 Q
  70. dma_addr_t dmaphysdest1 = 0;* }/ n' Z/ q. S
  71. dma_addr_t dmaphysdest2 = 0;1 ?& j' r8 K+ b  L4 @& i
  72. 3 R) v- _7 c1 B9 H& k
  73. char *dmabufsrc1 = NULL;7 b; l" n. K: [/ P7 L; U! D
  74. char *dmabufsrc2 = NULL;
    + m2 W7 ~$ U1 J' t3 L3 b
  75. char *dmabufdest1 = NULL;. l) R# R' N$ e& h9 \
  76. char *dmabufdest2 = NULL;
    7 H, z% c$ H/ ]1 V: T3 J/ I: L8 J

  77. : f, T% l4 f. Q  l& B
  78. static int acnt = 512;
    ( j+ W" J% e& _
  79. static int bcnt = 8;
    ; E+ v& g/ n) E  [; c$ i! H
  80. static int ccnt = 8;5 Z6 E4 k5 @7 s9 Z9 S
  81. ( D' n" ^$ m% ^! V1 F+ H0 y. K& k
  82. module_param(acnt, int, S_IRUGO);
    . Z0 \0 |. J: r  Y7 [
  83. module_param(bcnt, int, S_IRUGO);/ B% v- D3 B( g# j# g1 u; |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 W' P- Y( Q! Z7 I7 V# C

7 ]) Z2 E% J3 j& i! P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) s. t" ~* D/ ?. h% @- }4 ~% H& Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! Z1 h2 F/ `# e3 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 b; x3 Z1 ~, ?/ X

$ c1 U1 l* E1 N6 g! y2 Q6 H5 y- \. f8 y0 G! J# M/ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 09:49 , Processed in 0.037090 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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