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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) Y; C0 H2 D, M' x
  1. [code]EDMA sample test application) @* H# D, E: P3 A" P5 @& J0 ]
  2. /*) B; `8 ^' t, N1 B9 x' F. }. Y
  3. * edma_test.c
    $ x7 j( s( _* K8 v. T# K& I. d' |
  4. *
    1 q8 t9 |* d7 i8 u$ C$ Y3 Z  R6 J
  5. * brief  EDMA3 Test Application0 v- k- I& w) r' E, l+ ~( \
  6. *& U8 t/ l) m1 L+ Q. a8 r# R
  7. *   This file contains EDMA3 Test code.1 D* p( h1 M; H
  8. *
    ( S+ q5 r9 f. ~2 |& y& }/ q, K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . L) G4 a2 A" H, Y- g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( V5 V2 ?; s9 h3 ]: }9 l4 I
  11. *         TO CHANGE.) @" H. n- y  E5 b  n# G* P
  12. *: X. d2 a( q( _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - Z# z" r8 Y" [3 M8 m. l4 u/ G
  14. *
    ( d3 l6 l2 J/ X- M  f, [. f* x$ f; N
  15. * This program is free software; you can redistribute it and/or- X1 U, n/ D+ N; p$ ^' J- n
  16. * modify it under the terms of the GNU General Public License as8 `( ]0 @* G" b$ T
  17. * published by the Free Software Foundation version 2.  L6 \5 U6 y+ J2 ?$ Y
  18. *
    8 k" k0 j) o. B6 i7 Q) e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " M4 z! L3 k( r: Y* f
  20. * kind, whether express or implied; without even the implied warranty
    % C' A3 @0 n% w/ g( Q# J$ b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [1 |7 b: Q/ m
  22. * GNU General Public License for more details.
    # z; ]  x0 Q) W' {
  23. */
    % s  U& M, f5 e0 Y0 q+ A$ |
  24. + ^6 k6 A$ P: E& \0 N( Z' ^
  25. #include <linux/module.h>8 r5 n/ w, l  i& H0 U, ~/ X1 S
  26. #include <linux/init.h>
    * r/ i+ Y2 O- ~9 [, M7 a% P( E
  27. #include <linux/errno.h>( \2 E* V( ]4 d& n  q& m: ^
  28. #include <linux/types.h>
    0 _! ~$ h: {: J, ?- f
  29. #include <linux/interrupt.h>2 N7 P! Q+ }, P5 n& ]
  30. #include <asm/io.h>
    2 N- w5 N- E9 j1 \
  31. #include <linux/moduleparam.h>) F) ^* B2 s2 Z- _
  32. #include <linux/sysctl.h>
    5 K3 n( J+ S  w2 o2 G
  33. #include <linux/mm.h>( O6 G. B% x& {& t* [
  34. #include <linux/dma-mapping.h>' M3 O; z: m) l9 ?2 _
  35. 3 q/ h# }# H1 ^6 E1 l
  36. #include <mach/memory.h>
    4 c$ ]9 G3 W/ N: o! c$ q2 `; e
  37. #include <mach/hardware.h>6 [* x. Q3 W# I0 p2 W' _$ p/ y: h
  38. #include <mach/irqs.h>& z8 N7 u, Q: ?( O$ e8 ~
  39. #include <asm/hardware/edma.h>
    / B0 @% B2 ?3 y/ v  M" K* V, U
  40. ! `4 ~1 B! Q; p- o0 k% ~; c2 h: {& J
  41. #undef EDMA3_DEBUG
    ) ?  ]9 c+ k8 m: `8 q
  42. /*#define EDMA3_DEBUG*/$ I* T2 T; D# c0 W

  43. / }# v; e1 P# x0 V7 g: m/ o! _
  44. #ifdef EDMA3_DEBUG
    4 ?6 r6 a/ S, N" S
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " |) ]! U0 H; E) P3 ?: `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 H* L; a* S  S; v5 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # v/ P+ b1 C( c
  48. #else, Q# ?  K; w& g
  49. #define DMA_PRINTK( x... )7 ?( i5 ?5 w% h  K$ e/ f
  50. #define DMA_FN_IN$ b  b" D& c: }% g6 r# q. K
  51. #define DMA_FN_OUT
    - Q5 e# ^$ a! L. I
  52. #endif
    / c( D5 @8 t  p3 g3 K9 ^% M' Q% n
  53.   c  n" Y( s5 f! o' @, z- c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- p7 G* w1 y+ t: C( P7 j
  55. #define STATIC_SHIFT                3( h( Q3 u! J0 i2 Z) Q/ y
  56. #define TCINTEN_SHIFT               20: X8 L" F7 _- w7 x/ y3 ~
  57. #define ITCINTEN_SHIFT              21
    & Q/ n& y; V/ O! D6 g! o; D
  58. #define TCCHEN_SHIFT                22
    4 l$ D3 \) v' s( S% w
  59. #define ITCCHEN_SHIFT               230 F# l% g6 I  R
  60. 8 V' w( _) M  a2 l2 g
  61. static volatile int irqraised1 = 0;
    ( p5 b' I) [; V1 a
  62. static volatile int irqraised2 = 0;
    + l2 E3 }% `0 j& r2 i  K; q7 |4 W8 F
  63. / l. z2 O7 \1 T# T- y" Z5 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 j$ I; F- W- `& ]0 F: }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# }7 k4 c- _9 Y1 b, p8 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % ]9 i6 E3 s' D
  67. 2 i  d! z8 |* F+ [& ?+ x3 b0 t
  68. dma_addr_t dmaphyssrc1 = 0;
    - [! f+ N$ g/ E
  69. dma_addr_t dmaphyssrc2 = 0;
    4 w* P8 o3 f, R9 G8 x
  70. dma_addr_t dmaphysdest1 = 0;
    - D1 k+ ?8 o% W3 i
  71. dma_addr_t dmaphysdest2 = 0;
    6 ^: r# K. N8 ?0 r9 ?$ G, Q
  72. / O2 P6 W( {$ y1 b5 d1 u
  73. char *dmabufsrc1 = NULL;
    ) C: F$ L3 U9 p, ]3 {- R
  74. char *dmabufsrc2 = NULL;6 D9 f' i! Z& o2 r" p
  75. char *dmabufdest1 = NULL;
    ) a1 M/ l0 x. L( N* e! N
  76. char *dmabufdest2 = NULL;/ P9 {& V) r# L* A  V
  77. 1 k+ c# d0 a2 J( C
  78. static int acnt = 512;
    / h( I) h; w8 z9 o# C) H- A
  79. static int bcnt = 8;
    , @% F" u" [) }, e0 R+ V' [1 D- a$ v
  80. static int ccnt = 8;
    2 d# d8 J0 [  I
  81. 1 I1 C- G+ m+ v9 P& I. |+ l1 |* w/ e
  82. module_param(acnt, int, S_IRUGO);
    ; l- n  p1 e; b& J- v# A( ]( w2 f
  83. module_param(bcnt, int, S_IRUGO);5 i( o5 ^7 x  N& Z/ r9 A6 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ U' U* Z% \4 G1 ~, e: H3 H! l% ]* b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ O& e9 ~; j9 n1 C5 {' ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# M3 u$ ]( ^0 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 h: _4 ^7 k) y1 Z
. c7 a* o1 ~! v' ?) ?( W
, k) t5 v7 h  E. Y# ^4 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 12:35 , Processed in 0.040727 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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