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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " Y" }" j3 d. k* a
  1. [code]EDMA sample test application
    3 x; c- ~# p8 S: K/ o
  2. /*
    1 D5 Q8 L. q% H! M. O) R6 Y
  3. * edma_test.c5 v" O  v& w- J+ ~9 J5 x; s2 B2 Y
  4. *7 I. H- }" S" Z9 S4 o' N
  5. * brief  EDMA3 Test Application/ \' j( U8 L; I. w' O$ G9 z  H# h
  6. *
    ; p8 e* ~+ {: G  E5 N' W
  7. *   This file contains EDMA3 Test code.+ Y5 Z) h) |. }& f
  8. *; V3 l' E# {, H/ X; p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, |- Q" v/ w6 G" H. @, d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # D' v! M6 G! U+ e7 s
  11. *         TO CHANGE.0 m2 n3 @+ c( C
  12. *: |7 O. S" p) a, u; E  L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : z1 E6 H7 D( u% }8 D% \0 }4 X
  14. *
    : Q" Q7 g. l& |3 d# G9 _
  15. * This program is free software; you can redistribute it and/or4 |+ w& `$ W9 G7 d4 l1 K5 {0 d
  16. * modify it under the terms of the GNU General Public License as
    ' u* E% a$ J6 J! m8 v' g) s
  17. * published by the Free Software Foundation version 2.& D+ \) U' R; ]3 J8 o
  18. *- e6 r& G0 C" T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / p1 j+ J* J9 j0 f' e6 c
  20. * kind, whether express or implied; without even the implied warranty: \" s9 f1 |. U5 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" S& c  H% b* M$ j
  22. * GNU General Public License for more details.  k/ I% k$ {+ a
  23. */
    ) p- s4 x1 n" m

  24.   g6 |$ k$ ^$ t' y; r
  25. #include <linux/module.h>  L) T+ A9 x; Q5 a/ V9 |
  26. #include <linux/init.h>. t" f, C+ O. ]# P1 B* m
  27. #include <linux/errno.h>5 U: V2 k' P2 i7 ]% ^
  28. #include <linux/types.h>0 Z+ O5 @8 n# z/ _
  29. #include <linux/interrupt.h>8 C7 @0 u5 j2 O4 G' o
  30. #include <asm/io.h>
    ) t3 _+ u" R$ U& O# G- ]" {
  31. #include <linux/moduleparam.h>& r9 g& H. D. G5 T
  32. #include <linux/sysctl.h>* @7 ]7 H: `8 T+ d5 O- [! X
  33. #include <linux/mm.h>
    ! j! q& p. S, r) S
  34. #include <linux/dma-mapping.h>
    2 _2 M0 t& N7 e$ A/ j/ l- ^
  35. % [' b2 q0 ?8 P* I9 K3 J! _0 ~+ t
  36. #include <mach/memory.h>
    9 v, D: i' ]& A6 `8 L$ M4 l6 T$ t
  37. #include <mach/hardware.h>7 n* I! \3 p% ~$ X# d4 Z) c' |
  38. #include <mach/irqs.h>/ F9 p' g; @% f9 d+ Q  y1 q
  39. #include <asm/hardware/edma.h>) t, J. K$ e5 d' H+ G2 N

  40. 9 y! ^4 |5 W7 t% M: p4 R4 g
  41. #undef EDMA3_DEBUG6 w: R& d4 [* ?7 Y0 ]! W
  42. /*#define EDMA3_DEBUG*/
    ' w7 L( `, M7 |9 P. R

  43. 9 Q$ o' }& ?" F5 H2 A- I
  44. #ifdef EDMA3_DEBUG# E, d- V4 \" y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" g( |; `8 Y3 r; W+ m" B3 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ @6 w7 f$ ]- x1 q" u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , `3 b1 l. s. F! ?2 P3 J( N) s( F
  48. #else4 h  n4 q/ ^5 C( R. A
  49. #define DMA_PRINTK( x... )( K' x% a( F! d& D& i, ~/ T7 R# ?
  50. #define DMA_FN_IN
    " e$ R. n8 }% A1 x( W
  51. #define DMA_FN_OUT3 P$ G0 n) K8 k% d+ `
  52. #endif. L8 B0 \. Y6 }# V' w+ p" e

  53.   G6 o7 f* k# Y9 Q; Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : E* G3 J# }9 ~4 s2 x; U
  55. #define STATIC_SHIFT                3
    6 ~. {6 z7 \% F. u5 Q: Y
  56. #define TCINTEN_SHIFT               20
    " w. @% {; A2 j' }0 }; N1 C& A
  57. #define ITCINTEN_SHIFT              21
    & ]% k. X7 f' X' t$ ?
  58. #define TCCHEN_SHIFT                22  a8 V1 @3 N8 H
  59. #define ITCCHEN_SHIFT               23
    # W" f( z6 l' _7 X! q7 q
  60. ) `, r1 l$ M; E6 H7 A1 d
  61. static volatile int irqraised1 = 0;
    / c( f( t* X' x
  62. static volatile int irqraised2 = 0;
    ! w7 w, O0 i' j7 B9 U% U! }

  63. % x4 G$ m* ], x4 _0 z3 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 W" [6 e& k* E7 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! f, Z- F$ [/ n$ H3 P4 Y: D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Y* Q3 M9 y/ D4 M0 G

  67. 9 d9 {3 E$ ~" I
  68. dma_addr_t dmaphyssrc1 = 0;! b2 k4 \* S4 a7 E5 `! p( Z
  69. dma_addr_t dmaphyssrc2 = 0;
    + y( T& Y* e2 J7 P0 g8 g
  70. dma_addr_t dmaphysdest1 = 0;) \7 g+ D- |: |+ I8 w" @
  71. dma_addr_t dmaphysdest2 = 0;1 Q4 A. M7 ^( t$ _- p. X
  72. ) ]( Z. G) b! v% ?. T7 p3 T
  73. char *dmabufsrc1 = NULL;
    3 ~# d+ N+ k1 a! h& @3 A+ b
  74. char *dmabufsrc2 = NULL;2 V1 [8 l1 Q( R: l( Q: Q
  75. char *dmabufdest1 = NULL;
    : ?+ j0 M9 A2 \- S3 d
  76. char *dmabufdest2 = NULL;
    - k, e6 h! n6 e# v: {! g5 a

  77. 1 q! s' u8 ^3 _& G& `% V3 X0 v, N" z4 ]
  78. static int acnt = 512;" c9 [' ], A) d, d, R6 Q( ~8 W; {
  79. static int bcnt = 8;4 C  I: l0 G+ y! u# H+ |' E
  80. static int ccnt = 8;
    9 t" Q& i! _2 Z

  81. 1 O8 s; G2 v) [
  82. module_param(acnt, int, S_IRUGO);( e4 m1 M2 X9 Q* @4 C& j- G
  83. module_param(bcnt, int, S_IRUGO);
    ) \0 L0 M, y7 E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. b/ g2 _! l9 _+ d$ h
. X: \  H7 D% I6 X: A# _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  v- F# u+ X  C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 r6 j/ b2 N2 t$ S0 X% b+ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  X& ]% W" S  t
+ Z- U% I8 Q: x) p" {% ?1 Z6 I$ Q; i- h. g" Y: t2 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 05:41 , Processed in 0.044005 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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