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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 s/ D3 l- R: q8 `
  1. [code]EDMA sample test application$ s9 n* W/ O! V4 h2 ~
  2. /*
    ! h1 c% V$ I+ c9 x
  3. * edma_test.c+ K) X8 _0 E5 {' l6 A. b6 S
  4. *" i+ ]9 f5 f- B+ i9 m; F
  5. * brief  EDMA3 Test Application
    % h6 `. Z8 o- |& r& w3 H
  6. *
    3 e3 Q3 J: g! J0 v
  7. *   This file contains EDMA3 Test code.
    $ T9 ~# O2 r! R: G. e! S6 y: R# u% i
  8. *- a- f* n/ L; Q5 J* u& W+ u3 v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " l( t# M" s5 t! s; q. c8 p- q& d" b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 n; b( @0 _9 d- T0 q2 J+ d+ L/ Z
  11. *         TO CHANGE.& }' p* L' p8 U# [& ]
  12. *
    ( F$ S& S1 Q* |  a( p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * ~, h, ]: \4 F8 G+ N( Z
  14. *
    ) q. F/ b( s- S
  15. * This program is free software; you can redistribute it and/or
    ) ~& K# B# Q* y6 L
  16. * modify it under the terms of the GNU General Public License as6 m8 c1 \% {5 b2 u0 p: u/ P
  17. * published by the Free Software Foundation version 2.
    / @% m, K/ W4 Z- r0 j
  18. *1 M) [, Q- @9 l$ l: Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ P% ], Z/ d2 s0 |
  20. * kind, whether express or implied; without even the implied warranty; a- E$ z2 p: n7 _' d* F' b. }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 N) z+ z( ?+ |6 o( w! N8 `
  22. * GNU General Public License for more details.! z% r8 w2 o- z) z2 d
  23. */
    ( L  \' R7 i9 ?, y! a1 C! \

  24. : }( j2 B" O' O' m% o
  25. #include <linux/module.h>0 ~+ I$ A+ ^/ m. y. _: ]3 X1 i* ~/ p
  26. #include <linux/init.h>
    1 r3 |8 J) ~' l1 G* B: i6 }1 J6 ?
  27. #include <linux/errno.h>
    ; ]% B7 R' a  h: M
  28. #include <linux/types.h>
    - [$ u3 w" W/ K  i- Q5 I
  29. #include <linux/interrupt.h>- e, Y2 |1 W+ F# @$ ^+ r( P
  30. #include <asm/io.h>' T) q2 a1 Q# c1 ]9 p
  31. #include <linux/moduleparam.h>" A. W/ F* P3 g" P% ^/ A
  32. #include <linux/sysctl.h>7 w" u7 S, v+ N- L$ }7 k
  33. #include <linux/mm.h>6 i: @1 V* @  S2 \
  34. #include <linux/dma-mapping.h>
    # P( f& w: C( \# \
  35. . P6 z' \5 S9 l8 ?, H% I# q
  36. #include <mach/memory.h>
    * b! j  `! z, @3 i* ^' V# j
  37. #include <mach/hardware.h>
    7 Z8 A: Z4 J) Z# y/ E
  38. #include <mach/irqs.h>+ m1 j) E2 h# ~/ T" b9 S+ }
  39. #include <asm/hardware/edma.h>' N0 L1 H- ]6 U1 \6 [! d6 n

  40. # |* ?6 u: q& k9 y7 a; i/ P
  41. #undef EDMA3_DEBUG
    6 \1 [: @7 E% m
  42. /*#define EDMA3_DEBUG*/$ c- Y! G7 |! g) z) t* r( C

  43. ! [; n) g0 s$ t5 g
  44. #ifdef EDMA3_DEBUG
    + R3 o; E) n. B) U" o3 [9 F, T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - ~/ s0 p! [0 U) t3 f; {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 r; f8 ?( j: \: u- d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - h( ^, k. N2 H  p: {+ A9 J7 p
  48. #else
    4 H9 a6 t/ {. Z; u
  49. #define DMA_PRINTK( x... ): ~! Y% h" O- o& S4 N" @0 [
  50. #define DMA_FN_IN5 {5 T7 M/ U; b! h+ f# F: I# u$ D1 ~
  51. #define DMA_FN_OUT
    # h" [6 R$ B/ Q9 V8 l/ ^
  52. #endif
    . Z+ E1 }  e! O; h" d' S  U/ W

  53. 9 _( N+ P" c: y1 s1 M  W$ F. W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' M# z" l  d4 o+ i6 q2 J
  55. #define STATIC_SHIFT                3
      X& ~$ g6 Z: ?; H$ ?% J
  56. #define TCINTEN_SHIFT               20" O, S2 F/ W- [
  57. #define ITCINTEN_SHIFT              215 O( @- [" k# d8 S1 r' ^
  58. #define TCCHEN_SHIFT                22
    4 n, O8 O9 A# A$ U& b
  59. #define ITCCHEN_SHIFT               23
    ' Y/ M! M' F$ A- [
  60. 1 w& V! Z% `& m) o
  61. static volatile int irqraised1 = 0;
    1 {9 H* |0 y3 b" A$ m5 V
  62. static volatile int irqraised2 = 0;
    , j- r8 E' J; [; o$ u
  63. , s5 `" k  g! z5 O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( o4 K( L" [/ v$ g  q4 C5 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 s' z: x* Q& X3 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! _7 Y) m. K( w
  67. $ j8 U( j7 |$ H# ~- L0 L: r
  68. dma_addr_t dmaphyssrc1 = 0;" u+ B  j6 P6 u* z. K9 a2 t
  69. dma_addr_t dmaphyssrc2 = 0;
    & {- r  }8 p6 F# R6 g. @$ ^4 v4 K
  70. dma_addr_t dmaphysdest1 = 0;
    + \7 W2 u1 @) z7 ]8 }  I' Q
  71. dma_addr_t dmaphysdest2 = 0;' P9 ]+ D" K$ q* C( D8 u) G

  72. 9 x, G, j5 J, u$ q' [/ o8 R! s
  73. char *dmabufsrc1 = NULL;( d, H1 [8 s, j0 H9 U8 j2 Z
  74. char *dmabufsrc2 = NULL;$ s  {+ w+ E$ ?
  75. char *dmabufdest1 = NULL;/ R0 e- J2 Z* T2 v: n" C( R+ ~
  76. char *dmabufdest2 = NULL;5 D/ T2 D" B! d2 D7 f4 w$ d

  77. , s; N% O1 r7 S! Q& s7 Q+ X: Y
  78. static int acnt = 512;
    " a! [9 i/ A: o! k8 u
  79. static int bcnt = 8;6 ?9 H1 V" N, l4 I; \# G8 x
  80. static int ccnt = 8;
    4 _# @) E, k7 m4 Z2 i2 E

  81. 3 @4 x5 [* D6 i+ _
  82. module_param(acnt, int, S_IRUGO);+ p5 M* |6 l& C9 r" y8 B, Z' D
  83. module_param(bcnt, int, S_IRUGO);& q. F# C0 X# I9 Q' }
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# j' {  z2 ]2 q, s7 I

) W. e+ v3 w# r! V6 j+ X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 h7 _( `: ?9 ~! r4 ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 o* M0 {9 w. U  j$ t6 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ R2 i1 z3 @6 L/ i8 `2 ]- u5 t) W( b

& ^0 ~6 D+ u% w' Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-5 20:37 , Processed in 0.041276 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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