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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 e1 P, B- T* o& t# h: g5 A4 g
  1. [code]EDMA sample test application+ G; e  v+ k" B* {
  2. /*
    " s- Z5 x$ [, V
  3. * edma_test.c
    + f/ O4 h/ h9 Z' |+ O4 s
  4. *
    . r6 {! V, \2 v5 E5 Y
  5. * brief  EDMA3 Test Application2 Y; g, Z% u6 B' p
  6. */ k; J- r, [" a* D& X
  7. *   This file contains EDMA3 Test code.1 o. N4 e1 t9 H7 {
  8. *
    3 E% m6 p1 y4 i5 ~) [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( F2 V% R9 ?1 W/ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 m8 F) I% D. [0 }% P
  11. *         TO CHANGE.
    ( q9 `, A6 H6 E& {& i
  12. *- f2 T9 G4 r4 I2 k3 X" q+ ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 E& @1 K8 ?3 A  I2 r8 d
  14. *6 u% l$ B# F# ]
  15. * This program is free software; you can redistribute it and/or
    / h0 f: k1 ~9 k4 z) c% N
  16. * modify it under the terms of the GNU General Public License as. O5 J: J! i( K& v' p) k  h; p3 `
  17. * published by the Free Software Foundation version 2.
    $ C' v# s" F; \, M) K9 D
  18. *7 |" R% N5 |9 i0 n- o7 b$ ~/ G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* w& R9 z) N0 g* J$ Y" k0 L0 b- t
  20. * kind, whether express or implied; without even the implied warranty0 l; g; y% L" ~! ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% }8 `4 X3 G( z4 w
  22. * GNU General Public License for more details., |2 c! u% n6 M
  23. */
    : Z- t/ j4 H7 T( Y7 V7 B

  24. * R7 g4 x. w9 ?% Q" d9 o
  25. #include <linux/module.h>9 E; g& R1 ?, Q( Z" h* F, y4 p1 f# B
  26. #include <linux/init.h>
    6 j6 q7 h3 b. i. l* _( G! E! r9 j6 e
  27. #include <linux/errno.h>
    * r8 s  e1 t5 w: q8 @# |
  28. #include <linux/types.h>
    . d/ T& A8 v+ e" T5 ^
  29. #include <linux/interrupt.h>: c9 X8 s' T5 y6 r7 H7 G
  30. #include <asm/io.h>
    # D0 @0 v3 k4 A  l! L7 O- R* T
  31. #include <linux/moduleparam.h>4 F7 H6 I/ D4 G$ t" N+ q
  32. #include <linux/sysctl.h>
    # w6 N9 R7 l/ \+ K- Q, U3 V7 M
  33. #include <linux/mm.h>
    % g( [1 Y% F& o( n4 Z
  34. #include <linux/dma-mapping.h>
    ! D9 F: U1 V: a  o! m/ U) m! N

  35. 0 x5 |" _/ _  w) x  r% B
  36. #include <mach/memory.h>
    * e# o6 U) o2 {+ ]9 s2 N3 b6 {4 ]
  37. #include <mach/hardware.h>2 ^, j, }; H4 X) G
  38. #include <mach/irqs.h>! d1 [/ Y* v3 |! N7 z  l" s
  39. #include <asm/hardware/edma.h>9 z* S2 {1 Q" Z4 y
  40. 8 E2 Z. F- F  }' B3 R% `, u
  41. #undef EDMA3_DEBUG1 n& e6 d! V- }# K2 |
  42. /*#define EDMA3_DEBUG*/# r' R& x$ W6 E4 Z4 C$ y$ `8 e
  43. 8 `; u( A8 D) X
  44. #ifdef EDMA3_DEBUG/ g% J5 t: j: ]5 N) B" ]# b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Q* ~# B! k  l! W% C) \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# m4 v" M1 x4 x8 I( j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! R2 X( D2 I# h
  48. #else, y7 K! ]8 l2 D2 q
  49. #define DMA_PRINTK( x... )
    % S" ~3 }. A3 u6 x) Y
  50. #define DMA_FN_IN7 y, i0 w. |2 t+ M% P
  51. #define DMA_FN_OUT
    1 i+ g8 R) V: o- I
  52. #endif8 U9 P" i; _+ \: l8 o. R$ {

  53. 3 r) }6 x' y- u. G, c5 l7 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % W0 R# I; L. I, i
  55. #define STATIC_SHIFT                3
    : J: L4 X' P' X2 y/ V' O8 h- J, K
  56. #define TCINTEN_SHIFT               207 U& y5 E) G" z; {  z4 G( H( N
  57. #define ITCINTEN_SHIFT              21
    6 x  T& V) S, k) r- Q, b" B
  58. #define TCCHEN_SHIFT                22, s; r& x3 A& s7 Q. [% v9 f
  59. #define ITCCHEN_SHIFT               23
    % t& r* {- L) W) M
  60. 2 ]% V4 Y! N2 j, w  i6 \
  61. static volatile int irqraised1 = 0;
    ; E+ q+ a3 @' c9 p+ F* D  p* e
  62. static volatile int irqraised2 = 0;
    0 W8 G  ~9 u; ]
  63. . S0 z7 p) L9 k2 D1 q& D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 _: C  p/ [% v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ N6 h$ n8 X1 g& l! S7 R  Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* `1 A2 Y/ |9 n1 l" ^9 H/ I
  67. ( a* `# m4 g2 K$ d5 T# X5 M
  68. dma_addr_t dmaphyssrc1 = 0;! T; x( T' w3 s  |/ |2 g4 J% {
  69. dma_addr_t dmaphyssrc2 = 0;
    - d# O4 x( u0 k
  70. dma_addr_t dmaphysdest1 = 0;- W: q! `* g( u0 h- X- K* n
  71. dma_addr_t dmaphysdest2 = 0;
    / _7 N" q) }: L: {2 O5 Y5 h% R
  72. + U: U! P+ c* l& L! t- t. L
  73. char *dmabufsrc1 = NULL;
    1 v( M3 J0 t3 q. h
  74. char *dmabufsrc2 = NULL;; a0 k( L$ O0 T- {3 c0 c' }& @5 L6 t9 a
  75. char *dmabufdest1 = NULL;
    - H: p. w( ^8 U% c. A
  76. char *dmabufdest2 = NULL;4 B1 O# e3 o+ c& A8 l
  77. + N7 l* _% ~+ M, ~$ q" @
  78. static int acnt = 512;
    3 N. c+ S! U) ?
  79. static int bcnt = 8;5 }% D1 d6 b# C" D; E+ ~
  80. static int ccnt = 8;
    " \% x# H$ A7 T
  81. / u) U& k# y" _2 Q7 F$ _
  82. module_param(acnt, int, S_IRUGO);
    % D0 a7 y! U; p$ S! J
  83. module_param(bcnt, int, S_IRUGO);( E4 W# h* C& G7 I1 I5 Y' F8 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ [; j/ J2 z' b% z$ f' ~4 c3 R6 r8 y! @1 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 U- E' X" R( F9 x* ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& W* N1 l( Z( z  ]- M) W' e
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. H9 W& X& a% \) T+ O
+ ?, z" D6 t; h4 ?2 J0 |

  ^% [- k% \1 T) ]0 ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 05:41 , Processed in 0.040017 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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