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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* `; ]  m4 j3 F* I% ~
  1. [code]EDMA sample test application) z. T  k* \% \, V
  2. /*
    4 L4 Y1 b& ?; q
  3. * edma_test.c+ n- E1 x. y5 u" O- T8 [. T
  4. *
    8 Y( ?3 ^5 [/ M- Q& X
  5. * brief  EDMA3 Test Application1 N  s+ R) T6 a$ i8 b
  6. *
    2 k" T# ?: |. [6 F: J, S
  7. *   This file contains EDMA3 Test code.
    6 O) z& U8 k7 W% k
  8. *
    6 m4 i9 S8 ~( v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : n3 \. h$ a0 ~  U  l% W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , S! {: P8 M8 a# ]; [0 H+ s
  11. *         TO CHANGE.( E& @" Z9 F; Q2 E# d3 j
  12. *
    6 w1 P6 \( x0 s) \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 \4 `7 x( X. x% B& P8 |8 F3 T( b
  14. *" x; H1 U* D; W0 ]  |
  15. * This program is free software; you can redistribute it and/or. w' {* @  G  T  i3 ~
  16. * modify it under the terms of the GNU General Public License as/ j( C/ p3 w5 i" q( `1 K
  17. * published by the Free Software Foundation version 2.
    ; ]4 R& x$ s+ T9 J$ I+ y% X% @- P
  18. *& H) C' j' [) k8 s- Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 l5 n! }8 @$ ~* p
  20. * kind, whether express or implied; without even the implied warranty
    , f* q3 Z5 v. [# H7 O8 ?$ i7 [* d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 l7 R& z# o$ H
  22. * GNU General Public License for more details.3 k+ p: i$ L1 [2 a
  23. *// N$ _9 |/ b4 G! Q9 E

  24. + Z4 i3 ?' r) B& l$ a. m$ Y
  25. #include <linux/module.h>
    - {! o' @, J+ z: n1 H& I- |* O
  26. #include <linux/init.h>. q! S. q$ N$ N  @1 E
  27. #include <linux/errno.h>" V$ b# J' z9 [0 Y. x
  28. #include <linux/types.h>; I( f+ c1 w. U$ w, {2 ~) y6 |- m
  29. #include <linux/interrupt.h>/ t* n! I( s% R% j
  30. #include <asm/io.h>- ^; n' P0 |$ v! ]
  31. #include <linux/moduleparam.h>
    & x" h0 P$ [% z& Z% j
  32. #include <linux/sysctl.h>, S. F3 Q9 _" q  G  ~, c; J
  33. #include <linux/mm.h>, b9 E' I; Y- h5 N7 a+ k7 O; l
  34. #include <linux/dma-mapping.h>8 {, O- ]/ o; p/ U+ ^

  35. 4 \) _; {1 p! E) D" x1 T6 S
  36. #include <mach/memory.h>
    ; e0 C( x7 M$ _" d' H/ b/ N$ i, Y
  37. #include <mach/hardware.h>
    - S! ?5 n( s# N9 O' s8 y
  38. #include <mach/irqs.h>
    ' e" A. ^" _) d( N. k: z
  39. #include <asm/hardware/edma.h>
      Z9 F$ `0 u, H- w4 Q& k% _
  40. 9 t* T5 \3 p9 @9 ^1 S+ n
  41. #undef EDMA3_DEBUG- Q9 S2 Y; R7 E: G
  42. /*#define EDMA3_DEBUG*/
    & E) S. O$ G8 ?, R& j3 G" s  s
  43. 0 a# v; g  C- T, c3 ]$ i
  44. #ifdef EDMA3_DEBUG
    - n" w1 [' P1 F$ e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 C4 t( h; k+ ?! T: J! h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& g* a/ @' G9 b: K( i2 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % q+ E7 n+ F% r$ p7 C
  48. #else
    # y) w' l/ k1 H
  49. #define DMA_PRINTK( x... )' \; `# R3 F5 `* Q' i" C# [
  50. #define DMA_FN_IN
    , r/ N- U% A6 @4 G( x  F! t
  51. #define DMA_FN_OUT
    : D0 f: R2 g; v# n6 r
  52. #endif
    / b0 c* ^" R0 z" G& j

  53. " {& [2 H# A! h3 H% ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : t, l0 f' u8 {& E5 M6 m
  55. #define STATIC_SHIFT                3) f1 A# l8 {" S4 J
  56. #define TCINTEN_SHIFT               20
    ; h2 e/ g( }0 e
  57. #define ITCINTEN_SHIFT              217 P  E: k5 s5 C5 S, A( X
  58. #define TCCHEN_SHIFT                22
    " I- N0 r* S- P" J
  59. #define ITCCHEN_SHIFT               23+ T0 y( T# [( n8 ^8 T" g  s

  60. $ B8 d6 [$ D& d0 |& B9 c
  61. static volatile int irqraised1 = 0;" W& u; o" Y& m5 a! K
  62. static volatile int irqraised2 = 0;
    " P5 m/ w$ u( J/ r8 I
  63. % a/ W; D+ Y1 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , @6 \* @9 g  B: F' A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: o' h/ G: l2 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / |0 d" ?  J- Y2 \+ r6 {: ^# ^3 A

  67. ; {$ r/ ]# D8 D* N- ^+ j( E7 F- C
  68. dma_addr_t dmaphyssrc1 = 0;
    / `4 M, D4 B( H/ B* e; u2 J3 k, e3 R
  69. dma_addr_t dmaphyssrc2 = 0;* G) f5 N2 n7 \; Z8 r& W( F9 \
  70. dma_addr_t dmaphysdest1 = 0;
    . y5 z0 |  z- ]" w; G; n! H
  71. dma_addr_t dmaphysdest2 = 0;  H5 h; M9 b) O

  72. - D8 X: G( N6 d4 K; y
  73. char *dmabufsrc1 = NULL;
    7 Z. c0 {. E' ?5 D+ ?* T; o
  74. char *dmabufsrc2 = NULL;
    $ _  o7 j  o- y' F# h: J4 C5 X
  75. char *dmabufdest1 = NULL;' c! P6 A4 E5 `. x& o" P
  76. char *dmabufdest2 = NULL;. x3 H3 A- F7 W9 h

  77. . O2 N" K; k% @1 i) u+ L
  78. static int acnt = 512;
    + S) Y9 j, K! v# g7 y9 J
  79. static int bcnt = 8;; }  `: G# b5 }$ B
  80. static int ccnt = 8;
    : i0 V* Y& ?) t/ k/ ]6 v
  81. * k& [+ }& c9 `5 L+ _
  82. module_param(acnt, int, S_IRUGO);1 }% |/ m' Z- h, j& v, V( F
  83. module_param(bcnt, int, S_IRUGO);6 b2 v, O+ n- Z. L- ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 P  [: e( ^3 U: ]! r! i- j, V* k7 t+ u) E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' R6 X) r' d! p2 ^! @( M0 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& D0 ^  H2 k0 Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ }) M+ D1 Z; V# e6 X5 d0 |! y

# R' T& I% D, k
) t* p* A( @7 k+ \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-8 21:52 , Processed in 0.039633 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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