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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" r! ^; A) Y4 p+ q. Z. x
  1. [code]EDMA sample test application) ~- d) C' p7 v  j
  2. /*
    & M) |9 l+ e4 c
  3. * edma_test.c
    / F  v% q; Z3 D
  4. *
    $ v- u; o; L! v$ V) H
  5. * brief  EDMA3 Test Application
    4 Q+ ^1 Y# M  l0 E4 [
  6. *# l1 ~% }% w. r% |+ M/ T3 D
  7. *   This file contains EDMA3 Test code.2 W; X. e8 u5 }- e0 x0 o
  8. *
    8 c$ \" m& X) I( b. z1 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ N2 y) T) |9 j4 w: b* n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + j5 \: h' r3 i0 p
  11. *         TO CHANGE.
    0 y7 @4 w% m0 j
  12. *- ?3 ?3 M* D6 w& }# i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 i- f/ L7 G4 e3 @5 u! y/ n2 q
  14. *
    , _$ B8 c. v/ Y1 s2 A
  15. * This program is free software; you can redistribute it and/or
    ( T: J6 T1 Y+ j: q4 D( e
  16. * modify it under the terms of the GNU General Public License as
    5 @' Q0 n  U: G2 f, W) e
  17. * published by the Free Software Foundation version 2.
    ; k- o  ]% t/ Z" O1 E5 W
  18. *  a4 C9 `6 ~3 _! ]$ w+ J3 H0 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # t  H* J* \: w" b3 N4 M1 X) p
  20. * kind, whether express or implied; without even the implied warranty+ o& L6 z7 r. j7 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 b( E. U/ H6 ^9 ^- l$ w
  22. * GNU General Public License for more details.
    & W! M% g' ]9 Q# M" c
  23. */: d: N* O. m5 d; @1 E

  24. , T8 v+ P( @) s6 \# [; t+ W
  25. #include <linux/module.h>
    ! n* V7 d+ I: x" j
  26. #include <linux/init.h>7 c% o' }5 f* W! \; ^
  27. #include <linux/errno.h># H& W5 y. a4 e
  28. #include <linux/types.h>
    3 H* D  ?2 q4 p; f) w
  29. #include <linux/interrupt.h>% |2 @1 R5 \% _! `) `; {5 G+ Z& ^
  30. #include <asm/io.h>
    5 T- y4 X3 B8 n# n$ R$ r
  31. #include <linux/moduleparam.h>
    2 [, q$ x* i: F+ @4 p2 z
  32. #include <linux/sysctl.h>7 M9 ~4 L8 d$ l+ \! V
  33. #include <linux/mm.h>7 {4 j  f, J/ a" w+ d$ ~9 N+ J$ W
  34. #include <linux/dma-mapping.h>) S* ?* w. ^, v

  35. ' Z7 ?  p* e" ]
  36. #include <mach/memory.h>
    * S. [& L, u$ s
  37. #include <mach/hardware.h>0 f& |- r$ h7 R. U$ {. p, D6 {
  38. #include <mach/irqs.h>
    " z& |$ P7 r5 l, z
  39. #include <asm/hardware/edma.h># X1 G! Z. V& M' b9 c+ A
  40. 1 q$ O" d. i' i. B7 v
  41. #undef EDMA3_DEBUG9 f7 O7 g0 k  N3 e( {2 f
  42. /*#define EDMA3_DEBUG*/( b$ q. ]" d) L* c! K/ T: h
  43. # E1 m- v! @) n+ X$ T8 i5 |+ e
  44. #ifdef EDMA3_DEBUG+ X( D" ]+ P0 [8 k6 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ c2 S& r& a2 b; ^) \7 z0 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 y3 g  k3 B; }; e( h5 X$ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 f5 r/ n0 v) ~. E7 \
  48. #else9 z/ [% h# c$ e, ]' z+ V# A
  49. #define DMA_PRINTK( x... )
    0 c% a8 x$ g" n
  50. #define DMA_FN_IN
    7 }( U$ ^, N' i8 Q. o$ l
  51. #define DMA_FN_OUT1 j- N8 C6 a5 D. G. j. ]5 r
  52. #endif
    1 ]- Z: R/ J1 n7 d6 H; Y: C$ y

  53. ( [( f: P/ x" R# F; o, I) \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 f$ H8 Q0 o. b' k0 }, h+ ]
  55. #define STATIC_SHIFT                3
    5 _; O2 u: Z/ K6 Q: c1 v# ~
  56. #define TCINTEN_SHIFT               200 w. T1 B# p* G! {( g
  57. #define ITCINTEN_SHIFT              21
    3 p7 h# _) v' _- Y. m! x- B
  58. #define TCCHEN_SHIFT                22) g& h) T$ c! G! Z6 @
  59. #define ITCCHEN_SHIFT               230 E0 y5 h5 ^1 I8 t+ k
  60. 0 M5 R. ~) d: S. P6 K% [' E
  61. static volatile int irqraised1 = 0;- V/ e! }3 W1 I% J+ ]
  62. static volatile int irqraised2 = 0;
    * U. g* L' W. @

  63. 2 _! T% E* l+ r) v" N3 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 o+ P+ _/ a' k  Q- V6 Q% d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - B& D8 c( n' c# W# Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n! T7 W+ ^- L# J9 N9 K' M
  67. ; K7 F0 u/ L: K/ Y' O  v6 l  a
  68. dma_addr_t dmaphyssrc1 = 0;  Z/ m, }4 ~) d2 b0 U
  69. dma_addr_t dmaphyssrc2 = 0;
    8 A6 j% o; Q0 i0 h' P3 M
  70. dma_addr_t dmaphysdest1 = 0;4 ?3 Z0 k+ s# U0 |$ i0 x) M. I
  71. dma_addr_t dmaphysdest2 = 0;) q3 c6 Y9 R4 x) \$ U+ T: Z0 Z

  72. ! \8 R+ {: C# L6 K+ S, ]
  73. char *dmabufsrc1 = NULL;- ^- e! s% `4 i
  74. char *dmabufsrc2 = NULL;0 O* j& w* y' I' V: t8 Y
  75. char *dmabufdest1 = NULL;1 U& C+ S* S$ n
  76. char *dmabufdest2 = NULL;. ^: r, t( Q0 p5 F' f" b8 o7 H: y
  77. + i2 t* Z3 G) P8 A( `# z1 y
  78. static int acnt = 512;
    ) Q6 y) p- v0 h
  79. static int bcnt = 8;( f# x$ G, B0 ]! `  M
  80. static int ccnt = 8;
    ' i3 b' n8 A- b; j" m4 D% ~

  81. ) p  }1 }  N8 e% C0 [9 u/ x
  82. module_param(acnt, int, S_IRUGO);
    + e+ s4 f8 {; u( C
  83. module_param(bcnt, int, S_IRUGO);
    : n1 L- [& P( q/ T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  [* e  t' ^3 F& E2 i" `1 _) s6 J
! F" m, p/ i* L, D  d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @! B, i" V  V$ Z1 }7 {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- L9 b3 T0 A4 K  T# n$ S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- Z) ]/ ~0 p; c6 v/ J' |; K; w5 t# R+ b& s/ D! G* |# Z

6 c+ P5 [( I7 @3 X. ^5 E8 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-13 08:25 , Processed in 0.054613 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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