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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 D7 ^, L* Z/ j2 l5 n& y
  1. [code]EDMA sample test application+ m9 T2 g8 v* t/ C: ]  `
  2. /*
    0 t" _- F: d* |" `. {+ C
  3. * edma_test.c
    7 i3 Z4 a. S7 c1 Q0 Q4 r$ m/ D
  4. *5 D4 Y) F! B. i6 `
  5. * brief  EDMA3 Test Application
      c2 G% f( G' r8 R$ i
  6. *$ x  P+ L4 U0 H2 O0 T: s1 E
  7. *   This file contains EDMA3 Test code.
    ) K/ S2 I3 P: v2 _! Q; c+ a: |4 w
  8. *
    & S! V& t9 y* Q4 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 l3 Y& ?; J0 G! c9 q! C  J) j% C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . A) c; p2 Z$ q7 t% X2 m0 `% Y
  11. *         TO CHANGE.; T! j# {- S5 E! i4 G" Z
  12. *
    7 C& o% s% Q5 ]) Q3 W/ \, E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 B, b6 O; S& t9 K; H
  14. *
    , v- O- B: j: A- y5 _9 ?. u
  15. * This program is free software; you can redistribute it and/or
      O0 ]# x& u+ @: h
  16. * modify it under the terms of the GNU General Public License as5 x, L2 L. c: E3 U, N
  17. * published by the Free Software Foundation version 2.
    5 N. o6 x& {  S+ X
  18. *
    2 I3 w  e9 C3 K) |- p( M- k2 o# J9 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % V* q9 {* H4 a/ b1 S5 K6 A
  20. * kind, whether express or implied; without even the implied warranty& N- h* I! }5 m0 ^. S; X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; X/ {  `6 q  @
  22. * GNU General Public License for more details.
    ( Z# {0 Z7 E' V% L
  23. */
    3 C8 S" s6 l/ {

  24. ; L) a- ~5 `! T: {; w
  25. #include <linux/module.h>
    ' U& C3 F! q; G+ t
  26. #include <linux/init.h>
    3 Z! g* S: K1 I0 j; \' [
  27. #include <linux/errno.h>7 L/ H" O. @; F
  28. #include <linux/types.h>& m' R* y% S3 V% h" \  w# l( Z, I
  29. #include <linux/interrupt.h>
    " `4 Z; P5 K7 d
  30. #include <asm/io.h>4 |4 y8 E$ G/ g$ ^  Y8 s1 P
  31. #include <linux/moduleparam.h>
    1 r* O/ w9 y# ^" |9 A9 Q
  32. #include <linux/sysctl.h>
    , _9 v% |3 q' l! H
  33. #include <linux/mm.h>' C8 l' ^% P7 ?- p( ]
  34. #include <linux/dma-mapping.h>
    , ]  V& n, l3 _
  35. 6 O( \4 x/ y1 t6 E7 g
  36. #include <mach/memory.h>
    7 h$ V) ]! |9 ]0 r6 L
  37. #include <mach/hardware.h>
    5 n: r- i1 K# M' E) M
  38. #include <mach/irqs.h>
    : \2 j' G. i, E, m
  39. #include <asm/hardware/edma.h>
      r; K9 R0 Q. s8 L0 t( A& J9 ?4 G! m
  40. 9 A5 O) m. b7 l. p# h
  41. #undef EDMA3_DEBUG
    6 C5 W0 u1 c8 a  W# C- T
  42. /*#define EDMA3_DEBUG*/
    ) s+ r& z  \$ W4 k  R
  43. $ V& l% W, Z2 B5 R) g
  44. #ifdef EDMA3_DEBUG& @& f8 k% `- X, K9 _/ C) T+ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 ]7 q, u, s; o" E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): {0 x% a& o8 Y# f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 r7 `8 a0 s# x$ [; C
  48. #else' q( J5 T0 B; T& `" R' g
  49. #define DMA_PRINTK( x... )
    - S2 E$ P5 ]& W
  50. #define DMA_FN_IN. g8 T6 S+ O( I; s" @
  51. #define DMA_FN_OUT
    0 Z- Y8 ]$ b2 C  [
  52. #endif
    2 e- H' ]) A4 W6 t8 K

  53. ! P" H. S  G& z/ k+ r3 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 o# X# l( \3 l' `1 L7 R5 P
  55. #define STATIC_SHIFT                3' {+ x6 q, y6 p& w+ a% X  I! ~
  56. #define TCINTEN_SHIFT               20* n( g) ?( K, E, ]: y) ?0 @
  57. #define ITCINTEN_SHIFT              219 U) y4 _% V/ b3 K' V1 ~
  58. #define TCCHEN_SHIFT                22
    ' e5 _1 d9 T' w6 b$ K, e: d
  59. #define ITCCHEN_SHIFT               23& X( [# e/ u/ B

  60. 2 q0 T' s" e' x' m4 X
  61. static volatile int irqraised1 = 0;& F! y7 C' Y$ T/ A8 a; H. z1 S
  62. static volatile int irqraised2 = 0;
    - i/ s8 Q0 u& T  ]3 l) m

  63. 3 |) b& q" c% G3 x* O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; h% W9 Y/ p7 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) i( q( \' p$ Z' ?2 _/ o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ^1 b5 A1 l+ O. l
  67. 1 Y9 T( e" |+ y
  68. dma_addr_t dmaphyssrc1 = 0;
    + ?4 Y6 M5 b& ?8 F, |
  69. dma_addr_t dmaphyssrc2 = 0;
    $ J  z2 Z, |5 q: {7 q; ~3 ^
  70. dma_addr_t dmaphysdest1 = 0;
    4 n& D5 ?0 r, _0 L
  71. dma_addr_t dmaphysdest2 = 0;
    # t% M! s, {% ]" a5 l+ J* r2 [

  72. & V9 L( ^& K" K: }" S+ Y
  73. char *dmabufsrc1 = NULL;
    3 M: b" u1 j: Y+ q
  74. char *dmabufsrc2 = NULL;
    " E0 V& P- h: d
  75. char *dmabufdest1 = NULL;
    - r  H! S% z: u, \  ?7 q% O
  76. char *dmabufdest2 = NULL;
    8 I: J% j' Y- ^  b
  77. & T/ s+ J" i, e" F3 q* Y' }
  78. static int acnt = 512;
    # K1 J8 U& I, t$ i; t* t  i
  79. static int bcnt = 8;
    - ?5 J% k5 E* u) _
  80. static int ccnt = 8;
      i: I* B$ z4 i! V3 {
  81. ( a. u3 n  Q2 c+ Q& v9 @' {# i
  82. module_param(acnt, int, S_IRUGO);( y# u# a4 q$ ~, j' A: J- _9 ^; z
  83. module_param(bcnt, int, S_IRUGO);! n- l" f& a0 q' w1 V( _, w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: b( t! s, `  H, A
' Y- y- y9 q# _5 [, ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 ?- W7 l1 [. E0 \) C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* M9 q, ^1 _: X. m. u. C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 ?+ |, e4 h% Z0 t$ S3 H, \% Z
8 A& ?& w' o% c4 o  X

$ D# L6 u; h, x/ ~+ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 23:37 , Processed in 0.040683 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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