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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* A. J' T# _' D3 w
  1. [code]EDMA sample test application
    % `+ p: g+ D# F* H
  2. /*
    5 U, \' Y3 f: f( D, Z
  3. * edma_test.c* R& C- J, @+ q2 V& Z
  4. *: C9 c9 L0 s* R& d$ O# V& S
  5. * brief  EDMA3 Test Application# h+ F8 w6 R  P" \% \1 {: P5 ^/ ^
  6. *
      @/ E, R& K; G9 u2 y, }
  7. *   This file contains EDMA3 Test code.* @+ C. A' u7 s, U6 M/ v# ~6 i  B
  8. *- s2 K2 E; e; A4 I) u& G3 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ ^1 T5 ]( \& J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 h7 {% j; O4 t- H. O! _1 b# Y% Z
  11. *         TO CHANGE.  ?5 d4 t1 y/ b
  12. *
    + Y9 W' t! W" B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! h! M% J! W! v6 P
  14. ** k% R1 }3 L$ S: ~# r
  15. * This program is free software; you can redistribute it and/or
    8 j8 h% L' i* E) L- @
  16. * modify it under the terms of the GNU General Public License as2 x, o2 Z4 U8 R! r5 M5 e
  17. * published by the Free Software Foundation version 2.. L( j+ X, O+ ^& Y3 u! y  s- P* e/ b
  18. *
    - G8 \( t" p/ {3 E& C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# R; S4 [9 J7 W3 E$ E
  20. * kind, whether express or implied; without even the implied warranty) a( i8 F" d2 v( R- s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / @+ E- q6 H% y, d* o
  22. * GNU General Public License for more details.
    + j. x4 c! P& M3 M$ c
  23. */) {) \3 P! \- _
  24. - |1 Z1 t0 o, {
  25. #include <linux/module.h>* l' r, }8 p, L+ \8 o- a
  26. #include <linux/init.h># f  ?8 S4 E- V' C7 b( i
  27. #include <linux/errno.h>" M2 Q8 J- @8 [
  28. #include <linux/types.h>
    4 H/ l" ^( T% R# r5 ~$ R$ ~
  29. #include <linux/interrupt.h>0 c8 I- {4 @2 h; N9 P: W& w+ e5 K
  30. #include <asm/io.h>: d/ R2 Z. Z8 e
  31. #include <linux/moduleparam.h>
      @/ a8 [4 W$ `. B1 Q* L6 @, F
  32. #include <linux/sysctl.h>8 k2 _5 H" Q! y& d( g2 B" Z8 Y+ J% q
  33. #include <linux/mm.h>
    " I; y0 R2 ~$ s3 k: x
  34. #include <linux/dma-mapping.h>
    ! I  }; D) q7 h6 Y( I
  35. * d! N# B( |4 s3 r
  36. #include <mach/memory.h>
    1 |% F9 F5 g, B3 O% R. f2 U! T
  37. #include <mach/hardware.h>
    # ~6 q5 o+ ]+ r
  38. #include <mach/irqs.h>
    ; m) P) @9 x. R. |+ v, t& y
  39. #include <asm/hardware/edma.h>
    # i; t! J( L- Q, X" g9 E( u
  40. % n/ a* t, c% f# t% p3 B" ]' t
  41. #undef EDMA3_DEBUG
    6 r) I6 m) c, e7 v+ D; [1 \6 n
  42. /*#define EDMA3_DEBUG*// [: D5 u; W, q$ [4 T0 ~) M

  43. ) v$ D* i  O9 S+ W
  44. #ifdef EDMA3_DEBUG7 l$ e+ [1 t4 F6 o% D: _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; ]0 o% v: G9 e. z+ Q$ `. R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): a; J* A9 c7 J& s. K; n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! ?( A$ T3 X# s! W* Z
  48. #else
    5 N  s  y+ Y  O2 Z3 f" s
  49. #define DMA_PRINTK( x... )
    + d9 _. x3 Y: k# X# }' h
  50. #define DMA_FN_IN
    5 {" M( k# W- a+ l' R
  51. #define DMA_FN_OUT
    + H" J' Y; j- G0 x# u3 }
  52. #endif0 ~- |! v0 M  ~5 O/ D: P

  53. 1 X8 o- e' q8 w# p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 K- P  g+ S4 q6 m- w3 q
  55. #define STATIC_SHIFT                30 F& ]/ G8 T. j' o9 i  v) l4 y% h
  56. #define TCINTEN_SHIFT               20
    2 L1 C- W; f7 R% y; }
  57. #define ITCINTEN_SHIFT              21
    6 ?7 k' z. X: [+ S7 ^+ @' g2 Q
  58. #define TCCHEN_SHIFT                22
    2 }/ ]  ]5 w8 }' ]
  59. #define ITCCHEN_SHIFT               23
    $ _: w* ]& b" f  G
  60. ( Y! x# G. K1 C- S9 Q
  61. static volatile int irqraised1 = 0;; P/ v6 I+ [. D9 K3 j4 M
  62. static volatile int irqraised2 = 0;
    , V/ f* s/ H) V' l+ p
  63. 0 C& F" N3 l% N' l3 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 A$ O4 K* D4 c6 f3 A, E/ c& ^  U) c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 g' I' t& j1 Z& R# w  b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 V9 T" s, c# i; `! x. M
  67. ; f, t# F9 H2 h* ?! r; I
  68. dma_addr_t dmaphyssrc1 = 0;) [9 Z/ ]1 C& n, G
  69. dma_addr_t dmaphyssrc2 = 0;, @4 N6 K/ S% S. {
  70. dma_addr_t dmaphysdest1 = 0;2 i7 c: n$ a" g8 X* w
  71. dma_addr_t dmaphysdest2 = 0;8 z; d6 g' D0 N
  72. + H1 w; V  C4 m: U: T
  73. char *dmabufsrc1 = NULL;# H5 M' E4 i1 w* R( v
  74. char *dmabufsrc2 = NULL;
    6 R0 \# ~" c4 ?
  75. char *dmabufdest1 = NULL;) T; [1 ]! y& }0 j' _
  76. char *dmabufdest2 = NULL;
    3 _* n; ^7 r0 E! T# F9 ~( m& V2 f
  77. + o9 _" C. q2 t. \
  78. static int acnt = 512;
    3 _2 }7 [' T! E/ F3 G# y/ [
  79. static int bcnt = 8;) D) G7 z( X/ e3 g
  80. static int ccnt = 8;  c7 i/ c3 \  V+ r7 I

  81. % I; N( I3 f5 c7 {0 D8 {5 ]0 ?
  82. module_param(acnt, int, S_IRUGO);
    . y9 |# Q1 c! o
  83. module_param(bcnt, int, S_IRUGO);
    8 {# z/ ?% b. `0 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 T# z8 V4 m/ c# C4 [+ g$ S. ?. b4 r* z6 K$ C& \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% s4 x% y/ k2 o1 @
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  H8 k$ w2 d: ?3 K, g  M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 I) }  {; W% W4 D0 l4 l& l2 S5 i- d5 G( P" A& n) `
, [7 Q! U6 f3 ^" M1 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 09:46 , Processed in 0.083826 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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