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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 x8 k% m- k2 L4 E; s) p
  1. [code]EDMA sample test application
    , @+ o2 w& w: C5 y& C4 w/ K' j
  2. /*
    ! ^6 w( k: c  N2 w
  3. * edma_test.c8 Y' J" j3 M. w9 B
  4. *
    : k1 i$ r' f0 A. f/ ~" h
  5. * brief  EDMA3 Test Application; i( E" E) m( R5 R. h1 H, c
  6. *; \$ r6 x8 e' @: U: L$ M2 g
  7. *   This file contains EDMA3 Test code.* ~% e! V2 C8 l, Y( e( }, f
  8. *
    + Y* c4 p4 Z' g6 T3 ^# j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 O6 `5 B/ O2 L0 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 h9 Y! Y! [* q8 B  R: _$ g* N2 D
  11. *         TO CHANGE.
    6 j' G7 t& l, A* H
  12. *6 t: }3 e4 r8 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & b( l4 z4 D7 y9 K. Y* i% _# f- ~/ P& K
  14. *5 s: q+ {/ G' [: V5 ^
  15. * This program is free software; you can redistribute it and/or5 o* a0 a/ k/ l# D5 X
  16. * modify it under the terms of the GNU General Public License as( w# ~4 d6 C( X1 d
  17. * published by the Free Software Foundation version 2./ s- k* Z7 D$ M  _( u1 i4 R! H; g
  18. *8 P; q4 D) U) t" P4 f" q$ ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ?0 O. i+ [: J% }
  20. * kind, whether express or implied; without even the implied warranty: `' h$ o4 `& {( y7 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 C: ]1 @( H& h% h; @
  22. * GNU General Public License for more details.: S5 j7 |3 m+ `  P4 X; Z
  23. */; o3 D) W; d& k

  24. 8 q6 {6 A+ M4 P3 n4 Q0 d
  25. #include <linux/module.h>( x: X, P% w  |
  26. #include <linux/init.h>
    , a& Z- K2 B# _( w3 s) I! A; H* x
  27. #include <linux/errno.h>3 m6 n; p* X) N( c! X6 P( o) \
  28. #include <linux/types.h>% P1 X- O: ~8 Y
  29. #include <linux/interrupt.h>$ ~5 l9 K) Q* r- r
  30. #include <asm/io.h>
    6 V2 ]( }& H* D/ F
  31. #include <linux/moduleparam.h>
    % d* M1 i# P  j) Z3 d) m
  32. #include <linux/sysctl.h>
    5 g4 l+ {7 u0 F. B
  33. #include <linux/mm.h>( s1 G/ e; C# l, @* `& l; M7 {0 l" g
  34. #include <linux/dma-mapping.h>
    , B' `' b) A- A9 P. O  J" ~& }6 o

  35. 6 r% I- G$ K, f
  36. #include <mach/memory.h>+ M! n7 E+ d* ~, D5 [
  37. #include <mach/hardware.h>
    " T9 }0 |; s! P
  38. #include <mach/irqs.h>7 k' }+ w6 T, O
  39. #include <asm/hardware/edma.h>) [& k: V0 l5 u! m- V9 m

  40. " P/ @) z' C& z. ?+ U* e" F
  41. #undef EDMA3_DEBUG
    5 M; C# ~" A3 w1 P$ z2 @! a6 g
  42. /*#define EDMA3_DEBUG*/
    2 P" ^$ C( S+ R2 }, |
  43. 7 O5 U" H& [" C# v) Y
  44. #ifdef EDMA3_DEBUG
    0 u; m( Z" n1 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ N4 M9 w6 R* x$ [( g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . j+ ]; b) h: s" P, Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% `- `% K4 O+ n- Q
  48. #else
    9 R8 @/ {8 N2 [( _
  49. #define DMA_PRINTK( x... )
    5 X  L; E# O" P% X5 L% w. K9 Q6 _
  50. #define DMA_FN_IN$ L7 b2 e6 w7 A/ O1 q$ d
  51. #define DMA_FN_OUT- Z- B, ]! V/ E4 s/ \# {
  52. #endif( _4 W- C: @! z# x0 t
  53. $ h4 f7 j4 P7 _) `( \  ^' N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ Z( ^  N. V$ P" T, m6 ], Z
  55. #define STATIC_SHIFT                35 C. X9 B- V. l, G
  56. #define TCINTEN_SHIFT               20
    / @2 r  n) S! l: ~8 a/ V/ R; }
  57. #define ITCINTEN_SHIFT              21: d  m- F) {( c( H# Q6 h
  58. #define TCCHEN_SHIFT                22+ Z# s" f5 e$ m" y
  59. #define ITCCHEN_SHIFT               23
    8 A; ?) I5 k. z( v: p2 h
  60. . f2 p! X4 b1 s; c) F7 |2 q* |1 ~6 q
  61. static volatile int irqraised1 = 0;1 z4 P& d3 w7 b& z' |* g
  62. static volatile int irqraised2 = 0;5 K- {! l6 }6 ~; u, o
  63. 5 G) C& R* L5 J) \- ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 X* `0 Q$ n- h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  V( h  i0 x8 ]4 \3 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - |3 G; f6 k7 T" b3 b& A
  67. , d$ K- b2 b8 z8 K1 p
  68. dma_addr_t dmaphyssrc1 = 0;
    + A# X7 X0 U2 t. H
  69. dma_addr_t dmaphyssrc2 = 0;
    3 ?' r& ?6 N/ D" i* Q
  70. dma_addr_t dmaphysdest1 = 0;
    9 p/ ^7 C& P3 {
  71. dma_addr_t dmaphysdest2 = 0;
    5 Q! H+ Z1 G" t: N0 i# }2 F

  72. 2 s: I2 B4 @6 r" g: Z" C! y
  73. char *dmabufsrc1 = NULL;
    5 U8 Y. X* t, t5 z' t) p0 E
  74. char *dmabufsrc2 = NULL;2 l5 T: M- j3 P. t4 y. Q& H. T$ P) ^
  75. char *dmabufdest1 = NULL;
    5 ]8 o& t) g) n+ i8 M! `# ?" p
  76. char *dmabufdest2 = NULL;
    3 X# w1 N. H9 n

  77. 2 Z$ i9 L5 K% Z; z- V
  78. static int acnt = 512;- G* ^( C( v8 ]: B) [8 K
  79. static int bcnt = 8;
    1 ~/ a9 d) N  s' L
  80. static int ccnt = 8;
      U* ]% J2 {* D" S/ r' A

  81. 1 t9 q) u0 O' E7 Z! @0 H
  82. module_param(acnt, int, S_IRUGO);- i, @" o0 T& s8 l& m0 t+ @# g
  83. module_param(bcnt, int, S_IRUGO);2 p/ A" s4 F& y1 v# g  r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  C! ^1 j, K( N6 f% x* V- y+ G" o( u2 q: ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 P9 j; x0 A1 n) y" G9 a% p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ ~! f9 {& D; g4 C% P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, h$ k( v8 a8 X6 M; W2 N

& e4 Y$ b0 F4 W0 j& m* G" A$ ^" N0 U+ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 04:26 , Processed in 0.043998 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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