OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& O6 i3 N" U9 \& r) F
  1. [code]EDMA sample test application7 n/ q; p6 }; _) [! k$ [/ S2 _
  2. /*- [( Y2 Y4 K% K6 y- s3 m7 r
  3. * edma_test.c
    ( @4 y, R% o# T- U( R, k
  4. *4 R9 C* c# A4 b8 P6 A5 C
  5. * brief  EDMA3 Test Application5 c; z$ m: B3 a  t
  6. *8 ?2 v. W$ C# K3 b% b& C
  7. *   This file contains EDMA3 Test code.* M5 k& @: n1 n! s
  8. *3 @$ u9 a) B, |+ T; [7 U  Z$ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      h+ L& x) ^7 N. M7 R( X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 O# L- P" o, S8 ~* ?8 P  o
  11. *         TO CHANGE.
    8 C8 @! \3 b8 n. u0 b+ b8 V
  12. *& m& \7 D" o% e* |7 n( s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; x. }- V3 ?$ j6 a$ Q2 M: U* C
  14. *
    7 k" M! U* u3 A$ \0 N8 W3 A
  15. * This program is free software; you can redistribute it and/or
    # p' h0 }% X7 l1 w
  16. * modify it under the terms of the GNU General Public License as! G1 ]. ~3 h0 Z) O9 U, g4 u+ U$ Q
  17. * published by the Free Software Foundation version 2.
    / g8 Q0 a: N  T8 ?" w
  18. *( ]& ?) o1 r0 N6 v, e6 B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # V+ S, C, H/ r0 v; o
  20. * kind, whether express or implied; without even the implied warranty
    , V6 p/ I1 b4 ~' \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 ~' Y" t. y# }4 i3 t6 @
  22. * GNU General Public License for more details.; k0 D4 `- f" a2 }, B( F* Q
  23. */4 e! F: j( W/ V4 o/ R$ F+ S7 J

  24. % ?) k) R) S: `& u
  25. #include <linux/module.h>
    * V) c, [1 s0 e$ i, z7 {  D3 F6 A
  26. #include <linux/init.h>
    1 w2 i5 |) S; E& M  J' E& e  A
  27. #include <linux/errno.h>* P/ H" q, _( J
  28. #include <linux/types.h>" L$ A6 O  S' g- H- G6 }
  29. #include <linux/interrupt.h>
    . J4 q- ]; G9 a
  30. #include <asm/io.h>8 c- a2 |2 y5 z0 g& D5 `
  31. #include <linux/moduleparam.h>' B" l, H' G2 G5 I
  32. #include <linux/sysctl.h>
    # t+ y# O( j/ _. [) F& g7 }7 [
  33. #include <linux/mm.h>
      i+ A2 ?7 K3 U
  34. #include <linux/dma-mapping.h>7 V9 F) w* S9 I$ E* [9 F; s  e* N

  35. . w& s# \# X% |8 R$ u1 n% g- p4 D
  36. #include <mach/memory.h>
    , D/ \# O$ L( L; ], G% D0 K
  37. #include <mach/hardware.h>
    4 |7 R+ f, P0 P$ H
  38. #include <mach/irqs.h>
    6 K2 F3 c# a, y3 _8 ~! f! p! y( W
  39. #include <asm/hardware/edma.h>
    5 P  n( Z  z" Y; |. ?3 u9 m: S

  40. : V4 E5 D8 u" R, I0 b/ l3 _
  41. #undef EDMA3_DEBUG$ v3 l6 @+ ?2 D0 k, R! J0 A
  42. /*#define EDMA3_DEBUG*/' P' _0 B# i3 C# d5 z- Q

  43. " k5 }( g* J% V$ }7 z8 R) n" C$ ^
  44. #ifdef EDMA3_DEBUG
    ( ?6 g! D0 _+ Z& f9 p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 \" B- S0 c- O8 V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) b! I7 p/ V$ q" o/ B$ K* N+ Y* d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): Z" m1 g9 u/ |# U
  48. #else
    2 y& n, Y/ W- Q
  49. #define DMA_PRINTK( x... )* P4 I, d  \  A, D$ z/ T" n. ^
  50. #define DMA_FN_IN8 K+ j3 A, W5 k  D  k% J
  51. #define DMA_FN_OUT
    6 W' e' @( \) V0 L, F% ^; w
  52. #endif
    % M: r, }$ |8 R# ^# ], H
  53. 6 j9 G4 {5 U' J2 |# {- A7 g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      r4 T" Z) F! S; w3 W8 B
  55. #define STATIC_SHIFT                3
      R$ A* K% }  L1 Z' o
  56. #define TCINTEN_SHIFT               20
    5 ]1 j9 T# U. G% f( u0 U( L
  57. #define ITCINTEN_SHIFT              21$ l$ v# D- a: U. l, K
  58. #define TCCHEN_SHIFT                22
    + h( D5 H' w$ F3 F
  59. #define ITCCHEN_SHIFT               23
    1 v3 L! S) N" K
  60. 8 f! b7 ~& L- U" f7 V- D; q: `
  61. static volatile int irqraised1 = 0;: S$ F6 R  l+ x, [$ n  R3 y
  62. static volatile int irqraised2 = 0;; Q6 J2 N" o/ [/ z& L! B3 p8 x( b
  63. 6 y# g3 p9 d: @0 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + w+ z  `( }, Y/ P; R. I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # H  Q. `& n6 R, C0 ?5 m+ z3 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; I1 ?8 G# q* X6 m# v& K% o
  67. - R% U! ?" P- M# U9 u: w
  68. dma_addr_t dmaphyssrc1 = 0;
    ) l5 P" ?+ ]2 b
  69. dma_addr_t dmaphyssrc2 = 0;
    - l% F2 _9 ~$ j% ^+ r
  70. dma_addr_t dmaphysdest1 = 0;+ H5 n; I' G* g- y8 V
  71. dma_addr_t dmaphysdest2 = 0;% A" X- Y  E3 x& p5 Q* P
  72. : H3 D% k7 U" U# `1 X. t4 p2 j
  73. char *dmabufsrc1 = NULL;% W1 T9 i! E3 y& R5 g5 }; x# s: J
  74. char *dmabufsrc2 = NULL;
    3 u' z  x4 H/ b8 e0 ]
  75. char *dmabufdest1 = NULL;, {' a2 j) T0 B! [9 }. h$ t
  76. char *dmabufdest2 = NULL;* H9 x8 j  z: Q# C2 Y2 C
  77. " Q3 H, |, _# F# s- F9 L6 k; i$ B* S
  78. static int acnt = 512;* f% s4 x1 T  F9 b1 O
  79. static int bcnt = 8;
    5 q- k! n9 p4 n1 k+ [
  80. static int ccnt = 8;
    0 `# Y- }) M! ^5 `$ }

  81. 3 q% h; H1 k) X
  82. module_param(acnt, int, S_IRUGO);
    5 t+ k1 m& R4 i
  83. module_param(bcnt, int, S_IRUGO);! ~1 j$ J6 d0 S" ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  u. Y4 e) `+ Q# [

* ?9 h. A+ g+ o$ k& @& Q: Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% ~, v; p% }/ x8 i* Y* e  G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 w# s! s1 H# J; H- L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* ~. i( X2 X0 F  u$ V1 j5 P. V0 L6 d& ^3 o( i1 t

1 \( {1 j2 p% A  r/ i$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 07:53 , Processed in 0.054571 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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