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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 L* F5 X; M9 E( l+ e) C2 g
  1. [code]EDMA sample test application5 U4 P+ Z. x1 z9 i. Z# N( }
  2. /*
    % c7 V8 B' u5 j! U* f+ Y' B
  3. * edma_test.c+ n2 P" N! R$ j9 a, M6 C
  4. *
    # z$ n" Y6 Y3 T/ D( q5 `& D
  5. * brief  EDMA3 Test Application
    * M) ~# q/ o! H1 B, a
  6. *# L$ z4 @5 _& j; ]* H1 Z1 E
  7. *   This file contains EDMA3 Test code.
    7 e: m3 g6 x' J) K6 J3 q
  8. *+ [: s0 e1 z- y+ B7 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 C) d! ~  }# ^# j  m% ~; u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + G# ~9 q0 H( j
  11. *         TO CHANGE.* u) x* f! d. h8 J
  12. *
    , k# o. q8 j  I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 K. T4 {8 j2 w% [; }
  14. *' _* c2 D6 w+ f# k
  15. * This program is free software; you can redistribute it and/or. c4 Z5 c$ h9 G- G- F" c" {/ m" O7 J
  16. * modify it under the terms of the GNU General Public License as
    1 k* |9 T9 t/ n
  17. * published by the Free Software Foundation version 2.
    & I4 u/ l; R2 j) I1 X
  18. *# b4 e9 w/ z. j& W. d: M0 S# Q4 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 F0 k) r$ n' Z1 X
  20. * kind, whether express or implied; without even the implied warranty: G/ f4 G! e& o: a6 [' H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - i2 o% @& O: ^
  22. * GNU General Public License for more details./ X' E/ t+ g& Z
  23. */
    & }- U6 ?) p" }8 p% t3 s* O5 }9 s
  24. ; i4 s% [$ ?! M; h1 X, |) b
  25. #include <linux/module.h>5 @1 w6 A8 }4 n# m1 U8 n# c
  26. #include <linux/init.h>7 }; r  m; Z) c. [6 [
  27. #include <linux/errno.h>
    ! r$ G2 y1 O) _+ D. r
  28. #include <linux/types.h>
    8 E' z6 |- A3 [1 p: s' y
  29. #include <linux/interrupt.h>
    ! O; l! j5 h5 y- t6 {. n% ]! F  H
  30. #include <asm/io.h>
    ' ]+ ?. W1 R4 ^: e# q
  31. #include <linux/moduleparam.h>$ K/ F/ _5 k  t
  32. #include <linux/sysctl.h>& K9 I, B' ^% S  I" T5 i! U
  33. #include <linux/mm.h>& k8 ?8 ~3 U, t$ B6 N& g
  34. #include <linux/dma-mapping.h>
    . W" B& H+ t/ \8 S9 Q, Q. Y" W
  35. 1 D/ H. k2 G5 a
  36. #include <mach/memory.h>: s- X( [, E5 z' o" b1 Q
  37. #include <mach/hardware.h># T- Y  z* m0 M1 {3 w4 k6 F" T
  38. #include <mach/irqs.h>. {& x5 A1 W4 w0 s$ B
  39. #include <asm/hardware/edma.h>
    % Z# ?- F4 J9 d3 j4 R. D/ U8 g

  40. ) h) g# I2 S) I: e' x9 z" ?& X8 y
  41. #undef EDMA3_DEBUG4 j9 q8 K9 x* |
  42. /*#define EDMA3_DEBUG*/
    2 c0 D0 G8 A% q" D# X/ {
  43. - \# t7 j* E4 e2 }& c1 x7 H
  44. #ifdef EDMA3_DEBUG) N! ?6 h- V0 l  e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & k1 T- {  w5 y+ `: \; }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " u% n. s6 r, L2 F! P$ ~- e3 T. w: t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; m' c5 `/ Y3 d% m
  48. #else
    . o7 @& ?' e& F. u& w# l& M- G
  49. #define DMA_PRINTK( x... )
    3 m1 o( z/ X; K" I
  50. #define DMA_FN_IN2 d' E/ u; L" l) r# D8 m
  51. #define DMA_FN_OUT
    3 ]3 ?! X8 x: r
  52. #endif; [8 X7 ]/ ]' x6 Y3 C: B
  53. 0 M: N% w5 _: v# D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ |3 Z& O, j+ ~' U
  55. #define STATIC_SHIFT                3
    6 n2 g3 U" z& b3 ?! U8 _' {
  56. #define TCINTEN_SHIFT               202 d- B7 y$ j0 C% b9 [
  57. #define ITCINTEN_SHIFT              21
    . V  T/ `4 R  z
  58. #define TCCHEN_SHIFT                22( G$ B% L1 P/ W% m1 L" q* J
  59. #define ITCCHEN_SHIFT               23  H2 D8 ~# n( w: E
  60. $ R1 C8 D& y! A4 {. I
  61. static volatile int irqraised1 = 0;6 l. i0 Z8 a2 c1 h# `; W( J0 c
  62. static volatile int irqraised2 = 0;
    5 r. q/ n/ G7 n9 q0 M: T  [! b

  63. # j, g) p+ w# I6 s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s8 |. ^' L: I8 b9 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X2 w3 Y0 O- b$ R8 ?  d+ ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + L: c3 k6 i" ?, M( v0 F# X7 c
  67. 9 o9 I+ {- R" L/ s7 a3 |' ?# ^
  68. dma_addr_t dmaphyssrc1 = 0;
    5 d7 X! _( n( ~7 I
  69. dma_addr_t dmaphyssrc2 = 0;
    0 z- ?% Z9 q; S+ @0 }* d' c8 Z
  70. dma_addr_t dmaphysdest1 = 0;
    : I- m: `4 `5 s9 C
  71. dma_addr_t dmaphysdest2 = 0;
    / z  ]( D; n: [% u! o
  72. + [) h- g4 V  z. @  N
  73. char *dmabufsrc1 = NULL;8 W  n' Q4 V$ E' N. G2 E8 V0 {
  74. char *dmabufsrc2 = NULL;
    ' a7 O/ @* o/ X! I$ k
  75. char *dmabufdest1 = NULL;) v: T2 B: c6 v6 _
  76. char *dmabufdest2 = NULL;9 Q( Q0 D9 s  h" f" F! W
  77. - ~4 @- c& D/ p% ?  _2 ^
  78. static int acnt = 512;
    4 [) X* W# k! T) ~; ^
  79. static int bcnt = 8;
    ; L/ q& f  l4 B, J- O+ C7 V3 K
  80. static int ccnt = 8;" V7 s  a/ R5 V! v: \# z

  81. 4 t. J% a" `8 Y* f3 p
  82. module_param(acnt, int, S_IRUGO);
    : f- I  H1 g' G6 I/ i% C  J7 K
  83. module_param(bcnt, int, S_IRUGO);9 U. [; D  h  Z  l- B. S) n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( j' E* v3 X# j0 q

+ ^* }2 Q. P$ x  L9 y5 F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  |1 w7 ]% C- O  e8 w8 ?% Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ M% C9 i* c. |) C2 G& \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" G* x8 j$ |% O6 Q1 U5 m- V* i2 ~" G
& c+ y/ ~% B8 a( i* n, q" b2 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 07:39 , Processed in 0.040129 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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