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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ^1 E6 U  s. D4 D* J; I
  1. [code]EDMA sample test application9 ?6 [7 h. J" i0 J* D( ^
  2. /*
    ' \, s6 |1 }# \# T0 u- e
  3. * edma_test.c! i: G  v/ Y1 y2 o7 A
  4. *: W1 g* `+ w& b) z3 K
  5. * brief  EDMA3 Test Application
    $ f" F! X' F: i: f7 h
  6. *
    6 c( H" e% S" |2 X
  7. *   This file contains EDMA3 Test code.
    2 q9 H5 z* X* L' e& v  J9 g
  8. *0 [( m% w0 ]+ Y. K0 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( ~3 U: `) B; Z2 ?) x" q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & o* L) X' @0 U
  11. *         TO CHANGE.
    + |" |/ C3 {: H* M$ q# [
  12. *
    / [5 t, x$ Z# x: [4 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * M% @' X. k, V  i( S: a  S+ P2 S% n2 y
  14. *  s& k$ y3 h$ Z
  15. * This program is free software; you can redistribute it and/or& }! \4 t5 w1 L# \
  16. * modify it under the terms of the GNU General Public License as
    % l. a7 W8 ]# V% Q( ?! D) Q: {$ Q
  17. * published by the Free Software Foundation version 2.
    - S4 J4 e( e) i0 {# {
  18. *5 N: ^- d+ a  B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 U8 C. l8 u! T% @1 _
  20. * kind, whether express or implied; without even the implied warranty) l3 ^* u0 Z4 y& k! J  `4 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + V3 B: l( p% Z6 k" i1 x
  22. * GNU General Public License for more details.
    6 e9 P1 c" U0 ~
  23. */
    3 L# ^) t" a) C; g4 h: m2 g" ]

  24. . h& v: I' I7 s- ~
  25. #include <linux/module.h>
    ; t8 L. r; e3 x$ d2 }; h. m
  26. #include <linux/init.h>9 d, u6 n% G& I4 H
  27. #include <linux/errno.h>
    . A- }; q% U/ G' y" k  B
  28. #include <linux/types.h>
    , d& _0 R% W, `
  29. #include <linux/interrupt.h>7 i! q5 A' {! ?0 d9 R8 F
  30. #include <asm/io.h>$ y- E1 E/ H; _9 g" L5 O
  31. #include <linux/moduleparam.h>" x6 d) i& a9 }
  32. #include <linux/sysctl.h>
    + @& q4 h0 {3 n
  33. #include <linux/mm.h>
    ! D- j2 K! ?: K
  34. #include <linux/dma-mapping.h>
    * f- t1 X8 `. r4 A0 }

  35. 6 X1 I" b& r; V
  36. #include <mach/memory.h>
    3 G. C4 \3 e/ O2 W. Z/ }1 E$ i, Y
  37. #include <mach/hardware.h>
    ) `3 X& y6 K6 u
  38. #include <mach/irqs.h>
    9 d8 {# e. p. C; t- Y, }& Z2 {, \
  39. #include <asm/hardware/edma.h>
    / j6 _' n! ~4 [" l2 S5 F1 l

  40. $ [' w- |9 }( Y8 q  w
  41. #undef EDMA3_DEBUG
    * B$ |7 X, Z$ o$ G
  42. /*#define EDMA3_DEBUG*/9 h, _; M9 s6 W9 T2 k* m) ~* }

  43. 6 ]6 \; p+ x1 X# }
  44. #ifdef EDMA3_DEBUG( |6 ?' `% K- @! ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 s% ]& n. l# X# ^( u+ Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a! e( V7 Z/ A$ z% T% }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' \) G4 M7 X: P/ f
  48. #else! K6 D& M* \4 q$ w2 O& u
  49. #define DMA_PRINTK( x... )
    # k8 z: \3 ?$ j. C& ^
  50. #define DMA_FN_IN0 j" M3 P9 \/ _  e8 @: L
  51. #define DMA_FN_OUT; g. c1 y7 y8 ]. [: D) Y/ q  Q
  52. #endif( F6 ~: R2 J% K' E
  53. 4 k- T( @  S0 X3 r  M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 |$ P  A' x, \- [
  55. #define STATIC_SHIFT                3
    $ B/ `2 \5 C' b! u) T
  56. #define TCINTEN_SHIFT               20
    6 p) }8 H+ E3 [- l! n0 }4 O
  57. #define ITCINTEN_SHIFT              21
      t' D9 a' t( S5 T9 X, @# L
  58. #define TCCHEN_SHIFT                22
    : e3 k; U5 q' z. V
  59. #define ITCCHEN_SHIFT               23
    - _6 s7 B& q+ ]  \' |+ H: F# O0 V) S) b
  60. 1 \* K9 k# {; I7 e+ @% L* ^
  61. static volatile int irqraised1 = 0;0 L. m$ p1 [  c- X& g
  62. static volatile int irqraised2 = 0;( K, i( Y, Z& j  [# z8 D7 I+ q
  63. 5 }4 p2 D) B1 R' V- V; ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' t( \$ G) u' o4 l8 h! V
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 q9 x) Q6 o5 W& o5 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 x5 ]0 A+ n0 y7 p3 O) c' l

  67. / M4 E6 O3 |) {9 T& o# f* t
  68. dma_addr_t dmaphyssrc1 = 0;5 _" w8 _% ]" O
  69. dma_addr_t dmaphyssrc2 = 0;
    9 c4 M2 A( F3 B- O" p
  70. dma_addr_t dmaphysdest1 = 0;
    0 J. z/ r1 r, E7 C
  71. dma_addr_t dmaphysdest2 = 0;
    % _! U7 |) Z( n& J) q7 C) H4 i

  72. 9 _: q/ f3 _& v) e
  73. char *dmabufsrc1 = NULL;
    ( z3 j6 V) b/ G9 E0 P7 r$ [5 \% \
  74. char *dmabufsrc2 = NULL;0 Q4 y3 x5 q& u6 l+ }: ^
  75. char *dmabufdest1 = NULL;7 w% B2 O$ q+ e. C. v- c3 {
  76. char *dmabufdest2 = NULL;! s& E3 p6 n6 \+ P2 F% s
  77. / h& }$ H& I6 |
  78. static int acnt = 512;9 Z) }6 F8 h; ?. N
  79. static int bcnt = 8;
    3 q2 y0 F2 `# o! b) P+ z
  80. static int ccnt = 8;
    / F2 f  a; C1 d6 l: W, a

  81. * J% ?8 B; [+ J( n
  82. module_param(acnt, int, S_IRUGO);* B- _5 [+ l0 u
  83. module_param(bcnt, int, S_IRUGO);2 ]( j* }, v% H/ B6 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 L; O  G- ^0 ?2 S  U. f, N
, `" ~; |8 H0 h& d# _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 q9 |: Z0 T; \2 t8 D+ p9 Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& y$ Q; P" q% }/ ~& ~0 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, a) J  i9 o; c2 ^) b6 t9 w- _( y" I" m2 h: ?
- M+ |$ D: F; D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 11:17 , Processed in 0.039209 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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