OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# Q; w! j' C0 c
  1. [code]EDMA sample test application
    8 }' @- A: N* |, N) R  ]3 R
  2. /*9 f7 G4 z# z) |" O  u
  3. * edma_test.c
    * |1 ^- p; C  u) b7 l  w9 e( c
  4. *6 M% a. [/ U3 N/ a4 y/ c
  5. * brief  EDMA3 Test Application" {* s; E' \$ x) J/ E6 D$ s
  6. *
    ; E  N+ P" k8 c; u% ]2 c6 d
  7. *   This file contains EDMA3 Test code.3 F- b) V4 t1 O. W: c7 _# |
  8. *! ?/ n9 @, P2 t! H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / ^7 c; S7 ^9 z& l" j5 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; Q9 T* z+ ?( \* P
  11. *         TO CHANGE.& F3 f/ |/ x/ Y5 `$ k$ G
  12. *
    * v3 Q+ o1 x/ D, }- l1 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 R% q2 V$ b: @$ }( x, Z) M
  14. *" L* c6 Q9 L& o
  15. * This program is free software; you can redistribute it and/or; _/ z5 L5 e% S& c4 F7 W
  16. * modify it under the terms of the GNU General Public License as4 Q& b& m8 U, I+ U
  17. * published by the Free Software Foundation version 2.2 |0 |& I% h" }$ V1 n. M# S
  18. *
    7 N  {# r& `4 z6 M0 }7 b/ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  f/ k0 @- ^8 w( ^. A
  20. * kind, whether express or implied; without even the implied warranty
      e5 q$ G& r: @& J, L: @, B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + p# I7 Q' f+ b8 b  {
  22. * GNU General Public License for more details.
    ' y+ v7 V* o8 y& h* f' s( n
  23. */1 x1 k' u) }  E7 G
  24.   ]# h, U* F! [+ R) v
  25. #include <linux/module.h>$ |6 p: Z: t7 k9 N
  26. #include <linux/init.h>' R% a4 o  c; s- Z7 o
  27. #include <linux/errno.h>
    2 \- I$ m! {4 ~6 ~1 _3 Z& f
  28. #include <linux/types.h>
    & x  a0 Q, _) H0 _' N3 q- q
  29. #include <linux/interrupt.h>. A$ J9 z( A# z4 Q7 y
  30. #include <asm/io.h>6 W7 [$ d# ~2 T# C0 E
  31. #include <linux/moduleparam.h>. ]7 Y8 `" d+ q$ d# N
  32. #include <linux/sysctl.h>
    ! \8 A% s8 Y' b, P% M& P* i
  33. #include <linux/mm.h>
    , |% \  H- z4 h8 W' u. Z' ~8 a
  34. #include <linux/dma-mapping.h>+ d" J/ U6 t% S( d
  35. % j9 t* G, U( V+ s8 S( @
  36. #include <mach/memory.h>4 D- w, U5 D4 z* a
  37. #include <mach/hardware.h>
    8 P( i0 S# [7 r8 m
  38. #include <mach/irqs.h>
    7 c& X9 u5 _- G' X$ a% m
  39. #include <asm/hardware/edma.h>
    0 k- z) g$ M; N! ~) Y/ K* u
  40. ; s8 d2 S4 h/ Z1 d. {
  41. #undef EDMA3_DEBUG7 D7 ?6 |* G. \& }/ z
  42. /*#define EDMA3_DEBUG*/
    6 y7 m0 i* Z4 S% _' P) K# h
  43. - g3 ?! I: J; X/ S  R: E3 a
  44. #ifdef EDMA3_DEBUG
    . |! K, k2 n0 S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 P& c" a6 l" `- P' l8 h# J* p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # m8 \* ~$ b: U6 m; L" k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* R. ~- C# d. o7 X* g$ a
  48. #else
    7 ?* J) _# a8 @' k) L- T
  49. #define DMA_PRINTK( x... )
    . X7 R$ d3 m& j% ]- X! F0 C
  50. #define DMA_FN_IN
    7 \) s/ y2 Z* D" ?& i% w! b
  51. #define DMA_FN_OUT
    0 W/ S' T: q- F. F# F: o" I3 Y
  52. #endif
    - ^" M3 k! u* \

  53. 9 d+ Q: i+ G4 Y0 }: R1 x4 l4 ^* @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 V' n. b; m" v
  55. #define STATIC_SHIFT                3/ X# f% B+ l  y3 o; ]9 ~0 I
  56. #define TCINTEN_SHIFT               20
    ' k' [$ a3 {/ X) \! L" K
  57. #define ITCINTEN_SHIFT              21
    ! N1 C9 V( u  @9 W5 e
  58. #define TCCHEN_SHIFT                22! H  T/ o4 M. z: k8 H* \2 N
  59. #define ITCCHEN_SHIFT               23
    / T5 f; t1 e0 I, u' p
  60. 3 f. ^. O# C. B
  61. static volatile int irqraised1 = 0;
    1 E" b3 J1 [# z- X  a
  62. static volatile int irqraised2 = 0;
    ) N% y, [9 P" ~0 A/ ~( Y/ J+ a# h* L
  63.   M/ L* f! n0 y& ]) m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: s+ q% B: Z2 P. m2 P, s9 l2 O1 }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x5 P8 h, |% D6 }4 L) S2 m8 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z. i% S& G( d8 ]0 o) l9 K

  67. " v! L9 V3 k3 y6 f$ s
  68. dma_addr_t dmaphyssrc1 = 0;, C4 z; |" V4 F, e1 i
  69. dma_addr_t dmaphyssrc2 = 0;
    " i0 W' B/ b6 l/ y' f
  70. dma_addr_t dmaphysdest1 = 0;$ R! V9 l7 Z$ O6 U9 }
  71. dma_addr_t dmaphysdest2 = 0;7 v9 ?5 V1 S9 g& s4 R% h' ~
  72. 6 |  r6 h8 d* z: m
  73. char *dmabufsrc1 = NULL;
    - v0 Q# j* Z1 y
  74. char *dmabufsrc2 = NULL;7 e4 u! ?" n' a( b0 k6 h. b+ |" w! F
  75. char *dmabufdest1 = NULL;
    7 }7 }5 Y4 V6 d) D7 S
  76. char *dmabufdest2 = NULL;2 I9 q+ f. H+ R0 G
  77. 2 ?; `) g' y5 W* A
  78. static int acnt = 512;
    & b, j- m9 K5 U% V1 n- ?9 I. e7 h4 E
  79. static int bcnt = 8;* u, g% H8 F' z; V# I
  80. static int ccnt = 8;
    : l; U& M/ W+ k0 H, |% J
  81. 7 k; E% P( M1 z: o2 \& R$ }6 s
  82. module_param(acnt, int, S_IRUGO);
    # |5 G+ Q' h3 C) z1 f: c
  83. module_param(bcnt, int, S_IRUGO);
    1 V0 X5 s( ]0 ^+ M, L$ T# W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 A4 D! O0 s+ \( h% n3 g" a
) P) n' x) B7 u0 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& w6 J4 |' w# i# ]/ _) q( F: |* X0 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 J& G2 U+ W/ k! I8 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 |8 W/ J+ h/ O7 \. y; B: t
# j% R# P( P0 v2 Y) ?; S2 P  F; T8 {2 S+ S7 p0 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 11:00 , Processed in 0.044768 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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