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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' A2 D  i. H2 t% n9 \2 C) T" R! D
  1. [code]EDMA sample test application* d" A: i7 p, T0 m) p8 E5 ~& S
  2. /*
    : j4 Z# `! @3 G0 d0 ~' T
  3. * edma_test.c
      B, H. O+ @) n2 |9 W' a6 q3 Q' S5 G
  4. *
    & o; \. @  Q! B1 b8 p
  5. * brief  EDMA3 Test Application( ^5 u% H6 L9 t. z, j, q1 R
  6. *
    # \9 V' F6 u" R1 H3 H  q
  7. *   This file contains EDMA3 Test code.. }# Y9 M3 x* F: g# m
  8. *% [+ j% y( s1 k* i( u# r! A, T! J+ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ }6 \  t2 r# [6 x2 u# }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + I1 }* I1 a' U* K' [
  11. *         TO CHANGE.. W5 @& b8 A* a9 C) D
  12. *
    - H% }: s1 A( Z, e6 u& P) w$ L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y' ]1 m, g7 v( r/ V7 w5 v
  14. *
    1 Y/ Z! B' N( L) d+ k
  15. * This program is free software; you can redistribute it and/or
    1 \& B' ~, W( U, K
  16. * modify it under the terms of the GNU General Public License as
    " ]+ j8 o2 D  d3 N
  17. * published by the Free Software Foundation version 2.! i( z4 Q4 O/ p* |& C
  18. *
    ' N8 o1 J! z/ h/ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! g0 L+ h; `: G7 j
  20. * kind, whether express or implied; without even the implied warranty  Y: A& t. k0 t0 n/ \8 v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) G: c2 t* J6 I. {
  22. * GNU General Public License for more details.
    * j4 z% [# T! k8 L8 t, s: s
  23. */% [8 y- C% [1 ?  z' |9 B

  24. 0 U7 v! d5 a9 V3 w  R% P
  25. #include <linux/module.h>
    ( u2 ]" q, ?* Y' g: C
  26. #include <linux/init.h>
    - F; R  C/ r# O7 w: Y, x
  27. #include <linux/errno.h>$ S. Z/ U% u) P5 b
  28. #include <linux/types.h>
    5 ]& }( W( ]" G8 h4 c/ E, s8 f$ I$ D
  29. #include <linux/interrupt.h>& \& D4 R% V7 k- A3 ~
  30. #include <asm/io.h># W" {2 k. @3 ]1 q- X5 ?% H
  31. #include <linux/moduleparam.h>/ t) |9 T/ s; ~
  32. #include <linux/sysctl.h>
    7 v; c9 T% [; R
  33. #include <linux/mm.h>
    ! P" z, `% Y' @/ t$ p+ i8 Z
  34. #include <linux/dma-mapping.h>4 r! p4 c; D5 G1 H* O- P  m
  35. # U: J8 S4 g3 ^
  36. #include <mach/memory.h># I0 A+ N; i% u, \& h
  37. #include <mach/hardware.h>
    - I' w" l; l& w. s" D
  38. #include <mach/irqs.h>
    , \. z- P" {4 n7 Y, C0 t- C
  39. #include <asm/hardware/edma.h>
    ( V' O- {  F6 t7 T0 q
  40. 8 D8 z- j4 C( r
  41. #undef EDMA3_DEBUG
    ! P# h' k- u3 I: X, @  Q: D6 E
  42. /*#define EDMA3_DEBUG*/# G' \  c- O# j0 J) Y; Q
  43. & n" ?# `/ T. z- P# g' m
  44. #ifdef EDMA3_DEBUG
    2 X, U( i) l) J/ T& ^& f* j9 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( g2 V$ N$ A4 m9 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 y& r  `: k; J6 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 L: \/ W/ r* r* W% }8 N; V
  48. #else7 O3 D  q% i7 n1 ^
  49. #define DMA_PRINTK( x... )7 G8 C& W, w% N7 q9 f, _, ~
  50. #define DMA_FN_IN
    8 I3 Z( |6 q0 N" }5 I
  51. #define DMA_FN_OUT, `5 Y( `0 J7 f; ?% v* g1 d( p" u
  52. #endif+ S/ ~, l5 w7 {6 s: Z

  53. 9 H- I2 @" z' j  m, \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) Z1 Q5 X8 R/ V" v5 Z; l
  55. #define STATIC_SHIFT                3
      ?& T7 Y# b, r# l
  56. #define TCINTEN_SHIFT               20
    1 W7 w8 S9 S, i. j
  57. #define ITCINTEN_SHIFT              21
    7 F/ f5 ?( w1 t2 T5 ^- A( p( M
  58. #define TCCHEN_SHIFT                22
    " O  k1 ^/ Z  F  s
  59. #define ITCCHEN_SHIFT               232 f! g2 `/ Q6 c* q4 b, F8 [

  60. * g) j$ H- |5 S4 ?: I9 H
  61. static volatile int irqraised1 = 0;% X# L0 V3 S- d
  62. static volatile int irqraised2 = 0;& I- P1 _+ V# F" c5 y
  63. ) a: N. v0 A/ |/ q$ {4 N2 V+ w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" Y0 o9 Z- `1 ?  s% v7 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 d: T* u6 y( m  X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 z' J0 |3 P9 g% f$ N

  67. ' @9 |' h" H4 U1 ~- H
  68. dma_addr_t dmaphyssrc1 = 0;, [" W) c0 ~1 o# K6 Q: O+ H/ x1 V% l6 X
  69. dma_addr_t dmaphyssrc2 = 0;
    0 e* B/ U2 @' O: o9 G0 r6 U
  70. dma_addr_t dmaphysdest1 = 0;
    5 ~! z/ ~1 J) l2 t; A) N5 }3 a  o
  71. dma_addr_t dmaphysdest2 = 0;
    2 S3 f- b  _) ~% p& k

  72. 8 |" U% L$ g! O* o, _3 E- n
  73. char *dmabufsrc1 = NULL;
    " P  N9 M5 [$ F1 J
  74. char *dmabufsrc2 = NULL;
    2 k4 l. k' y. T$ ~
  75. char *dmabufdest1 = NULL;
    0 f& B! G9 X. X9 _* |1 Q+ f
  76. char *dmabufdest2 = NULL;
    - S+ H0 p: B: @) ^0 x
  77. 0 e8 G0 q7 E8 j% V3 g/ ]
  78. static int acnt = 512;
      T4 a( O( x7 M
  79. static int bcnt = 8;
    ' C2 x4 t+ H. g- I5 T
  80. static int ccnt = 8;
    ) U  E* d& O6 I, L; e9 D7 A2 w
  81.   g1 R$ j+ O! q5 P; A9 o" e& o
  82. module_param(acnt, int, S_IRUGO);/ P2 Q: \5 J6 c& ^0 R) K
  83. module_param(bcnt, int, S_IRUGO);" }3 m7 j- S. G9 U$ z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! z1 G/ A1 P* t( m5 V* Y* I& o0 o& g2 E; d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" ~" f/ h6 j% j8 D' y. d4 C$ t+ carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ @0 k# }; A6 x! Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 K6 C. i- x7 w1 X1 h  ~
, X1 c: q, o! I, y2 h* X( Y4 S
; c, l# r6 b# x; A& z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 15:03 , Processed in 0.046179 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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