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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; k6 N" X4 V; o- d( Y
  1. [code]EDMA sample test application% n) L; v% o3 d6 ~+ C$ o
  2. /*
    # V0 ^! [+ q4 Q$ [) d
  3. * edma_test.c
    2 a- }2 O/ Z  d9 Q8 y
  4. *1 l; j1 {# r+ r
  5. * brief  EDMA3 Test Application% z9 r; g# `0 h9 E' c
  6. *
    1 f1 B; b, @' n& \
  7. *   This file contains EDMA3 Test code.
    . ~9 Z+ ~2 @0 k3 G$ U: r4 E! ]& d
  8. *
    ) J( ~# r0 {3 C3 ]/ i: x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 W8 \5 l% o& ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# u* E* O2 ^  V( {! U1 }
  11. *         TO CHANGE.' e) E" Y; ~2 Z! h$ S" z2 X
  12. *
    . ?$ u' q3 A% R* [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 Y, G  F# J* Y: I8 A. o
  14. *
    ( m8 p, @* L! }  F, K" z4 C
  15. * This program is free software; you can redistribute it and/or
    % R2 _' C& z% b7 p' s
  16. * modify it under the terms of the GNU General Public License as
    8 f: D* R, w! }, ~# e3 M+ A+ J
  17. * published by the Free Software Foundation version 2.; _- ~7 L( M& G* I: N+ _8 }
  18. *
    * W/ N9 J% {9 }$ T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . I, w9 T4 w/ [$ e: k7 T
  20. * kind, whether express or implied; without even the implied warranty
    # o8 L, z& R! l7 R, ~# Q& K. z! j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* d* h- z& b$ B" x- C
  22. * GNU General Public License for more details.9 |' A( q+ ~& k. x: d" d% |
  23. */
    2 @, t' ~0 O: x* t# R

  24. 1 a0 S( x( k1 {* O0 q
  25. #include <linux/module.h>
    - h" ]1 e7 y, b' b* U) V1 z
  26. #include <linux/init.h>- P1 y/ h6 p; H  z/ r
  27. #include <linux/errno.h>
    : r0 M5 R, a" }- G. o
  28. #include <linux/types.h>4 m( T' Q0 k  [0 z6 {* C+ q
  29. #include <linux/interrupt.h>
    + G& g  H- ?) J6 {- Q
  30. #include <asm/io.h>
    2 D; J6 `. {+ V
  31. #include <linux/moduleparam.h>
    8 Y5 g7 i% ^1 }3 ^& ?7 o, g
  32. #include <linux/sysctl.h>
    * z. D; q) x3 ~5 Z% o. W" f
  33. #include <linux/mm.h>
      h: d. v" o6 z% o& T
  34. #include <linux/dma-mapping.h>
    3 n# g3 \3 L9 _
  35. & P3 F: q4 f, ~5 N* F
  36. #include <mach/memory.h>6 g8 q" H( o! g& ]3 }
  37. #include <mach/hardware.h>* q) a: G' T# O! @, v
  38. #include <mach/irqs.h>  h. t# Z& J0 \1 {7 Z( Z9 h4 q* l! V
  39. #include <asm/hardware/edma.h>+ ^- n* A# h  F- H# w

  40. $ i' ~; `) i7 o2 l$ n- F0 v. x$ a/ \- ~
  41. #undef EDMA3_DEBUG
    + }3 D; i, R$ H" w* k6 l) M! G
  42. /*#define EDMA3_DEBUG*/
    , @, j- Q) [. E/ @  j
  43. - `9 Q7 ^# L) h7 ~# }, e7 D+ `
  44. #ifdef EDMA3_DEBUG' A& u! b! ^) K3 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& l* t$ h; H% }9 r: n# v4 p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" n0 U! r( A  ~2 ^; M& \4 X8 o! s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( R; L- n. J- H7 L
  48. #else
    * U8 Z+ i/ w$ P0 J5 G; P
  49. #define DMA_PRINTK( x... )' [  b7 h4 H! P3 K9 V* P
  50. #define DMA_FN_IN+ ?6 l: v: N3 P& i0 G" {  W
  51. #define DMA_FN_OUT
    % @! ]3 d  F3 w+ W2 Z' s: ~% O
  52. #endif
    8 o8 \0 a( Y* q* {8 m. Q. q
  53. . Z" c" J# Q1 Z1 g  Z- P" Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 i3 ]! ]9 s- Q. ?: q
  55. #define STATIC_SHIFT                3
    8 |9 ]7 J' |4 a/ q" z& V
  56. #define TCINTEN_SHIFT               20" H. i( Z6 e6 j. R* v
  57. #define ITCINTEN_SHIFT              21
      I2 o- ]9 ^4 w& y
  58. #define TCCHEN_SHIFT                220 O% r  z5 M* P3 D; J. z4 Y
  59. #define ITCCHEN_SHIFT               23- G  {. ?, K' b4 H; S

  60. $ D* l* H  ^/ g9 @4 S
  61. static volatile int irqraised1 = 0;
    + a1 h8 ]& ~; t6 t( ~+ x/ w4 {0 \
  62. static volatile int irqraised2 = 0;8 ~. ~% }7 R3 Z9 Q, d
  63. * A9 L2 Z" C7 }3 @+ g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ~1 J$ k+ A3 g/ c: G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & x* ~. ~5 r* u4 V! S* }- P6 E# H/ L6 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) _: V4 N7 w2 n: o$ I& o
  67. % \3 |) `8 `  `- i
  68. dma_addr_t dmaphyssrc1 = 0;
    / j2 O- R7 @' P; l) o. u8 D
  69. dma_addr_t dmaphyssrc2 = 0;
    % K6 d1 K: i; |( Q
  70. dma_addr_t dmaphysdest1 = 0;
    : f" V4 z* V: Z' @5 Q: q* c' g
  71. dma_addr_t dmaphysdest2 = 0;
    1 U/ v5 l" r  ]
  72. . [( g2 {1 u" z. y/ ^7 d! e; i' Q
  73. char *dmabufsrc1 = NULL;
    : E. g9 |% L% m! Q0 V
  74. char *dmabufsrc2 = NULL;9 G  M% m. D5 ]. h
  75. char *dmabufdest1 = NULL;2 k) ?  {# X" M0 r
  76. char *dmabufdest2 = NULL;. H$ A* \6 }, h9 }

  77.   [6 {+ E% m, ]: ^3 u6 d+ e1 C
  78. static int acnt = 512;
    ( S! y7 D1 f' q( I& h$ o5 i+ W
  79. static int bcnt = 8;) a7 H; y/ _# j, S$ |$ v: ~$ x1 U7 Y
  80. static int ccnt = 8;
    1 Z# y) h5 e4 c0 ^' h8 x: [& b
  81. 4 q3 b) X2 i% c7 [: e0 \9 g( B
  82. module_param(acnt, int, S_IRUGO);
    8 K0 X& h! P/ B; j6 x
  83. module_param(bcnt, int, S_IRUGO);
    " [0 g2 ]+ l8 E, v" N6 U0 |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 R3 c1 n1 D% m& d5 g! B
8 t+ z) `- j  \2 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ d8 C; y: m6 }/ b: w
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 A8 l9 h, j$ Y# T" n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' [( j& ~& ?* u% \" e# l1 ?, M1 t2 R3 n. N1 J7 ~& ?0 L2 f- L2 i

# ~3 j: ~, E( M/ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-3 16:58 , Processed in 0.046838 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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