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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - g; b2 N8 b/ @8 K2 g
  1. [code]EDMA sample test application9 D! l. g) y% S/ [$ I
  2. /*4 ]. _* Q2 `" H
  3. * edma_test.c
    % U) ^+ h/ r* t; p( J
  4. *
    9 R" h. P* v& u1 F
  5. * brief  EDMA3 Test Application" x( z6 V5 m+ {: @6 S$ Z8 L  r
  6. *
    5 y5 G; m  B3 c& f2 C! F
  7. *   This file contains EDMA3 Test code.
    1 |$ I  z& L7 r  F: P
  8. *
    ! W9 S' o- \& X+ Q* t, N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! A) S4 l. J+ u* p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % L) I9 x5 m, W/ z% N  `: U
  11. *         TO CHANGE.5 i  E0 d; y; [9 u4 g# n; E8 B. ]
  12. *$ e( k/ v2 `4 m- h$ i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 k) J2 K. _- c3 c  x2 y" ?
  14. *
    6 [. r. G2 q6 z- F+ h# Y" E
  15. * This program is free software; you can redistribute it and/or
    * t+ V9 o: H6 D8 U/ ~  @# q0 y" t) e
  16. * modify it under the terms of the GNU General Public License as
      t  P  r5 p; [4 F; F  }0 g
  17. * published by the Free Software Foundation version 2.
    7 C& t; Z; X' l% S' B
  18. *# s4 Y& g1 a9 l; [" ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; g% f8 w. L' y" R5 m7 w* z5 i
  20. * kind, whether express or implied; without even the implied warranty
    % k7 H  ~2 Y' [2 S2 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  l" y# e4 ^( X* `
  22. * GNU General Public License for more details." F- q3 u) u( I2 Y
  23. */
    ; u( L2 M+ t) F/ X% l
  24. / k6 e0 u  o4 s/ ~2 w! f: [
  25. #include <linux/module.h>
    6 l% I7 {- S1 c! C8 p! O
  26. #include <linux/init.h>
    3 ~/ Z0 W" \& h; _
  27. #include <linux/errno.h>
    - e) @+ g5 v, w1 K/ H
  28. #include <linux/types.h>
    " _9 g8 _# G# q' \( A7 O/ Z
  29. #include <linux/interrupt.h>
    + \- z! c' S+ d1 Q4 T1 l
  30. #include <asm/io.h>3 Q( s2 T9 [5 ], o- V* C, a- d
  31. #include <linux/moduleparam.h>
    $ \$ \/ m/ L9 P* g& X4 p  H
  32. #include <linux/sysctl.h>- v( W% l' z5 r
  33. #include <linux/mm.h>+ l8 ?# H9 }% k3 |) I/ b
  34. #include <linux/dma-mapping.h>7 l2 ]  E8 r' R2 U# @) ]' K, g4 {

  35. 0 f2 u$ O+ I- a1 }( [! c
  36. #include <mach/memory.h>
    . H( n. L# p6 c2 n6 s
  37. #include <mach/hardware.h>3 A5 R( r% C5 g7 d
  38. #include <mach/irqs.h>6 j2 S1 F1 Z3 f! B' I
  39. #include <asm/hardware/edma.h>
    ) ~! E, {; R; d) W2 d
  40. 2 s$ o1 L! ?+ e% d& J" |
  41. #undef EDMA3_DEBUG$ @# Q' R& h3 A+ R/ A$ @7 o
  42. /*#define EDMA3_DEBUG*/
    " O7 m* |- _7 Y- R

  43. , A% M' I3 W/ d5 Y. a
  44. #ifdef EDMA3_DEBUG
    6 Z' {% @$ U! T2 Z6 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 S6 ]9 n2 L9 u; F2 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% X/ f% V5 p& K9 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% S& o, V1 h- E# ?2 F( ?
  48. #else1 w6 d- c1 \) t8 ?* i7 u$ Z
  49. #define DMA_PRINTK( x... )
    # Z" n2 Y5 S) d. O& j# i: d
  50. #define DMA_FN_IN3 Y; m/ L( |: I; K1 l: H8 F$ h/ o
  51. #define DMA_FN_OUT
    6 b3 b! `6 C" R0 w, d8 L5 ?
  52. #endif0 o3 o1 M' \' ~7 j0 w7 s# K
  53. # r) K2 y' v% d5 L" J7 q% w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      p8 H3 P5 a4 N5 c6 r
  55. #define STATIC_SHIFT                3
    3 x7 w* [  t5 ]8 X! K! U% `, U8 M2 Q6 X
  56. #define TCINTEN_SHIFT               20
    1 {& [8 {4 l$ P1 ?7 D& ]3 \. u+ \
  57. #define ITCINTEN_SHIFT              21* }# I) C. m1 x/ a0 h
  58. #define TCCHEN_SHIFT                225 t: }- e' m# }5 C4 [+ E
  59. #define ITCCHEN_SHIFT               23' d5 x4 p6 x/ a9 ]% f6 }
  60. / B) M+ k" [% \# q) b7 B
  61. static volatile int irqraised1 = 0;
    + F8 H4 N9 C  W1 Y: }# O
  62. static volatile int irqraised2 = 0;
    , h3 N( B0 `$ ]: t

  63. 7 p( \% ?  f/ Z+ |; J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 {2 [2 m6 x& r5 U+ A& D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 j  ^6 |: u" x; f$ m! g* `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 M2 Y" x5 [5 L  G2 K' @

  67. * m# p; A6 R. m) @( d% S0 x
  68. dma_addr_t dmaphyssrc1 = 0;
    9 Q* L1 S2 [. g" j* ]
  69. dma_addr_t dmaphyssrc2 = 0;
    & F8 k8 V' \/ A
  70. dma_addr_t dmaphysdest1 = 0;2 |3 j6 m* v3 a0 t
  71. dma_addr_t dmaphysdest2 = 0;
    3 M3 S$ A3 @5 T: u8 u" O

  72. $ r" I7 W) t6 R# j  z0 `
  73. char *dmabufsrc1 = NULL;; C2 t9 @6 f" h! m
  74. char *dmabufsrc2 = NULL;# C8 n$ }6 R3 W( ?& U& b2 Y
  75. char *dmabufdest1 = NULL;2 M' U8 _2 k6 f5 L' G7 \2 H
  76. char *dmabufdest2 = NULL;
    5 R4 X" `, C7 Q3 J0 G( Q  H2 z

  77. $ l+ |1 Z4 A2 m3 \7 T4 F
  78. static int acnt = 512;
    6 z: D# H- @! t4 b
  79. static int bcnt = 8;
    3 A9 O3 b* B+ a. M
  80. static int ccnt = 8;
    4 G) z" P- Q( z' N) l$ K0 r7 ]3 i
  81. / e$ i& t: Z3 b" A( o+ n) t/ q
  82. module_param(acnt, int, S_IRUGO);
    1 T9 v. F+ X9 A
  83. module_param(bcnt, int, S_IRUGO);! h2 k8 ^; t% Z0 S1 U9 D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, C" S! k0 R/ k( X2 P$ g0 h

) j) P7 ~4 {$ V. ^. k" _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( ~& [1 Q  g( j# e' [" J$ S0 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" b. \" H' y- p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 R5 N9 f* R7 n1 i, R* |. I) u/ F4 G, b! W# R
+ H% a( N$ O2 e9 n  S  }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 16:44 , Processed in 0.042211 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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