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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( g( [: s$ r" U0 [
  1. [code]EDMA sample test application
    9 w% O2 E% w4 d' p9 t6 K  @* h8 M! a
  2. /*' W1 H: F7 Y; l9 b9 {) y* I  ]
  3. * edma_test.c% {* c: ]; U" V) I
  4. *
    # ~& \$ u: X, C
  5. * brief  EDMA3 Test Application# R4 Z  m/ i/ l9 L; V; J! `: E  ^
  6. *& D, L8 Q+ T/ j  m% \1 |3 V
  7. *   This file contains EDMA3 Test code.3 h3 R6 L1 I1 S" a, ^7 L
  8. *
    ' W4 Q2 K  W- k5 H, @+ I/ f# l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . h/ `4 h1 d- I0 {. X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 D6 u) f- v+ E/ B, j4 F+ b
  11. *         TO CHANGE.8 K4 S) f+ H* l% O3 o5 Y
  12. *: g3 r) O7 b4 d+ Q& k+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' ~, K& Q% F! N( }
  14. *
    / E* i+ R- h6 S$ h9 Q
  15. * This program is free software; you can redistribute it and/or
    $ a" d# f' ]- R- I! Z
  16. * modify it under the terms of the GNU General Public License as
    9 K% r' y0 H3 m' E
  17. * published by the Free Software Foundation version 2.
    ! R0 W/ Y5 m; r$ c1 F' Y0 }+ s; c9 }
  18. *
      i9 y. {& t% P: X: A( R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( r1 s5 I! C) q. ~: a& L1 E% `
  20. * kind, whether express or implied; without even the implied warranty
    0 P, x, h; g( p- R% o8 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 b5 L& S$ O: O! I( e
  22. * GNU General Public License for more details.
    7 f, F  H0 E" s/ V
  23. */
    1 @9 ~( @$ \  w- e

  24. / T+ c. a$ k7 N1 B
  25. #include <linux/module.h># u! u2 L- U( _: L
  26. #include <linux/init.h>
    % W- C" A% t; h( r  x8 N/ j
  27. #include <linux/errno.h>5 o! D/ m, M( t# O' J0 t$ ^! r7 K
  28. #include <linux/types.h>0 q- P  ^! }6 D' B; u- Q) U
  29. #include <linux/interrupt.h>. e- G' S& M1 [4 R( @3 u3 U
  30. #include <asm/io.h># L$ |0 g5 ~, Q5 w
  31. #include <linux/moduleparam.h>
    8 w, i( C, b6 ?( b
  32. #include <linux/sysctl.h>
    . N% G2 u  v7 W! s
  33. #include <linux/mm.h>) y7 t3 c( t2 W1 L; w  a- w7 L
  34. #include <linux/dma-mapping.h>0 Y; R, P: Z% p2 s5 A
  35. ! a1 v, }! K/ `! P- o
  36. #include <mach/memory.h>( Q# q2 I$ g2 K! N
  37. #include <mach/hardware.h>
    - o  L5 `* d1 S: R$ O9 V3 w$ Y' d
  38. #include <mach/irqs.h>) _4 d" Y2 P6 o; c
  39. #include <asm/hardware/edma.h>
    ) r$ c8 t/ a: g7 G. ]8 y/ @
  40. & D: @6 H# [) {+ v( s% |; @. L4 \
  41. #undef EDMA3_DEBUG& V5 Y. L) o+ w$ J& S! o  R
  42. /*#define EDMA3_DEBUG*/
      i2 F. P+ p. p) X

  43. 4 y/ H& m+ m" A% z% Q
  44. #ifdef EDMA3_DEBUG
    7 K* L7 j1 g1 o1 X! `/ P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& Z1 j, E: p: i9 ]. ^. W0 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( m$ X! [$ H; C9 J) }+ [/ Q6 Y7 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! p; ?5 B5 I* k! W" V
  48. #else
    ' q; C, Y* ~) j
  49. #define DMA_PRINTK( x... )
    # I* d. @! g+ i9 o1 ?, T. Q$ Q
  50. #define DMA_FN_IN" x6 n; o- Q+ x$ w9 \" Y, u
  51. #define DMA_FN_OUT/ I* S5 u! ~8 l8 m) `' {
  52. #endif6 F- Q: a& Z" O/ G( S! C6 M
  53. ) s. `& j  ^$ k5 X& c' R2 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" \, z$ f5 x+ \3 b. g3 |
  55. #define STATIC_SHIFT                3! g9 c1 T8 q4 q" w/ I
  56. #define TCINTEN_SHIFT               20
    + c$ K+ h( I' Q6 L# V; W: o
  57. #define ITCINTEN_SHIFT              213 M0 G: L' s2 T; J- r
  58. #define TCCHEN_SHIFT                225 A+ [/ J, y6 c
  59. #define ITCCHEN_SHIFT               23$ z' [- D: n2 f0 z8 V

  60. $ m3 H% }9 ]. A: Z
  61. static volatile int irqraised1 = 0;
    ( K7 H' f$ t# x# }$ M
  62. static volatile int irqraised2 = 0;4 x5 _; V2 E: A/ g& z+ `

  63. + d% ~* `; o0 K! w  t! X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ?) h- L1 \+ `3 m# n" w  c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 Q8 z- m& L4 L5 l, a5 H0 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m$ O4 ^: ]; f, w* _9 A& d

  67. # q5 e% v: p/ C2 M
  68. dma_addr_t dmaphyssrc1 = 0;
    # k$ T! Q+ p' [# K- m5 W
  69. dma_addr_t dmaphyssrc2 = 0;
    ; C) Y3 d' m" j) p# T: i
  70. dma_addr_t dmaphysdest1 = 0;* A/ l; U5 u" X. \7 R5 a$ f
  71. dma_addr_t dmaphysdest2 = 0;! [( Y9 b) C+ W1 ]8 {$ I$ a

  72. 5 }2 u& C! `* {2 B
  73. char *dmabufsrc1 = NULL;' ^! o+ Q* d9 V4 S' S
  74. char *dmabufsrc2 = NULL;" L% f6 z8 ?" ?9 z* b: m% S
  75. char *dmabufdest1 = NULL;
    8 s* s) d6 I5 Z: M& Z" z
  76. char *dmabufdest2 = NULL;
    . m$ ~" j& B& p3 ~0 F

  77. 3 u8 R* v! V+ C8 [& g3 X/ X  o
  78. static int acnt = 512;
    " _& T: l& X4 ]0 h5 y. G
  79. static int bcnt = 8;
    1 J- s1 Q7 [" D$ g# a
  80. static int ccnt = 8;
    4 l" |1 S2 P, C

  81. ; O- X* j0 N/ C+ u' K. |
  82. module_param(acnt, int, S_IRUGO);
    / m, t. `; `" l3 O
  83. module_param(bcnt, int, S_IRUGO);
    / D4 @: ^$ z$ B" P/ F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- K+ t% {8 x1 q' u7 m; W
. R8 U9 h3 k" L; m      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. O4 {) w# {$ l0 T4 N0 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 ~, c6 Y$ ?9 @2 P6 O  L) Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 f, t6 U5 C: L. a! h1 A/ N

- A$ v! w4 K6 ?6 `! K" s# j, W+ R  m% y" @/ Y: z4 {  {5 y5 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-11 09:58 , Processed in 0.042493 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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