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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 p; ], e0 E6 z" f8 P
  1. [code]EDMA sample test application
    $ F5 w8 E% a# O8 z( P
  2. /*
    ! t# u: W3 Y" R
  3. * edma_test.c
    7 S( G' G, Y& L! R: A1 G& Y
  4. *
    & a% a1 P5 h  Y
  5. * brief  EDMA3 Test Application
    ( ]3 s' l( I3 c& N
  6. *
    + n9 U) `, k% y& w- I
  7. *   This file contains EDMA3 Test code., M  W/ o: I; T) A* W/ }" n( N
  8. *
    - W" T& e* z: s7 r, l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : y+ |. D- D$ F: g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 _) Z4 `2 I) F' u5 @. L2 j" ]# Q
  11. *         TO CHANGE.
    : A" l  g9 z) c3 l
  12. *2 V9 l4 l, q& G' e; u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) U5 e% d/ e3 h1 J
  14. *7 U0 K1 |9 J$ N, z: @' O
  15. * This program is free software; you can redistribute it and/or( ]& Z0 ]. h- i- K/ E& s
  16. * modify it under the terms of the GNU General Public License as
    3 w+ j  B( d) {5 \# C
  17. * published by the Free Software Foundation version 2.
    ) L% F7 E; }2 i
  18. *# i; B$ X' u: V' |; y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% k3 W) ]# m5 z, |- V, g
  20. * kind, whether express or implied; without even the implied warranty
    % u# n6 f8 l# ]  S1 S# W1 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 O# s% q; K$ L4 H0 f# n
  22. * GNU General Public License for more details.1 e& y' X0 Q, |6 x) u" X5 C" g
  23. */
    + l" P5 L1 f$ b
  24. 3 T- {: o# Y+ C2 |$ P9 @& m$ b6 g
  25. #include <linux/module.h>0 i: v7 r% S7 Q8 G  ]8 k0 k
  26. #include <linux/init.h>
    ; W+ X% K8 R! X; F6 L
  27. #include <linux/errno.h>
    2 l( ^. L4 t4 V/ r/ R' h" @
  28. #include <linux/types.h>
    ( B3 g' q7 X/ z; V+ i8 L
  29. #include <linux/interrupt.h>
    , x8 [& B* f! h8 s
  30. #include <asm/io.h>0 ?+ ]$ T/ _' Z; q3 m: L7 o
  31. #include <linux/moduleparam.h>3 R5 Y( o2 O* T4 l
  32. #include <linux/sysctl.h>! ?6 F6 Y3 k7 _# u$ a5 X
  33. #include <linux/mm.h>
    - Z+ @: Z. [+ Y& Z3 T
  34. #include <linux/dma-mapping.h>& ]& p+ Z1 u# h& {5 {

  35. 8 A  }5 X1 Z5 v
  36. #include <mach/memory.h>& f* Q  c5 X+ g1 i% [/ `9 `1 X
  37. #include <mach/hardware.h>8 [/ [0 l% G/ [0 M* `
  38. #include <mach/irqs.h>1 f7 `" b5 v4 j5 j
  39. #include <asm/hardware/edma.h>
    ; D: _2 _6 v1 d1 ]  w: n! l* E  S

  40. 4 ]. J4 q5 [6 N) h. z
  41. #undef EDMA3_DEBUG
    3 T0 l" I; H9 F' {1 Z% W3 J
  42. /*#define EDMA3_DEBUG*/
    1 z' V$ Y" ~; z
  43. - Q/ |) c/ i- f- Y7 p" q
  44. #ifdef EDMA3_DEBUG. ^1 E+ ?5 E1 `% M! a* m1 Q% \3 t7 ]! L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r* b! |3 V8 D# B+ }8 }9 w' c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ D# T1 y, z, `5 i' B& ^" k9 ?- }$ a; t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      ]7 @0 [+ B5 @: A/ q- U8 L* B
  48. #else
    ; s7 ^0 [& n- h2 u, g
  49. #define DMA_PRINTK( x... ); V7 m* ?( K, d5 L# B
  50. #define DMA_FN_IN
    2 o; E6 B- M! Q- k0 V
  51. #define DMA_FN_OUT9 c  q# K7 w- j
  52. #endif8 T! H+ V% H9 N$ z

  53. + z9 S' e  \; \: `$ @( _  W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * C; s, \$ l0 B8 A' x
  55. #define STATIC_SHIFT                3
    0 @$ G' s' V( n. W6 z% o) z' J
  56. #define TCINTEN_SHIFT               206 f5 r3 y( L: h1 Z2 @7 m; |
  57. #define ITCINTEN_SHIFT              21
    ( U7 ?/ G$ w" l9 d6 i5 O& J) V
  58. #define TCCHEN_SHIFT                22
    5 e$ z1 F) f& m6 V, f' O4 F
  59. #define ITCCHEN_SHIFT               23
    4 d! W# q1 D" h
  60.   J; D" e( ~" n7 \0 s; G) {
  61. static volatile int irqraised1 = 0;
    : I  a$ R& Y# d4 Z- a3 C. @* S
  62. static volatile int irqraised2 = 0;" F0 r* |; z6 X4 X. f" i

  63. ( `" ^8 m6 i1 u) ~3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # F$ g2 A" }7 _' t( F4 j1 S9 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ k/ ?' y! {+ P- Q$ H) i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & u9 A+ @5 [( Y/ s
  67. * S9 I$ o, G& M9 ^1 h
  68. dma_addr_t dmaphyssrc1 = 0;& x: e! g& S; [1 ^/ U% y4 ~! D* S
  69. dma_addr_t dmaphyssrc2 = 0;
    6 Y; P7 {" ^0 m) r
  70. dma_addr_t dmaphysdest1 = 0;
    . `% U0 z, p( B% d* B
  71. dma_addr_t dmaphysdest2 = 0;( _+ x3 ?! b, _) F, l0 N8 }/ X

  72. 3 {: p9 M8 P- n& ~: Y
  73. char *dmabufsrc1 = NULL;2 _, \6 c' s! J7 w0 s0 u
  74. char *dmabufsrc2 = NULL;
    ; Z+ d: |% f7 l! }: y7 m; q% y7 e
  75. char *dmabufdest1 = NULL;
    : A9 q3 G/ h% A; I4 S1 y1 `' Z$ M
  76. char *dmabufdest2 = NULL;  G% y; n& C9 \; y4 ?
  77. ) j3 ~1 o& p4 x2 ~  d% C
  78. static int acnt = 512;
    % c. _7 c0 A' ]: d; W/ w  v4 P( c
  79. static int bcnt = 8;6 _+ g! y0 s% t/ L
  80. static int ccnt = 8;
    ) ~5 H. D* _/ R3 Y7 G

  81. ; J; y! n& W5 O& Q- u
  82. module_param(acnt, int, S_IRUGO);0 E# D/ Q; t( a
  83. module_param(bcnt, int, S_IRUGO);6 Y# U, H1 ?! K) R( Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( a( c) ?7 x) y" h5 F

) t: `2 E/ \- s2 O% h      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( U* X( ?$ F8 K" Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  g2 d# G$ }  ^- i, l4 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 f2 P% @* Y8 k; S( X
1 m/ Q1 J6 E' w0 p4 P! J

$ G9 C; ?7 b2 R9 |& m4 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 21:30 , Processed in 0.036565 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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