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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! P7 w. U$ T. C% g
  1. [code]EDMA sample test application7 E3 j8 P& |+ c" X( d
  2. /*
    0 m1 r. E1 g1 R8 F7 |2 Y% s' B
  3. * edma_test.c, i4 h6 t( w5 I2 a! l+ b! a  t
  4. *; }3 j5 X* M, _1 n1 C3 [& {& J
  5. * brief  EDMA3 Test Application
    3 ~6 a3 f. z, s6 H: ^! b. a
  6. *
      \1 S+ s- r# Y6 j9 e! P
  7. *   This file contains EDMA3 Test code.9 d3 _* ?, h% t& V( R& U; _1 `
  8. *
    ( a9 C5 `. W) w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ A7 }: b* N+ m4 a$ U% ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 t9 n/ l- |/ `
  11. *         TO CHANGE.4 t% F0 x: t6 W2 @2 t' O
  12. *
    ' J8 f* x- Y+ q: t/ m# Q: u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % Z% M5 U# A  K( o( ]
  14. *9 b4 s0 V* s7 D7 _
  15. * This program is free software; you can redistribute it and/or
    8 m# O; d; b1 A" d$ D. W* Z6 S
  16. * modify it under the terms of the GNU General Public License as7 I, ]& q$ V- z6 k8 g7 O
  17. * published by the Free Software Foundation version 2.! _- W4 I6 J( A* H2 y1 z( m
  18. *
    + j- ~: @) x& N" {- L1 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( W6 {: v7 h+ q
  20. * kind, whether express or implied; without even the implied warranty9 n5 x& I: _/ d8 f0 ]- W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! b6 J5 V! p7 ^! ~! M+ ?0 U
  22. * GNU General Public License for more details.0 M2 F( `3 P0 N7 I  K6 `* x5 o
  23. */* |/ z/ v6 e$ j" S) n% M

  24. " F# R+ M  B- l8 g+ }' T+ q
  25. #include <linux/module.h>
    / N* E/ y: L7 [4 {% M( D
  26. #include <linux/init.h>
    % I0 u( `/ B! `7 c. J
  27. #include <linux/errno.h>
    - \# C. `) @$ j; c5 L" P
  28. #include <linux/types.h>6 A5 G3 V' k0 }) N  z: l
  29. #include <linux/interrupt.h>
    * r) n# g! N# U5 t4 f: j4 A
  30. #include <asm/io.h>
    + A7 D7 b2 a. L& c
  31. #include <linux/moduleparam.h>
    3 o. F: H, J2 e1 l3 I2 R
  32. #include <linux/sysctl.h>- g" ?; e& S  S4 d$ j- O
  33. #include <linux/mm.h>1 S* k$ w$ K+ M4 g
  34. #include <linux/dma-mapping.h>$ s6 r, z0 n. e' k& ^8 s- X9 x
  35. 0 M" [# R- Q3 R+ Z6 q9 g5 _# Y7 p
  36. #include <mach/memory.h>% ]/ M% n' P2 {" ]7 ~- |
  37. #include <mach/hardware.h>4 O6 Q8 X1 z4 p- x# L
  38. #include <mach/irqs.h>) U$ q) x7 U6 k( g6 d# C+ Y
  39. #include <asm/hardware/edma.h>2 @4 u1 g5 x2 G& f9 j

  40. 3 M1 i  L+ K% q& F: g- a
  41. #undef EDMA3_DEBUG
    ' ~$ e: F7 {: U9 B  t! e$ `
  42. /*#define EDMA3_DEBUG*/
    6 S" p2 r1 A+ }, X

  43. / r$ `# L. R3 ^" X% k
  44. #ifdef EDMA3_DEBUG/ J' ~0 H% k1 O: R( _+ A. s: g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 \( @! h6 S& `' c$ O% f- Z- m) A9 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! ]/ P8 {! V# u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % Y8 x2 T% [; X# s9 ~
  48. #else
    5 ?2 t% D/ Y/ g8 h$ j
  49. #define DMA_PRINTK( x... )
    * @* K- t9 s. n8 i1 l/ f6 V
  50. #define DMA_FN_IN$ ~& }8 m' e7 W
  51. #define DMA_FN_OUT, g( Y/ X# f. b! N) y, J/ d4 ]
  52. #endif& D5 q; ?9 Z6 b

  53. ( ?  n- z" Q, o: ?! q" l" O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ {  L$ _1 |, @7 b, H6 `
  55. #define STATIC_SHIFT                3
    7 ^) y* K/ i$ V4 z& N0 K
  56. #define TCINTEN_SHIFT               200 W$ E- O2 H/ Z8 X) y& N" H) z
  57. #define ITCINTEN_SHIFT              21+ u7 W3 ~; i* u$ T, @
  58. #define TCCHEN_SHIFT                22! Y) r. C7 P5 H+ \8 J9 H
  59. #define ITCCHEN_SHIFT               23
    . q+ I( b; J( [! ]4 G; A3 H1 Z

  60. 5 P6 w1 l6 J7 p& o
  61. static volatile int irqraised1 = 0;
    ; P9 Z3 y: m- b# ?/ G
  62. static volatile int irqraised2 = 0;
    ! h  r' H3 ?: k
  63. 2 C. g. @3 x3 C$ r0 R1 }+ q/ e  u, K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Y, ?1 ]3 Z& A" L/ |4 V7 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- V( N3 w" n* l0 f4 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; F- P; Z# d5 j# t" E; c

  67. , j5 T" f. ?4 n2 k! c& o
  68. dma_addr_t dmaphyssrc1 = 0;
    / I6 `: L% N2 [; n7 c8 {
  69. dma_addr_t dmaphyssrc2 = 0;
    6 d3 B1 {% A6 t7 R2 [# m
  70. dma_addr_t dmaphysdest1 = 0;
    / a* T. x4 R+ x3 c. C! m: G
  71. dma_addr_t dmaphysdest2 = 0;8 j' S2 v4 S: |9 A2 ]3 d

  72. * A2 g6 N7 e) o; V# X- K
  73. char *dmabufsrc1 = NULL;. x+ c2 D" @$ r* s
  74. char *dmabufsrc2 = NULL;
    # ^! ~8 T- h: G9 _
  75. char *dmabufdest1 = NULL;6 B* F* @' A0 W- e
  76. char *dmabufdest2 = NULL;- P- R/ f: c% C* n: g
  77. 5 G( g9 Y" T- b
  78. static int acnt = 512;
    5 M7 ?# D) i5 g7 @. U& h+ {* S
  79. static int bcnt = 8;+ t/ Y& z- F  c5 A
  80. static int ccnt = 8;
    / d2 f& M. L! L* R% V+ v& z( m3 u# t! J
  81. + ^1 P, G' a4 I' C- X! k
  82. module_param(acnt, int, S_IRUGO);
    % d6 [; }5 h$ w- I* \# ]
  83. module_param(bcnt, int, S_IRUGO);* U% z, V& o. |; l8 `8 L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% N% l4 h3 m! F2 M; e4 D
) s! \# @! q) u8 l0 b. X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s; y7 O6 z' f  _/ U( b: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 P" x  Y" e8 Y- A' r& d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 q0 Y2 j. r* ^8 T+ T
8 ^; p% k7 o6 Q, h$ \# V

  Q# n  U/ s: M/ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 00:57 , Processed in 0.039895 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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