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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / i- x" r8 ?% w; \/ L! }
  1. [code]EDMA sample test application1 ~: p; F* o* f5 T+ Z! M
  2. /*
    . o: y4 @! d0 J0 s4 Q
  3. * edma_test.c2 \  `- H* ]( i3 g
  4. *0 `0 d( H" C( n+ @0 E8 {3 C0 M2 Z
  5. * brief  EDMA3 Test Application, Z) b5 t1 `6 u* n1 J* R- E
  6. *
    % x0 u/ t* a+ N& G% C5 U" `0 O
  7. *   This file contains EDMA3 Test code.
    % |3 ?% j% e, R8 \" p4 _  R1 O
  8. *4 G1 Z1 K* r! E- l$ M5 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ [" N. ~7 f9 |' ^% A5 l" `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & ^* x1 F4 d( Y5 m) ^
  11. *         TO CHANGE.) u8 y! ?% T1 F# N' u- t$ K5 W! H
  12. *3 y0 _# R4 I: P1 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 T$ @6 N4 o4 n: x0 i, G
  14. *5 O" o) d- L+ R5 i
  15. * This program is free software; you can redistribute it and/or& M' R$ M/ Z7 A8 o6 ?: ]
  16. * modify it under the terms of the GNU General Public License as( [' G' S' S% \, F! p% M1 L
  17. * published by the Free Software Foundation version 2./ p% V' f* A* c# Y+ D  x
  18. *
    7 c! i9 T3 D( |' q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 q0 X" Q7 O+ u# I4 i
  20. * kind, whether express or implied; without even the implied warranty) D; t( F3 z7 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + h; T1 W2 r5 c8 g! A4 p, z
  22. * GNU General Public License for more details.4 \: g. M, {- }1 O; Q
  23. */
    / o* m' y3 L* _1 P5 @1 ^

  24. / O, ~& G  ?* S* F; U
  25. #include <linux/module.h>
    ( n4 g# \5 {% d6 t+ I
  26. #include <linux/init.h>
    ( M1 Q. z( Y  _4 v
  27. #include <linux/errno.h>2 I' @* f2 L4 ^% \! W  k5 u
  28. #include <linux/types.h>
    8 p0 x+ l7 Z8 d9 X9 O* A
  29. #include <linux/interrupt.h>5 a3 h/ x3 `5 N
  30. #include <asm/io.h>
    ( z$ y* l; u$ h% ^
  31. #include <linux/moduleparam.h>) H) y! X  w) E. Y. F
  32. #include <linux/sysctl.h>. p2 b4 K* r- f/ ?- V- M' q
  33. #include <linux/mm.h>
    4 K: x6 X; ~9 U6 P
  34. #include <linux/dma-mapping.h>% |7 `; K3 I/ L# v7 Q! K( S; A( |
  35. $ _3 C* b+ W+ r4 p) h0 O
  36. #include <mach/memory.h>
    : j; N2 M: m  i: ^' {5 ?+ F0 ~" {
  37. #include <mach/hardware.h>
      L9 f: J, S/ N: O; e/ W/ U
  38. #include <mach/irqs.h>
    3 [( S$ B4 e! n3 [; N9 \& [
  39. #include <asm/hardware/edma.h>! t( @* [- C0 z

  40. & y$ M: Q) }& B# q: E
  41. #undef EDMA3_DEBUG
    ' ?, H1 k+ v. G- g5 g; e
  42. /*#define EDMA3_DEBUG*/5 v8 Q, f; c6 p4 b1 x) o2 z& }

  43. ) h* |  X9 J; d# x% n! l# v
  44. #ifdef EDMA3_DEBUG
    + T2 |8 h+ b" l. Z  F: p4 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # l* Z& P: b( F1 @- o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ~. D, a! I- r% Y0 w3 T, `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ?& q  c$ ?) V6 \8 f& I
  48. #else7 ~6 `! x6 D4 ]8 Q
  49. #define DMA_PRINTK( x... )
    ; H! j2 c$ J# x/ p
  50. #define DMA_FN_IN  ]: }$ X- d6 @9 x
  51. #define DMA_FN_OUT# H; g' x! |* ]3 I
  52. #endif
    & n2 j6 H# r* J) f1 L- G

  53. 9 T1 ?0 r" U3 J1 S) h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % g- V& }7 o2 K! e5 `) `& z# a
  55. #define STATIC_SHIFT                3# D/ T1 |) j0 A' |9 o5 `4 L9 H5 `
  56. #define TCINTEN_SHIFT               20
      w) \' b3 m5 H1 X( \& t0 J$ [8 A
  57. #define ITCINTEN_SHIFT              21
    0 Z. H; @! C& J! Q/ Z. T6 t# E$ L
  58. #define TCCHEN_SHIFT                22# O. H4 J1 \4 E1 x  N/ \
  59. #define ITCCHEN_SHIFT               23; f7 E& Q" w9 h1 }
  60. / n$ F* X$ ]# s! V
  61. static volatile int irqraised1 = 0;4 Y: v4 H0 Z4 w5 X! K
  62. static volatile int irqraised2 = 0;( d! U! K- N8 p4 L  s; ^
  63. : V, _  K" Y! m# Y3 I) ]& Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 z% _' I! o, U& m) G1 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , x6 M% p! t3 h& p3 R6 z- X, a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~+ L3 F/ W/ F! J0 w5 ~% @; z
  67. % X$ o% ?  F8 Y# ~: ~; ^- J
  68. dma_addr_t dmaphyssrc1 = 0;
    2 }8 Y, Z! s3 h) [* F; w+ `+ O  F4 `
  69. dma_addr_t dmaphyssrc2 = 0;( d, k) c! C0 z$ f
  70. dma_addr_t dmaphysdest1 = 0;
    0 {' u$ o' X* J$ U
  71. dma_addr_t dmaphysdest2 = 0;! M! t5 C2 c9 @  t6 `: I$ S2 h
  72. 2 O4 w0 l/ e+ |  {; ~1 I# I' c- K
  73. char *dmabufsrc1 = NULL;6 C- i& Y( [% @2 }1 }  y
  74. char *dmabufsrc2 = NULL;
    ! l: v8 O  r9 i, H+ o6 e
  75. char *dmabufdest1 = NULL;
    / P+ n( p# f& E3 m# q3 p8 m, K
  76. char *dmabufdest2 = NULL;) _& `, ?; U% {$ i; z
  77. ! X0 M& x. F" o( v% w! L
  78. static int acnt = 512;. p5 Y* z6 }! G  P6 ]: a7 P% _
  79. static int bcnt = 8;. L# e- Z9 m. t: j" l7 B3 l
  80. static int ccnt = 8;
    , Z. h% V: S4 }4 E

  81. 2 F9 |* U+ j% l' C7 [. L( r
  82. module_param(acnt, int, S_IRUGO);  r- W+ _1 I$ ~: N8 B  q
  83. module_param(bcnt, int, S_IRUGO);
      d+ H: {5 k( j( p6 d- o& y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' G2 b' a! T# Q1 i. S; C1 P3 u7 i9 }# L+ i% i/ v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 }* A5 E! E$ P7 H5 O& p& L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- u. t4 ~  \1 i( e; G: P
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! m- n3 s/ z/ w) U5 {* t
: [% e' `) J3 u! S
; j6 \# U. j+ f2 B; {2 Q: g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 16:26 , Processed in 0.044587 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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