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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 Y* ^1 F* {' P* U4 D- A
  1. [code]EDMA sample test application
    ' @' s. i0 R+ z0 E
  2. /*
    1 E- l+ b- {& M  \1 v
  3. * edma_test.c
    0 k2 x7 `* u" \0 E
  4. *9 [/ j3 D; `* {* V
  5. * brief  EDMA3 Test Application8 p/ w1 A5 d* g) l" S
  6. *
    ' o! F5 I+ v# ^" n7 O4 A. {
  7. *   This file contains EDMA3 Test code.* a4 ~4 S* _1 ~$ h
  8. *
    + p. B2 r& e/ z1 O- e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 k% D6 z' ?9 [$ a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : d" F- _  j  O, T) N3 ?2 K
  11. *         TO CHANGE.6 K6 b+ z' L/ `8 V/ [: r
  12. *
    2 w# Z1 z! V6 @  c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 f' a5 A: j$ ~( V
  14. *3 i8 s7 Q- I6 \2 @, ~/ Y2 ]8 v. ~, Y
  15. * This program is free software; you can redistribute it and/or
    + I1 G) p  R3 G; ?$ f
  16. * modify it under the terms of the GNU General Public License as$ g& ], |- b7 n5 e+ f, g" _5 F
  17. * published by the Free Software Foundation version 2.+ [# b) O% s0 Q" ~
  18. *7 X' z6 P' M0 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 V5 C7 u6 o: G6 @
  20. * kind, whether express or implied; without even the implied warranty
      h3 D& u- a4 k0 t* |  f% `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 d$ N# F  {. M* n, a
  22. * GNU General Public License for more details.
    5 q! g( \. y0 j7 ^7 v# B) W) o9 g
  23. */
    . m7 ~) _- [8 J
  24. ( G% q  r2 }9 r9 X: W: W  A' z1 V
  25. #include <linux/module.h>
    " s0 X; v2 A& I
  26. #include <linux/init.h>
    2 b" W0 N) ^0 i4 _( r
  27. #include <linux/errno.h>; n+ f; D2 T( l1 H- `8 S* p
  28. #include <linux/types.h>
    " K8 h% U' N* k- }' L3 W5 M; K
  29. #include <linux/interrupt.h>5 M  S4 m2 z2 Z" D, }" o7 D3 ^9 W  k
  30. #include <asm/io.h>
    % y4 c8 |7 t1 s7 }' d1 n1 K+ P
  31. #include <linux/moduleparam.h>
    / I2 Y4 ]1 F7 r6 a' v2 {$ K4 F, K
  32. #include <linux/sysctl.h>3 X! D, x- j! E, P' B' q8 [8 n2 Z
  33. #include <linux/mm.h>9 T- G# a$ g8 ]6 Z1 t0 _
  34. #include <linux/dma-mapping.h>
    1 }& D0 T3 B. j: F
  35. # f. n* G" e/ X' q* h8 {
  36. #include <mach/memory.h>
    3 |1 ?% Q5 S" W: b. Z1 n
  37. #include <mach/hardware.h>
    . O' P8 D* @& p  g
  38. #include <mach/irqs.h>
    & s& q" Z: l# e
  39. #include <asm/hardware/edma.h>
    3 e8 O7 U9 V5 m9 E
  40. . r- u- E$ Y9 N
  41. #undef EDMA3_DEBUG# m  X" P2 [4 e  M: T# a
  42. /*#define EDMA3_DEBUG*/
    9 Y" p( w, w* v$ w8 U& f" ^# f
  43. ! j, c3 i0 t% D
  44. #ifdef EDMA3_DEBUG
    # |+ A4 r9 r9 O/ N) ]- G" n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 v6 f" Y8 H2 y* ?( Y/ s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! B; }+ n/ h$ Z) |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % u: r4 q) s4 q) T( D
  48. #else
    0 o' F) V; s( q% e# g
  49. #define DMA_PRINTK( x... )
    4 Z) M, `& L0 I( C: k* U
  50. #define DMA_FN_IN
    2 o7 v' Q( G/ F5 u; f
  51. #define DMA_FN_OUT& C0 E! x- O6 i" e
  52. #endif
    . M: p% @3 W! o

  53. 9 a" R7 I8 O& o, ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % x7 k1 L2 e/ Y
  55. #define STATIC_SHIFT                3
    & d. y, \7 Y) g
  56. #define TCINTEN_SHIFT               20
    0 z0 J4 I0 A, v: [
  57. #define ITCINTEN_SHIFT              21/ v$ t7 ?$ f- m  j, s: N9 G
  58. #define TCCHEN_SHIFT                22, v+ t4 ~  G3 A; }7 |# ?# f7 F
  59. #define ITCCHEN_SHIFT               23
    5 G' I6 g4 L. M. X! D+ R
  60.   t6 m( Y3 B" }  o9 \- n
  61. static volatile int irqraised1 = 0;, o! q9 ~( `$ V4 U6 C/ F9 M
  62. static volatile int irqraised2 = 0;
    " o, a" H% F4 X8 _
  63. 8 G+ S: G6 y' u/ \# B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h4 f/ S' j: M* p) G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, ]: N. o# I; w. m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 i. T% M8 x0 |, ~* s* {

  67. 1 M* w) _! {7 c
  68. dma_addr_t dmaphyssrc1 = 0;
    $ s  v6 X+ L6 a& a9 r" F' M
  69. dma_addr_t dmaphyssrc2 = 0;' j2 N  S: O! S" s. W" n3 T+ S; I' m9 C
  70. dma_addr_t dmaphysdest1 = 0;4 Y& ~3 ~# K( f  H! @
  71. dma_addr_t dmaphysdest2 = 0;9 ?" w7 A( h' W% A0 @

  72. 5 `9 k! ?2 D" @
  73. char *dmabufsrc1 = NULL;- O$ G/ j, |4 v; z. X  U  q
  74. char *dmabufsrc2 = NULL;
    ( ^4 J2 [& ?7 C
  75. char *dmabufdest1 = NULL;
    # u6 C9 \9 b$ V  m
  76. char *dmabufdest2 = NULL;9 j( p' i3 P4 S: n( k* X& K" l( G

  77. - l5 B( o* u8 y' D; k! w
  78. static int acnt = 512;6 Y% ^0 ]% M; j+ e) ]5 e% _+ F+ H
  79. static int bcnt = 8;' M5 x) K* ?1 u3 W* U% }% F
  80. static int ccnt = 8;6 J5 G5 M& R$ g3 S; r9 l4 Y, {
  81. : G/ C/ ?3 u  S
  82. module_param(acnt, int, S_IRUGO);2 {0 a9 @$ C7 s1 H0 d: u5 n: ]4 ~4 t. f
  83. module_param(bcnt, int, S_IRUGO);
    8 u% g  e7 J; B  |% O  L. @) N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) |# a! d4 I" R
8 \. u1 {$ O5 K" |9 Z0 h: ^& V6 |      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 L: S- U! {! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' L5 X3 y, @! C1 u; A* Y  v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ N, L9 ?5 Q1 o0 [+ m
! U, G% ?0 t1 U- c3 Q' L3 z/ k4 N, _, ]9 ^1 m& Y  a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 15:37 , Processed in 0.039255 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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