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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 V7 @2 i1 K( I, j8 I
  1. [code]EDMA sample test application
    % J' n8 [( n9 K" @
  2. /*7 o$ X$ P$ R1 T: A' }  R: q7 @
  3. * edma_test.c1 f- p& d) R: R. |/ W1 S2 `
  4. *1 I/ S, f! _( W$ M9 P0 H: E& t# g
  5. * brief  EDMA3 Test Application
    . R5 w; d9 `6 H" }6 _! |& X' N; ?0 D
  6. *
    / l! x% p  A" `3 x  G
  7. *   This file contains EDMA3 Test code.
    ( X. a' b' G3 _4 A/ i; a& }
  8. *
    9 o) G) ^3 R; O0 o6 I' M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; w- M0 ^( {* H, u% ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ s$ z# S8 D- L) e& @, ~" B
  11. *         TO CHANGE.
    , F! P; O% R: i! C  W  }2 R
  12. *9 w' F$ A  {2 J& a) g& K% `/ _$ h7 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' {1 x, J' |0 R: v% e! _
  14. *) r+ W; R" S% ?: ?0 q
  15. * This program is free software; you can redistribute it and/or$ Y1 e" y0 H1 Z: b! k4 a. b
  16. * modify it under the terms of the GNU General Public License as
    * a9 F) E5 y$ u  K) o
  17. * published by the Free Software Foundation version 2.* e9 }; P: j& V" w, J2 R
  18. *9 F! l8 f/ {8 }: }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / m9 ]/ q' G- d
  20. * kind, whether express or implied; without even the implied warranty
    9 _. p: F! @, S" }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 s  G5 c4 J7 d5 z9 v
  22. * GNU General Public License for more details.
    9 R( x7 S1 w1 s
  23. */
    . V# E  m& d) ?

  24. ' ]# ~3 n# q" {; g! k* }" N
  25. #include <linux/module.h>3 ?4 y( m+ C. ?1 F* v- M
  26. #include <linux/init.h>
    , G0 I& d- {; a% ~! J4 d
  27. #include <linux/errno.h>
    ; t7 B9 N; h( A1 t% S$ b6 k
  28. #include <linux/types.h>- D1 w9 e, s! @4 t4 _" M/ A4 k
  29. #include <linux/interrupt.h>
    # l/ a. r# k- W; X
  30. #include <asm/io.h>
    . C( z* a8 f! v  f- S0 r
  31. #include <linux/moduleparam.h>: s& Q* o# J3 f
  32. #include <linux/sysctl.h>6 B% B: _( \" G: L8 o
  33. #include <linux/mm.h>
    * a5 _  Y) a# T1 F: J+ @0 q
  34. #include <linux/dma-mapping.h>
    : e3 j0 t( `3 r, P& [% {

  35. 7 Y4 O% f, f3 S6 m% r- n% v
  36. #include <mach/memory.h>9 E5 n) u+ G" M2 i
  37. #include <mach/hardware.h>( c- t& c( D0 C/ V6 c; q" J
  38. #include <mach/irqs.h>
    + L* k. E1 L; J) K
  39. #include <asm/hardware/edma.h>  |. u/ {' I( B  C* Q+ t
  40. / G5 f+ U$ J, d3 L
  41. #undef EDMA3_DEBUG( d" `# S5 v8 Y# A+ G
  42. /*#define EDMA3_DEBUG*/: _; n0 a+ ?+ s

  43. % o( A( ?4 ]% w% j+ b: F
  44. #ifdef EDMA3_DEBUG
    ; y- R- g3 v4 v$ e& l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 [  `$ r2 r+ l! [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" j5 O: k7 j( z1 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): w( C: y: E% M& r
  48. #else
    4 M6 E, w& g: n
  49. #define DMA_PRINTK( x... )- `' C: K* {: p
  50. #define DMA_FN_IN( R- h/ n, I# w, U9 f  w, ~! @/ n
  51. #define DMA_FN_OUT
    5 _6 J% S. \! t+ s# q" A1 i3 S+ v
  52. #endif
    $ L7 B% y, i% |* k; w

  53. ' F! O2 {' @' E; O6 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  {5 W+ y+ S& F0 H, p7 V$ W3 h
  55. #define STATIC_SHIFT                3
    % C0 V7 q! P9 x& X* _" F
  56. #define TCINTEN_SHIFT               205 i5 v: C3 X- M' h$ c1 K
  57. #define ITCINTEN_SHIFT              21
    4 M, y6 y$ c* H0 d
  58. #define TCCHEN_SHIFT                22
    * |. |# [' H$ K6 g; K2 Q0 M5 K5 e
  59. #define ITCCHEN_SHIFT               23; _9 x, r: `4 C9 I; n
  60. + q( o. R' Q' }# L
  61. static volatile int irqraised1 = 0;
    1 N+ W+ }- T1 b. P: O) K9 v* M
  62. static volatile int irqraised2 = 0;+ v) W7 `/ R6 v( ]

  63. ( B+ b1 c) Z) a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" H+ r$ Z0 @0 a, h8 g) t; u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! D5 z. {: h) }0 {( p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# J$ G6 Y) ]/ P& P: W/ k! M
  67. ) H, w1 [. g) `7 D6 S: k% F, k
  68. dma_addr_t dmaphyssrc1 = 0;
    2 _. u7 P& G0 U# {' _/ K
  69. dma_addr_t dmaphyssrc2 = 0;, L3 w8 t  g) L6 s
  70. dma_addr_t dmaphysdest1 = 0;
    / @8 U3 p3 ]" }- |+ v
  71. dma_addr_t dmaphysdest2 = 0;1 L- G6 F* x5 [: ^

  72. 6 G5 ^+ u9 G. N- T
  73. char *dmabufsrc1 = NULL;
    7 m8 F/ q5 `6 t
  74. char *dmabufsrc2 = NULL;
    $ U0 j0 ~  P& p* o. K. Q
  75. char *dmabufdest1 = NULL;
    . q7 [  ~! z; p. s  `; U" {
  76. char *dmabufdest2 = NULL;2 b* M: v7 d/ ~* D
  77. $ H( z$ D7 u( r) |( s
  78. static int acnt = 512;" x0 ~2 G  h* H; \0 A
  79. static int bcnt = 8;3 }& Z, P$ c9 ?/ \$ b8 C
  80. static int ccnt = 8;
    1 k$ `: t2 b9 }+ x0 {* X' F

  81. " q' h5 `( [5 w& x
  82. module_param(acnt, int, S_IRUGO);
    & g" T3 D; S4 E$ A
  83. module_param(bcnt, int, S_IRUGO);5 H7 w* f4 h% g' D; F% a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 j* ?# [0 p2 r5 Q7 }
' A& i# I; f# E& c- G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ @& K0 o, N$ [3 G, F7 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! l8 j5 j7 Z, A( c" X% d& m     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ?  d; w+ P* M* u8 G8 J; o7 [* y( K: ~3 D
( p4 N  ]9 k7 m/ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-4 09:42 , Processed in 0.039199 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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