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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 s% O. C/ D; O- a  |% X7 L; g
  1. [code]EDMA sample test application
    / k: f# Y5 b/ @3 r7 c7 U
  2. /*' M: C6 z# f, J* p' d2 E
  3. * edma_test.c
    $ t9 h1 r/ Z. B+ c5 ~
  4. *
    + w! d' p; w- H# z6 i
  5. * brief  EDMA3 Test Application
    , g, J4 U; D) \; J7 k. u6 \2 B
  6. */ d- Y* R" O" T, }9 ^2 \
  7. *   This file contains EDMA3 Test code.
    ( g; e3 V- u7 i$ _. Z- z4 h; G3 R
  8. *
    6 H2 |1 D% i0 K4 l) O) ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , H' t3 i3 k1 W3 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 L' U2 a+ j" E( s# O# {+ ~& n2 c
  11. *         TO CHANGE.1 x3 E7 F$ V( d9 r
  12. *
    ! c7 F5 n  A; T% i% R4 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      G2 j8 J4 R% u; e% M3 C
  14. *- K' [/ v+ S8 S
  15. * This program is free software; you can redistribute it and/or
    5 H( N& I# v2 O# ^( ?/ F
  16. * modify it under the terms of the GNU General Public License as
    9 [. b6 g; V( m5 e5 l  h# U
  17. * published by the Free Software Foundation version 2.+ i% e# H) s& ^5 _
  18. *0 a3 P$ W, L( b4 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + j+ Y  i6 C, @/ N9 C) N
  20. * kind, whether express or implied; without even the implied warranty- N3 z; |4 O5 g% Z- p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& E! b' x+ e& E
  22. * GNU General Public License for more details.
    4 k5 M5 X( g: n- w' |. t* j
  23. */$ z* H5 T8 F/ m; M0 b
  24. # D* n* L: ]$ H2 W; D2 h4 z. }
  25. #include <linux/module.h>% \' z0 u) K0 {& f# Y+ Y
  26. #include <linux/init.h>
    3 [5 x# u( ]$ P2 |; S0 V- N
  27. #include <linux/errno.h>3 B: s( P( B4 ~6 D9 t5 }6 E
  28. #include <linux/types.h>! D9 g9 q1 k7 I9 s, Y
  29. #include <linux/interrupt.h>
    2 S3 j" F6 H* m* H. S; ~
  30. #include <asm/io.h>
    $ u: H2 s2 p1 U1 J9 ?
  31. #include <linux/moduleparam.h>
    / x3 f- @4 h$ A; M4 S
  32. #include <linux/sysctl.h>( O9 U$ U% W0 I- ~  M9 l2 A5 K8 \
  33. #include <linux/mm.h>' ]2 ], \4 N3 T
  34. #include <linux/dma-mapping.h>
    7 S' A3 y" C0 m$ D* H8 _

  35. 9 E1 {9 q4 B6 \( V, T2 ~* t
  36. #include <mach/memory.h>
    - j, Z' V; }; @5 P
  37. #include <mach/hardware.h>  S& g# V) o5 c& F0 t9 H
  38. #include <mach/irqs.h>
    8 }6 C, T, z# G4 R4 s
  39. #include <asm/hardware/edma.h>
    : Z2 R0 a: f3 f; s

  40. 5 ~0 ~7 `* \$ g. F5 y( @
  41. #undef EDMA3_DEBUG
    * \9 n$ P/ D" S6 @; A
  42. /*#define EDMA3_DEBUG*/
    " v0 X/ m3 i" C
  43. / T& r5 _0 v# D9 T) @3 n) s
  44. #ifdef EDMA3_DEBUG
    * P* o$ K1 i6 ]/ {' H3 v3 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & Y  U3 d4 ^- J- h$ E6 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ G! f/ O- t# T! d9 K2 y0 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% ]$ ?" F! f. c3 N5 q+ t1 R$ }: ]; O0 I
  48. #else8 b4 i3 F. Y. g" u  m$ ~5 X
  49. #define DMA_PRINTK( x... )% U9 k5 X% n  W1 y; Q$ [' m
  50. #define DMA_FN_IN
    # [4 R4 K3 n; x' O; Y, v& p: c# o
  51. #define DMA_FN_OUT
    2 {, A/ v* n! H
  52. #endif3 B: \4 X0 m+ N' P9 H$ w
  53. % T0 w9 c, a! @7 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 |; w6 f- |3 o7 S/ S3 }
  55. #define STATIC_SHIFT                3
    8 j- b6 A6 m8 @' U0 O- o* M! p
  56. #define TCINTEN_SHIFT               20
    . M& ^4 b) ^% L9 c* l2 b: i) ^
  57. #define ITCINTEN_SHIFT              21
    3 X/ S+ K- F- K  A( t
  58. #define TCCHEN_SHIFT                221 G( n( j. G. l$ p1 }
  59. #define ITCCHEN_SHIFT               23( Q$ {/ o/ W: |- `. c, C0 X; W8 f

  60. : L2 a, c6 h5 o$ t. b* A* i( @
  61. static volatile int irqraised1 = 0;
    7 _8 C+ @9 R- W
  62. static volatile int irqraised2 = 0;
    0 L9 V0 [) s: k: a" a

  63. / T6 N8 e/ E0 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 H+ x2 ?# V! T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 ~8 l, v7 j/ u4 Q' M1 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' L$ E; ?/ Y! @, S) w) h3 p" d
  67. " O# u' U; f* i' P
  68. dma_addr_t dmaphyssrc1 = 0;
    . b  W% x& r$ p" r, q3 R$ O. Q- C
  69. dma_addr_t dmaphyssrc2 = 0;
    3 E/ L+ X* h4 l! Z7 s) H) j" ]' J
  70. dma_addr_t dmaphysdest1 = 0;1 h5 f* k6 z6 L2 i0 w$ P6 [
  71. dma_addr_t dmaphysdest2 = 0;
    ! [; M% H3 O! o5 y( B
  72. . u) j; |7 u7 ?1 M% ]; R8 u
  73. char *dmabufsrc1 = NULL;9 @$ L9 O! [. f& i
  74. char *dmabufsrc2 = NULL;6 \9 i  r: U" d1 V. R
  75. char *dmabufdest1 = NULL;
    " Z# ?7 ~6 Z. l; @$ R1 U5 g- S
  76. char *dmabufdest2 = NULL;+ z" H) w% [, b" t) E, \  I$ u' B. {  b6 \
  77. * d* t/ P4 ^5 V# r: o1 S0 k: m* Y
  78. static int acnt = 512;; V9 i6 ^; g+ r- J3 n
  79. static int bcnt = 8;; X7 M$ i% |) t3 w' ^
  80. static int ccnt = 8;* A$ ]# Z: S& f' E0 _  B

  81. " x: B4 B" j& _0 V% k
  82. module_param(acnt, int, S_IRUGO);$ `7 Q( P6 F4 n& i) D% l  g
  83. module_param(bcnt, int, S_IRUGO);
    - Z; I/ [+ x1 s+ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% }7 L' d) U+ |( P0 p9 G

* U% R0 v) m- z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ U% Z4 p. v3 U& W' p% ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! W9 Y7 S+ V# G. y2 ^# w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, }$ M7 A* g% N6 z6 t: \7 K" L

1 @2 a2 x5 M$ ^0 V+ f
1 k1 J0 m; K+ ~4 C- m5 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-8 17:27 , Processed in 0.040393 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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