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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# k4 X/ d& `5 d0 z0 Q# D; J3 `8 n5 y
  1. [code]EDMA sample test application
    % t' P1 L. u$ e* b
  2. /*; b4 ?' w- `" Z# j3 {) w
  3. * edma_test.c
    ' B. V- O2 D; S1 g
  4. *
    ! I# p8 j8 s9 w- o, r
  5. * brief  EDMA3 Test Application" y, i  |$ T+ @9 R9 ?
  6. *
    ( t+ i( |  {4 S2 P
  7. *   This file contains EDMA3 Test code.
    4 n& K4 v, w( P' _0 \
  8. *, [1 `/ p) l/ i  z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m% H9 B& x* x8 w* G' D* `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ r- [. l! v. u5 r
  11. *         TO CHANGE.
    , D$ Q4 L. \; S+ c% D2 t
  12. *
    4 r$ x9 J5 C# C. d- S: A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* x  _4 a; e1 j- _$ D- l
  14. *0 K% H; |( H2 k- L
  15. * This program is free software; you can redistribute it and/or
    ; M* a2 f1 V" r7 k
  16. * modify it under the terms of the GNU General Public License as% P# |( r; p$ ?
  17. * published by the Free Software Foundation version 2.: d. I" J6 T# A. f! T3 |# _+ Q. _
  18. *0 ]: p8 V1 r5 n5 [7 I, N% @) k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 G) E6 W0 x* Z/ `
  20. * kind, whether express or implied; without even the implied warranty
    * v3 k1 j2 I% V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 Z" X2 P+ [6 C8 a. M
  22. * GNU General Public License for more details.
    . E; d/ M" n7 y# P
  23. */' V6 f5 C, s5 L  S

  24. # Y3 Y- k4 b2 Z& c, g2 d6 O$ a
  25. #include <linux/module.h>
    : L6 Z7 i/ h& q: B/ J7 `
  26. #include <linux/init.h>
    ' }. t8 h. ~* Q& `6 q
  27. #include <linux/errno.h>( G* f& X8 s7 C6 r0 X1 Z+ y
  28. #include <linux/types.h>- c. k. P% D5 S" E$ I. o- [$ y  z$ ^5 e
  29. #include <linux/interrupt.h>% c" z5 E# t* x- D, ~( W' j
  30. #include <asm/io.h>
      G4 [) a" b! x6 h7 r
  31. #include <linux/moduleparam.h>  N- G* P% Q; P$ y0 P' ?
  32. #include <linux/sysctl.h>
    9 H( S+ Z2 @7 L7 L% ]
  33. #include <linux/mm.h>  `! U! z* B' p! [
  34. #include <linux/dma-mapping.h>
    / E  L, J( F( g* P- M
  35.   Q( k$ t% ?0 n! y
  36. #include <mach/memory.h>6 P9 M1 k: U! p( c/ Q- n, g
  37. #include <mach/hardware.h>
    7 X7 f  S( W6 H+ `
  38. #include <mach/irqs.h>9 X7 W9 {0 n+ O
  39. #include <asm/hardware/edma.h>: g3 S  R) [2 \  V( y

  40.   ?( Y1 O6 S2 O2 i1 t9 H
  41. #undef EDMA3_DEBUG
    ; k" U  r; x6 J9 q3 S
  42. /*#define EDMA3_DEBUG*/
    9 ]  c4 B# D; `- r+ z

  43. " P+ L* Z; z5 |' K9 ~, A: i3 r& _
  44. #ifdef EDMA3_DEBUG
    1 G5 G: k# H; ]& q0 t. |7 l1 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ G- S. z( i  `7 j; B, R
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 E; G& _$ `" ~9 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / P- o7 X' n# z
  48. #else& l* P2 k; X& c; ]& p9 I: b/ {
  49. #define DMA_PRINTK( x... )& w6 m( C/ `1 Z0 M5 }  }4 g5 k
  50. #define DMA_FN_IN! _; p7 M+ D) f9 l; K' j
  51. #define DMA_FN_OUT- j& E7 l! {% R9 S5 C+ c& b
  52. #endif/ D7 Q: p0 v* }; G$ G4 H
  53. / j: r  c' j1 S& I: N* v5 d1 P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): I8 E0 u  E# X5 M; V% |
  55. #define STATIC_SHIFT                3
    - i" q. p4 I4 }  B5 M% n
  56. #define TCINTEN_SHIFT               20
    / I3 F3 i) E/ Z( E( h: n+ U
  57. #define ITCINTEN_SHIFT              21
    $ N+ z# |4 p7 E# i# s
  58. #define TCCHEN_SHIFT                228 [! H+ v3 W& O  Y5 n* m
  59. #define ITCCHEN_SHIFT               23, U  O: ?' e( M; G
  60. 3 M# p$ u! g9 I* H9 ^3 H
  61. static volatile int irqraised1 = 0;2 k: |  A$ M* g! U/ [8 e) c  Q
  62. static volatile int irqraised2 = 0;
    + @* w: D- H5 d
  63. 5 B5 x; B/ F5 l/ @/ _2 r9 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }6 Q; B/ X/ G) f' z2 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p  q1 V& n. G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 ~8 H: }: ^" e- R( I6 _; x9 R
  67. 0 G% S& V2 }( Q6 J+ `* q  A% c
  68. dma_addr_t dmaphyssrc1 = 0;
    $ U2 j0 T7 h: E0 }- m0 @
  69. dma_addr_t dmaphyssrc2 = 0;4 O5 E# }/ o2 i/ E
  70. dma_addr_t dmaphysdest1 = 0;
    $ {2 o0 |/ ]+ P  V' c, F
  71. dma_addr_t dmaphysdest2 = 0;: g5 D1 d" i4 T8 k
  72. 6 Y$ q3 Q& u4 t* V
  73. char *dmabufsrc1 = NULL;
    6 j9 l& c+ M: s% x- N1 M, y
  74. char *dmabufsrc2 = NULL;5 @/ s7 }7 s" ?$ I& U  A3 p0 B9 Z2 M
  75. char *dmabufdest1 = NULL;
    / _! P- C4 f8 X
  76. char *dmabufdest2 = NULL;" D! u% R0 C9 }) ~- m7 `" \0 @8 u

  77. ; P5 c2 Y' O1 P+ \  Z
  78. static int acnt = 512;1 K! m6 T+ d3 Z! W
  79. static int bcnt = 8;( @$ ?6 t$ l+ w7 O6 t* e
  80. static int ccnt = 8;
    ) P- ^  q% C+ [- R
  81. ( c6 p' y1 _9 Z% R1 s
  82. module_param(acnt, int, S_IRUGO);
    2 ]6 [/ ~" b; G+ \) \. u0 ^* D( k, n
  83. module_param(bcnt, int, S_IRUGO);+ |( ^  B+ O+ J: V' d$ W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ ]: F  H1 r, J  i) }& g! C
! O6 }$ n4 @. s6 F" s4 I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- u* O# ]5 f9 J( Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 Q. u1 b' T& M, N. ~8 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 c3 V# k& B( v1 f, E4 w( m
) Q: ?8 H) C& {  I% l# i
1 f6 ~: d3 H! b' B. _  ?' d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 00:49 , Processed in 0.039392 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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