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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 w2 Q! |* p5 I; _' k, h: V
  1. [code]EDMA sample test application
    6 {2 k2 Y& C% ?' d/ k
  2. /*0 k1 u- C5 ~) @1 x
  3. * edma_test.c6 \, N0 C3 p0 e4 O
  4. *  ], D% ~) j/ o$ c& K0 {
  5. * brief  EDMA3 Test Application
      V- e% V8 z4 [$ [3 q
  6. *
    : ^; f3 V3 G" e
  7. *   This file contains EDMA3 Test code.7 Q2 Q$ G- r- P* L5 g+ l6 n: v
  8. *7 D# b! c) _$ m( S( Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 \# C; |0 ^- ~9 l/ k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Z& Y, Y3 p2 g8 h3 O9 R% E8 U$ F2 @4 N
  11. *         TO CHANGE.
    5 Y4 h. q6 {; m8 L+ S3 Z* ]
  12. *, @$ t  y4 j: j8 I+ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 M0 I- T  e) g3 v6 i" y" Y  K3 S" B
  14. *, }9 S  ^" W" b. p# v
  15. * This program is free software; you can redistribute it and/or# k8 }8 S6 v- ]7 T' r8 C
  16. * modify it under the terms of the GNU General Public License as: \# y4 ^: a( ]7 P# W+ \
  17. * published by the Free Software Foundation version 2.
    $ b! r1 i/ c9 j+ l# Z
  18. *
    # ~) ~, ?/ G; U: N6 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H0 U% _+ A: ?
  20. * kind, whether express or implied; without even the implied warranty
      Q4 r2 s1 g( h! L( H6 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  k6 A, k. u, t- ^9 M
  22. * GNU General Public License for more details.$ X% B/ |$ B, O
  23. */0 D* a' v, F3 o9 r( r
  24. ; B5 }4 M4 r1 ?& E- o5 Z
  25. #include <linux/module.h>* j) ~6 L3 x( P' L# Y
  26. #include <linux/init.h>
    8 e8 R8 ?1 n0 S6 f
  27. #include <linux/errno.h>
    ) m! D6 O. [/ c
  28. #include <linux/types.h>
    / O/ y0 R" n5 ]) x8 {
  29. #include <linux/interrupt.h>  S2 W# F2 m8 O2 {" v
  30. #include <asm/io.h>
    ( a8 X3 Z$ a" c0 d. ~
  31. #include <linux/moduleparam.h>* D& j6 Y- l. [6 x
  32. #include <linux/sysctl.h>
    & h3 E# T+ c4 _  Q# c4 _7 [# Y
  33. #include <linux/mm.h>
    # N4 i! e) D% |% r1 r
  34. #include <linux/dma-mapping.h>) D5 @7 e- ~1 g1 m! `! S/ U$ E4 |$ L

  35. 9 r7 S  {+ `7 w" x  ?5 L2 W
  36. #include <mach/memory.h>4 m2 \" |" ~/ f7 G3 r7 r* O7 a
  37. #include <mach/hardware.h>9 v0 W: J* x$ {& @/ K
  38. #include <mach/irqs.h>  ^5 H9 p( V- k3 K. S
  39. #include <asm/hardware/edma.h>
    $ c& F( m/ n6 V4 H& i# P
  40. " w6 b8 L7 z+ C7 K
  41. #undef EDMA3_DEBUG8 s4 H4 ?& {0 m! M4 H
  42. /*#define EDMA3_DEBUG*/1 f0 M4 [0 n3 C/ h* F! o

  43. 6 ?) k/ I/ f6 i! A2 L, y* S6 L3 ^
  44. #ifdef EDMA3_DEBUG0 s; Q6 ^. q+ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 r3 D0 h/ x5 p; L1 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 c2 W$ I: H% w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 A3 J0 l' e5 E( }. h6 g
  48. #else0 J5 ?' Z% u4 z- {& G+ x
  49. #define DMA_PRINTK( x... )
    & \; V7 Z" S2 W6 `" O: `
  50. #define DMA_FN_IN6 F$ }' l, o! T9 _& p
  51. #define DMA_FN_OUT. L* J- D9 i7 c! g" z
  52. #endif
    : X9 |8 ?2 U$ h. W5 o

  53. ( l; x2 E1 b1 N& U* i) E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 I4 r& w5 ^) J0 y
  55. #define STATIC_SHIFT                3
    * r$ _% S' |2 H5 Z  |* A
  56. #define TCINTEN_SHIFT               20/ B4 O/ f/ t5 c1 y8 q7 m" ]# i
  57. #define ITCINTEN_SHIFT              21- a: B/ c5 T) o9 ]0 M
  58. #define TCCHEN_SHIFT                22+ V+ e/ L- T" ]: Y- E0 x% l1 ]
  59. #define ITCCHEN_SHIFT               23! ]' X. r. {# S

  60. 7 {$ K  }% G( h$ _8 H
  61. static volatile int irqraised1 = 0;  v5 e- M1 Y& |) h
  62. static volatile int irqraised2 = 0;, D% y! S. R4 d
  63. 7 U/ @0 y1 Z3 Q. E0 c, f6 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! w2 \% N4 v" }  m% ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 b; \1 H8 v  G, S. J- [$ u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 [: @8 r& s) r2 E$ ?
  67. ' r" F. f0 f: U: Z" O1 `
  68. dma_addr_t dmaphyssrc1 = 0;
    : D7 L" `! ~3 T0 J
  69. dma_addr_t dmaphyssrc2 = 0;/ k. \7 Z, c* `- Y) B6 J) _4 N9 S
  70. dma_addr_t dmaphysdest1 = 0;3 x0 a/ ?$ `' q- a
  71. dma_addr_t dmaphysdest2 = 0;
    ; y; @1 s# v- M9 X2 u( t; ?

  72. 1 H8 s1 Z. H% C0 |4 K
  73. char *dmabufsrc1 = NULL;: H! A' V* Q3 l
  74. char *dmabufsrc2 = NULL;! P/ U% ^+ X- |6 y; f
  75. char *dmabufdest1 = NULL;  }8 r  x7 C6 I2 J+ M* h
  76. char *dmabufdest2 = NULL;
    ) n( K8 r" R0 E
  77. 0 k; t- v8 P2 v+ d9 W
  78. static int acnt = 512;* k  j9 |* s9 f  S# m# H
  79. static int bcnt = 8;6 @* v, ~6 {" D5 n5 V1 y0 W. E/ w
  80. static int ccnt = 8;
    " ~% B3 V5 }" F$ W

  81. 1 C6 Z* D5 N# H$ z2 O% ~3 c) N
  82. module_param(acnt, int, S_IRUGO);
    1 t% Y9 F6 x) t4 R( G, d
  83. module_param(bcnt, int, S_IRUGO);" \% w* r9 `  ~% u1 ~5 M- B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 S; E. ~/ a# d8 `6 b
* T2 o& u1 a8 j/ a3 R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 Y) a/ T  ~9 Z' e. j
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 S# p. K8 i8 i4 ]3 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  Y$ H- c6 N1 _# f% Q, q# V7 X
2 s+ e7 y; Y: `% ]; R$ R- p: ?& m- t5 e2 }$ M5 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 22:10 , Processed in 0.039080 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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