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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 {" ]+ }0 d# @
  1. [code]EDMA sample test application! f! R( B# b" p9 C4 ?+ k" B* ^
  2. /*$ T' [. v5 {; M/ S3 @, i
  3. * edma_test.c3 S, L- E; d9 W# ]
  4. *# Z9 M  K' C! ]: T6 P) p/ ?
  5. * brief  EDMA3 Test Application
      y" ]: s" d0 ^- y. b/ T" P
  6. *
    4 ]# D' e( A; z% t8 S0 Y
  7. *   This file contains EDMA3 Test code.) S1 _- N$ p( Z
  8. *: K" x1 d" h- x* F: s3 H1 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . b: E, g4 U; M! U" b. s% {; W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- x. o+ A/ H5 O5 c* j% J
  11. *         TO CHANGE.
    ' E( h4 l! K& [* _, Q! V( ]
  12. *
    ! x# A9 J+ v2 i* M- u! s8 @- w/ r8 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! |: `# w* H0 K- E2 w; p" C/ s; o
  14. *6 |# }' r0 p1 }- P  m6 _0 K
  15. * This program is free software; you can redistribute it and/or0 ?5 J" U  i& C* L
  16. * modify it under the terms of the GNU General Public License as
    - `# Q# r7 k, d
  17. * published by the Free Software Foundation version 2.
    % D* H: E* b+ F* `
  18. ** c+ H9 w- z" d( S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# c+ r$ f/ P# J5 C/ L: h+ i
  20. * kind, whether express or implied; without even the implied warranty7 a# z$ {6 P/ W+ t+ X" ^6 r+ s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 S  N" |2 x* ^0 C7 m- K1 f7 A7 ~& e9 s
  22. * GNU General Public License for more details.
    8 }9 i+ w% i0 }2 S
  23. */
    $ G0 x4 Q& Y! f9 S
  24. ; \  x5 w8 w" J- o+ r
  25. #include <linux/module.h>  F; B) M! q1 H2 r7 O9 W- s
  26. #include <linux/init.h>
    * d! j& Z6 l5 D7 I# z: o
  27. #include <linux/errno.h>
    ! T9 R1 q, P7 K$ M
  28. #include <linux/types.h>  Z" I. b; G3 T, Y& c. ?  a8 v
  29. #include <linux/interrupt.h>
    ' E2 w" C3 ~1 g) m) t$ M
  30. #include <asm/io.h>
    & o5 w" d& ]9 k; P1 n. e- ^, {! P
  31. #include <linux/moduleparam.h>" c: k3 y- Y! F3 V9 M2 M
  32. #include <linux/sysctl.h>- }  s" U& t! X- \
  33. #include <linux/mm.h>& h0 i+ i3 [% z- Q  \
  34. #include <linux/dma-mapping.h>8 R3 [6 y: W: `8 o# K$ y
  35. 0 c' h$ {" g9 f% q  q- W1 U8 z
  36. #include <mach/memory.h>+ h8 U% l( J" ~3 r; d3 M( _
  37. #include <mach/hardware.h>
    ' q' g* x( r; V" l. w4 n
  38. #include <mach/irqs.h>
    # g" p* _# c/ z8 n: }2 L7 u
  39. #include <asm/hardware/edma.h>: U$ \& p) P5 s; Y

  40. ; i! u! b. E0 X& K( r) w+ s3 V
  41. #undef EDMA3_DEBUG5 a. v6 |5 m4 F# }+ i/ [9 G
  42. /*#define EDMA3_DEBUG*/
    ; g, u1 I1 n0 U9 e

  43. + j: i- O/ z+ c  }
  44. #ifdef EDMA3_DEBUG; X; ], a3 t" }, |& Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 J0 O* o* n$ s8 F7 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' d& {8 @) r3 Y; [* v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 |; K6 T  K# w! M* @& E) s
  48. #else/ Q9 X; t8 l: Z6 y, V* ~+ O
  49. #define DMA_PRINTK( x... ): S$ v' c/ b: n1 `2 f8 b
  50. #define DMA_FN_IN
    6 m; O0 t5 R+ H+ g# [
  51. #define DMA_FN_OUT
    9 F3 F0 q9 l7 f8 ^& R4 Q9 x
  52. #endif, E  W9 ?& r4 L# f+ y1 `6 c& O
  53. 5 {# A+ r9 h# V! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + {1 f8 p2 G8 E+ c1 J
  55. #define STATIC_SHIFT                3" Y3 [  E9 c/ w9 S7 g
  56. #define TCINTEN_SHIFT               20
    " N* F2 O$ k8 Q2 s1 S; S
  57. #define ITCINTEN_SHIFT              215 |0 Q  E) Z& Q
  58. #define TCCHEN_SHIFT                22
    ) D3 W( L+ B6 m( t* F
  59. #define ITCCHEN_SHIFT               23) R6 R0 Y- q" `$ x
  60. 2 V0 `% h3 t9 p8 d3 q6 y
  61. static volatile int irqraised1 = 0;2 E3 ~: V- e0 c2 g: d* g; d( I
  62. static volatile int irqraised2 = 0;
    ) t$ `* E$ d; c2 B9 t1 v
  63. ; f" ^' s! H. `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 y2 \* x$ [% k% g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 X& U: i) Q. K4 r% p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & B0 O6 d/ h4 F3 z! d9 S

  67. 4 N$ u, _" d+ T9 B, J8 j. ^
  68. dma_addr_t dmaphyssrc1 = 0;
    9 M! Y' m+ y' z7 S0 f
  69. dma_addr_t dmaphyssrc2 = 0;" F8 z1 x1 F/ m; k7 ]
  70. dma_addr_t dmaphysdest1 = 0;$ h# w9 U% ^5 I! m
  71. dma_addr_t dmaphysdest2 = 0;
    - l* n+ i" c1 t# r) Q4 e: W6 M

  72. , B+ G/ n9 ~" s9 O, Z6 i, T+ n  d
  73. char *dmabufsrc1 = NULL;
    - x3 O8 D9 {4 }  {/ R
  74. char *dmabufsrc2 = NULL;
    ( O$ ?1 v0 d, \
  75. char *dmabufdest1 = NULL;
    $ K* \, |. y' M
  76. char *dmabufdest2 = NULL;
    1 Y- Y; G6 r! F, C* _" p" c

  77. ) M0 t$ n* `& C/ D. t& l
  78. static int acnt = 512;3 i$ p4 n! H3 ~4 \) o
  79. static int bcnt = 8;
    $ g' W; ~- O! S  v' \
  80. static int ccnt = 8;
    ' Q0 E# t5 R" T- Z$ l
  81. 5 R! y5 S" w, M* Z# q
  82. module_param(acnt, int, S_IRUGO);8 M" u" P5 y( @# E, g4 w
  83. module_param(bcnt, int, S_IRUGO);
    $ {9 ]. d+ q: J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# b1 g1 x, ?5 g' o4 [& Y) N. c! `/ |; t! O! _2 v8 y3 D# Y. n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* C; s; e  Z, [( t  N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 H" u  k& h% S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ |, h9 c1 A3 [" p
2 @. s% h4 l) d2 ?1 w. Z
9 I0 ~- @( K5 |  b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 16:20 , Processed in 0.040140 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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