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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) }4 Z6 n# @1 I
  1. [code]EDMA sample test application
    . v- [; z, p5 ]. B) [- v/ A) U& E
  2. /*) @7 Q0 p7 o9 O4 z. c) D
  3. * edma_test.c
    & T6 B/ P: t1 p& s
  4. *" ~5 f& l7 b) ~) e9 G
  5. * brief  EDMA3 Test Application. L. L' X6 m8 a8 G! b1 O
  6. *
    ' P! ^: _1 H+ V1 G5 q
  7. *   This file contains EDMA3 Test code.
    0 u: D; u- ~; }; e  h: W3 g
  8. *' k# P% X0 N4 W; B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  w7 d9 e  ^- N4 ~) k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : E& J  r; @: I$ u* v( H
  11. *         TO CHANGE., w( ~% h( {) {  r4 V# g
  12. *
    8 H" G( W1 h7 \- @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 Y/ c- O; Y  f+ ^
  14. *8 h3 X& @' {: R, G  ]8 n! {; y8 C
  15. * This program is free software; you can redistribute it and/or
    + I8 [$ a& w/ d5 V3 N
  16. * modify it under the terms of the GNU General Public License as
    5 `8 m# T/ C5 H. o$ E: f6 e
  17. * published by the Free Software Foundation version 2.' ?  r; _  w# i* d
  18. *
    - ~5 w* w  D* Y# C* `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! t8 D9 u/ \) c
  20. * kind, whether express or implied; without even the implied warranty: y: e6 H2 O# R1 ~! f0 A; N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 C  E8 p. A/ A3 n( Y! P# f/ @0 ~
  22. * GNU General Public License for more details.
      Y2 _0 N6 `0 u; W5 Z- @" f
  23. */
    8 \$ J  a8 f9 i  G# ~( L

  24. * R4 f  H* n, g8 J9 M& w% C
  25. #include <linux/module.h>
    + D+ L3 G; h8 @. Q% ~
  26. #include <linux/init.h>
    & j2 }( Y+ r' U' d' s
  27. #include <linux/errno.h>5 D6 W# |% X7 e* W% R; U2 b1 z1 w5 i
  28. #include <linux/types.h>
    6 ^. ]7 M1 J: O2 F; Q  C
  29. #include <linux/interrupt.h>) b( i2 G" Q: Z
  30. #include <asm/io.h>! _4 x  H2 U  S2 }/ r
  31. #include <linux/moduleparam.h>
    . V2 [4 [5 k# c8 c. m
  32. #include <linux/sysctl.h>2 w0 ~7 v! Z& Z
  33. #include <linux/mm.h>
    3 M4 D# o; B" P
  34. #include <linux/dma-mapping.h>
    " p* V$ a5 n$ [! f( X  A

  35. : m; X7 T9 a/ E% e! a
  36. #include <mach/memory.h>/ _: B; d9 ]7 q4 {6 S
  37. #include <mach/hardware.h>2 O  {9 E  F. W! Z6 I0 J
  38. #include <mach/irqs.h>
    , x: o1 G) ]7 G# N
  39. #include <asm/hardware/edma.h>
    0 y/ v' Q2 i) g- ^0 v7 {8 h& H" \* y4 q

  40. - c  m* S2 q! l1 ?
  41. #undef EDMA3_DEBUG5 \" g8 Z$ v9 V
  42. /*#define EDMA3_DEBUG*/
    . }" H; N  i* Z" r0 l$ \& M
  43. ( ]9 \8 D; X) x7 ^2 W) e, ^  t
  44. #ifdef EDMA3_DEBUG9 Q; `$ W0 |: y# A- S  N/ I# g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 k+ \& y! e! B. ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 p5 U6 U" Z! v' L$ O+ G! I  K# |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  b) E6 j! v9 k# e
  48. #else: u3 o( i* Y. `5 d; s
  49. #define DMA_PRINTK( x... )# {$ G  s) }' Q5 R
  50. #define DMA_FN_IN
    6 `& a' @# r- m
  51. #define DMA_FN_OUT( v- M/ z% o4 N1 o. U
  52. #endif
    3 E. c, c% K3 Y
  53. 4 E1 U8 }* z0 D% R5 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ O; @+ z0 r# F* c5 o* n8 G
  55. #define STATIC_SHIFT                3
    5 y! L9 x/ U9 ^2 D
  56. #define TCINTEN_SHIFT               20' i( @1 Z) ?. ^( f
  57. #define ITCINTEN_SHIFT              21+ t. w  C* J! e. F! y, k  |
  58. #define TCCHEN_SHIFT                228 y  d4 x) [( q7 Q7 `9 p% A# x
  59. #define ITCCHEN_SHIFT               23
    2 S; b9 X  s- `3 K  p" ~* p/ N: L

  60. 7 [1 O7 r$ ~* d
  61. static volatile int irqraised1 = 0;
    + _) M) {6 Q/ Z& a
  62. static volatile int irqraised2 = 0;
    ' l8 E1 N0 [( e8 y3 q0 t& B
  63. 4 r9 Q' v/ C2 H0 E6 X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z. U, T% ?# {8 c7 B8 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, Q8 h) g6 G4 C1 ~/ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 P; F& y6 d8 N6 E: w$ Z! g

  67. 5 g6 M( ?* u) j' O
  68. dma_addr_t dmaphyssrc1 = 0;& E3 ]9 k' X. |3 }$ f
  69. dma_addr_t dmaphyssrc2 = 0;7 y2 w: _# q5 g' \# [4 ?1 _6 _0 A
  70. dma_addr_t dmaphysdest1 = 0;
    - F8 d: u% C3 V# z# \' R* Z  ~
  71. dma_addr_t dmaphysdest2 = 0;
    ! {- U0 e- u  L1 j8 E' a

  72. # Y% I6 B5 b0 |& ^9 ?3 p% @
  73. char *dmabufsrc1 = NULL;# r3 f7 S( I/ E* h' \
  74. char *dmabufsrc2 = NULL;
    . m( I5 j3 h/ s2 ?: X1 W( G
  75. char *dmabufdest1 = NULL;
    5 J" @7 q! g  h/ e* o
  76. char *dmabufdest2 = NULL;
    - J! w; x! F% s. a
  77. # I. Z" J% m$ y
  78. static int acnt = 512;
    : B( D5 f5 |! C( O$ K- h- ?  O2 S
  79. static int bcnt = 8;
    ( Q2 Y" I1 N8 K9 Z  C" g
  80. static int ccnt = 8;
    0 n$ Q  u+ {9 u4 C
  81.   y; ^/ D/ V2 V  Y$ U
  82. module_param(acnt, int, S_IRUGO);
    ' g1 m  I1 R) s$ J* v
  83. module_param(bcnt, int, S_IRUGO);
    ( I: p- O, x1 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  W  o- w8 D$ |( s
* E2 j6 I, h  ]+ L$ o( I  @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ d8 t$ T/ a0 D: |. `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 G2 R4 ?! C9 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( R; u. \+ ^9 e) K; R: Q7 t! T
  C7 I" y& n5 M' ^) A8 r% p7 ?- w1 p% e6 o* E/ \% w( T- c# j0 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 22:21 , Processed in 0.065854 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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