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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ g+ n0 G* \% J' ?$ J+ N
  1. [code]EDMA sample test application) M; ]- i& T% w& J1 O0 S! A
  2. /*
    2 Y$ _6 {8 p5 A' }8 W% X' p
  3. * edma_test.c/ }4 `% C/ P3 t; ?0 C7 J/ T
  4. *( G% c0 H( G% c2 c- A% w+ u/ n- l
  5. * brief  EDMA3 Test Application, t3 s& U2 w9 L& R) J! ]
  6. *. X5 D$ |' ]2 f& {1 p0 v5 Z
  7. *   This file contains EDMA3 Test code.: n4 a2 K- E. F3 S
  8. *
    " _7 X1 [6 ]9 A, E$ ~( R6 ?2 o% K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' N1 C2 B) H6 b0 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : @/ B& D) u0 r! z1 o- @- @% M
  11. *         TO CHANGE.
    2 H5 u+ j) b- a! P) t! Q1 ]
  12. *
    6 l, F$ F* M+ I" h# [! d- r; W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; E' e3 b; w0 O' D+ d
  14. *$ m* D8 ?3 g6 ]: N7 y
  15. * This program is free software; you can redistribute it and/or
    ( F5 J% t4 k8 l" r7 b' R$ S
  16. * modify it under the terms of the GNU General Public License as- I) w. f; {0 H9 f4 i- S
  17. * published by the Free Software Foundation version 2.- G. Z5 i0 j1 t7 y
  18. *' b! K" ^! r- j6 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 G' ]4 n# t8 u2 ^" ]! B
  20. * kind, whether express or implied; without even the implied warranty- G5 }' i% f  P( B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 K0 O1 \+ B1 a1 @% M) e. v9 Y
  22. * GNU General Public License for more details.# ]& w) g/ V- A0 Q$ T
  23. */; Q6 d3 w0 s0 L0 W5 Q: J
  24. / e+ S4 h; [0 ^. C$ J! K
  25. #include <linux/module.h>
    % U' Z1 M9 F& x% e
  26. #include <linux/init.h>
      c* z; W4 M7 C# u& k- h2 h$ o8 Y
  27. #include <linux/errno.h>6 s' j5 k- P  T, a) j+ ^/ ^
  28. #include <linux/types.h>+ n6 s- k9 T; a: P! i2 S
  29. #include <linux/interrupt.h># @# l- {4 w  {1 _' \
  30. #include <asm/io.h>
    - n' t( B% W' _" \6 }
  31. #include <linux/moduleparam.h>
    . Y! S  e9 |& b
  32. #include <linux/sysctl.h>& N/ X& e& m5 x8 M. C: m
  33. #include <linux/mm.h>
    8 }$ h6 M" z1 ^- F5 B' r7 G
  34. #include <linux/dma-mapping.h>
    # ^9 n4 }& y! A. T( U4 A
  35. * Q) G$ X4 Y) g9 M
  36. #include <mach/memory.h>
    & u: i( e; A7 t4 k# V" P4 S
  37. #include <mach/hardware.h>6 }  }1 C  i9 M$ F$ H# w
  38. #include <mach/irqs.h>% }5 d2 X( S7 s. x0 }
  39. #include <asm/hardware/edma.h>0 _) {( H' ^9 O7 L8 {
  40. 5 I; t8 o( V6 Q- W+ c# \3 \
  41. #undef EDMA3_DEBUG" P7 [3 w& q! X0 w% K( k
  42. /*#define EDMA3_DEBUG*/, P! Y1 U# d+ M: f! k
  43. ; j( \* T* F5 [' P/ r! f: O7 [
  44. #ifdef EDMA3_DEBUG2 L  i2 I( w$ \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . I) \. H; ]0 r$ W. V, Z9 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - O' r! I) h: f/ Y  ]( @8 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . E  J& p' y4 R4 k) a
  48. #else% N( c5 o0 n( n, F) ^
  49. #define DMA_PRINTK( x... )
    / R, ^3 N0 K0 C8 X9 l3 u$ `* o
  50. #define DMA_FN_IN
    2 r4 {: b4 Q% |" z+ t
  51. #define DMA_FN_OUT1 i, F: }2 H; ]( A9 u1 l. T
  52. #endif
    * Y/ N- f7 _0 j* J0 @
  53. 1 H4 J7 w2 Z2 t; q' \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 @$ x) S9 E* P7 B
  55. #define STATIC_SHIFT                3
    % k9 V) K7 ?' i9 D
  56. #define TCINTEN_SHIFT               20& V9 v  a. ?  j  s
  57. #define ITCINTEN_SHIFT              21: p* A; ]: K; b) p8 p- f
  58. #define TCCHEN_SHIFT                22: R" [' E2 k# ~" u
  59. #define ITCCHEN_SHIFT               23
    8 m$ }* c0 d/ l) S

  60. % Y1 c. v0 `  y
  61. static volatile int irqraised1 = 0;1 i. E# d' H+ l. j0 Q$ ^
  62. static volatile int irqraised2 = 0;
    & A7 A* z2 d5 g; e/ P2 h) G+ C

  63. - `) |: l5 g1 \( N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 y8 R6 K& L. e' T* b2 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l, [9 H% d" d; B5 G* e4 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* q2 F' c2 _8 M

  67. % K4 n: `3 g3 B' D8 f2 S9 A
  68. dma_addr_t dmaphyssrc1 = 0;
    0 T2 X0 Q' r2 ~+ I
  69. dma_addr_t dmaphyssrc2 = 0;* q& |' P# s6 h7 a- [  o2 L0 |! p
  70. dma_addr_t dmaphysdest1 = 0;' N" K" B; h8 S$ B: d
  71. dma_addr_t dmaphysdest2 = 0;/ s. e, c* m3 M/ Q) X; \

  72. 5 E2 K' }2 U" J" b6 U- g* k# Z
  73. char *dmabufsrc1 = NULL;. _) r: m* m9 o& R5 d
  74. char *dmabufsrc2 = NULL;
      S4 ]6 H: [- q# e
  75. char *dmabufdest1 = NULL;
    4 X9 t% ^: _. v0 e- L. t- R
  76. char *dmabufdest2 = NULL;5 i7 K' r' b  o2 V% @+ I

  77. - J6 G: P! O4 z- e, O+ E% ]7 O
  78. static int acnt = 512;
    + C: P; [7 }6 h7 i
  79. static int bcnt = 8;. q& L9 D8 `' K* X' s0 U
  80. static int ccnt = 8;
    , b5 h: a, j. `$ }
  81. & B: G8 ~6 K+ Q" k3 q
  82. module_param(acnt, int, S_IRUGO);
    " y9 {5 ~! ?. w1 j
  83. module_param(bcnt, int, S_IRUGO);# G8 f+ m* J) X+ N9 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( P* C; o: ~1 g5 z6 i; {/ C0 |+ c8 E1 e* C* d2 ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 o5 b/ b- D- X4 r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 X% h  h, M! k" a5 j, V1 c4 ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! C, u6 q5 j) p
) d0 a8 k5 @. j( L' M  z& @5 I. G) B- ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 01:16 , Processed in 0.043666 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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