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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y& A8 e2 P7 H  [4 L- I  w# V$ D
  1. [code]EDMA sample test application
    ; ~0 J7 e7 K" w# p8 Q9 A$ n  m
  2. /*
    $ I" T) C- Z: T" V: t0 H4 _! I4 S
  3. * edma_test.c
    / C- V. H( E; m
  4. *: z( q# J$ E' C$ N; I$ |7 q
  5. * brief  EDMA3 Test Application% @/ U2 m/ e& ?
  6. *9 e( e) Z+ q: N; y- i$ h
  7. *   This file contains EDMA3 Test code.
    ' N1 }1 W% c! p7 q( Z7 T
  8. *  P9 \/ R$ Y& H5 c7 S# ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' |7 n$ |5 j! |6 O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* F, U* B5 ^1 x2 e# U, i/ X
  11. *         TO CHANGE.
    4 J! `+ e9 p" x$ [; f# @# r. E
  12. *
    ' W! N% D' \* j& f% z" S- p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 B3 p8 J  o5 H5 W% ?9 d, s; O" i. b
  14. *6 c5 P" {/ \. |4 A
  15. * This program is free software; you can redistribute it and/or- M- ~' \. w' u0 h, \) K) a: ~
  16. * modify it under the terms of the GNU General Public License as1 V6 |1 Y8 A; ?. K' Z
  17. * published by the Free Software Foundation version 2.
    ! P0 b$ r& X/ C6 Z2 Q' U
  18. *
    4 D/ R( g* I4 }) m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 V% m  z/ i' T8 x( k
  20. * kind, whether express or implied; without even the implied warranty
    7 S' d% s! T- t4 q1 l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 C8 v- V, i  c$ _2 O
  22. * GNU General Public License for more details.3 X0 J# s7 z' p
  23. */
    ( i' U$ l* A8 N
  24. . i5 l+ Y6 a/ V8 v7 M% O; r
  25. #include <linux/module.h>9 g5 O3 b( v: S; W% V, i
  26. #include <linux/init.h>
    $ ~( ^0 x& U8 Q6 |) o8 G
  27. #include <linux/errno.h>
    7 u  T$ ?3 b- e2 `1 `' j. ]' B2 w
  28. #include <linux/types.h>% Q% ]6 P. u! C0 L+ X2 G
  29. #include <linux/interrupt.h>+ [, E/ o/ M- F3 U( Y
  30. #include <asm/io.h>6 t) Q9 C  |& ?$ q2 g) J
  31. #include <linux/moduleparam.h>
    # [5 }8 _. p  I+ j0 J) |
  32. #include <linux/sysctl.h># |: E1 X6 x) ]: C  @% c
  33. #include <linux/mm.h>8 j7 ?! x5 d. f
  34. #include <linux/dma-mapping.h>( y) W, S* ]* O4 x( B

  35. + ~' ~: I" i8 x1 v. ]
  36. #include <mach/memory.h>
    ; ?- O+ X; G; f- F9 ]
  37. #include <mach/hardware.h>2 J1 W& i' i: a& f! Z* z3 a( x
  38. #include <mach/irqs.h>
    . k, i5 X& h  c: U% q
  39. #include <asm/hardware/edma.h>3 c1 L3 B, E7 X1 C

  40. & H. c/ }' C9 n$ D( `$ D/ _9 i
  41. #undef EDMA3_DEBUG! l5 F' A% E# U. K/ U( i
  42. /*#define EDMA3_DEBUG*/
    2 |1 ~& O. y& C7 F4 A/ X7 a

  43. ! O. y3 n: U; N
  44. #ifdef EDMA3_DEBUG+ X5 _* w8 d, n; f$ e( c0 P6 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : Q0 v, |% g. i8 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 S" j& r& x  h$ ~# b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 R4 H6 L* n9 R* a
  48. #else3 S# X. L6 r& }: Y
  49. #define DMA_PRINTK( x... )
    9 H: _  u4 F1 H( Q# g6 v
  50. #define DMA_FN_IN
    5 k; v4 Y( y! h& B
  51. #define DMA_FN_OUT
    $ T, A$ b  C, Q% h, v
  52. #endif
    - s9 [8 g2 x) h* f7 r# `
  53. ) B* R, \4 J& R5 s4 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      X! C! w7 M+ x$ b* v' h9 V8 _
  55. #define STATIC_SHIFT                3. h# z3 C; P% C& O9 p
  56. #define TCINTEN_SHIFT               20; d7 C5 n; y- {
  57. #define ITCINTEN_SHIFT              21
    ; v7 x5 ^! Z1 S9 R" d# T
  58. #define TCCHEN_SHIFT                22
    * x, ^9 m; p+ A. ^
  59. #define ITCCHEN_SHIFT               23" Y% s7 J6 b# H- ]1 W* q

  60. ; p( @5 h+ |: E# U" Z9 s9 t
  61. static volatile int irqraised1 = 0;8 e7 ^% q" O* N
  62. static volatile int irqraised2 = 0;
    0 a2 o$ W9 n: D) k7 e. b4 C& f

  63. : L4 {9 Q3 a+ E9 D7 D9 W0 u, O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , r+ }+ \4 `( l, _& g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 K( U( O  g! W$ X+ {( b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 b9 W) C1 }/ s( ?' I
  67. 7 H; J  s2 t, @* K. H" Q7 |# x
  68. dma_addr_t dmaphyssrc1 = 0;
    * i' B& q8 J( _0 q2 d9 [! }7 }
  69. dma_addr_t dmaphyssrc2 = 0;
    " |/ B& V% p9 v5 o
  70. dma_addr_t dmaphysdest1 = 0;0 ?" c* S; G3 o2 O8 v3 x
  71. dma_addr_t dmaphysdest2 = 0;
    # }: ]  g! o% u/ f& m; t( f, m: G
  72. 5 [# J# M  B) o/ U
  73. char *dmabufsrc1 = NULL;
    0 S. y, R4 L0 ^0 y3 O+ _. ?4 @
  74. char *dmabufsrc2 = NULL;8 s  ~1 b& [: s2 Q. p9 m
  75. char *dmabufdest1 = NULL;7 N  P2 I3 Y$ E2 |1 A( q
  76. char *dmabufdest2 = NULL;+ C8 }6 X2 {* U* _9 O- Z6 G
  77. , C) z  w3 w- Y, j# x( B
  78. static int acnt = 512;
    7 j3 @9 m! N% g% ]2 ?4 v; p
  79. static int bcnt = 8;
    * g) b: A  d, t( t# o2 c+ M1 g
  80. static int ccnt = 8;6 X+ K5 ^0 Z& _0 r& N* @! D

  81. - Q9 l1 P& _: l4 }
  82. module_param(acnt, int, S_IRUGO);
    ( o+ Q" M3 i# O1 b
  83. module_param(bcnt, int, S_IRUGO);
    1 X3 Y. b3 m( t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' |/ ~% e' _& k! E) [  N0 f# _+ `9 `! n! n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# p5 w3 t$ O- ~) B+ R. `: X+ H/ t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* R4 h" ?. s) _3 [3 I* |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 M/ C; D" D# {

* H0 ]3 e- {+ e
2 y, s0 k% \+ n* k% e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 08:38 , Processed in 0.038965 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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