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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 V6 r1 }) a# {( H( l* M
  1. [code]EDMA sample test application( V! ^" }5 X% w$ ^. C$ L
  2. /*
    0 ~. c  h* G) V, g; h) D5 u
  3. * edma_test.c
    ) k4 m7 @& W6 h
  4. *& [/ A& s& S. R6 A8 |
  5. * brief  EDMA3 Test Application
    - U* t, y3 r: ^) `* U: O0 S
  6. *
    " W2 z' R+ G# a0 u8 u3 `1 v
  7. *   This file contains EDMA3 Test code.- `) A, h3 d$ a' T
  8. *
    # L% }& b* z5 C/ Q4 G% S+ a& }% ^* |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ?' j" b" @& u, v+ o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 V* a4 D( G6 ?7 @# N7 u" K
  11. *         TO CHANGE.
    ) K- i; H2 z9 J0 |: x
  12. *7 F. @& }/ l; ?' o" d7 m6 v8 b5 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * s5 i# p+ r1 B3 `6 f! F
  14. *, [/ A# M! }) S9 S6 G" y
  15. * This program is free software; you can redistribute it and/or+ R) ?. h1 l) Q) l( X' M/ B
  16. * modify it under the terms of the GNU General Public License as
    7 r% K0 k3 ~: ~
  17. * published by the Free Software Foundation version 2.1 X6 m. {1 e( _3 Q' _( K' h) z' D3 p+ y
  18. *. L0 S3 c7 H  r' W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 W1 t8 e; X7 X! p8 t  U" v8 t
  20. * kind, whether express or implied; without even the implied warranty. ^* Q" t) H* B/ G8 ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; s/ n. d# K' p. n* @
  22. * GNU General Public License for more details.' U5 i' @1 u# W8 a( _, L
  23. */
    ! A2 g" _8 [, U% N! O. L2 v

  24. 4 ]; \" H! m* c: L9 Y" m8 G6 X
  25. #include <linux/module.h>. V4 f8 P/ Y  y5 e0 t
  26. #include <linux/init.h>- t# |6 q# s2 |9 c. H6 G& N
  27. #include <linux/errno.h>  V+ _2 R; g' t  f8 B$ |3 E
  28. #include <linux/types.h>
    " c. Y' t, H9 J1 Q  d8 B3 o# A
  29. #include <linux/interrupt.h>' O% \3 [7 I3 q' ?% a4 o9 D/ ?, G! m
  30. #include <asm/io.h>2 W# J4 ^: e, v! b7 L) F6 r5 w$ ~/ r
  31. #include <linux/moduleparam.h>
    ' _  M. H  R) _( _  ?0 g3 B
  32. #include <linux/sysctl.h>
    7 I/ i# |1 _: W* H0 ~( v! w
  33. #include <linux/mm.h>) g! G' ^% q& C8 h
  34. #include <linux/dma-mapping.h>% R4 l+ V6 q: Y0 I4 {& r. r

  35. . B: ~0 R% E0 j+ A2 n2 _
  36. #include <mach/memory.h>
    . k* `1 k1 d6 l3 B
  37. #include <mach/hardware.h>
    2 _; F3 h/ M6 j% X. \* Z2 E. Q  ]
  38. #include <mach/irqs.h>+ d  K6 y  h; J: l0 `* O/ h
  39. #include <asm/hardware/edma.h>
    8 H: Z9 I, o6 o; _" t+ O( x/ s  M; d
  40. 2 Q! o) D6 y7 s: ^
  41. #undef EDMA3_DEBUG* Q" T  d: t% t' J
  42. /*#define EDMA3_DEBUG*/- h( I0 V! t5 D  B0 q4 n

  43. & R. I! y0 `4 P/ D# z3 S2 Q
  44. #ifdef EDMA3_DEBUG
    8 S0 A+ ~2 m  F" E( v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + M. J- C% q4 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 {. L* S* M: I" ]* W3 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , R2 F  A: u' B
  48. #else
    5 l3 x9 s2 H: i$ Z/ }* {
  49. #define DMA_PRINTK( x... )
    2 A/ ?/ j' [! s- R, q, N# ~. B
  50. #define DMA_FN_IN: q- r9 ]1 l% |) T$ T
  51. #define DMA_FN_OUT  V, }; t! Z1 H# f& t0 P
  52. #endif
    0 f' q$ R7 R' x4 P4 }* i
  53. - q% J. s* d5 ^3 l7 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( x" Z) r1 H3 \- D2 ~# I/ m
  55. #define STATIC_SHIFT                3' v9 }3 |. C4 g+ {. Q
  56. #define TCINTEN_SHIFT               20
    9 p. \" ?8 t. r1 p/ V  R
  57. #define ITCINTEN_SHIFT              21
    * w: J+ j! h: ~5 B
  58. #define TCCHEN_SHIFT                22$ j" J% Q: \9 {5 f& r
  59. #define ITCCHEN_SHIFT               23; _, }6 D: |1 \& Q. o7 Q/ ~

  60. / m- }" S; z' V9 H/ Y# ?8 x* f
  61. static volatile int irqraised1 = 0;
    ' l( u5 U, Y+ L% p5 b" v
  62. static volatile int irqraised2 = 0;
    / W& Q3 X) I  Z" c9 E6 C! N  B  L

  63. 0 J' }9 z. ^: E0 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ t% b$ e! P+ U8 X, c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) l* J0 ~: q; b% x1 h. H4 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `3 C! P6 m( o" G' h, k8 j' `
  67. / _" V' ?1 T6 J9 O. x; t
  68. dma_addr_t dmaphyssrc1 = 0;$ \) v3 @. c# i: E7 {  s
  69. dma_addr_t dmaphyssrc2 = 0;0 {5 X5 N9 g0 F# m, _
  70. dma_addr_t dmaphysdest1 = 0;( S+ m! N- ]9 G: ?5 \. C$ o
  71. dma_addr_t dmaphysdest2 = 0;& ^- v, G4 p/ c" f

  72. 5 P6 @6 T. d4 |6 @+ h0 L# m
  73. char *dmabufsrc1 = NULL;, }& x  u* {) Q- H& ^- x3 \
  74. char *dmabufsrc2 = NULL;$ C+ v$ Z- y! Q9 n; e
  75. char *dmabufdest1 = NULL;
    " R  f( ?* s3 b6 B3 n7 {5 k
  76. char *dmabufdest2 = NULL;
    ; S2 c/ c/ N, Y
  77. 6 j% N: E' q; T& V
  78. static int acnt = 512;% g+ S2 H; w* E  X+ C
  79. static int bcnt = 8;
    2 ?' @: I# V: p' s, E* r
  80. static int ccnt = 8;+ b+ B. v7 E, M
  81. 1 T; A- f3 z, @2 G  g( o' A
  82. module_param(acnt, int, S_IRUGO);
    8 r7 R( l1 _4 u8 X+ }
  83. module_param(bcnt, int, S_IRUGO);! P9 b2 A3 z4 m; P" i) Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' E, G/ F, c7 V& F
4 `' v5 a  b0 q% o" x$ I' h- j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 }1 \1 J) F2 ~# R/ U/ U: C, larm-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 r# N+ }, S. h2 a0 M5 [# i7 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 k4 K! Z9 ]: p! Y' U
6 b& I& {) S+ U; }- D
2 o+ B' Z. W" `8 w6 E, e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 04:24 , Processed in 0.040708 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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