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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* t3 U* @  i2 F( \/ ]3 B' x
  1. [code]EDMA sample test application3 ^9 I3 `% Z/ }$ n
  2. /*: o" }/ ]8 j! i) u( O
  3. * edma_test.c, k% X) [* \4 r5 Z! x( Y
  4. *6 u, }9 U  f; f+ u6 U
  5. * brief  EDMA3 Test Application
    3 \# h1 N( J2 i% W6 w0 {* b4 t
  6. *1 Y7 \1 X. q, I; K9 G- G
  7. *   This file contains EDMA3 Test code.6 D, V: R# n" T$ @  r/ d
  8. *
    7 B# J: m2 |! W+ M& M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 g, ^% e3 g' M# f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 v! f, [- z* u0 s8 b! X+ I
  11. *         TO CHANGE.; o  D3 R& Q! C! D1 o
  12. *0 D6 p4 F  V$ u% b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! B+ e4 v  N- S! B! ]
  14. *- F, s) {, w# i- C
  15. * This program is free software; you can redistribute it and/or  X" p" r) V3 H0 j% ~. x
  16. * modify it under the terms of the GNU General Public License as
    % c9 M( c  B, a4 p
  17. * published by the Free Software Foundation version 2., R, L+ }; g- [  G( b; H1 e
  18. *( Z2 u8 l7 T+ C7 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 V) P/ G- M) J0 M4 S
  20. * kind, whether express or implied; without even the implied warranty
    , S, ]6 w9 X; h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 _  g' i2 ^- e! Z
  22. * GNU General Public License for more details.
    , m* r+ q3 z  b" Q0 Z+ C6 c, n
  23. */9 v3 k9 N1 l+ t
  24. ( K6 w# u: U  _  |
  25. #include <linux/module.h>9 }) \" ]3 q6 L4 T
  26. #include <linux/init.h>$ e7 ^) c& W( C0 g7 w
  27. #include <linux/errno.h>
    . j  M; W. O, N7 B" ?4 c
  28. #include <linux/types.h>
    / X9 E9 k0 C! x' V: D. A' j
  29. #include <linux/interrupt.h>3 o# f- {( F; h9 v% |5 P9 z
  30. #include <asm/io.h>
    ) q& H/ Y1 q( ]
  31. #include <linux/moduleparam.h>% v: b4 ]; `) t
  32. #include <linux/sysctl.h>1 o5 ~0 y  n8 v7 a
  33. #include <linux/mm.h>
    $ @) K) k( V. q
  34. #include <linux/dma-mapping.h>
    0 @5 y; s& m" |* q* T' A0 w& _

  35.   }+ p. c3 r' Z" {, [7 G+ v. e
  36. #include <mach/memory.h>
    # A+ ?8 F$ a. f+ q5 Q% @
  37. #include <mach/hardware.h>
    * S1 U; F4 e9 q
  38. #include <mach/irqs.h>
    6 k' y0 x# m$ |: r# x. m
  39. #include <asm/hardware/edma.h>
    4 M! w* ~1 |9 k7 W9 o
  40. ' [' G4 ^: P( ?( E- x  o
  41. #undef EDMA3_DEBUG
    2 G3 v" y4 b3 H, {  ~9 x
  42. /*#define EDMA3_DEBUG*/
    - P9 C' X$ z/ ?: ~9 E1 l$ ^# [

  43. * f0 n- P4 g$ j2 g, M7 W' m
  44. #ifdef EDMA3_DEBUG
    , ~/ V0 w3 ?& j+ y7 w# g8 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). s6 M- m# c6 ?: J/ w6 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      D1 x: ?. \8 N8 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 D  k$ q+ ^7 ?5 i0 g
  48. #else7 N/ \* P* d2 I
  49. #define DMA_PRINTK( x... )7 W' a9 W1 @) g, H
  50. #define DMA_FN_IN+ m9 \0 s% m/ a" a' d& D$ [8 m
  51. #define DMA_FN_OUT
    , |. A0 ^1 [/ p& h' Q
  52. #endif5 h5 N) E5 }) `# o- e7 u4 C3 `- T

  53. . N* t6 D. ?/ @7 i" f6 Z' i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 @4 w! u2 r4 t( r2 ?
  55. #define STATIC_SHIFT                3
    / q% B9 v7 W5 H6 Y" U8 s, k
  56. #define TCINTEN_SHIFT               20
    8 e$ s- I! R% J! a7 G. i
  57. #define ITCINTEN_SHIFT              215 I* f; T, }# {- w1 B: \
  58. #define TCCHEN_SHIFT                22
    2 `7 Y9 H" u; X: K, w
  59. #define ITCCHEN_SHIFT               23, @. w4 u" C- B! o
  60. # T- |/ I$ |7 R- K
  61. static volatile int irqraised1 = 0;0 q/ u; f8 y1 R8 v3 g0 I9 e
  62. static volatile int irqraised2 = 0;
    $ U# n1 C: D) u1 S
  63. $ r' Q) q% w! \$ a0 x, y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _. Q3 h  X( u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y& _* ^* O) S+ f' h) ~9 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , O' c0 g. {, `4 p
  67. , e/ u# |% I1 z5 h6 a+ P
  68. dma_addr_t dmaphyssrc1 = 0;( P; U% ~$ |+ d6 E4 O; N0 c
  69. dma_addr_t dmaphyssrc2 = 0;% M9 Z: Q  M6 A
  70. dma_addr_t dmaphysdest1 = 0;# Q+ A  j7 O- |  h
  71. dma_addr_t dmaphysdest2 = 0;2 N$ F: @: i% x* }- d% c3 q" q
  72. $ I/ |5 B8 S; [9 L9 h1 G, T
  73. char *dmabufsrc1 = NULL;) s/ c& u' z4 p, ~- n' ?/ h
  74. char *dmabufsrc2 = NULL;! F( D! O. m; s" i/ F9 o4 z6 u
  75. char *dmabufdest1 = NULL;" _; u9 f0 `2 W
  76. char *dmabufdest2 = NULL;
    ! E( n% c7 ^3 f. Q3 O

  77. ' Z8 v- n- E8 Z, Y, k8 C
  78. static int acnt = 512;
    ; L! {; s  k; o( L9 p( }  ]
  79. static int bcnt = 8;
    . e7 ~- h5 b" \3 v; a* S
  80. static int ccnt = 8;
    " ?& X* f$ w% _! T/ z& M

  81. 7 m# Q2 O* {/ }: Y. O4 r4 w+ Q1 ]
  82. module_param(acnt, int, S_IRUGO);
    : W1 T- Y6 v7 S0 v
  83. module_param(bcnt, int, S_IRUGO);
    - V2 d4 N6 \, q  h+ \5 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 H0 p2 t( w% P& b+ O* ]+ |
& i8 h+ n. n1 Q  Y" l( R6 z3 P1 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- o  L. W# e! G+ |$ D1 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* G) ^7 h2 K! _2 S# d. r! p% t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 k- D* m! }1 }9 ]
" `! S" r4 S- e
1 ]8 s3 k5 q# |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-15 04:42 , Processed in 0.052183 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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