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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 j; i1 S( ~/ w& r' [* S* N4 Z3 M
  1. [code]EDMA sample test application% u- m7 i# q  R6 }
  2. /*6 _7 }+ |4 U- o
  3. * edma_test.c; u3 G& I2 ~" x3 S; j7 i: d
  4. *
    ! `5 x% @* A& s6 W
  5. * brief  EDMA3 Test Application7 M' }, P% g8 i6 B$ h7 Q) T
  6. *1 j( p! x* ^5 E  w% f. q
  7. *   This file contains EDMA3 Test code.
    1 g; K5 C) K+ w/ g9 V' k
  8. *# `* Z" h5 r8 Z  I% D' ^3 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 P2 e( A$ a8 o# ^" ]7 U, u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  U( C7 H: X7 B- m+ r
  11. *         TO CHANGE.$ g, A' ?% k1 J4 |7 \5 z+ @' O
  12. *! N! u/ J6 s4 D( }2 z4 f: g0 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) v, K" X$ v/ N( F0 D* I
  14. *
    8 y+ n$ o( Z/ t/ v6 r
  15. * This program is free software; you can redistribute it and/or8 A$ @( ~1 C6 `# F# {& v4 X9 Y$ N6 o
  16. * modify it under the terms of the GNU General Public License as
    " U7 L3 D4 h0 z2 K5 ~, a
  17. * published by the Free Software Foundation version 2.& V. v$ Q3 ~1 k8 r& D
  18. *( O# M$ V3 j' ~0 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( B: J) g* p0 u
  20. * kind, whether express or implied; without even the implied warranty
    8 X, r+ N2 `0 ]+ [, u/ Y9 D! u
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ z3 v1 _; C. E6 A7 ~  I8 E) R
  22. * GNU General Public License for more details.
    ; u' ]% K8 c4 m6 d& O
  23. */) M7 o  U" f: D$ Y8 N* [1 f8 U

  24. 7 I5 i/ r  C% g
  25. #include <linux/module.h>
    ! |- ^! z: z  m1 J
  26. #include <linux/init.h>
    & |; J4 K- @( Y$ K: ?. s( ?
  27. #include <linux/errno.h>5 y  N6 i7 k7 C, X9 Z
  28. #include <linux/types.h>% A- m+ S) I6 d5 j! N+ _* m
  29. #include <linux/interrupt.h>
    9 W( e( `; W5 n! w) J# b$ v
  30. #include <asm/io.h>4 _* ]% j" m* a6 D
  31. #include <linux/moduleparam.h># b3 i( a% Y. B  L" ^& `, z
  32. #include <linux/sysctl.h>8 D1 T& H. B& ^# u6 y1 V( Y1 M
  33. #include <linux/mm.h>3 [0 i0 A/ N* E' E; [+ l- `
  34. #include <linux/dma-mapping.h>6 e" e/ ]4 U2 \. x3 W

  35. / i: A9 j7 o$ V2 W1 ?
  36. #include <mach/memory.h>
    1 g. ]4 Z7 z3 N6 Y& w, m
  37. #include <mach/hardware.h>
    % G5 E) B! N. }3 ?
  38. #include <mach/irqs.h>
    / O6 M7 _9 b. A0 b: C
  39. #include <asm/hardware/edma.h>) C. v; ]- p& P6 W6 A1 R# t* W
  40. 7 W' `/ F; q; f* j
  41. #undef EDMA3_DEBUG$ J: d* I* U7 Z+ n; Q! i
  42. /*#define EDMA3_DEBUG*/
    / t# ^( j) ~( ^9 [3 w' @
  43. / W! {4 {* l" N( e
  44. #ifdef EDMA3_DEBUG
      I# c, g9 U: D' d" g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 g6 e+ S) k/ @2 g9 D  U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; r5 V" y: I& R: K3 n; U0 G* M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); G7 d) J0 y7 |( s
  48. #else
    % Q* O( d# u  {) t0 c
  49. #define DMA_PRINTK( x... )% Y- t( J( N, F4 K3 ?
  50. #define DMA_FN_IN* ^/ B: A% v2 S& x) i6 r/ S
  51. #define DMA_FN_OUT
    0 a0 _" q: S  l4 d; ^% b
  52. #endif4 R1 P- a2 B9 q4 z) n& Y. z' L

  53. ' j$ B; D$ D9 B; {' n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! U6 F0 s8 [! ]' t: d7 t
  55. #define STATIC_SHIFT                3. {- z" \; H: o
  56. #define TCINTEN_SHIFT               20
    ! t2 v1 }: T, u- P  T) J' k1 E: I
  57. #define ITCINTEN_SHIFT              21
    . i: b9 W9 o/ \4 _0 }+ }  |
  58. #define TCCHEN_SHIFT                22) ?9 E7 Q$ u7 f! f; w
  59. #define ITCCHEN_SHIFT               23
    " O5 i9 m! b+ {7 i+ g- W
  60. $ }& H! e; A0 B3 P6 F
  61. static volatile int irqraised1 = 0;
    7 l# v/ I1 e4 q
  62. static volatile int irqraised2 = 0;
    ( E, h! q! C! k3 `4 X7 |7 }

  63. # L% j5 Y6 C1 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X' z9 M$ i# ^9 S4 \) e7 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      m; v4 e! \. J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @1 R4 ]1 }) r2 D" c6 n

  67. ' E2 a; w3 h0 C# a6 X
  68. dma_addr_t dmaphyssrc1 = 0;
    ( {" r+ U4 G; V0 c
  69. dma_addr_t dmaphyssrc2 = 0;- X+ Q- b& W9 P% ]% ?" \
  70. dma_addr_t dmaphysdest1 = 0;
    : Q# V8 x6 V: c+ E
  71. dma_addr_t dmaphysdest2 = 0;
    ' _4 B  u2 l$ X8 n2 U
  72. ! j4 }( R0 G, C0 W
  73. char *dmabufsrc1 = NULL;
    / H+ A2 n3 q! H9 {" S  K2 c& q
  74. char *dmabufsrc2 = NULL;8 C" G* o/ R  ]7 R. L5 e+ E1 V
  75. char *dmabufdest1 = NULL;4 P( ~* i% {1 Q8 Q9 g# z" K
  76. char *dmabufdest2 = NULL;
    ( ]& x; }& H) F

  77. 4 S$ `& {8 a4 I& W# d, u" d
  78. static int acnt = 512;: j% \" h' E& Q
  79. static int bcnt = 8;# E% u: D, N( `7 B0 O
  80. static int ccnt = 8;
    $ c. C( F! J' _1 E  \

  81. % x$ W% b6 }$ `  d1 ?
  82. module_param(acnt, int, S_IRUGO);
    6 v' V& D! v. z8 q% z" m+ ^  q( s
  83. module_param(bcnt, int, S_IRUGO);
    5 r% J, p) ?& E3 \1 @( }: f7 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) ?3 Q% [: u* c7 d$ @

) f7 }' ?# }3 a( ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 [; u' _( g4 ~* J9 Y( J6 g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 t1 o/ j8 h% D. n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% i7 m2 N' Q# k% _

2 v: o: Q5 W" {; W) x' T* X- \; _8 B$ Y8 l9 d  v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 13:49 , Processed in 0.054651 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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