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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 y) l5 I$ d1 A! X' q
  1. [code]EDMA sample test application
    ; d! q  o# F. \6 {- ?. b. @
  2. /*/ c' Z, N8 x$ ?: d9 R8 F
  3. * edma_test.c8 p3 u3 |. x. `9 d, b$ Y
  4. *8 U1 ?/ B& ^9 ^
  5. * brief  EDMA3 Test Application
    , L/ D6 U- s" C  M1 x9 ]% K# q
  6. *
    % _3 b% b1 D/ N+ O
  7. *   This file contains EDMA3 Test code.
    ' G. J/ X5 s# A7 |- v1 @
  8. *6 N( V# L5 q! L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - k2 R) o4 T5 p+ B7 D6 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      U& _) B6 i1 e. }8 r+ p
  11. *         TO CHANGE.
    % v( E- C& {* G( u% h& Q. Z
  12. *& L# \3 w, N: d+ [2 X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& R7 v" o9 e5 g" j' r& w  [5 x. G
  14. *" T$ v5 B4 y7 p' ]1 d! {+ `; N) a
  15. * This program is free software; you can redistribute it and/or& `7 `( T2 c2 D% P" R' X
  16. * modify it under the terms of the GNU General Public License as) a$ H4 Y  I" o: w% A/ O9 E2 f
  17. * published by the Free Software Foundation version 2.
    ; L# C7 C4 A( q3 {: ~1 w6 Q
  18. *8 I  H2 v% c: k/ `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  v. G3 p: z: O4 S7 R* b3 V
  20. * kind, whether express or implied; without even the implied warranty$ b  f- a( \  F4 |* @* F3 G( R% M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : V2 c3 e# y1 N' P
  22. * GNU General Public License for more details.5 P, A) U( f# D" F2 \# R% N* ?
  23. */
    # a5 B' m# a2 _- H" B  j, l5 g2 L

  24. " p8 `! Y, J$ P7 n
  25. #include <linux/module.h>
    ! B' v/ x0 b/ ]( a4 p$ q
  26. #include <linux/init.h>7 y: [# I; J( Q6 ]" v
  27. #include <linux/errno.h>8 T8 o& T1 M# _8 l) S2 o
  28. #include <linux/types.h>  T2 a. N9 t2 P3 K
  29. #include <linux/interrupt.h># S$ u* o! p" k, h, A2 l/ M& X. [
  30. #include <asm/io.h>0 u  F8 e4 ]6 o: w3 T
  31. #include <linux/moduleparam.h>
    $ I8 q8 ~0 g4 P. e3 @) m
  32. #include <linux/sysctl.h>
    : c. g/ x1 O$ e" L% p
  33. #include <linux/mm.h>. Y' }% K# a  K& v* E
  34. #include <linux/dma-mapping.h>
      W  @. _  y/ S, K
  35. + \) W9 \1 b6 [4 Q& n0 M! K* Z
  36. #include <mach/memory.h>. c" B! l( d) n$ c0 b6 K$ f9 r
  37. #include <mach/hardware.h>! j& ]3 L! x7 g/ X
  38. #include <mach/irqs.h>
    9 w/ r. D/ n0 O5 Q
  39. #include <asm/hardware/edma.h>
    & H& W) f! Z4 o; o/ C: H

  40. 6 [3 Q- ?: V7 z7 l, p# J; W
  41. #undef EDMA3_DEBUG
    / ?+ O3 c6 c; m/ t1 ~/ M8 h
  42. /*#define EDMA3_DEBUG*/+ t3 Z% z. O  C5 q& D8 k8 {8 E+ u6 d
  43. 6 x' L3 @. n3 H
  44. #ifdef EDMA3_DEBUG" u% d- E! v& m5 O) x' c2 T  K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 ]0 f1 ~9 z& e  M8 W+ [/ F; g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * u2 @3 ~0 q, _  r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 z. M2 b6 V6 Z8 o+ Y* D. O
  48. #else$ Z/ ?0 [& d0 S' T- a
  49. #define DMA_PRINTK( x... )0 x# D2 Z/ r4 L; i
  50. #define DMA_FN_IN0 e" X' z) W/ M
  51. #define DMA_FN_OUT4 m5 e" E1 A0 k% n4 m% E! K# O
  52. #endif
    * C$ t3 W8 d7 t6 [2 Q( O9 k- w

  53. 0 X" y. ^& I+ Z+ h* i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 S( y$ f/ ~: B6 i# ]
  55. #define STATIC_SHIFT                3- }9 U5 V4 {! s
  56. #define TCINTEN_SHIFT               20
    * C: |$ A3 T. {
  57. #define ITCINTEN_SHIFT              21
    8 s& T6 f4 X" ^3 U" G5 y  k2 _7 `
  58. #define TCCHEN_SHIFT                22
      e0 q: ~$ J0 i" @, J
  59. #define ITCCHEN_SHIFT               23+ g1 a+ r# ?" b8 y. _& H# u

  60.   m7 d- s3 ?, q/ l6 O5 B3 H* }
  61. static volatile int irqraised1 = 0;
      E1 t5 _7 U6 P7 Q
  62. static volatile int irqraised2 = 0;/ [9 L9 j* R& ~' z9 ]

  63. - A6 f5 V# b  `& G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; P9 X* P# [2 |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + D% V# n! C6 I5 D' ?5 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 C: F. E" G/ p
  67. $ a' [1 t, O/ `, \# E) B/ ~( ]+ u
  68. dma_addr_t dmaphyssrc1 = 0;5 ^3 j$ F* D; F
  69. dma_addr_t dmaphyssrc2 = 0;; u% i! ?6 r1 t% R; o. z9 n  h
  70. dma_addr_t dmaphysdest1 = 0;+ A, [; k9 S; I. v
  71. dma_addr_t dmaphysdest2 = 0;
    / r  }7 w8 T: c3 [$ |( _& ~4 s
  72. : i0 m4 `* J: L, h, }  s/ ?" i9 O
  73. char *dmabufsrc1 = NULL;+ [- r; T: Q# R  \
  74. char *dmabufsrc2 = NULL;
    , @5 Z" [6 y0 B8 Z
  75. char *dmabufdest1 = NULL;! O2 B$ ]" D" U) n
  76. char *dmabufdest2 = NULL;
    , X) O6 s& T4 Q8 _0 X$ d

  77. & J# H0 I) w$ [; ?7 C6 _
  78. static int acnt = 512;- Z' e/ S7 z# C5 d  K' d* }5 P
  79. static int bcnt = 8;9 e9 {7 ?1 m$ a1 W" j; T
  80. static int ccnt = 8;! K% L& C7 p- `0 i. O
  81. 1 [! b3 V& B( `7 B0 G
  82. module_param(acnt, int, S_IRUGO);
    1 ]* o7 ?) L; |4 A$ a, L6 ~
  83. module_param(bcnt, int, S_IRUGO);
    0 B4 g8 |! Q  }0 @% d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" |* c6 c' i6 _: F! p
, u/ X+ b. z) R, G5 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% q8 l/ ]# w( S' darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 X, ]7 J0 O0 T7 v4 T- y8 E  \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 k. j9 n$ e9 i7 j: l/ d4 Q
% Y2 j( F1 M3 d# j! \. Z/ ~/ T

4 n1 w" v  e2 g5 E4 T+ u; H% B/ u6 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 09:34 , Processed in 0.046503 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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