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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . t) b9 K# O- E
  1. [code]EDMA sample test application' F5 m7 L6 [) s! D" {* r8 i
  2. /*' \$ V6 ]1 _, l- Y& [
  3. * edma_test.c
    7 C; e: S0 c9 h  V* W0 ~# B
  4. *
    7 y& m2 i. s7 i$ l8 p
  5. * brief  EDMA3 Test Application2 u$ {  g- q5 G1 _4 r$ |
  6. *
    + W: N; `$ N0 y9 R
  7. *   This file contains EDMA3 Test code.
    + @" f; v6 S: E) v( `" w
  8. *" {! m4 l, c  q. \8 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " z7 ^. {3 T& |8 E" t/ j( v3 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 K# `! D  B& e0 f9 o) O  R9 z5 L$ I
  11. *         TO CHANGE., {5 E; u+ A' \3 n
  12. *( }/ [+ G* E+ g: Y' B7 ^% j: K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      q5 V) g% G, {9 L
  14. *+ k6 {; o2 V$ V- q0 o
  15. * This program is free software; you can redistribute it and/or
    . ?6 R& G+ h, b  `2 F  R+ u
  16. * modify it under the terms of the GNU General Public License as
    6 i" Z; D% w4 `& ^4 l* L
  17. * published by the Free Software Foundation version 2.# b3 i) |3 E2 C: k9 A$ ]
  18. *) ?- M. z* s" R- L) S% J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ A2 T6 m, ]% Y+ Y. ]9 t
  20. * kind, whether express or implied; without even the implied warranty
    ! S' o5 s& m: L# i7 c% K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 [6 ?8 p" n8 T- J8 n4 O9 R% V
  22. * GNU General Public License for more details.
    . p* d# C! t4 z# |5 N
  23. */' r. F8 z( l6 d1 w4 L

  24. " S" Y# v" h! m' F/ X
  25. #include <linux/module.h>
    ( ~; Y  Y- D) l) P8 q
  26. #include <linux/init.h>
    5 z9 h  [! l( m. x. ?
  27. #include <linux/errno.h>
    3 F) Y' K8 F5 M& K2 B4 |4 p5 [* f
  28. #include <linux/types.h>
    6 ~, s0 X* ?& p% n
  29. #include <linux/interrupt.h>
    9 a) a  z! M& y  B
  30. #include <asm/io.h>) Q7 C6 P8 U# W6 l
  31. #include <linux/moduleparam.h>. V4 Y: k7 t$ P: |+ T- \! f
  32. #include <linux/sysctl.h>0 u) J4 C0 S1 n1 Y9 K- g
  33. #include <linux/mm.h>
    - X& k+ Z' @) a; u2 E
  34. #include <linux/dma-mapping.h>* b1 G9 U" c- f% o# p, Q5 ]% ?

  35. 3 O( |  z7 T7 Q. B; |1 r
  36. #include <mach/memory.h>! a* \, q+ q3 i  W+ _! M: K( W8 W5 ~
  37. #include <mach/hardware.h>
    4 T+ I. G! O+ Q% N  Z% e+ ?: U
  38. #include <mach/irqs.h>
    7 W( n1 {. r) o* l4 G5 R
  39. #include <asm/hardware/edma.h>: {8 o& i4 g5 ?$ ?! t! `1 a: u

  40. * e& P5 ~. w& b, p' ^4 k( l: ?. q: M
  41. #undef EDMA3_DEBUG
    1 _* g# e( m/ h0 {9 n
  42. /*#define EDMA3_DEBUG*/
    " A+ t: J" b& O+ _* l7 h, b

  43. 7 M* n- {4 u! i
  44. #ifdef EDMA3_DEBUG
    " h  q3 H* J9 L' B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ t" N- C( ~, |- w& d& s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) A; |* L8 B! u' r3 p3 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + z* |8 o# w0 Y! n  ~
  48. #else8 K! S7 D2 v# d. F0 O7 [
  49. #define DMA_PRINTK( x... )( y! \  A. Y- @  G
  50. #define DMA_FN_IN: d9 n& {1 ^9 R0 W- v$ l" H
  51. #define DMA_FN_OUT; E/ p* b) y' Y7 ?8 ~, g
  52. #endif
    3 R* ]7 d. ]0 j+ h7 w
  53. 4 W* E2 d& M& y* }  `7 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% p, ?9 k5 V- a0 Y7 \3 |9 W
  55. #define STATIC_SHIFT                3
    / o0 x& i4 [5 E  s5 W- Y
  56. #define TCINTEN_SHIFT               20
    , b1 H' H1 j% M2 y/ V( S. ~! m1 E, i( e
  57. #define ITCINTEN_SHIFT              21
    , ~' ?* L. l) Y) O$ ~5 n8 z
  58. #define TCCHEN_SHIFT                22
    " R* ?% f& v  `+ o2 A
  59. #define ITCCHEN_SHIFT               23' y6 [2 ~9 j$ X' U4 x
  60. ' J2 A* F7 h  `. f* s1 Z
  61. static volatile int irqraised1 = 0;: d$ J" H/ n- z& n# f' T2 a. b+ ]/ |
  62. static volatile int irqraised2 = 0;
    . D: Z' D' D" ^, ^* ]
  63. % ^, o5 z( N: K% K( W3 x1 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]$ C0 b7 c- H- ~5 p/ @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) q6 a9 j, n( u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ g0 b# b6 D9 C) B

  67. 2 h& Z0 \% T6 Y" v
  68. dma_addr_t dmaphyssrc1 = 0;3 ^, U8 ^1 x6 W5 _
  69. dma_addr_t dmaphyssrc2 = 0;$ s$ [1 t8 i, W0 @5 @  H) P5 k
  70. dma_addr_t dmaphysdest1 = 0;
      a! R8 c3 ^8 F
  71. dma_addr_t dmaphysdest2 = 0;
    # _4 n: Y: Y5 R' Q4 `0 m
  72. + |) e9 G5 t1 S7 s! @
  73. char *dmabufsrc1 = NULL;
    & K7 _; W- h  |( `) N7 i" D
  74. char *dmabufsrc2 = NULL;
    : q* k' {' q8 R. P
  75. char *dmabufdest1 = NULL;& P" B+ U/ W, D
  76. char *dmabufdest2 = NULL;
    ) |' O4 c/ W$ U4 u& M0 M

  77. 9 p+ A) U0 T/ d: \. V, B
  78. static int acnt = 512;3 Y7 \9 X0 l9 r
  79. static int bcnt = 8;
    - i6 _8 o& H' R8 G. @$ x8 n
  80. static int ccnt = 8;6 E4 f8 l4 W) U% H
  81. 0 n( N' R( x3 B4 Q5 t2 N. w: \: b
  82. module_param(acnt, int, S_IRUGO);3 m) \: Q# W0 e& X! F
  83. module_param(bcnt, int, S_IRUGO);4 _1 |: Q0 x% n! g+ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- c& a) ]. U9 R- G: T. g% h

: t& e# y6 Q+ Y: H. {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Q7 v/ h4 X3 F# E! S2 A% ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 L$ b2 V/ l! @; o. K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) A1 v3 t7 }) {7 \9 u0 ~8 R/ p0 f
  u% n! t; \4 I* e# j; K# J
. s; S0 }3 p6 j6 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 14:48 , Processed in 0.039969 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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