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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 p+ E- v6 i- F$ n& d# \9 m1 K
  1. [code]EDMA sample test application; q& D4 c' V0 S1 A% f8 I) q
  2. /*9 z1 G. Z- [5 @. X' Q
  3. * edma_test.c0 C! }# j$ q) b) ?( l* o2 a
  4. *
    & `  m: U- x8 v9 K0 Q) b* b# e5 w
  5. * brief  EDMA3 Test Application
    " R- ]) S1 o$ @
  6. *% j- f& ~+ N1 A; T' C2 h/ |( R
  7. *   This file contains EDMA3 Test code.% L% t& k6 r4 `9 i" y
  8. *& u& \0 x- c' W( Q" A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 [9 o1 e9 k9 D; r" S- ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 p+ y2 B) d8 X( F- S
  11. *         TO CHANGE.
    1 }6 M4 b" E0 z+ Z9 r4 I; c
  12. *1 r4 g. r& R3 \* F, S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 u& Z. |: w- e% U/ f1 X3 Q
  14. *
    0 E2 _) }$ V+ Y1 A+ |* k
  15. * This program is free software; you can redistribute it and/or# b8 b+ l, X5 K
  16. * modify it under the terms of the GNU General Public License as* ?0 X7 e& a; B$ p. Q1 l0 K- |8 l& Q* j, ^
  17. * published by the Free Software Foundation version 2.0 O. A: X9 F/ K
  18. *6 t" T1 }: i2 {; G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; I1 F! y( W3 B# h* @6 c7 \) q
  20. * kind, whether express or implied; without even the implied warranty
    , d/ g0 B& \( Z: s  P5 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , T* ]0 Y5 |' ^4 @! J8 p* N( |
  22. * GNU General Public License for more details.
    # S$ c/ r4 c+ u1 Q7 F2 J" b1 M
  23. */
    % v/ O' {9 o- b+ I

  24. 3 B  n) O. Y* H, H/ t
  25. #include <linux/module.h>
    * i8 v- b/ [% c
  26. #include <linux/init.h>+ `- w" U1 T; }& s1 v  x
  27. #include <linux/errno.h>
    + g# \$ @( Z# I; E4 C( y* X$ W
  28. #include <linux/types.h>
    ) l0 D1 N3 S- ~" l$ R( Q& N8 [1 }
  29. #include <linux/interrupt.h>0 N" @% X: _% _6 z( B
  30. #include <asm/io.h>
    4 ]9 X, B  ]! @4 q' c- D8 T
  31. #include <linux/moduleparam.h>
    % w0 _- k- f+ |. ?- E; |5 C) B
  32. #include <linux/sysctl.h>
      N# J/ ^, D/ Q9 m. F9 Y+ z
  33. #include <linux/mm.h>, c, f: b2 T/ e5 z4 R6 r& W& N
  34. #include <linux/dma-mapping.h>
    # K4 J$ A# r5 l& {' q. ^
  35. ! [, v/ P0 ~3 Z- h! }1 M
  36. #include <mach/memory.h>
    ; W: D& K, E* l9 J8 M& }
  37. #include <mach/hardware.h>' D; q- V4 z# ?( U& r
  38. #include <mach/irqs.h>7 S. C2 u+ s) n; A- H! D
  39. #include <asm/hardware/edma.h>
    1 ?. J2 P, F5 [  [

  40. ( _1 }4 A4 D* E
  41. #undef EDMA3_DEBUG
    ; E3 |3 @+ n4 e0 e
  42. /*#define EDMA3_DEBUG*/
    6 d" s7 }. G' I) P- j* q/ o8 l

  43. % g2 G( `! `7 S2 o# h
  44. #ifdef EDMA3_DEBUG3 H! [! H5 P0 Q: ^' u4 d$ `) _0 B! |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' C% m# N2 K7 Q/ ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % g0 }' {$ V, k( `& g4 R3 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  B2 G& `* m6 A* [
  48. #else
    2 ?$ P, T8 O2 p4 Q8 ?, m& l0 u
  49. #define DMA_PRINTK( x... )
    " Z$ z0 T" e! n
  50. #define DMA_FN_IN
      W3 X; c) h9 c- S$ n. u
  51. #define DMA_FN_OUT" _( L/ n& W, s8 m: A( O
  52. #endif9 R7 t$ C7 I! U1 z, y6 f- }  V

  53. / x8 Y7 x# N& g+ d+ _6 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# `0 m$ I; b+ R# ]0 `
  55. #define STATIC_SHIFT                3
    2 X& y8 ?7 R' T- l
  56. #define TCINTEN_SHIFT               20
    % @$ I6 ?+ {- f9 f# l
  57. #define ITCINTEN_SHIFT              21- M8 J3 z2 y% U/ U1 {  L8 p
  58. #define TCCHEN_SHIFT                22
    ) l8 B9 E% d9 N6 I5 v" L
  59. #define ITCCHEN_SHIFT               23
    ( b" X  y5 v# h2 e1 u3 K
  60. . G6 u6 M* l. P
  61. static volatile int irqraised1 = 0;2 o. k% o; N, h" K
  62. static volatile int irqraised2 = 0;& {( w, b8 H9 u; ?
  63. / P8 h. a7 u& d' z6 }- J  c" [# F0 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Z2 G& Y6 C1 ~& C/ s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , I: r4 }5 S- A, l% v/ a& o( R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" J! h, z1 U# v1 N

  67. # G, ]0 F" W5 _/ b1 W. ?
  68. dma_addr_t dmaphyssrc1 = 0;# `2 ~( c: j  ^0 D/ w% U5 w* P
  69. dma_addr_t dmaphyssrc2 = 0;3 k  W# B3 I* e5 x; \
  70. dma_addr_t dmaphysdest1 = 0;
    ) [5 R) O# K  ~
  71. dma_addr_t dmaphysdest2 = 0;
    1 y, P& H  o' o$ ]! b

  72. 9 ]$ J* s( N; W: [
  73. char *dmabufsrc1 = NULL;
    / H* Z9 z4 y5 Z7 F$ W/ k
  74. char *dmabufsrc2 = NULL;
      k) k5 c: a. Z) W: N  @7 Y
  75. char *dmabufdest1 = NULL;
    " o1 [% t0 F1 n" Y3 B: n, _7 P1 r
  76. char *dmabufdest2 = NULL;
    " H! f' t) j1 D! ~" b
  77. ! e1 W) e  D: z- X, U
  78. static int acnt = 512;
    $ T& c8 v; F8 Q
  79. static int bcnt = 8;
    + }% `6 s% u# `" T
  80. static int ccnt = 8;
    - O5 f6 l7 V- q, A  y: R

  81. " j: k0 B) Q: y$ G+ ]0 h
  82. module_param(acnt, int, S_IRUGO);4 z1 N& `3 ]: C4 C  j  j
  83. module_param(bcnt, int, S_IRUGO);
    1 a3 D/ s1 j0 q8 T) r/ o, _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; N, ~$ j! @7 x$ z
* l- a7 l. D# v0 I& ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 `) c7 w" j0 C) J9 K# r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ L0 |; s9 l8 O* z  P) l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]0 D% X: ~& z( D5 M
! f$ m8 O( @3 s1 u
8 Y) U3 \! }5 d5 D. i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 17:10 , Processed in 0.040789 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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