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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # l3 j& Y: f/ h
  1. [code]EDMA sample test application
    6 c* e7 H( j  I4 @" n1 x
  2. /*+ A; h7 d  M7 I3 ]$ p
  3. * edma_test.c
    2 l6 ]0 Q) V) u6 Z& z: F+ U4 _% r
  4. *: b, P  i) _9 f+ E2 i# F, {$ K
  5. * brief  EDMA3 Test Application, Q; y) k2 U6 f% a1 N: j- g! B" S
  6. *
    ' ~+ h8 M2 F/ P; q
  7. *   This file contains EDMA3 Test code.
    % r' J, b( _7 W1 z! k) f0 I
  8. ** j6 {3 `& G- u" c6 ^# P; Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . K9 a( W  B3 y" _$ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 [9 [4 C  ^* i4 ~& m* E+ i$ z
  11. *         TO CHANGE.$ S1 E1 f- j4 ?- ], n+ K  B' n
  12. *3 S: e7 y- P& L) b% m5 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ~8 d* m9 R# [* p+ o5 V
  14. *4 S5 s- ^9 ]5 ^$ q5 Z& {) ?8 t
  15. * This program is free software; you can redistribute it and/or* m0 \* g. F% ?$ i. l8 h
  16. * modify it under the terms of the GNU General Public License as
    1 m! y9 F1 S  ^! G; @! @
  17. * published by the Free Software Foundation version 2.3 B: }8 h2 |0 G& S) ^9 _  [
  18. *
    & Q9 r) V/ y' H! q% e9 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 t# f4 v: B0 v# c' A: h
  20. * kind, whether express or implied; without even the implied warranty* N/ Z5 Q% _  ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , Y/ V# s4 S2 K3 B* W0 u
  22. * GNU General Public License for more details.3 S! n( ~+ I# o8 d0 \, ^
  23. */& C* ^: ?: K8 I% \- v0 r
  24. ; A' U( w$ d3 m3 U9 _: |4 Z  W5 c; x
  25. #include <linux/module.h>* V4 I2 O3 F! z1 n; O
  26. #include <linux/init.h>2 |, ~1 A1 j; L# F
  27. #include <linux/errno.h>* o- }. h& U$ z9 x, A) o) t
  28. #include <linux/types.h>
    : H/ \0 O# j+ i. t8 E0 \9 o
  29. #include <linux/interrupt.h>0 m0 z2 Q6 c# L
  30. #include <asm/io.h>4 W$ D( c' O9 Y2 K
  31. #include <linux/moduleparam.h>  }& A" M2 o# P2 C
  32. #include <linux/sysctl.h>
    ! I( h0 E; |) g
  33. #include <linux/mm.h>: |2 ?& |8 K# j3 \! z: T
  34. #include <linux/dma-mapping.h>
    - y# C; C2 q/ l6 G
  35. 5 A; |# A3 R3 b, `* n
  36. #include <mach/memory.h>1 a- i8 ~0 z( M" ]% d# K
  37. #include <mach/hardware.h>
    + R% v: y" }4 R! O
  38. #include <mach/irqs.h>4 w0 D. V7 l" [% L# Y. |5 j
  39. #include <asm/hardware/edma.h>3 ]5 Q. l0 Q+ `4 P0 g/ I
  40. 1 L5 P( A8 s( P; G3 G
  41. #undef EDMA3_DEBUG* d+ G* V  T( j6 [, R0 T0 h& Q
  42. /*#define EDMA3_DEBUG*/
    9 D% L6 L! I( t- W0 `7 \/ L7 t6 t4 n

  43. - ^  p% \# P7 s3 W: v- h- ~
  44. #ifdef EDMA3_DEBUG/ v& a# t/ G! J- I3 u0 ~( K; p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' ~4 s* c, E' l# d& \* W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # W2 O; \: h7 A% J! l6 f7 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); n1 t6 r4 m* z0 |0 L9 \
  48. #else* k% `* L) W% U) {
  49. #define DMA_PRINTK( x... )
    5 V" _* g( K3 J
  50. #define DMA_FN_IN6 m5 H1 m# T* z& k* x
  51. #define DMA_FN_OUT+ F" f3 c! r+ n, t  F5 V
  52. #endif
    ( N, O0 S6 G, f+ z4 e( N
  53. . x2 ?* N& l' h5 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , \) n3 Z1 O9 @9 |4 c
  55. #define STATIC_SHIFT                3
    ! H" ~- r% s  O* F0 z
  56. #define TCINTEN_SHIFT               20
    ! a' I0 w7 P: C
  57. #define ITCINTEN_SHIFT              21* }4 L. n, r& N
  58. #define TCCHEN_SHIFT                22
    # p) k( o4 P3 }- h5 N+ N8 g/ f4 p
  59. #define ITCCHEN_SHIFT               23
    1 E/ g, [  z' Q" G- ~

  60. 1 G' P0 Y0 p1 `0 U+ v3 u6 O( r
  61. static volatile int irqraised1 = 0;1 c7 |% X7 f9 ?: e2 f
  62. static volatile int irqraised2 = 0;
    3 e# a% _2 G7 x3 n( E

  63. + h& }7 i& d$ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) k* i, _% B3 N& U; G3 V5 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S) ]+ k' A/ K" `) f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 \0 I5 e% ^' ?& K( ~$ ~6 O
  67. ( l9 L0 [% x" q
  68. dma_addr_t dmaphyssrc1 = 0;$ A3 w  ]# @, M. E! K* h0 E
  69. dma_addr_t dmaphyssrc2 = 0;0 z/ D$ p# b7 I, T8 B
  70. dma_addr_t dmaphysdest1 = 0;8 Z% @* o- s& U/ Q+ p: X1 M! E" D. }
  71. dma_addr_t dmaphysdest2 = 0;: c3 [9 \; _; s/ ?

  72. ! g, c6 a* i! E* x  Q5 |% E
  73. char *dmabufsrc1 = NULL;
    7 [, |# @, P7 _" B
  74. char *dmabufsrc2 = NULL;. Y3 ~  G( I5 j& X1 s
  75. char *dmabufdest1 = NULL;
    1 i, z7 `9 G, g" ~# x  \
  76. char *dmabufdest2 = NULL;) T, Q! B3 Q5 Z0 \! ~

  77. 9 F/ `5 B- y" |! F4 A# V( }
  78. static int acnt = 512;
    3 k' {, s  l7 Y- j' f# P
  79. static int bcnt = 8;
    ' m/ e4 P3 Y$ d8 K( r/ I) c$ \
  80. static int ccnt = 8;/ b  l6 f& T) B& M
  81. , Z% w$ P5 Q0 q+ V2 R# M, }7 ]
  82. module_param(acnt, int, S_IRUGO);0 [3 p  K' x. z
  83. module_param(bcnt, int, S_IRUGO);
    4 e% E9 H) {, f$ W! J5 R7 g! P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 x- u1 U+ h9 t0 D/ j2 f' W1 x
4 n1 ]7 S5 `! H! M' f
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  Y8 D! }, @8 ]* e/ larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( @+ L# n; S/ G9 y$ [; A; y4 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 {9 ]" M) B1 P7 k. b( s; d; ~' A  Q, L" n
; Q" @- J# k! `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-16 20:35 , Processed in 0.037881 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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