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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + X* [4 m. Q8 w' J
  1. [code]EDMA sample test application: Z3 a: @# n+ O. E
  2. /*  `( M9 _, L/ l5 C  f5 @- k
  3. * edma_test.c7 Z9 E' {- c, d0 r4 W% m
  4. *' I  M8 ]5 s: y, p' J; u  h
  5. * brief  EDMA3 Test Application
    * {+ h- @1 X5 |% F# r
  6. *
    ; A& w' K" R+ y% G2 f& Y
  7. *   This file contains EDMA3 Test code.; P2 l6 b, r" S% n
  8. *
    # M- V7 E7 Y* h0 g' s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ^. v! {# r9 o/ ^: U4 T1 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 q( D" T0 b  o% A7 q) O
  11. *         TO CHANGE.
    " U8 P) E; O. Z5 p+ T2 ~& p
  12. *
    5 ?8 q0 c! s, z6 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 q9 j  S2 y4 O) X4 ]; L
  14. *
    $ g, }) @0 o1 u' C
  15. * This program is free software; you can redistribute it and/or
    - |2 Z4 J( G" n) a
  16. * modify it under the terms of the GNU General Public License as" C6 H, N& w2 a! k- C
  17. * published by the Free Software Foundation version 2.* b) B& ~/ O6 ]5 V1 o6 u1 Y
  18. *
    8 t  X. @" K: B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; C, e) i& ]3 Q9 C
  20. * kind, whether express or implied; without even the implied warranty
    - i8 Z: V! f" [. o3 Q1 }) y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 t3 J2 Q. }0 g- [' V/ c  u+ W
  22. * GNU General Public License for more details.
    ( Q8 O5 m1 n. u0 P6 K
  23. */
    : k" Z6 U) l. ?; R! A3 n8 T

  24. , P; |* l, y8 Y5 Q- B
  25. #include <linux/module.h>+ T, k6 B/ y* X: U
  26. #include <linux/init.h>+ Y/ j: @  j7 G: u2 z9 x& \8 a
  27. #include <linux/errno.h>1 W& w( g/ o4 i1 \  O! [0 l5 I4 Y
  28. #include <linux/types.h>
    6 m+ u: Q6 X# [9 K# V$ o
  29. #include <linux/interrupt.h>
    6 `4 P# V8 s: w
  30. #include <asm/io.h>1 x" f$ `* }5 U1 P" Q1 G
  31. #include <linux/moduleparam.h>) N2 l+ v* [1 _" m/ A! _
  32. #include <linux/sysctl.h>5 F' G& D  J' W7 j1 z
  33. #include <linux/mm.h>2 Z* \$ U% H- ]2 X6 @
  34. #include <linux/dma-mapping.h>
    . J3 W6 k+ H. C( Q9 ^. y
  35. - Z. |+ [* u- r& S% |0 E/ L
  36. #include <mach/memory.h>' s, a5 m+ d1 g# S+ [$ G
  37. #include <mach/hardware.h>. B$ w0 @4 s& l2 |
  38. #include <mach/irqs.h>% D% {3 g" m1 O
  39. #include <asm/hardware/edma.h>6 ~- d( b# Q# Z$ j
  40. / a/ U. l1 a1 I5 d; M7 }
  41. #undef EDMA3_DEBUG
    , O5 |9 i8 i: ]6 F
  42. /*#define EDMA3_DEBUG*/
    , g! F) U3 ^/ G# E/ }

  43. ) F$ o* c$ K$ [: E* {
  44. #ifdef EDMA3_DEBUG; r6 U4 [. b, A4 {" p2 w% t# Q7 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) i3 q3 G- _0 Y" f" D/ d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : @% }% f6 I; _7 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * F. D* @( C1 \- X0 ~
  48. #else8 ^' Q3 X/ `6 G
  49. #define DMA_PRINTK( x... )/ X1 m+ T) ~  P+ p; D
  50. #define DMA_FN_IN- V1 a' j* }7 ^3 p
  51. #define DMA_FN_OUT
    5 J1 J7 a0 H% E5 T# ~8 H
  52. #endif6 q8 S% K8 ?7 I' s1 W
  53. 3 E2 s! R, F% [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . c  Y: p# W+ r2 v9 }
  55. #define STATIC_SHIFT                3) ^0 u: i5 k) T/ `
  56. #define TCINTEN_SHIFT               20
    1 @7 S% l$ K; e6 j, p. U
  57. #define ITCINTEN_SHIFT              215 V: c  b7 i+ M' ?
  58. #define TCCHEN_SHIFT                22
    0 e+ R7 @/ v+ s( B0 z6 }
  59. #define ITCCHEN_SHIFT               23  @1 |* ?& \/ m1 G# `, R
  60. % [5 ?3 u5 O* |2 s) q4 R
  61. static volatile int irqraised1 = 0;9 B% D2 h- @4 p0 A/ F& p
  62. static volatile int irqraised2 = 0;
    9 v8 p4 o1 E* \: F& d8 b7 J, K: Q
  63. $ M% F( }5 g7 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 A& _7 `, F0 i" H6 I! O* ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 J/ h7 v6 w9 i3 O) _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Q9 d+ @9 q+ Y, a% O0 E) Z6 }5 {: R

  67. 2 f* k( _8 W0 C; F+ {% s
  68. dma_addr_t dmaphyssrc1 = 0;
    # G8 |7 f; @0 I  w3 Y) m
  69. dma_addr_t dmaphyssrc2 = 0;+ s0 k& z* E2 q
  70. dma_addr_t dmaphysdest1 = 0;5 G" `6 W7 R; c7 R1 |. w" V
  71. dma_addr_t dmaphysdest2 = 0;- @; B! w: {( p
  72. : w/ n3 n  W; ?/ M
  73. char *dmabufsrc1 = NULL;
    2 Q* K: g. ]! U- v/ `
  74. char *dmabufsrc2 = NULL;. V5 l+ s: I" y6 F8 j  h
  75. char *dmabufdest1 = NULL;3 c# p* m" A1 e8 ?+ L" o  r
  76. char *dmabufdest2 = NULL;: B7 s$ ?1 _& Q; g( N

  77. * c( \) r% [- P$ K7 O
  78. static int acnt = 512;
      N/ `( \/ ^) C4 B. {" J" ^% F, J
  79. static int bcnt = 8;
    3 p. {" i7 V' t/ t+ K* h- Z& u
  80. static int ccnt = 8;% N' O( C6 x; A5 Y9 R
  81. ) p) f7 l# z  C6 q- s
  82. module_param(acnt, int, S_IRUGO);
    1 z7 e" |& {5 P0 \( |
  83. module_param(bcnt, int, S_IRUGO);
    ( s( b. Y& M5 d9 T4 z( ]8 }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& a# t' \7 q2 [' o# O

1 N" o4 L, E2 o7 z8 R" t9 P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- b" r7 c5 [4 J. V% ~& aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; b+ U; f- ]$ B* n" C) N  }9 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 X# v- Y1 l5 d+ R$ V) r
$ t7 A8 k% E- ^5 s! P; y6 a9 u  w3 H* p& m3 ^: @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 17:20 , Processed in 0.039642 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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