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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 g% M$ u! _! ~- _
  1. [code]EDMA sample test application
    0 p  H! R( I& O% z
  2. /*! k. j1 @$ U, a5 N0 i. D
  3. * edma_test.c* J4 y- U$ ^% ^' I2 z# x; b
  4. *
    1 ], r8 t- g; T( r. b: ?
  5. * brief  EDMA3 Test Application3 L" @/ ~! e  w* u' ^( X
  6. *& |  s, d; F% q1 o! x/ n0 J
  7. *   This file contains EDMA3 Test code.0 Y8 V8 P) S4 B
  8. *9 |' B( y2 {/ ]- w& g" J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  i, j) x2 z" n- Q) k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 E6 b. b5 G" {% Z. w
  11. *         TO CHANGE., Y6 O6 {2 x+ E: m! s: _
  12. *
    - e) J9 R! L0 ]' \0 Y/ S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 f. a1 |  q4 x- Q: H! s
  14. *$ A: F9 q- I1 n2 z
  15. * This program is free software; you can redistribute it and/or
    , {8 ?3 c. S4 t4 d9 G9 Z
  16. * modify it under the terms of the GNU General Public License as9 F! c; ?9 Y7 B9 ]
  17. * published by the Free Software Foundation version 2.7 X3 X4 c* r3 n7 a7 u
  18. *1 A- y' o$ p0 Y0 c& k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 }! n4 {) B" W
  20. * kind, whether express or implied; without even the implied warranty
    % \; b& R  a" S& n1 x6 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , w. Y2 k; E$ R! R$ ~8 f
  22. * GNU General Public License for more details.) H5 E* d, S; ?( M# x8 `
  23. */6 g- b, h# @1 h

  24. ' v. u$ D, H4 j1 P
  25. #include <linux/module.h>2 b4 F' S3 B- y5 F6 U
  26. #include <linux/init.h>
    ) d' p( I" C" g9 E# n3 U" E8 q
  27. #include <linux/errno.h>
    " c" E; t6 R7 G' s) |7 b
  28. #include <linux/types.h>- x: r* r  z! ~7 W* a& ]; E+ m4 l
  29. #include <linux/interrupt.h>
    ( D2 a1 V: E. O% C  L/ l
  30. #include <asm/io.h>
    + X# m! i8 d$ C: |5 B$ o
  31. #include <linux/moduleparam.h>: P  c% E; H' s! a( w
  32. #include <linux/sysctl.h>
    * [' J9 i; Y# u3 ~. p* ^
  33. #include <linux/mm.h>" ?0 F5 W! n$ |3 A" @* u2 t
  34. #include <linux/dma-mapping.h>
    , h6 F+ r1 G0 T% R: ]
  35. 6 k. K8 R8 a) e5 Z
  36. #include <mach/memory.h>
    ; c& [  K. Q( F6 z& A9 O) a, c
  37. #include <mach/hardware.h>
    - s  C+ A: p$ o) ]3 O0 S
  38. #include <mach/irqs.h>' l* j$ Y; E/ R6 U. w3 R
  39. #include <asm/hardware/edma.h>
    ! z' l" |2 O  L8 ^( b
  40. 6 _% O6 h+ x0 e  E# T
  41. #undef EDMA3_DEBUG, O+ w- x4 |# B4 O$ D; U$ X
  42. /*#define EDMA3_DEBUG*/
    8 f! G" t# y( ?. o
  43. 7 v2 F- |5 m' \( L: W$ ^; d
  44. #ifdef EDMA3_DEBUG
      }6 ~1 @+ H1 M3 I, ~; @9 c7 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ B' q  v: _& ?+ X; w, A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 Y4 _5 a3 W! o2 Q' o5 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 U2 d3 f- Y- ^+ e$ _
  48. #else( P+ w8 w' n/ G' |) T6 }
  49. #define DMA_PRINTK( x... )" l( Y  }- C" d+ a5 \9 f4 o4 Y
  50. #define DMA_FN_IN
    3 c! |7 X( w; U4 ^! L
  51. #define DMA_FN_OUT7 x, Q. `+ N+ n5 ?
  52. #endif/ e# O3 H- A9 M. n) F; d8 q
  53. ' R9 v* ~. E9 n! ]% [$ [: ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' Z* E& c/ j3 J; N) p' }
  55. #define STATIC_SHIFT                3) M) r; t2 v9 Q; ]; }% \
  56. #define TCINTEN_SHIFT               205 i% M  v( G: C4 \# G* q7 E0 j
  57. #define ITCINTEN_SHIFT              21! s" N/ V5 P# C/ N- B
  58. #define TCCHEN_SHIFT                22, {8 B0 |+ i% i& Q* i
  59. #define ITCCHEN_SHIFT               231 t3 @1 M; f2 G- s

  60. ! i" F9 L* ?0 U
  61. static volatile int irqraised1 = 0;6 H+ L: m7 o# x+ S/ }. i
  62. static volatile int irqraised2 = 0;' M. c9 C; S# [3 G' i0 o

  63. + B$ O0 k; M5 ]4 e- t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 H2 V5 a8 |8 d1 `$ C5 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " K- x7 J1 L; @8 B" d7 H9 T: c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  e  [: m; y2 ?3 s
  67. 0 \, p+ N$ n% i+ Z0 j+ W' w; V" u
  68. dma_addr_t dmaphyssrc1 = 0;3 z/ H- Z) d# e
  69. dma_addr_t dmaphyssrc2 = 0;
    - }" J+ H8 `6 Y
  70. dma_addr_t dmaphysdest1 = 0;
    + i  l; G% M3 p5 S- S  y4 x! \
  71. dma_addr_t dmaphysdest2 = 0;3 y* [8 S8 T1 [# K# F: H9 p
  72. 6 p" J8 q# E' @9 `
  73. char *dmabufsrc1 = NULL;
    5 l; I7 u" t  t( y
  74. char *dmabufsrc2 = NULL;& D/ I$ F) ]; h+ K
  75. char *dmabufdest1 = NULL;7 d" n) n0 {6 |$ \  T' c
  76. char *dmabufdest2 = NULL;
    , t5 ~, q" I% m

  77. 8 b  @8 ^5 }4 H8 Q
  78. static int acnt = 512;& `  x- h& Z# X$ Q
  79. static int bcnt = 8;. q  J: q3 r/ S- V1 G! c- v0 _
  80. static int ccnt = 8;2 b; ~* s2 M, S) J* f' y
  81. 4 {" m- a0 z$ E9 J4 t* `
  82. module_param(acnt, int, S_IRUGO);
    ; h: }- e" V8 W4 ]& ^
  83. module_param(bcnt, int, S_IRUGO);. }5 u- f( b2 o' w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 W! Q0 ]( p) C
, B$ ~; O% Z% ?3 x* O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% }0 Q* Y* d4 S- G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 R0 b$ i2 r3 a# o2 h4 I/ {& f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) a4 h" Z; H0 ?: |7 L( ~# g" V

! r. g( X; [) f% J$ I- v
; W& {, }8 |9 ?$ j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 12:20 , Processed in 0.038055 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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