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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ b- ?3 b% _  w; {4 u6 I
  1. [code]EDMA sample test application
    8 V2 E& E/ X4 t9 `, v7 M, Q
  2. /*2 v- C9 E& f+ |0 i3 h/ u1 y# q
  3. * edma_test.c
    9 e- y; ?0 T" }, R' c/ e/ E4 H
  4. *
    8 d! p; _) j3 E" d  w6 z7 s2 Y
  5. * brief  EDMA3 Test Application
    , U5 L3 d/ C3 {( N6 y
  6. *' L. [9 _- ?# `7 a$ X8 y
  7. *   This file contains EDMA3 Test code.8 h! ~* w8 E1 I; ^# {% R, Z
  8. *
    / E9 a# \( G0 i( B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 `1 y- j! n$ S, I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ |( B6 m- A) i* s  {# o
  11. *         TO CHANGE.
    ( g0 h# `( y! Q* B, Y3 e
  12. *5 u& h, o/ m& C" a+ l+ r6 y# M! k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 v2 J8 }, i. {8 u3 G, ~+ F+ H
  14. *' D6 W$ Q4 z8 B' A/ o% ^8 p
  15. * This program is free software; you can redistribute it and/or
    ; X. b) ?. o2 X1 D% {
  16. * modify it under the terms of the GNU General Public License as
    5 e6 ]& |" M. O" S
  17. * published by the Free Software Foundation version 2.
    # I( G  @0 c) ]5 S
  18. *
    6 F9 g7 Z  d5 c, t+ i! X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ M9 I7 n9 V1 L1 G
  20. * kind, whether express or implied; without even the implied warranty
    1 \. R: `* V" o3 L/ l; I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * I" |3 x" l0 M5 O5 b
  22. * GNU General Public License for more details.
    ; @- A9 [& x; U6 q* |
  23. */
    3 A) o& p, Q2 k' Y

  24. ( i0 f( B: c& ^$ V4 C* e. E
  25. #include <linux/module.h>
    , t1 h" y1 \- Z) i
  26. #include <linux/init.h>+ T4 ~* X2 l) N$ h+ `0 c6 l
  27. #include <linux/errno.h>: _! @; p& e4 j+ Z: }# a
  28. #include <linux/types.h>2 C' l1 l& Z. [% U  z2 g- M
  29. #include <linux/interrupt.h>* N+ ]' u. C' l* {
  30. #include <asm/io.h>
    , b. R( a; R$ \, a% _, X: I, B7 D
  31. #include <linux/moduleparam.h>
    + z1 J3 I0 ^' z$ ?2 x
  32. #include <linux/sysctl.h>8 z  \, D' o# A) V& X/ ]9 T; E
  33. #include <linux/mm.h>
    $ B: g) U" ~( D0 Q, K
  34. #include <linux/dma-mapping.h>
    * F4 {4 ?% `" V. W) B* L* x

  35. " D2 G4 h4 _- p- {8 O- Y7 \6 ?
  36. #include <mach/memory.h>& T' F# U0 O% b; l. q7 z
  37. #include <mach/hardware.h>& C8 d; u3 ^7 M. L; A8 c+ e
  38. #include <mach/irqs.h>$ V! y' v3 Z) V! o. }* e/ T
  39. #include <asm/hardware/edma.h>2 J, X: U( a) N9 u  D# p
  40. 0 J! |0 w* T9 _1 H" @- B  ]# }3 U
  41. #undef EDMA3_DEBUG
    7 e! C/ p( v  N0 l% m
  42. /*#define EDMA3_DEBUG*/
    $ P- m* c, k1 q8 D! E* b: Y
  43. # M0 I+ x# h3 J5 D' P
  44. #ifdef EDMA3_DEBUG
    . o* Z! f1 X4 `3 |2 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- b5 h8 K$ n; b5 g% H( O/ D  s/ L, @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 M$ i! N$ C# f4 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 D' z* J. N1 R+ |
  48. #else
    ; o% F3 K$ v5 c; Q- W; ~; g1 ?9 j
  49. #define DMA_PRINTK( x... )
    / @; V5 q: [8 |- C: c9 e2 t3 T& S# _
  50. #define DMA_FN_IN
      P; H2 X) [) y! L7 O9 r
  51. #define DMA_FN_OUT
    0 l! d! M" L# k- ?' }; a
  52. #endif2 G' J& b6 j6 b0 m

  53. & w( r+ @# [, E0 r6 i% v3 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : w$ ^3 t% @- f" h' M' J9 x
  55. #define STATIC_SHIFT                38 R; n; R  _. A
  56. #define TCINTEN_SHIFT               20
    - {1 K1 E3 _, X1 V
  57. #define ITCINTEN_SHIFT              21
    7 H8 f5 W$ C& Q# a+ s* D
  58. #define TCCHEN_SHIFT                229 ?3 M) s8 p1 k' Z! P9 ]* {, i7 p7 z
  59. #define ITCCHEN_SHIFT               23! s' d5 Q( n( e
  60. 4 Z6 D+ E9 h* S  F, Y, K! N
  61. static volatile int irqraised1 = 0;9 e  M- g, D  F8 G3 x5 j
  62. static volatile int irqraised2 = 0;
    2 s- K% [0 x+ C2 O$ ^

  63. 9 s. i8 U' Z5 a  U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 Z* U: }$ p, o' ~1 _, E# y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b; ]  n, [) _. P3 f4 R- V, ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 G4 N9 s! z# Z* Y! v1 I$ `
  67. % V# ?5 i. s$ d0 y! `: n$ d
  68. dma_addr_t dmaphyssrc1 = 0;5 Y! y8 Y0 j4 T, O6 X& p' i% M5 s
  69. dma_addr_t dmaphyssrc2 = 0;
    + I3 L( o. s8 H- H. Z5 h3 U
  70. dma_addr_t dmaphysdest1 = 0;
      e; ^2 J- Q+ V! B8 D. w; f' D8 T
  71. dma_addr_t dmaphysdest2 = 0;1 i3 ~5 x4 q2 j) c1 Y

  72. # p, x# v/ I) D8 a4 H3 c. Y
  73. char *dmabufsrc1 = NULL;4 C- }5 D2 C. P: ~7 G& l; y
  74. char *dmabufsrc2 = NULL;
    . e: c- Z0 j/ E
  75. char *dmabufdest1 = NULL;, _2 H8 M: f' _) k- o- j  X8 q/ s
  76. char *dmabufdest2 = NULL;
      y/ \' J! y% v6 R9 l5 W& Y- F

  77. ' N) [# L0 I; |6 z
  78. static int acnt = 512;1 ?/ J' W/ U: U) E$ E& F
  79. static int bcnt = 8;
    7 Z5 m3 Z4 l% K0 ?; @: R( T1 o1 T2 P
  80. static int ccnt = 8;
    ( v6 f& R; b! O
  81. ! V1 k2 G, u( w* x' U
  82. module_param(acnt, int, S_IRUGO);1 p' I+ n; d; B* R# l6 K
  83. module_param(bcnt, int, S_IRUGO);
    " r) t- G) M7 g  _; Z+ \- C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* y% Z" a3 z* j+ C! j8 E& v. O6 H: Q/ U. \9 r/ |6 `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ r1 Z* Y5 g7 a, O) Z% H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 t2 C1 }: I2 z8 C" _! r0 w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# U; L$ x. i* I" q/ A0 K/ S( g9 x) E" l8 A* F
7 u1 E9 L; b8 e* M$ _, k! Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-4 15:22 , Processed in 0.057528 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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