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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 {% h' v/ ?  R8 A
  1. [code]EDMA sample test application
    : {) B. O3 S) ~/ `: H7 A- b
  2. /*( t: ~- W8 F+ u
  3. * edma_test.c
    $ j" F% l7 B6 w5 J" g
  4. *9 C: Z& \4 M1 x% J8 w/ J3 t
  5. * brief  EDMA3 Test Application. f1 [, q6 V, D& u& U6 o8 x
  6. *
    ) w, X+ Y$ O: _3 R/ R5 S' s+ k; F
  7. *   This file contains EDMA3 Test code.- r& e1 q- ?& ~7 r* N
  8. *
    5 B; W4 v4 J9 C% o7 ]$ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ ^# G1 s- Q: p9 Y; _3 `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      ]" `8 ?- |! i* a" Y- j
  11. *         TO CHANGE.5 r* J6 |7 g) H% u% O
  12. *
    + Z) j1 X/ o$ H5 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 \4 f8 |) d0 z4 w  u
  14. *, S. v* D+ a) Z% T* R
  15. * This program is free software; you can redistribute it and/or
    . a- p1 V1 Z. @' c; C
  16. * modify it under the terms of the GNU General Public License as
    . S% `8 {8 G7 B5 S
  17. * published by the Free Software Foundation version 2.; D8 S4 E' B' w' P. v
  18. *+ Q6 `- D* i7 P, m- Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 e- I5 _2 N& z* A5 r! V! J
  20. * kind, whether express or implied; without even the implied warranty
    5 o9 T# J  w. a  g/ g' \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 ?2 A# s* |6 |- X, d
  22. * GNU General Public License for more details.
    5 H' G* L9 {) q" `
  23. */  Y% v! {$ d2 D

  24. 1 T$ [+ [; G/ ~. A: j; h
  25. #include <linux/module.h>
    ; p$ J0 c! ~& Y
  26. #include <linux/init.h>+ g- l! U1 m7 z
  27. #include <linux/errno.h>- C+ E( f5 j, h0 T9 |
  28. #include <linux/types.h>
    , R$ ^. Y& q% I2 s2 i% ]7 i
  29. #include <linux/interrupt.h># ~$ t/ b. u' F6 S, c
  30. #include <asm/io.h>2 ]4 o$ I+ m, @* Q- v/ `0 \
  31. #include <linux/moduleparam.h>$ d6 I7 n0 E/ X: ]" |7 X/ J
  32. #include <linux/sysctl.h>7 l- E  W; x8 |/ ~! x7 P6 Z
  33. #include <linux/mm.h>8 @' d$ |% b$ y
  34. #include <linux/dma-mapping.h>5 k( K7 e* @2 m8 p

  35. . I, R6 m+ ^: h
  36. #include <mach/memory.h>
    - E, U8 [- v- e0 U
  37. #include <mach/hardware.h>
    - r( A5 h/ S& K* W$ e9 s
  38. #include <mach/irqs.h>* p3 C& @4 y; T1 O
  39. #include <asm/hardware/edma.h>
    , @. Z% e' K/ i; v% x

  40. / l5 p4 L2 f, a
  41. #undef EDMA3_DEBUG0 D" n5 m" Q! k4 G- B" }9 l
  42. /*#define EDMA3_DEBUG*/7 H0 X+ ~! `$ u! S4 N  A# ?

  43. * R( `9 Y# x6 r& s& R+ r" \
  44. #ifdef EDMA3_DEBUG
    8 ^9 ]+ m# S1 ?! B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' @" O3 o* O- s! k/ ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  s' z$ t7 Z2 F8 }9 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( x. N  U  H. X8 L7 k
  48. #else. d. w' w# x8 J3 [1 ^+ R7 C
  49. #define DMA_PRINTK( x... )
    9 j2 z) I+ I! Y+ Y. B
  50. #define DMA_FN_IN0 L9 s8 g6 k9 E. M/ O- n
  51. #define DMA_FN_OUT
    # U) l/ y/ `$ B( r! `
  52. #endif
    # L: A! }) N/ R/ ~8 K9 P
  53. 7 ]5 F- y, i5 j9 z* z# d; c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; N/ @9 f% F9 |/ S
  55. #define STATIC_SHIFT                3( ?4 b& f2 k2 N4 g! `' _
  56. #define TCINTEN_SHIFT               20- o0 {6 M- v4 B" D* \& x
  57. #define ITCINTEN_SHIFT              21
    7 ?# F- V+ w& u
  58. #define TCCHEN_SHIFT                22
    . s0 `" m' l1 D* h( N/ t5 S
  59. #define ITCCHEN_SHIFT               233 s1 H( z  @+ R$ F0 D# S

  60. 1 Z+ p. P8 l6 r+ c5 o
  61. static volatile int irqraised1 = 0;
    9 Z2 Y  }6 Z4 B* _8 w/ \. I$ Q: [
  62. static volatile int irqraised2 = 0;% h$ Y% \' E: F( N. F

  63. - O6 o2 f, @, i5 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 N/ m$ g4 _, X; k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + F$ A) S' ]) X. q2 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; a- C% i: R$ F% [# V4 p. w
  67. # q5 ]/ Z4 X6 y+ ^2 J4 l* ]
  68. dma_addr_t dmaphyssrc1 = 0;7 F# B4 X: t0 y$ a# f! f* C
  69. dma_addr_t dmaphyssrc2 = 0;8 O  ^& @. w6 g" r$ }/ e. W
  70. dma_addr_t dmaphysdest1 = 0;4 X6 G  z. Y. ~5 d3 ?2 |& ]
  71. dma_addr_t dmaphysdest2 = 0;; S, \9 d5 f0 m
  72. ( @# x1 I0 K! I8 V! B" A
  73. char *dmabufsrc1 = NULL;
      d4 I8 M% c8 F% l6 E+ d+ e
  74. char *dmabufsrc2 = NULL;- j) m6 `* @6 t  L' q+ R; U
  75. char *dmabufdest1 = NULL;( B; k" d& x* V0 G! R
  76. char *dmabufdest2 = NULL;
    6 M: E0 o# ?* I2 U6 t8 q  q

  77. 6 t. F% ?/ O( B0 {; X, a$ Z$ G4 F+ Z
  78. static int acnt = 512;: A, k' [: X" I
  79. static int bcnt = 8;
    $ ?7 `. g( _8 H. R! s- A4 @2 m+ B
  80. static int ccnt = 8;
    % E$ g, S2 a+ S: Z
  81. ; H9 k. c+ I. C9 M8 d- k
  82. module_param(acnt, int, S_IRUGO);
    + G2 E" @8 f$ M: ~; b
  83. module_param(bcnt, int, S_IRUGO);5 q+ U. {# G, L+ G  {$ S& Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  ~" z- I4 G" X! V
7 r, ?3 F4 k* y1 l: v. g# P      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" K  ^# R; R  B* b9 X& A9 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  P7 O3 Y1 o  L: A) Y7 l, V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 o; q" O& B, ]. V" k, b: ^6 s" U: Y) Z& v4 J8 v/ l
8 z! F  K* n# V. {) P+ X5 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 09:22 , Processed in 0.039994 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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