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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 J6 N! _; u$ s5 s) T8 r" r
  1. [code]EDMA sample test application
    0 Z7 z2 h! |1 X0 P
  2. /*/ G9 R, h) g# d  Z* ?8 w  B; ?) d
  3. * edma_test.c
    0 S# T7 [+ E8 D9 }  |7 q
  4. *( z% `6 V2 f8 U
  5. * brief  EDMA3 Test Application
    $ E% L% {  d5 r- A  x
  6. *
    4 E2 {6 a- _) L6 v" p3 }# S
  7. *   This file contains EDMA3 Test code.
    ! c6 N  L- l+ O2 F& m( @6 e
  8. *8 ^2 p9 K; e( c' L) t' N$ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / E; L! k5 W* ^4 v8 d1 ~& Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # U* J9 d, g" [% U1 O8 T1 @
  11. *         TO CHANGE.
      h" v9 d& v2 ?1 |! Y- Y& V6 n
  12. *
    9 }- ?# {9 g* f6 O! D, f2 H; C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& d4 U' E, I$ q4 H% R' n
  14. *+ V! H( A# L) F9 L0 s5 p' F) }
  15. * This program is free software; you can redistribute it and/or
    3 ^6 u0 z. M( N" k+ p. o3 O
  16. * modify it under the terms of the GNU General Public License as
    $ y5 D, _, O( ]8 g8 P& x: }
  17. * published by the Free Software Foundation version 2.
    0 f) L; m# _4 z  G
  18. *
    ! s1 @/ i$ S# P0 ^' A" y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! @' S. P# q* i# Q
  20. * kind, whether express or implied; without even the implied warranty
    & T" a; p4 }1 L7 e; F& V+ w! Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 d- a9 |2 e6 `8 H. [  U
  22. * GNU General Public License for more details.  H0 Y7 O% Z6 i! v. S4 c
  23. */6 u1 P; w" t7 M( N# e% N  i! _

  24. , i9 u. t  `) j, O8 h  X% g" w
  25. #include <linux/module.h>" t+ z: g7 i! M& e
  26. #include <linux/init.h>
    4 t% f  }: \3 ]; o, K" x4 I7 v
  27. #include <linux/errno.h>9 x  \; E( Y0 P1 {" U
  28. #include <linux/types.h>9 f: t5 [% r/ w: W
  29. #include <linux/interrupt.h>
    5 c1 M, `3 V9 G
  30. #include <asm/io.h>& D2 C9 x$ ~; i* h, t( F* h( L
  31. #include <linux/moduleparam.h>1 j' r! `. [9 Y4 k+ u
  32. #include <linux/sysctl.h>
    ' @9 Q2 V6 O* A+ {# J- V
  33. #include <linux/mm.h>
    + y- _% o* I+ W6 _/ ]6 n2 Q- E0 x
  34. #include <linux/dma-mapping.h>% j; |0 g9 r0 q

  35. % T! j  K0 d/ L% ]5 g, x
  36. #include <mach/memory.h>3 ^& X4 |$ o  G7 [6 N& d7 r
  37. #include <mach/hardware.h>
    6 v  f$ C( H0 ?$ T' J
  38. #include <mach/irqs.h>
      r6 l! x! `0 a. H
  39. #include <asm/hardware/edma.h>
      \2 {" }9 j/ P* |$ \* ^

  40. : Z; |3 @9 V+ Y) ~9 B
  41. #undef EDMA3_DEBUG
    3 C5 U! ?' p# l# u; ]3 w  ^1 {
  42. /*#define EDMA3_DEBUG*/8 i' B( X7 [: c5 S" q$ O
  43. ( z) r1 ]/ j; K/ o
  44. #ifdef EDMA3_DEBUG
    $ L1 m: f9 D6 C& m! [  {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ O1 R0 f- D! q4 E# ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- s# }2 ~/ ~6 l0 `4 Z1 ?8 K( q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 z- Z1 O8 G4 J  d  l" U# u0 f
  48. #else
    ; e7 _; z; {! [5 ^- K3 }
  49. #define DMA_PRINTK( x... )
    9 a- G* U1 f+ w  N: w
  50. #define DMA_FN_IN
    2 N- I  A; K* F4 r4 z
  51. #define DMA_FN_OUT
    - L" D, w+ n6 }1 n8 q# B8 b
  52. #endif
    : f5 s+ \) c+ E% W

  53. ) @+ f( `  B1 |/ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 o$ ^+ d6 F$ X8 \6 @" ~
  55. #define STATIC_SHIFT                39 g$ U, Z7 v2 g9 V
  56. #define TCINTEN_SHIFT               206 l+ S6 i" G  H: m' m
  57. #define ITCINTEN_SHIFT              21
    . y/ O# k  S* Z6 r6 Z1 ], a  z
  58. #define TCCHEN_SHIFT                22
    1 J; j6 l" M" q& Q( O: w1 k
  59. #define ITCCHEN_SHIFT               239 _0 D. C3 @2 E7 F3 b
  60. ( [: A0 v9 m" R- \; T# q( l! r, Q
  61. static volatile int irqraised1 = 0;2 F- O8 x4 R, F' v
  62. static volatile int irqraised2 = 0;/ \- g) q8 ~& X0 D( W: B7 K+ t: K

  63. * u* w8 B& w! X' K& ^; W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E2 ~! O& T- }1 u& \- k# a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% b& Z3 v" h( i1 j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& s8 v$ e) V: B- x1 b; w

  67. : i, G+ m" X1 U
  68. dma_addr_t dmaphyssrc1 = 0;
    1 a; d; t$ C0 r, T, [' \
  69. dma_addr_t dmaphyssrc2 = 0;6 F, F1 c+ X1 r; y
  70. dma_addr_t dmaphysdest1 = 0;% Q9 W( C3 r2 m
  71. dma_addr_t dmaphysdest2 = 0;
    ; s& T8 ?9 b) k$ \
  72. / s6 i% }2 n3 C0 a6 H, t3 Z
  73. char *dmabufsrc1 = NULL;: L3 P( \6 K3 |: q7 }0 \
  74. char *dmabufsrc2 = NULL;/ o1 ?# U' Q8 o' n
  75. char *dmabufdest1 = NULL;% V1 y  u4 E, n7 @. ?! ?
  76. char *dmabufdest2 = NULL;
    $ {4 b7 l4 |' v3 F. \9 q) }, \1 s4 T

  77. 6 e7 K- Z2 `" ~; i4 j
  78. static int acnt = 512;
    $ Y) k, D9 l* y6 U6 k3 l  S. ?) S
  79. static int bcnt = 8;
    : H, T. D: A1 F
  80. static int ccnt = 8;  q  ]% b+ V& B: `. B6 u* X: b/ A  c
  81. 4 e5 x' S% D$ A# H. m9 Q! f
  82. module_param(acnt, int, S_IRUGO);& S6 A) g: S0 @( X
  83. module_param(bcnt, int, S_IRUGO);
    9 k  C0 {; i4 ^$ Z% d% I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( t  {  S! Z6 U! d! N. I
/ t) y- n2 c4 k! v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 [& w9 H: q5 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- w9 K) x* x4 T" S  W4 E7 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A7 N* b0 E: H, @8 w1 x( G3 C8 D# K

9 v( l  K/ L: z7 @, K1 D: p' t" J! w* ]( Z) d9 h3 @  _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 19:28 , Processed in 0.052670 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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