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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) p# y9 d* ~2 o) ^/ p
  1. [code]EDMA sample test application
    ) t3 C9 Y0 Z6 \3 B- t
  2. /*5 ?2 A+ c/ T; l2 L4 x
  3. * edma_test.c
    5 w( j/ y) a: q, I1 I0 p
  4. *8 I3 Y( `! z/ y% Z: c: [+ l) I
  5. * brief  EDMA3 Test Application% K5 L  {9 U1 l' f7 V/ l7 B8 M
  6. *% c1 N6 l  C$ k/ J5 H9 W
  7. *   This file contains EDMA3 Test code.4 ?" X. Z! @( o, F
  8. *
    + e+ ^) p2 \$ {% B  {9 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ e3 i" m  Q! }: O/ q7 i/ C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- h0 w2 |: a& [# c3 {0 l: ^
  11. *         TO CHANGE.
    & N- a  Q, I" i  I; }) W8 C* D7 l
  12. *
      }6 f4 G8 }  g7 o6 ]! x. ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " ]9 z; Y9 Z7 {( W0 w2 @; _# U  c
  14. *: P. k5 b' o2 a* Y1 l4 H, S
  15. * This program is free software; you can redistribute it and/or: A6 c. N$ I/ z( L0 E6 P
  16. * modify it under the terms of the GNU General Public License as
    / Z- n- {$ q2 R1 H+ ^% `6 d
  17. * published by the Free Software Foundation version 2.
    ' g7 S5 C. ~  ?+ F3 z' `* k& Z& Q
  18. *$ I  C9 t8 T6 x' S# X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - g2 a, O8 `6 C" T8 e1 t
  20. * kind, whether express or implied; without even the implied warranty0 ~: a: L& {) T$ z* }  K4 `5 r2 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: I$ `: I/ r8 U% {- S2 E2 c
  22. * GNU General Public License for more details./ I4 L) ]" X# ^; e- T7 @
  23. */+ V$ T' C3 n8 n$ k

  24. 8 v0 K9 N3 z8 y3 w$ S- P
  25. #include <linux/module.h>0 j/ c3 ~2 x9 B
  26. #include <linux/init.h>
    1 X; j5 X4 m/ `/ O
  27. #include <linux/errno.h>4 A/ k% E, u. B4 E4 ^
  28. #include <linux/types.h>2 {" L% k* W8 S/ _$ V9 W. X
  29. #include <linux/interrupt.h>8 I$ R0 f3 q+ o. J' X7 w
  30. #include <asm/io.h>
    0 U9 q+ v" g: L  Z) Y
  31. #include <linux/moduleparam.h>
    ) L% q* n0 ?7 v+ }$ i2 U4 w
  32. #include <linux/sysctl.h>
    $ T  _1 M" W% {8 [3 o; X3 c/ y1 k
  33. #include <linux/mm.h>
    - R) l. |) i3 c/ Z. P1 q7 c
  34. #include <linux/dma-mapping.h>
      T" d& d: J; L  d# i1 m7 Q

  35. 0 L; \+ ?! D9 T
  36. #include <mach/memory.h>
    - s! U$ p$ K$ K0 ?: o
  37. #include <mach/hardware.h>4 S# w" D. ^) [
  38. #include <mach/irqs.h>/ [6 G7 F" g; I8 r0 d! h
  39. #include <asm/hardware/edma.h>( c0 a; E4 l; B5 r  o$ C# ^8 V

  40. + I$ p+ x+ k7 ~' l$ v% `' t( F
  41. #undef EDMA3_DEBUG
    ! _/ k) u5 C4 ?9 W; [4 C$ k4 j
  42. /*#define EDMA3_DEBUG*/
    2 [8 K& u& ^) {/ P1 r: p

  43. 3 T3 t) ?8 Q$ K: R1 {
  44. #ifdef EDMA3_DEBUG
    7 J5 |6 B7 v# R5 L; `6 \0 f% s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - g# B% d$ n4 C, V7 K. f$ g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' Z, \8 n+ a5 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 x. |7 r% T% |0 X% D0 [- K7 F
  48. #else9 }9 n% N7 h- K" ^
  49. #define DMA_PRINTK( x... )
    / q/ W% o/ r' P- c' }: I& f
  50. #define DMA_FN_IN
    7 R! m% q2 R4 P6 M3 i( v
  51. #define DMA_FN_OUT
    ) {& b2 r- ^. V5 x8 e9 A! [
  52. #endif( Y) _6 P' g* z( J+ v3 Q
  53. " G2 V; I  E# ~1 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 l6 P! j& _/ c0 I4 w
  55. #define STATIC_SHIFT                3: L, x* v9 i( u, r0 j: w" J; f
  56. #define TCINTEN_SHIFT               20
    0 X. |0 j( \  m$ E6 f5 O" k
  57. #define ITCINTEN_SHIFT              21
    7 e/ x1 O) X! H6 k
  58. #define TCCHEN_SHIFT                22
    ( r/ ]' s3 @: d. d
  59. #define ITCCHEN_SHIFT               23" Y$ Q( q9 R8 c" _; o

  60. : X- B7 K  [$ O5 n. g
  61. static volatile int irqraised1 = 0;
    0 o/ e" }' T' J  T' _: o" V, k8 l  q: ~
  62. static volatile int irqraised2 = 0;
    ( b: J8 Q+ O+ C1 {4 u% P' h

  63. 3 z5 a4 G/ G7 \5 W9 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . `" R: a1 W3 ~+ N+ p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 G8 g! n9 }, N% i# L% w; g  U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" d2 N3 n! F5 v% e
  67. + f# s' [; {+ |! O, G8 ]
  68. dma_addr_t dmaphyssrc1 = 0;
    6 B0 [# T2 r" U
  69. dma_addr_t dmaphyssrc2 = 0;1 \" H" H) _4 u5 e* S: b8 l9 ]
  70. dma_addr_t dmaphysdest1 = 0;
    , x; v* C7 e0 d% U% L* \/ H7 n# d" G
  71. dma_addr_t dmaphysdest2 = 0;! l( T! E! u/ ~5 z9 s
  72. ; J- G  L/ E0 r1 G
  73. char *dmabufsrc1 = NULL;/ \3 r3 Q9 j: \7 u- K# [/ v7 d
  74. char *dmabufsrc2 = NULL;8 A& m8 {: n% ]! t9 e
  75. char *dmabufdest1 = NULL;
    4 M3 T% n3 K1 }" e
  76. char *dmabufdest2 = NULL;
    . K9 M; j1 N+ l) |9 B- J

  77. * n' J5 I0 Z! w/ \  L
  78. static int acnt = 512;* M+ W& F# P" {7 H" r
  79. static int bcnt = 8;
    ) }" }$ Y8 O9 A; i2 x% S
  80. static int ccnt = 8;* H3 s8 B3 u6 I; C
  81. 3 ~9 N& C9 J) U) b% ^' S# ~' h
  82. module_param(acnt, int, S_IRUGO);
    $ {) P8 |( Y  I% z
  83. module_param(bcnt, int, S_IRUGO);
    + R* l9 M2 ^! J. g6 |7 J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  T: f: s8 M5 ?6 Z9 d# O3 s' H* _
7 I! ?( o7 K( W$ f' f8 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. u: A% ^! L& `. |2 c* M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( i+ J& a# _6 E& n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# U; |- l, Q. u: Y' v9 O
0 a( J; N( D/ j5 D8 O0 E1 ?9 K
" m6 D  E6 [5 y5 V& G+ e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 13:17 , Processed in 0.039309 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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