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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * q/ W# h0 f7 U* I; X. f6 y+ u7 N. R- J
  1. [code]EDMA sample test application
    $ ]% O- t' W0 V
  2. /*
    ( Y9 E1 S$ e, E
  3. * edma_test.c5 ^! ~3 B8 u# c# B+ c7 p
  4. *' Z+ x2 r! r7 ^8 t7 ~
  5. * brief  EDMA3 Test Application
      {# a+ J) m6 ~& b0 `6 m- Z
  6. *
    : z. n/ ]3 `" p6 w
  7. *   This file contains EDMA3 Test code.) Z8 Z7 L. ?$ R9 e1 d6 M) r3 p$ u6 j  ^- ?
  8. *0 x' x- R1 f* d5 e$ \7 e  S: G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! M- s# h2 }& c  Z( p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " A- i- M! W- c
  11. *         TO CHANGE.
    7 t; E/ Q+ }$ X2 `
  12. *
    # b% r& r7 f! M$ Q- s- c0 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      v7 }2 Y+ @" I+ T# N3 n
  14. *6 N* ~# ^3 O7 R1 S! |6 n1 A5 Z
  15. * This program is free software; you can redistribute it and/or' @4 ]8 v6 Y" M
  16. * modify it under the terms of the GNU General Public License as; u. Z/ F2 t; i% X2 l
  17. * published by the Free Software Foundation version 2.
    5 [3 l) m: C  p1 V  w! ]7 j# s
  18. *
    , g( o" x: \+ _; W7 s+ [- n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 |3 ], Q6 t4 d0 F
  20. * kind, whether express or implied; without even the implied warranty
    3 |+ O+ w3 a2 k6 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ h& U- X: j' O6 i1 L
  22. * GNU General Public License for more details.: ^2 B. O. q1 t$ u0 F/ I
  23. */. p6 d8 V5 r4 d  c* u
  24. # F: K. _4 J, a
  25. #include <linux/module.h>
    & m# b) c& s; w& N! ?% s* q/ S
  26. #include <linux/init.h>
    / ^' T$ T; N$ m! ]3 {
  27. #include <linux/errno.h>
    $ u- N9 q1 Q/ Q; H% n+ P6 ?$ L! @" R
  28. #include <linux/types.h>5 r7 E4 ?. q0 u. `) U- D
  29. #include <linux/interrupt.h>9 M% }  N) k1 j7 @/ s) {6 q
  30. #include <asm/io.h>
    + P1 m; v1 @2 [) r7 u6 s
  31. #include <linux/moduleparam.h>
    % }. X8 E( i/ v" P; k* O* x
  32. #include <linux/sysctl.h>
    # ~. y1 L2 x( y+ b0 |
  33. #include <linux/mm.h>
    7 J  k3 t% @* ?$ D9 u
  34. #include <linux/dma-mapping.h>, ~& }9 e7 [/ p. I9 m! G
  35. - d5 ?; t2 O' R8 a; O( `5 ~
  36. #include <mach/memory.h>
    + o$ ^6 V1 U. q6 U+ ^
  37. #include <mach/hardware.h>
    / |2 r0 o( I6 f8 o% b& Z% V
  38. #include <mach/irqs.h>
    : v7 K: @3 \9 x/ C
  39. #include <asm/hardware/edma.h>6 k( Q0 D, i  ~! `$ Z
  40. ) t5 t7 Q: P2 }" H7 X: f$ j
  41. #undef EDMA3_DEBUG
    3 O' P" S# _$ c7 Z/ Q4 Z  d
  42. /*#define EDMA3_DEBUG*/
    ! y1 y6 E& n- `% P: @0 X
  43. ' ?5 l" V! f. ~  ^: t' |
  44. #ifdef EDMA3_DEBUG7 v- `; |2 r3 S3 y" e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # I- K+ @) O+ o3 H+ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 Z6 g/ B2 b5 M/ M2 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) w& b5 r% ?; ?7 [3 N' Q$ Z
  48. #else
    7 w2 j3 s( O* i
  49. #define DMA_PRINTK( x... )5 G# j- z: |% R
  50. #define DMA_FN_IN5 L" o: Q# L3 t  O* G. S) S
  51. #define DMA_FN_OUT
    . e* C4 S0 [# }+ V# n
  52. #endif
    : G" Z9 x  C( t: E$ h/ h7 x

  53.   e" y# J: L* w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). r! l: }1 E9 b9 n
  55. #define STATIC_SHIFT                37 @$ v) g8 @( z- D# a
  56. #define TCINTEN_SHIFT               207 E- W/ B8 l% ]8 I- e0 X- [1 W# e
  57. #define ITCINTEN_SHIFT              21# q+ c4 s2 L0 ]! H. |, x
  58. #define TCCHEN_SHIFT                22
    / v5 g. W& j. ?) B
  59. #define ITCCHEN_SHIFT               230 ]) j! S6 a  L, u$ J5 I+ e2 n9 B& @2 r

  60. 2 \) }0 `3 m, [* t8 h  p6 y+ w) g
  61. static volatile int irqraised1 = 0;9 R" F0 M% c+ j# n
  62. static volatile int irqraised2 = 0;, O6 e/ u4 N- O: J7 j

  63. : A% w5 [6 M5 O8 F. Z& a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ~: S1 b# C8 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' |( \; v" C* W: w. e7 ?* k; l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ K8 v. F7 ~& f3 Z: y
  67. $ i1 W. I: n; X; P! [) |% E
  68. dma_addr_t dmaphyssrc1 = 0;6 |7 }' i% D/ N
  69. dma_addr_t dmaphyssrc2 = 0;. }1 v, h6 e' Y( O& C
  70. dma_addr_t dmaphysdest1 = 0;
    + [, M) y* }" b9 x1 v# \. b$ E
  71. dma_addr_t dmaphysdest2 = 0;
    7 l  s* J/ b# _  L3 Z

  72. / d! e" H: \% f1 M* j2 }
  73. char *dmabufsrc1 = NULL;
    % u' Z  u% [# \; M
  74. char *dmabufsrc2 = NULL;
    " V) ^; [! [. P$ W; `7 H% U9 s
  75. char *dmabufdest1 = NULL;& N) e* K3 ~& V. c, D  t
  76. char *dmabufdest2 = NULL;
    $ o  ~+ A4 _. K1 H$ o
  77. / R# l% C4 D3 Z( Y! B
  78. static int acnt = 512;0 A1 R( `* Z0 c
  79. static int bcnt = 8;
    ! w6 H9 m5 p) T
  80. static int ccnt = 8;* E4 c( s$ J4 h% A

  81. 1 B& k; ^  @+ R0 D1 z5 R
  82. module_param(acnt, int, S_IRUGO);
    / R/ m( k- y) J
  83. module_param(bcnt, int, S_IRUGO);  i, K3 J, X/ }: l/ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 Y( |3 h1 r( I6 U% q: I9 g- O
2 }6 Z* V! r% c0 |. Y4 B/ Z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; Z9 A' n; C9 c+ o. C. z+ k& s" |) }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ ]; C2 A; n1 h2 H6 l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 W* P& m+ G' X3 a$ a+ x! t
' @; y: F0 m. f3 N
3 t5 G/ S  V, x6 N+ N/ y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 21:43 , Processed in 0.040143 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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