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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& P& Z# g, s0 }0 `- O1 j% D
  1. [code]EDMA sample test application
    + E8 B7 W3 C& ~1 Y$ g
  2. /*1 i7 u, v2 a/ V; V
  3. * edma_test.c
    9 o; ~' `; B$ s# K# r' u
  4. *' Z' ]2 ~: M2 y8 R! h
  5. * brief  EDMA3 Test Application
    3 u4 |) z7 b2 P/ f* y2 H% K
  6. *5 d5 u* ^$ D5 i; @0 H" E& t
  7. *   This file contains EDMA3 Test code.7 b) h- e2 a6 T, W" t- b
  8. *' }. n6 e- v# ~1 U# C5 I' H' y; t# _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 o; y4 N$ G! D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! z( t7 a( p, l, Q! v9 y1 q
  11. *         TO CHANGE." ~" ~$ |: u) |
  12. *
    ) H1 J' G' f5 x& u% j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 w! }+ {( N3 d4 [4 ^4 b8 G% h
  14. *
    ! `8 I) Q; Q4 @4 h$ C$ T9 V
  15. * This program is free software; you can redistribute it and/or
      V, {& v3 Z/ ?& Z4 \, i1 C
  16. * modify it under the terms of the GNU General Public License as2 [2 K$ X3 c, i' i- G
  17. * published by the Free Software Foundation version 2.
    / s  o1 b4 O; J+ b- P, v5 B; B. q
  18. *1 d/ S. P! D# g6 w4 B# a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 B4 Q* O, N- }  V; O# T
  20. * kind, whether express or implied; without even the implied warranty! P+ q0 i$ W7 k+ D8 G9 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( D2 z" w" n* t& M. z- y7 N
  22. * GNU General Public License for more details.
    $ S( P& I3 C& p! a( N
  23. */
    3 C: b) z. ^! F0 g

  24. 3 k  R+ H2 m4 f0 a; Q8 X6 k% W
  25. #include <linux/module.h>
    5 U0 f& w7 C# k* Q8 p9 J. f0 b
  26. #include <linux/init.h>4 F  n* w6 W+ `! T0 r
  27. #include <linux/errno.h>" K% Q  p$ S' ]4 \  ?1 t/ g4 c& i
  28. #include <linux/types.h>
    - m6 p4 I! _  C, s& Q" j3 F$ D
  29. #include <linux/interrupt.h># D8 F5 E5 B; ^9 O$ `+ S/ u$ w
  30. #include <asm/io.h>
    ; j( h: L) p+ a1 Y8 r* h, D
  31. #include <linux/moduleparam.h>4 ?" `9 g1 t2 e& t8 T4 u' q
  32. #include <linux/sysctl.h>
    5 l8 t5 L+ p  T8 v
  33. #include <linux/mm.h>
    8 q2 e  _6 C7 D% Q
  34. #include <linux/dma-mapping.h># p. A; {1 E5 P2 \, N% h
  35. . t  x* m$ c" g8 L+ G% E
  36. #include <mach/memory.h>
    0 y: ~* n2 k; Z) m8 Q6 K
  37. #include <mach/hardware.h>
    7 D' b1 P# d0 |) s
  38. #include <mach/irqs.h>
    7 I" m  z9 T, Z6 }7 d; L. E: k
  39. #include <asm/hardware/edma.h>
    / X1 [6 v! V4 c# \6 K' g, P
  40. , M# N+ p1 h3 X5 v
  41. #undef EDMA3_DEBUG/ D5 M0 V; I3 T
  42. /*#define EDMA3_DEBUG*/! e) a/ o8 e4 a; b

  43. " Q4 u: R; m3 h) {! a* h- ~
  44. #ifdef EDMA3_DEBUG, B9 [- ]( |1 [9 O, l1 G' q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 N' F& {( H/ p# ]' Y" C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ L5 a) d: I0 b7 V% d; y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). s+ y; W" L+ }: H/ D$ a' t
  48. #else% f- q- N. r6 V1 y& N3 Y
  49. #define DMA_PRINTK( x... )% V4 K4 }: w' e2 n4 g* ~  E1 l
  50. #define DMA_FN_IN0 P- H0 V+ [# L9 e5 K+ h7 S
  51. #define DMA_FN_OUT
    2 V5 ^% C7 U7 j$ S4 S" k6 q4 `7 N
  52. #endif
    $ I& G1 [6 A7 V0 d6 B7 P8 ]

  53. 7 Q  c- N# f& V/ |- P2 w3 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): `3 _1 T0 ?/ v- t/ I
  55. #define STATIC_SHIFT                3
    " C% ^. V3 T* Q$ F6 f5 |% P
  56. #define TCINTEN_SHIFT               20
    " b1 {( m! {; I2 H2 C- |( c
  57. #define ITCINTEN_SHIFT              210 ^, Y& W/ G' S. V" ~1 {% |- {
  58. #define TCCHEN_SHIFT                221 C$ T9 l4 ]# O4 F1 T9 N2 N
  59. #define ITCCHEN_SHIFT               23
    ( I0 q$ X) O- K/ D, v6 I: M7 S

  60. 6 p  }5 I5 c2 o; l
  61. static volatile int irqraised1 = 0;
    0 }8 l% b. a) X) `/ A
  62. static volatile int irqraised2 = 0;4 f' l* X5 G* s& k7 @
  63. & X, M* I# b, T  k- i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 e8 m6 ?, o+ ]5 ]) ?3 K  {6 e+ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + t3 @/ H( y! m) B+ z8 C- u0 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) |) ^( ?) T2 Z; v" Z0 q( C# B" P

  67. 3 S+ o4 o, _, @2 H# n4 D6 k8 N
  68. dma_addr_t dmaphyssrc1 = 0;
    ( i/ r+ R, i+ Z2 T+ ^! I5 {
  69. dma_addr_t dmaphyssrc2 = 0;0 @" H) N& q$ @$ I: A' b+ C
  70. dma_addr_t dmaphysdest1 = 0;: x7 o8 _! Q4 w
  71. dma_addr_t dmaphysdest2 = 0;
    + h' h/ V; m& B5 e

  72. ( T2 B/ z" `' E9 _/ q6 k) j
  73. char *dmabufsrc1 = NULL;$ L: T( E* v8 c+ }: o. H
  74. char *dmabufsrc2 = NULL;
    + b! V+ Q- S  n8 l
  75. char *dmabufdest1 = NULL;+ b6 G* [. `1 {$ [; R
  76. char *dmabufdest2 = NULL;
    0 \% U* O" d% I! C) \
  77. 5 r6 x. i  p6 P* O
  78. static int acnt = 512;
    ( G" I9 X) q0 a5 j
  79. static int bcnt = 8;- O' T( I; h& X/ p3 Q5 c( U
  80. static int ccnt = 8;  `- ~* _" Q2 L6 G! q  o* D' r9 D

  81.   ^! q3 l% I  P! B8 Q
  82. module_param(acnt, int, S_IRUGO);
      M$ K0 j% f5 W( g. E' p4 v
  83. module_param(bcnt, int, S_IRUGO);
    - q; V1 j6 S, Q0 J9 ^) k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 J, n% O4 x" E2 R3 o4 l1 |. Q: R- ]3 h. [% }- n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 m% a8 J( e2 S3 G# Y6 O6 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( V2 E% d1 l( k, j- V: a  _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 Y5 c; S) ^3 v" G$ k
' w. s) g* s* M+ B+ C- Z0 n( D/ \# p, `1 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 10:07 , Processed in 0.039041 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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