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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- K5 f% h9 }3 S) I# H) _4 u
  1. [code]EDMA sample test application
    % Y& ]5 [1 C+ g) E* H4 j6 x. W) G
  2. /*6 H+ T* U7 j4 ]
  3. * edma_test.c; |/ f& E: W2 D; Y. s) V6 _0 G2 l
  4. *) D" x* P! g7 r7 M3 `
  5. * brief  EDMA3 Test Application
    : e# v5 R9 x  G& `  n" f4 \
  6. *3 g, N/ S7 \" S' `
  7. *   This file contains EDMA3 Test code.  r9 y+ f) T0 n* H8 J5 S8 v
  8. *
    * o% @; z9 Q. B9 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + Q; E! B$ o, e3 }# r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" A! L$ o0 q7 s. l6 k/ O% e1 R) N
  11. *         TO CHANGE.9 Z+ b& _! A$ S7 v* p
  12. *
    + S+ r* T3 p1 p; c# H3 W4 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 a9 k9 f: S$ m5 C
  14. *
    - @) p/ I9 l- p
  15. * This program is free software; you can redistribute it and/or9 f( a1 H- c( \5 w3 U( |
  16. * modify it under the terms of the GNU General Public License as6 x! d. g6 C: {) U, K  B5 R( t
  17. * published by the Free Software Foundation version 2.: a! [; ^1 `- F
  18. *
    8 b& P+ w$ b, |( W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V' `" {% R% c: l, |
  20. * kind, whether express or implied; without even the implied warranty
    - u8 ]4 l. p0 t8 s. D! F3 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; b6 l7 t$ C- J- \5 p5 |7 z
  22. * GNU General Public License for more details.' N) j7 L% M! S/ ]. M: R# `4 j* T/ O
  23. */6 m$ M7 e% o, {

  24. / f% W$ ?2 k% m/ X$ {9 F
  25. #include <linux/module.h>( e7 x) Z  @( Y4 _
  26. #include <linux/init.h>
    ; K9 _3 s, t) \# Z* Y
  27. #include <linux/errno.h>% R# B4 A+ L7 I8 U6 B; c
  28. #include <linux/types.h>( Z3 |1 J/ o3 M
  29. #include <linux/interrupt.h>' q9 w7 X& _( M; K6 `' n, H* {
  30. #include <asm/io.h>' i  i% e$ ?8 i2 ?* K5 b& X
  31. #include <linux/moduleparam.h>, G) T) |5 s% x/ ^  N. n0 N
  32. #include <linux/sysctl.h>
    6 D+ i8 H) @' b) D/ c5 E5 e
  33. #include <linux/mm.h>) K9 C1 u" s. o7 s2 a4 }2 P
  34. #include <linux/dma-mapping.h>
    * u, y5 A% k5 Q5 i# _2 R$ l! g

  35. " O! Y1 v) q+ e7 M" Y  j
  36. #include <mach/memory.h>$ g# Z/ C3 E9 f6 P2 i6 P; a' m& \3 }
  37. #include <mach/hardware.h>, K( z+ g+ `0 c# c! d
  38. #include <mach/irqs.h>
    0 s6 U" G( p  S' h* k0 ]
  39. #include <asm/hardware/edma.h>
    ' m' L, q  k' z- L: H, y
  40. ! k6 ^- j* J4 e3 }/ z7 Y
  41. #undef EDMA3_DEBUG1 o0 `* w, x* V1 v) @
  42. /*#define EDMA3_DEBUG*/8 E3 F7 f5 _' X$ D9 [( v1 d
  43. - r9 E0 \1 }$ R
  44. #ifdef EDMA3_DEBUG
    3 a7 s2 q* Q6 R6 E4 p) Y+ K% N, o7 u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 l+ o9 e; g9 D3 u  m+ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  U/ j; H3 G8 Y% ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 L* N* d* V9 x
  48. #else
    , m3 X5 x& N0 x& p6 w; K. _
  49. #define DMA_PRINTK( x... )
    7 o3 V8 d2 I( y1 _" b
  50. #define DMA_FN_IN/ |2 e3 H$ H' Z
  51. #define DMA_FN_OUT
    : u8 k8 k0 B1 Q5 F
  52. #endif
      a: b9 [9 O8 `" L
  53. $ E# e' Q( q6 c/ O) C2 O- k% n' l1 L  \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* l- m5 W. y* H) m, X
  55. #define STATIC_SHIFT                3% t; V) \7 q( u6 {$ p
  56. #define TCINTEN_SHIFT               20
    % N" i2 I: M. H! G' y2 h
  57. #define ITCINTEN_SHIFT              21: m2 d3 ~' D6 ?
  58. #define TCCHEN_SHIFT                22  ~7 S0 F! }, d+ I; y* f. c' L
  59. #define ITCCHEN_SHIFT               23
    1 g! W& P3 @) G+ [. K" {! ~

  60. 6 d5 B" b4 w) K9 n) h. [. H
  61. static volatile int irqraised1 = 0;8 Z) B$ s# g& R
  62. static volatile int irqraised2 = 0;
    7 [! l6 G  z; R. u0 T

  63. # O2 i( v- ]  Q5 u: r) P% E2 H7 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ X5 J* _, v; y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 r, T- v9 L$ ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 |& f# v8 p4 L; W
  67. , {  K- T3 j. ~/ s) X4 Q
  68. dma_addr_t dmaphyssrc1 = 0;! N; H3 @% i+ f) a6 ?* @/ f; f4 ~+ H
  69. dma_addr_t dmaphyssrc2 = 0;1 {) \7 Q7 n  J9 L5 N+ W, d) a
  70. dma_addr_t dmaphysdest1 = 0;
    ! {7 I$ {/ T4 r: Q- d3 a
  71. dma_addr_t dmaphysdest2 = 0;5 {7 C( }1 o. t1 u, F

  72. ( U9 F, O, \. G0 Z4 b4 |
  73. char *dmabufsrc1 = NULL;3 \! H9 u9 Z. I1 @
  74. char *dmabufsrc2 = NULL;( d' r& k, Q. Z' ]& F
  75. char *dmabufdest1 = NULL;3 {& c. M/ R0 G4 c* p$ B' X. ]
  76. char *dmabufdest2 = NULL;. h0 o' e  X2 ?; Y
  77. % l* u1 O7 r$ \0 ^4 g  q
  78. static int acnt = 512;
    $ z- ]; P4 `! _+ R: F
  79. static int bcnt = 8;4 N; u3 |3 s2 p+ _- k/ B
  80. static int ccnt = 8;  \: R4 w* }$ j% R

  81. & z/ }" k7 `- p" X# l. z% W6 E
  82. module_param(acnt, int, S_IRUGO);( H! F0 I0 q1 i4 v! Q6 E
  83. module_param(bcnt, int, S_IRUGO);
    5 e4 b0 y2 F. X! u3 h! c1 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" U9 s5 w! A( [, a( g2 H" }6 X
. d* n, E7 @, w; N/ j8 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 {1 b2 D! b2 r" c9 m- ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ Y% c* U4 j  P' U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 p( p; o0 [+ H$ q& Q9 h: [% [3 S  j" d; M

4 O2 I# Z* g; |" ^$ J# r6 a$ u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-17 18:37 , Processed in 0.037301 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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