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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 K% {& o' T& N
  1. [code]EDMA sample test application
    + e: s3 _6 c6 V  U' j, G
  2. /*) ~1 Z/ e) D% i  ?+ s, ^
  3. * edma_test.c
    1 V. O0 K: Z+ A; k- l
  4. *: z& ?2 r  |2 D: V' f& o8 j* D
  5. * brief  EDMA3 Test Application6 ~: y1 I1 {1 v$ A% E/ `
  6. *
    & k$ L9 F0 @; h
  7. *   This file contains EDMA3 Test code.
    ) L: C' Q2 r6 r+ X$ F) h
  8. *5 ^/ b8 @! O3 X. L% L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * j$ H7 H+ S7 J- d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : V9 B+ m' ^, n+ Y
  11. *         TO CHANGE.7 D7 p5 V9 }" z( V
  12. *
    ! W5 w" S6 l$ y/ G6 B" k5 T6 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Q* G9 P5 Y1 y- ]# n/ {! p1 A+ d
  14. *
      q1 \0 Y8 V& u8 s+ I, G- H
  15. * This program is free software; you can redistribute it and/or
    * J; A- E  G* P$ w
  16. * modify it under the terms of the GNU General Public License as; w, ]1 E0 m7 g$ \9 y
  17. * published by the Free Software Foundation version 2.$ s/ G: c0 H$ G" k+ h; k! r
  18. *8 v/ k+ b4 i. [' s) O# L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 ]1 s& q: ~. r# w7 h
  20. * kind, whether express or implied; without even the implied warranty. x) d) J/ \1 G8 D4 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 ?( a) R1 o  G; H
  22. * GNU General Public License for more details.
    0 d  g; h1 X9 r* r4 P/ d& }
  23. */
    ! v! l+ D) H3 G9 b' _; b" x. s
  24. ' c; p2 V# ~$ i& m
  25. #include <linux/module.h>
    7 w; _. V; I' ~" a
  26. #include <linux/init.h>$ ?7 H2 ?+ f; {% v2 U
  27. #include <linux/errno.h>
    " d, N. Y: c8 {1 }0 b+ |. l
  28. #include <linux/types.h>
    9 ?7 R, \+ b: m; d) h) y
  29. #include <linux/interrupt.h>9 K) Z! ^; n# ^$ @& a1 W
  30. #include <asm/io.h>
    9 S9 x$ Z# i1 h: x8 D+ M5 J
  31. #include <linux/moduleparam.h>
    9 r4 N0 H* ~1 t1 m0 h1 N  O; x
  32. #include <linux/sysctl.h>! I$ {, H" r# N. R
  33. #include <linux/mm.h>
    2 M. U' r" |) z2 {' E
  34. #include <linux/dma-mapping.h>
    6 \) Y$ c& G" S" A

  35. . r) z, t# o% _
  36. #include <mach/memory.h>
    9 q1 L+ v. Q6 x, A* p7 \% l" U
  37. #include <mach/hardware.h>1 _) r$ n2 F7 G+ W$ \
  38. #include <mach/irqs.h>
    8 Z: `7 f0 b6 m9 p0 g, Z
  39. #include <asm/hardware/edma.h>
    8 C: |$ `( J$ x1 X% u, R5 Z1 h
  40. : [3 G4 H2 Z! b1 d6 M
  41. #undef EDMA3_DEBUG( G4 f, |# i& w( i3 v  f- m
  42. /*#define EDMA3_DEBUG*/
    6 r: [- j$ k* w% ^# @, J- E' o

  43. 3 P6 m7 h, w5 ^! r+ D7 f# \, ^
  44. #ifdef EDMA3_DEBUG
    : n2 l" i' j- T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" b6 W) v9 C9 M, M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 N- ~9 f& X+ J' Y! n, u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # s+ h' v% e# p0 m$ M
  48. #else( J- V  i- J. C( `' b+ B/ P2 W7 u9 G) Z
  49. #define DMA_PRINTK( x... )4 w6 R$ @! Y% ~( M- A7 C
  50. #define DMA_FN_IN
    * Y( R+ Z7 A* i
  51. #define DMA_FN_OUT% g* Q2 l' `$ n, M
  52. #endif$ p. P$ K: X& W! \

  53. 8 u  @% j4 W4 D4 M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 C& H4 a5 s. E* y
  55. #define STATIC_SHIFT                3, x& J9 f& N& w$ ^
  56. #define TCINTEN_SHIFT               20, K, v: W3 c7 T& J( y& N' S
  57. #define ITCINTEN_SHIFT              21
    - }# t: P# e0 l% u! M0 Q
  58. #define TCCHEN_SHIFT                224 x' s+ T+ x* L
  59. #define ITCCHEN_SHIFT               23
    4 {2 v) U7 e9 L6 C8 d$ r, l2 a
  60. 6 G& u& e) J6 G8 e5 K
  61. static volatile int irqraised1 = 0;& e: z3 Z5 T/ m  e9 ^) w
  62. static volatile int irqraised2 = 0;
    $ f# k4 }7 K4 D) V
  63. $ }  Z1 K, C% M/ L; i: m+ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# N8 a  _$ J" j  X. T+ A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j5 z4 e9 X. m' C6 n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 L4 z5 f5 ^9 C( u; g8 g& j$ q
  67. / c. }4 T) v- E; }) y. O. I; r
  68. dma_addr_t dmaphyssrc1 = 0;
    9 I4 b. i( S- {% n
  69. dma_addr_t dmaphyssrc2 = 0;8 Y: o5 y: O% R% _
  70. dma_addr_t dmaphysdest1 = 0;
    3 v' i+ o" t$ @
  71. dma_addr_t dmaphysdest2 = 0;1 K: C1 ~1 c  Y& E, v9 m
  72. 3 J9 q& v4 L  G* B( N# ?
  73. char *dmabufsrc1 = NULL;0 I% X  S  l- v/ N
  74. char *dmabufsrc2 = NULL;
    $ Q" C3 Q7 ]/ e
  75. char *dmabufdest1 = NULL;0 w8 C7 X6 E" R% a$ e
  76. char *dmabufdest2 = NULL;
    6 e5 H0 c" ]' b" A- ?3 U
  77. ; T, t, j: e" i5 n
  78. static int acnt = 512;
    + a6 m  a9 E: z+ H4 p6 a/ d1 `) o) ~
  79. static int bcnt = 8;
    6 y4 k% _7 f! b' q7 R+ k
  80. static int ccnt = 8;
    8 k4 V! U& X9 Z; R, I" t

  81. * Q( c3 E8 G# v" I  N# v- `, u
  82. module_param(acnt, int, S_IRUGO);
    5 T+ E" j: N* f2 O
  83. module_param(bcnt, int, S_IRUGO);
    + n3 T* f6 A3 C  \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; b0 C' Q. B# c! v0 O3 B
4 i* B. g1 `* _+ i! n2 s4 w% e2 K7 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" T" t4 N' Q0 E& ~; E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 K3 V% U# O, i( i/ W7 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 x: \; k- }9 {2 @

) b, e& L1 r  ^7 Z5 M- k; t; q* D6 p" P) d5 a7 t) B, \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 08:00 , Processed in 0.038579 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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