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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, W5 n  O4 ?7 p+ `. P
  1. [code]EDMA sample test application" _9 l. _7 |& F
  2. /*+ K+ y! y5 m. c* w8 ?# M
  3. * edma_test.c
    , H: f% `+ e4 M" Z, W- K2 Q6 _/ \
  4. *$ H& ^4 ^8 J: B: Z8 {3 _
  5. * brief  EDMA3 Test Application  I) J+ G$ }) \" S0 @# l% u
  6. *
    * c8 X& ?" I. F- N8 A
  7. *   This file contains EDMA3 Test code.
      B/ J1 M( w3 e) l) s0 L+ B
  8. *
    # _9 n" o9 e- _4 w; J; M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 G) y8 T7 i& O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: Y' X6 I9 \! X
  11. *         TO CHANGE., `$ P& o$ P8 N+ s( F9 |" f
  12. *1 V2 r6 }( e+ v9 O3 S5 q  |# n& {( r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& W& i$ i8 U" B" M3 f
  14. *
    ' @( K2 u7 C" [2 N/ `0 u  {
  15. * This program is free software; you can redistribute it and/or
    1 I& W/ Q$ {5 B) i: R: {- m
  16. * modify it under the terms of the GNU General Public License as
    0 b' L' H5 i" Z# y
  17. * published by the Free Software Foundation version 2.
    8 ]+ \. [5 {3 P$ X
  18. *
    5 c2 D* U- z6 O  p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 A) o& n8 E' ^( B9 L' H
  20. * kind, whether express or implied; without even the implied warranty
    ) h) K: X( _' `0 @6 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 U# @: p( K/ }7 D4 v
  22. * GNU General Public License for more details.
    0 [% n! Z" x6 F% l) A
  23. */
    2 Z! X7 d% l, E, C  @

  24. # g  N# g- v2 ?& M+ e5 k6 c' n
  25. #include <linux/module.h>
    7 }2 R' d4 j/ C) \9 V8 e1 _( K+ j
  26. #include <linux/init.h>
    , [( ?  C# Q/ m0 t! g% K: ^' N7 n) z. @
  27. #include <linux/errno.h>
      r+ E, Y% U# m  U& f
  28. #include <linux/types.h>3 L: w4 \& A# k5 {7 V! @5 z
  29. #include <linux/interrupt.h>
    2 o0 a% ^- k; c7 [
  30. #include <asm/io.h>- b) _; Y; q" y8 D/ N- G# B
  31. #include <linux/moduleparam.h>) k- O1 _% d' X1 Z
  32. #include <linux/sysctl.h>
    ( A# ~  K( b4 M$ v# O  G
  33. #include <linux/mm.h>
    : v' r3 t% Y0 e1 q1 E( l
  34. #include <linux/dma-mapping.h>1 @# N- S0 V5 Z1 g
  35. 6 D8 A  c/ Y4 Q9 i5 ?, T' ?
  36. #include <mach/memory.h>
    ; I3 Q& t) ]) _7 ~" P& m* b
  37. #include <mach/hardware.h>
    9 c9 [! q. h$ v/ i2 N2 |$ W/ q* j# F
  38. #include <mach/irqs.h>
    ; p3 w5 G3 t+ {. g  \8 r" R0 w
  39. #include <asm/hardware/edma.h>- j& |3 U3 a9 B+ \% M# ]+ }" e
  40. : ~( x6 s" l1 y/ O1 H
  41. #undef EDMA3_DEBUG' g* ?3 f# e' \" U, e
  42. /*#define EDMA3_DEBUG*/
    ( G& W5 O0 _7 W; a' ^4 j1 ^

  43. 9 ^/ @& g5 C% C0 v. K: `  o
  44. #ifdef EDMA3_DEBUG/ z& |: Q# y1 ?1 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS), O+ B. O: c, V4 F/ o' G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / q4 ]7 l/ R, F2 V" O& P3 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 G4 w% ~9 ]& j" d6 J
  48. #else
      n, o: A2 q* w5 e5 j2 A
  49. #define DMA_PRINTK( x... )) p4 v0 W* T0 ]( ^9 k  [
  50. #define DMA_FN_IN5 e) y: T, G) `4 c/ L' `
  51. #define DMA_FN_OUT2 r- n9 |1 d3 l1 T
  52. #endif2 m% ?0 {* s- u2 Q0 c

  53. 4 }8 K6 x) S6 |, O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 R" G- @/ s& t  b; N* h& p/ B
  55. #define STATIC_SHIFT                3& Q1 ~. }/ \1 z8 e
  56. #define TCINTEN_SHIFT               20
    ' J  L3 a) L* F9 P; ^7 ?' y
  57. #define ITCINTEN_SHIFT              21% w6 N1 J* K- i- l6 w
  58. #define TCCHEN_SHIFT                22
    . j! \: ]" L, q4 I, |
  59. #define ITCCHEN_SHIFT               23" M# I& ]5 L) h
  60. : R0 l9 I8 b% ]" G" t8 F
  61. static volatile int irqraised1 = 0;
      h2 {' Y. }$ k2 }% o7 G
  62. static volatile int irqraised2 = 0;# R8 [& T8 ^8 N6 Q$ r7 }
  63. * M4 ]3 Z" a& r' X8 C+ X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 l# Y8 D! S+ w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 W7 s- x- x5 Y# X( j% N$ ^) e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- C* q6 ~  N6 C: m6 @* W
  67. 2 ]# E3 x) Y, C* h3 @4 w
  68. dma_addr_t dmaphyssrc1 = 0;0 j. K. n5 W  w5 ^. e) y
  69. dma_addr_t dmaphyssrc2 = 0;
    8 V3 q# _2 A1 A
  70. dma_addr_t dmaphysdest1 = 0;
    : y+ V5 N8 H+ l5 D5 P6 `* {+ u2 ~
  71. dma_addr_t dmaphysdest2 = 0;2 _% d, C: t( k. P) _+ ^

  72.   b1 e% R  d! _7 g$ i: N
  73. char *dmabufsrc1 = NULL;5 D6 ~, S9 I7 I; J  S3 A
  74. char *dmabufsrc2 = NULL;
    ! `' R# K. b$ s. W: _) }6 u
  75. char *dmabufdest1 = NULL;
    4 C0 g* c% B8 K+ q. {
  76. char *dmabufdest2 = NULL;
    7 }2 w: Y+ Y: x1 _  B% o

  77. ! _- }; H& k) X% I
  78. static int acnt = 512;
    % v+ T6 E' M* z2 i6 P- \- }
  79. static int bcnt = 8;% L- H9 f+ z& c3 \
  80. static int ccnt = 8;5 K- K; R5 Y3 P
  81. + m' g7 O, [  {" e7 S% j6 s
  82. module_param(acnt, int, S_IRUGO);
    7 g& H4 M) V: s7 a* v0 k* C
  83. module_param(bcnt, int, S_IRUGO);
    ! _; g% Y; ~4 D" c$ a. p# p* ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 d/ r- f9 M9 h2 f$ z7 X' x0 X8 C1 v# Z) K# t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! L( N% j( ?, Marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% d1 g; }# m5 u) [5 X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% b+ C) f" r% ^) `
4 Z5 U: r# e8 F$ T) N
: M+ r7 j; {: [3 U+ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-20 16:25 , Processed in 0.038955 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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