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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  c7 F; A( w+ E* }
  1. [code]EDMA sample test application
    , C4 @6 |7 H8 ]' I
  2. /*
      F* e8 Z- V: W4 N9 J- G
  3. * edma_test.c0 r( _+ T* {4 E) y. G8 @! u
  4. *1 ~# H2 o8 a% g9 |( o  j; Q
  5. * brief  EDMA3 Test Application
    ; b% Y6 B% A/ m
  6. *
    . U% }5 f" I4 B8 g( @$ A
  7. *   This file contains EDMA3 Test code.0 d- P4 Y6 i# _
  8. *2 x% u- B6 ~+ |3 ?0 b, K9 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( o! x3 l* J) n+ Q) o! v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, q3 Q8 _* y! @7 h" p
  11. *         TO CHANGE.# |) X4 x5 B  Q$ l- n2 ]4 ?
  12. *
    - P; G8 m( |# c6 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , J4 x- ~$ }! S" Y8 t# l
  14. *
    # e3 ]8 c! z. p: v
  15. * This program is free software; you can redistribute it and/or$ @5 x1 I' H$ E+ R  r2 O
  16. * modify it under the terms of the GNU General Public License as* V/ D* b: j% H! t1 J
  17. * published by the Free Software Foundation version 2.
    9 I+ K+ c+ j2 |; T
  18. *% E  o8 ~. c; @/ K) Q2 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ?4 L* c" v8 q
  20. * kind, whether express or implied; without even the implied warranty
    0 \* G# I8 m5 B' G$ ^- e; @. {/ a( k* g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# A% s) z) J' e* T. M$ o. _( B0 T
  22. * GNU General Public License for more details.0 _" i% o: d  m3 B6 v9 J
  23. */4 p" f: w! z" `/ |. U1 [
  24. 3 s% x( @6 {, L
  25. #include <linux/module.h>
    ) ^5 U  d% K  |9 g1 ^
  26. #include <linux/init.h>! M; ^: k" S1 q2 B* ^) o; H1 Z; D
  27. #include <linux/errno.h>* V6 u5 s; m/ k1 c. G2 [, `
  28. #include <linux/types.h>
    ) s1 W1 M4 j  u& |
  29. #include <linux/interrupt.h>
    # A0 |3 P& H+ \
  30. #include <asm/io.h>7 }0 m; B% {" z! k* Y! `2 P6 o# P
  31. #include <linux/moduleparam.h>
    3 N9 Z4 h7 m' D2 s, z3 d
  32. #include <linux/sysctl.h>
    & z/ |) u- n( H4 w
  33. #include <linux/mm.h>
    # A  _5 ?* c& q9 q! x2 ^
  34. #include <linux/dma-mapping.h>' w1 l5 H- |' C: [

  35. 8 F/ ~# m3 A* |
  36. #include <mach/memory.h>
    0 N! Y6 h1 n, Y6 K+ c7 ?) i
  37. #include <mach/hardware.h>5 ~2 b9 V) q# m
  38. #include <mach/irqs.h>: }1 E+ h3 N8 Z, C' g& n6 k
  39. #include <asm/hardware/edma.h>3 u9 w$ B% ~3 n3 k/ r7 R3 P# j

  40. - R5 Z9 A+ x* u3 m; a0 e
  41. #undef EDMA3_DEBUG8 N4 h6 I/ o+ D% ~
  42. /*#define EDMA3_DEBUG*/
    . P8 n7 y4 A% \( b. D+ f6 {

  43. # C0 w/ D, z& N: t# s) G4 U0 e) t' X
  44. #ifdef EDMA3_DEBUG3 p6 j" S# _  S( }3 ~- U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 X$ f5 \' k: M. c. I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). {0 `: f$ A" R* Y4 Y' C+ ?/ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). [" H5 ^& t9 k0 G. h
  48. #else0 k. C' d7 [5 C5 _3 g6 n+ Y5 p) M
  49. #define DMA_PRINTK( x... )
    * K# j* V% ~& I
  50. #define DMA_FN_IN8 S- [" t7 V7 j3 ^6 i
  51. #define DMA_FN_OUT4 e6 W! D' x9 [: {
  52. #endif
    ) [2 c3 Y+ c8 r4 w( G3 P% V
  53. ! k" L; ^) ~+ l% d9 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 t& u/ a7 c/ o7 L
  55. #define STATIC_SHIFT                3* V) L: y' h7 j
  56. #define TCINTEN_SHIFT               20
    - |1 ?% u+ P- a% `" w3 t: B0 N" Z
  57. #define ITCINTEN_SHIFT              21
    ' r# x1 U0 C2 X6 C% M
  58. #define TCCHEN_SHIFT                224 w" \2 O' }! w. p3 i# k0 S
  59. #define ITCCHEN_SHIFT               23
    # x; K  n, n, I  m2 n) E
  60. 3 S2 b3 w/ u: m# E. F* D: K. o
  61. static volatile int irqraised1 = 0;6 D$ I# Y+ @6 ~. P  W) D
  62. static volatile int irqraised2 = 0;
    % F4 j% X+ H) I# w; G8 @
  63. ; O  X4 R8 Z2 m# y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 G1 a  h  i. v5 `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' K7 s  R% @! Q4 T) ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U: l/ k+ [# f9 m5 a, Z

  67. & z" z3 Z' K6 _( u% G' T
  68. dma_addr_t dmaphyssrc1 = 0;
    ; [  o! D6 Q) \, _
  69. dma_addr_t dmaphyssrc2 = 0;
    / l' n2 a/ V2 f3 o& R/ z
  70. dma_addr_t dmaphysdest1 = 0;
    + n5 K7 e* Z( B9 \4 j( u
  71. dma_addr_t dmaphysdest2 = 0;" \- S* `- z! T
  72. 6 l( A4 k! _2 t* N4 i/ G
  73. char *dmabufsrc1 = NULL;
    $ f8 A8 K/ b. f3 l+ S0 X$ p: w- f
  74. char *dmabufsrc2 = NULL;
    / w; Y4 S$ [- }. D/ S  k8 O) w$ c# A
  75. char *dmabufdest1 = NULL;1 C& |% F- d9 K+ N8 @. ^- j
  76. char *dmabufdest2 = NULL;6 ]3 l( @; G$ c; |% J9 t

  77. 8 p9 e! |. K3 Z6 n/ D  X* Y
  78. static int acnt = 512;! G( ~' ~. l& h$ s- d' ~
  79. static int bcnt = 8;; c% g0 p# Y- r
  80. static int ccnt = 8;8 H4 r: E( ?. o% d

  81. : h" c5 B: O5 e
  82. module_param(acnt, int, S_IRUGO);
    - Q! o- p6 N* W( I- y
  83. module_param(bcnt, int, S_IRUGO);
    9 Y. G' Y  F1 [; t' a5 Q7 |, c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' B, S( K1 y7 E' }+ H8 N# x2 P9 v& E9 W; Y9 i9 a$ G8 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- d* a# A$ ~! j5 [, ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* c5 p) F9 D. _9 W) `1 {* b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) c# B, W1 D* j! B3 ~* p) a3 u+ ^' \; y4 O

/ d6 d' f2 i) s# n1 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-2 02:32 , Processed in 0.039592 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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