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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 S( w8 Y, [; n! a/ R  P
  1. [code]EDMA sample test application
    5 g, C; [& c  \0 i
  2. /*
    . y" \% P' R$ G4 M1 o3 E% F4 Z
  3. * edma_test.c1 ~+ @) {/ }& `4 i
  4. *
    7 g" f3 p. t# r2 P$ c% S
  5. * brief  EDMA3 Test Application9 Y) c) _- N  l
  6. *$ N. E0 ?5 g: P2 ^
  7. *   This file contains EDMA3 Test code.
    " G1 G% ]2 a* Y6 N2 V& U, Z% e
  8. *
    6 g9 ?. [( ~; C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + S* T  p8 x- O" l0 E: E- j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& B7 i( W. u" w2 }# B
  11. *         TO CHANGE.
    ' |4 A9 W- D$ G: a3 s
  12. *4 V: Q" X# b3 a( |# D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 P# ^4 `; V" Z2 p5 `5 N8 B# Z5 [( @
  14. *
    ( R0 A8 w  A0 M* s' S
  15. * This program is free software; you can redistribute it and/or
    8 H/ M' Q0 _) {6 b& ?+ u
  16. * modify it under the terms of the GNU General Public License as
    1 K6 e" s- _) l1 g5 V7 q# f
  17. * published by the Free Software Foundation version 2.  J& ^1 i- r* h+ @/ _" s
  18. *
    ; A$ f% w8 S% W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 i* o' |; S9 f
  20. * kind, whether express or implied; without even the implied warranty
    8 n0 v4 G5 j# Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * [- ^# X, H: @9 e- Y
  22. * GNU General Public License for more details.
    0 f) n6 W  U; F9 ^5 ?' {5 E
  23. */* |3 [+ S, ^8 s1 f; C. D. U
  24. : q: _9 u* h( ~" I
  25. #include <linux/module.h>; O9 M3 g( l7 ?# e" u) V
  26. #include <linux/init.h>
    2 ~2 `& S9 ^. i% F7 R. a  B
  27. #include <linux/errno.h>" d3 q/ B8 r( g# p4 o7 Z
  28. #include <linux/types.h>3 p  X7 \' m* F* e" \1 @- X
  29. #include <linux/interrupt.h>
    ' t- O+ o1 E% @7 ]
  30. #include <asm/io.h>/ n. f' P6 X/ m' T6 U3 n
  31. #include <linux/moduleparam.h>
    4 \" @& [  P2 Q1 q
  32. #include <linux/sysctl.h>
    # J8 j# x8 M' y* a' }
  33. #include <linux/mm.h>
    5 @# l/ _3 G4 ]# I# @% R
  34. #include <linux/dma-mapping.h>1 |- P8 |, ]" M

  35. ' v7 d$ w+ D9 J' D; v2 v# `8 j
  36. #include <mach/memory.h>9 e) @# R1 g5 D+ K& M5 ^. b" n
  37. #include <mach/hardware.h>) ~! B1 p5 Q6 k+ _% k
  38. #include <mach/irqs.h>
    0 A! w8 W) _. p: w8 i
  39. #include <asm/hardware/edma.h>- R. A; I0 E( s+ B7 h
  40. : l  G/ w  _- J. _3 l: @6 U
  41. #undef EDMA3_DEBUG0 W" l) t: ]: Z2 w; ^7 m
  42. /*#define EDMA3_DEBUG*/
    # t) p$ {" A" i' n& f3 E: b
  43. / a1 i( b# W3 E2 s2 ^( C
  44. #ifdef EDMA3_DEBUG6 j; d1 k: O( j. ^; s+ X) u' J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 i* ~8 t. \3 K4 W9 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) W  I9 c* E* N+ B' M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 W) f" {. I7 I1 V
  48. #else7 F9 A' _# `1 R2 W% V' `. h
  49. #define DMA_PRINTK( x... )8 z& h( z7 K; z; O# B2 L
  50. #define DMA_FN_IN, m: Q7 o, C9 E; Q7 S2 J& K) ], ?' a
  51. #define DMA_FN_OUT
    ' q; I0 H4 R! D" \( ^
  52. #endif
    4 Y0 C& g; O1 f! k. w& ~3 ]

  53. 0 m- U3 S' ?3 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * ?# o* U+ ?5 o  w1 }, e! h
  55. #define STATIC_SHIFT                3; v1 w% K  ~; K
  56. #define TCINTEN_SHIFT               20
    1 K* M" _% X8 @/ u
  57. #define ITCINTEN_SHIFT              217 X( H/ ?: [; t0 |
  58. #define TCCHEN_SHIFT                22
    ( |' r# X) l0 r4 f" b
  59. #define ITCCHEN_SHIFT               23
    , ]5 Q8 _. T, f2 P( K( w. B
  60. 5 b7 W! P, O1 n; t2 X- g
  61. static volatile int irqraised1 = 0;
    9 Z9 r( N" J; E. ]  k
  62. static volatile int irqraised2 = 0;, x4 x- b" _: Y3 y* {5 ^

  63. + x8 y2 D) e1 L7 ]4 e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }5 i  l9 ^. E2 g) {' s2 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 ~* `+ K' V1 C+ `; C. O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      g- k8 x& z2 u5 P% _

  67. " \4 H' {9 k4 k- i  ]0 X  Z  R
  68. dma_addr_t dmaphyssrc1 = 0;  i) g; l# O" ?9 E  ]7 i
  69. dma_addr_t dmaphyssrc2 = 0;6 {; _2 Z+ T* {0 s/ R
  70. dma_addr_t dmaphysdest1 = 0;, x7 b, B" `6 A% F; v5 O7 m" _
  71. dma_addr_t dmaphysdest2 = 0;
    ; b5 ~+ }# @% u+ X. i

  72. ) p$ O% n( e8 s6 }3 n& s5 [3 u7 ^
  73. char *dmabufsrc1 = NULL;
    6 _) i* i0 x+ R; b1 }
  74. char *dmabufsrc2 = NULL;( m* R/ d) `; j$ h- g
  75. char *dmabufdest1 = NULL;
    0 r. D% t, t& s, r
  76. char *dmabufdest2 = NULL;9 m3 x, a6 U/ b! D5 d) P- V& d

  77. ( D- P0 z% x* u% L: Z4 s5 j
  78. static int acnt = 512;
    . u- \) E% e' d3 u7 H
  79. static int bcnt = 8;2 R' \2 p2 q* ~# g1 Z" H
  80. static int ccnt = 8;+ ]) Q7 ~6 d- `& @- ]& _2 j. p

  81. 2 L, |( Z& h4 g& P
  82. module_param(acnt, int, S_IRUGO);
    7 k& i5 Q8 Z9 \$ y3 ?/ ]7 G! u6 Z
  83. module_param(bcnt, int, S_IRUGO);8 n4 F6 `2 L9 `! u2 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! h3 o+ h7 I' n3 m( J4 R$ h
- P" [- a& _0 X% k0 r* s4 F% s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 D& g* _/ y5 Q5 x# W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 _" \- E& |  ?6 z+ q" t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ z' O' e7 N- Q/ \) s: \
  A; v& }( ?4 H" Y& L
) L/ _1 U& T" a2 P* l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 19:18 , Processed in 0.041016 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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