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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * j. J, O. S7 i+ E$ w; y
  1. [code]EDMA sample test application
    / k; g5 o2 }; D" o1 z
  2. /*5 m5 T- S: D5 Q3 d
  3. * edma_test.c
    0 Z! V! ?2 M; e; C+ `1 v0 o
  4. *
    8 [6 j; t# q1 G' Z) l
  5. * brief  EDMA3 Test Application1 O& o5 A/ o2 I6 V
  6. *
    * A4 K4 _" \" v) S; l% ~8 [5 D
  7. *   This file contains EDMA3 Test code.
    4 U1 h$ q- a9 C  C
  8. *& ~$ R' b/ o( x) Z, P0 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 g0 Q  K4 D2 x0 R) h8 O9 t5 v$ m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ h" T1 }- P7 ?$ f& `$ j2 m
  11. *         TO CHANGE.8 S7 R; S" c, ]5 l
  12. *
    $ }9 N/ I2 E; b/ |9 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ [8 {$ @8 a0 Y, P& ~# `6 l2 N# C
  14. *
    6 o0 D! a/ u; ^9 w) q
  15. * This program is free software; you can redistribute it and/or9 Q( \& Y; v5 N" [% d$ v
  16. * modify it under the terms of the GNU General Public License as
    % f# D% z( N# x# y
  17. * published by the Free Software Foundation version 2.
    5 o8 r5 m) M; j; K
  18. *
    % I) k; F+ t, B! @' q- j  m5 [) r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& D1 G5 g% |4 q  e) W" F
  20. * kind, whether express or implied; without even the implied warranty
    1 D9 T1 m0 ~" i2 O: C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 L5 V% p$ S1 r# ?, q
  22. * GNU General Public License for more details.6 |7 b8 e7 D9 T! g7 W
  23. */# l0 [8 q! b/ j. J5 @, k- j

  24. : @0 H  t; p) C7 [
  25. #include <linux/module.h>
    ( G1 j3 O4 d6 ~1 G
  26. #include <linux/init.h>  c, G' d$ b" g0 S# a& y
  27. #include <linux/errno.h>
    ! Q- C0 H" k; B0 C1 r1 M  Y
  28. #include <linux/types.h>3 h$ n( r$ z( P: Y4 I
  29. #include <linux/interrupt.h>1 o! d) h3 x" W* }
  30. #include <asm/io.h>
    . ?6 K" b; y7 {  Y, h9 R
  31. #include <linux/moduleparam.h>8 ^7 m# t( {% ]3 v) P+ L1 c9 k
  32. #include <linux/sysctl.h>
    * ^" ]2 l2 F; M
  33. #include <linux/mm.h>
    " f6 }- V2 k% S4 R- c
  34. #include <linux/dma-mapping.h>
    , j  O- n. ~1 T8 q0 X7 ?

  35. ( \/ r! {/ B- Z* @. J! u
  36. #include <mach/memory.h>% z! [: z4 v! ?4 n4 T
  37. #include <mach/hardware.h>3 [% i- l7 Z" `6 \! V
  38. #include <mach/irqs.h>
    ) S+ c2 G; }* s  k# K7 E
  39. #include <asm/hardware/edma.h>) M8 F# V3 c" p" v0 K( b+ G
  40. $ l* e6 V: U. \% i4 i1 w9 n0 |- b
  41. #undef EDMA3_DEBUG, Q" M: D4 z3 R$ S" u8 q4 Y: x) A
  42. /*#define EDMA3_DEBUG*/) m: ^8 ^- a9 R$ k0 i; O* }# A
  43. 2 u3 }5 w5 D, P7 {7 i9 q
  44. #ifdef EDMA3_DEBUG, N' k+ ^/ h2 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 K# p) b6 b' _' m) y$ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * q  T% M+ L5 `: t4 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) ?  S# @' R* [% }) w  {( }' x* z
  48. #else
    6 D; F9 p6 i0 ^/ y) B
  49. #define DMA_PRINTK( x... )0 K( U+ d! D: `/ k. ^: e; |
  50. #define DMA_FN_IN
    : y, ^8 L* |2 t2 ~* l9 n* R
  51. #define DMA_FN_OUT. l0 ?6 m+ B1 {5 ^0 L, Y5 t
  52. #endif
    0 c+ r! p7 R( V$ v+ N

  53. 8 ?( U& v7 B  F; B' m9 r8 o1 ?, J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( S2 T' }9 p; x& H7 `: {; V( q
  55. #define STATIC_SHIFT                3
    % k8 \; p# H) J. Q. d1 h
  56. #define TCINTEN_SHIFT               203 a* r, _4 ~' Z( o- f. J% K
  57. #define ITCINTEN_SHIFT              21. Z- i( M/ x+ j3 `2 c3 }, }
  58. #define TCCHEN_SHIFT                22
    - t. y8 R% z# x
  59. #define ITCCHEN_SHIFT               239 b  C" }" G, \! c7 z1 z: T, R

  60. 6 g' u' n7 k) m+ ^+ G  a8 {
  61. static volatile int irqraised1 = 0;
      J9 S4 M2 P& ~( |
  62. static volatile int irqraised2 = 0;! w/ L: j8 k0 {" X" b  Z+ r
  63. , j0 k& A2 C$ T4 h# z" l0 q8 }/ V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 y7 o2 i. z) z4 v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 H0 k+ q: ~5 f) ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 Y! X+ d5 @9 m& u' R& u, Q$ Q; k9 n3 G

  67. 0 z" D# h1 m- i
  68. dma_addr_t dmaphyssrc1 = 0;
    7 Y, j/ ~# W6 p  S5 P
  69. dma_addr_t dmaphyssrc2 = 0;
    4 E! V8 k1 \2 R# f  x, H& o. S
  70. dma_addr_t dmaphysdest1 = 0;6 Q2 f) _8 R9 I+ X9 n9 x: ^
  71. dma_addr_t dmaphysdest2 = 0;
    ! G$ C+ o/ A& h! y

  72. : |! M2 d& g0 K1 ]
  73. char *dmabufsrc1 = NULL;) c& ]# @( x& B/ `; u$ E! p
  74. char *dmabufsrc2 = NULL;
    - m* ?0 R# H9 e
  75. char *dmabufdest1 = NULL;  B. v! C4 Z: \- y
  76. char *dmabufdest2 = NULL;# `% Z' V( L4 @1 o2 \# y
  77. - E3 n3 W$ g2 P& {8 }. K4 I
  78. static int acnt = 512;
    1 S, C: e( h0 x; j4 V# x
  79. static int bcnt = 8;" M8 ~9 f' W) L9 F# l; F- b" x" |
  80. static int ccnt = 8;' f0 _1 u! u6 O9 U' Z

  81. 2 O# i% b6 C3 [' m, N& g: c
  82. module_param(acnt, int, S_IRUGO);8 H. ?3 s5 f/ v/ \5 a
  83. module_param(bcnt, int, S_IRUGO);! d6 ~9 r& Z4 x1 x; s
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- |; C& N" G0 L
; h; U) m, k& w7 d/ `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ^/ [9 x8 C, H- e" ^$ 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 z' \9 H$ S0 @2 m  L/ X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 F# h6 @, h8 g' }: F* Z
1 I2 ]. v, ?1 ]: O( @

) @) p- N5 D7 L7 ~% n% D, P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 04:03 , Processed in 0.039431 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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