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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   ~% P7 t2 ~7 T3 v1 l! X; p
  1. [code]EDMA sample test application% d# S4 z% A8 c9 E; g# P2 o
  2. /*. `3 l# ?3 F: G: h7 `9 V$ f/ {
  3. * edma_test.c* {/ p/ S- ?4 ~) ^) |/ p
  4. *: h" m4 n; \! u* b% P
  5. * brief  EDMA3 Test Application
    * K  H2 Y# A6 h3 \5 v0 P; ]
  6. *5 E  H, o+ P# s
  7. *   This file contains EDMA3 Test code.0 l4 J, r' O* B; c! s1 W
  8. *4 o6 W0 G3 o+ |2 u* Y4 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - n5 s; N- J9 L4 }- _& W3 {& }5 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      w0 V% K  x' i" b6 c' j6 \1 a: Q/ |
  11. *         TO CHANGE.- _7 J4 L. e( Q% d
  12. *
    2 y4 h2 q3 z6 c* `  w( O6 M+ S4 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + A' D- ^' [- @2 f: \$ r1 U8 _2 H
  14. *
    % e5 h  w) b- z# ]
  15. * This program is free software; you can redistribute it and/or- d) c& q  g% r1 x7 }2 a8 p
  16. * modify it under the terms of the GNU General Public License as+ c6 p+ D- P* a9 f" r
  17. * published by the Free Software Foundation version 2.
    / u& Z, h/ Z5 U: A
  18. *) n0 c; ?* b. o+ k$ {$ a9 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 S+ h- e' f0 h" o6 r$ W) H: D2 {
  20. * kind, whether express or implied; without even the implied warranty
    / Z( P2 w+ T% K0 Z+ N% s# Y4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ K2 m$ V3 r, |, |- E
  22. * GNU General Public License for more details.
    ' h6 i$ }8 I7 q  S3 X2 z& R: D
  23. */, ~. }8 R: e( d4 a

  24. 8 ~- Y3 g; N; L4 m- L
  25. #include <linux/module.h>9 O. F2 q+ M  s6 \' T
  26. #include <linux/init.h>6 L* h1 q. q: p6 _: i7 l
  27. #include <linux/errno.h>) q( @+ S9 F  U; N( a3 K
  28. #include <linux/types.h>
    % e# f& }8 t5 O* N2 e4 ^
  29. #include <linux/interrupt.h>. g# R" ~) o& a- ?
  30. #include <asm/io.h>  P3 T# P, D( m: b* l  H5 M& f
  31. #include <linux/moduleparam.h>
    4 a  ^( w5 S8 Y' b; i. }7 p+ r
  32. #include <linux/sysctl.h>, w4 b3 T$ U6 P2 J! w
  33. #include <linux/mm.h>9 a* T6 c2 Z6 l
  34. #include <linux/dma-mapping.h>
    " I4 I, h: A% P, V1 A# n

  35. 6 [' v9 f2 r' @# R  O& D
  36. #include <mach/memory.h>* k% s$ ]3 _- Y
  37. #include <mach/hardware.h>6 I+ J2 X$ W* M# m9 D
  38. #include <mach/irqs.h>: G, y: g: A6 k/ G3 C9 u: O& v+ E
  39. #include <asm/hardware/edma.h>
    / ^: y  [5 ]* C$ N, }
  40. ' }/ ~: _2 b( s7 e0 Z( ~4 P
  41. #undef EDMA3_DEBUG) }/ Y+ c+ f) I: r! S
  42. /*#define EDMA3_DEBUG*/
      c& i6 [" R" k- c, Q

  43. : s# e2 c8 {/ u- N7 |
  44. #ifdef EDMA3_DEBUG3 H* f- x+ r9 ~" B' v9 S1 j5 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( t: I! u9 [8 f% j& k0 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 \. N3 B6 Z# ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! Z# E& K; y+ I1 G# v& G
  48. #else
    * h# [3 B9 a9 \
  49. #define DMA_PRINTK( x... )
    3 w  @! j1 d& u$ w) M
  50. #define DMA_FN_IN
      M& t$ E: W) |& Q. [; _
  51. #define DMA_FN_OUT( l  @& I) o( C# ]- W9 X8 n& e) _9 `
  52. #endif
    0 s/ B, v  b+ r
  53. & K6 f% ^8 X  t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) m/ B! `8 Q1 C
  55. #define STATIC_SHIFT                3
    5 R: I7 n; F! V2 w# y
  56. #define TCINTEN_SHIFT               20+ i* i% f) W+ O+ I+ f* \
  57. #define ITCINTEN_SHIFT              219 y8 F: I7 M3 ?7 |0 n
  58. #define TCCHEN_SHIFT                22
    ( Q* ]; }) ?* i  n% p' q  S) J, H3 B
  59. #define ITCCHEN_SHIFT               23
    % M% O0 g; a/ ?8 L% e1 R
  60. 2 x4 B! D% Q  d1 I/ G; z: Q
  61. static volatile int irqraised1 = 0;
    . ?7 X1 Y1 Y8 d1 h) u* M+ ^1 t
  62. static volatile int irqraised2 = 0;
    4 ]+ |& g2 `4 u

  63. 1 ~1 x! I7 f, Q( W4 D# B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q- [% p# F% C8 J/ V* Z4 {4 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n& D9 z- b* W9 Q9 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 c: q0 W3 ?0 k7 u4 f

  67. ; q& h' {% L3 d) [0 K7 {+ |5 O
  68. dma_addr_t dmaphyssrc1 = 0;- y9 `* j$ W. _
  69. dma_addr_t dmaphyssrc2 = 0;
    3 n4 x2 }. T) f! P, k3 y- {7 A
  70. dma_addr_t dmaphysdest1 = 0;5 Y2 X, Z* ^! x7 h5 i5 p
  71. dma_addr_t dmaphysdest2 = 0;0 m* E, A2 H3 X6 R: X
  72. / C5 z5 ^2 f0 I7 e* G5 x# ?
  73. char *dmabufsrc1 = NULL;
    6 h" j/ X# |" I; b& t1 J  L
  74. char *dmabufsrc2 = NULL;/ z) z) r% M$ k% @$ J
  75. char *dmabufdest1 = NULL;% e2 D$ r; S7 g  }
  76. char *dmabufdest2 = NULL;
    # w: m4 P0 m9 I/ I0 k8 M
  77. 1 q: w+ ~% J$ b: B% x5 D9 }
  78. static int acnt = 512;: r. a. d- C4 L! v/ A/ l
  79. static int bcnt = 8;
    + v8 F! d2 l$ ~8 K
  80. static int ccnt = 8;. H  H+ h8 U' g
  81. + ]$ ?( `' L* u% |; h
  82. module_param(acnt, int, S_IRUGO);
    5 d# ?3 v9 f" _; E. Q
  83. module_param(bcnt, int, S_IRUGO);) X1 e% I/ t$ g" }9 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" n8 G2 q5 O8 I/ G) J0 q% ?, O2 k* v! ^. s) u# N7 _2 l/ l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; _9 p9 ]1 G% ?# k# f7 c/ {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 g- X  i: e6 b/ y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# Z+ Z  ?0 r' e: w
3 H3 Y+ C* M9 @7 I& \
: f0 o# r5 {# K$ L$ l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 20:20 , Processed in 0.038397 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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