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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- I. Q/ g' Q% g9 O3 q
  1. [code]EDMA sample test application, N- y) s" V! x1 f/ P: ?2 l# j! T7 a
  2. /*6 w5 `, ~. j8 A
  3. * edma_test.c
    0 }% }+ I: i9 m. l7 k
  4. *1 `' n. U2 U( ?0 M- s- K6 Q+ ]
  5. * brief  EDMA3 Test Application3 i0 f$ h4 s5 o3 W  G! i
  6. *6 E0 T0 P; l7 ^. J. k
  7. *   This file contains EDMA3 Test code." o1 w2 r' a0 g0 J9 ?4 }: g
  8. *$ o5 x) B) y+ A) `* ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % k1 V7 [( m3 {8 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! }' {" c$ g7 \, ?3 d0 J( J, ~+ P
  11. *         TO CHANGE.& C- z5 @1 N2 C/ c
  12. *# j( M6 A* ?: @- Q  w3 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 A1 b: k+ s: a6 t9 @5 L  D
  14. *
    4 Q" d  J4 j/ {( p
  15. * This program is free software; you can redistribute it and/or
    / R7 @( K, M6 p% u  T
  16. * modify it under the terms of the GNU General Public License as7 V, Z4 q$ I$ g* L) `
  17. * published by the Free Software Foundation version 2.
    3 W; A% G6 h3 {% S. U1 [' `
  18. *9 N/ `/ K* U, Q0 |, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ?) q; ~  a$ ~  ?
  20. * kind, whether express or implied; without even the implied warranty
    % G# d3 X3 |. a3 b2 i' _& w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; T  v& `  D7 d8 V* E+ i1 G
  22. * GNU General Public License for more details./ N( s9 F; C9 I; G. j( M
  23. */) Y' d, O( V9 G

  24. 6 M5 ^1 w( Z* ?& d+ V% \% E
  25. #include <linux/module.h>- y( h2 Z9 Y9 i3 {. x
  26. #include <linux/init.h>
    3 `) Q; h* ]7 z5 A
  27. #include <linux/errno.h>1 E" _2 Z) Z! H/ }0 C, w
  28. #include <linux/types.h>
    ( x: o7 c5 {8 N$ X, F' O2 s
  29. #include <linux/interrupt.h>
    , D$ }) d( d: ~' L
  30. #include <asm/io.h>
    0 `, J" U( Y- |: w
  31. #include <linux/moduleparam.h>* @- h& j. U$ R. {1 S' s
  32. #include <linux/sysctl.h>2 z2 Q7 L+ E% j" E) h+ i8 \6 V! d5 K
  33. #include <linux/mm.h>/ F/ l, i5 F" M! \7 \' C2 C2 E
  34. #include <linux/dma-mapping.h>7 k9 o1 M- a3 h. B3 Z) Z/ A$ l% {( `$ ~

  35. " S5 H6 f" ?6 e( r  n
  36. #include <mach/memory.h>
    / `6 N2 l9 n' a% g6 `
  37. #include <mach/hardware.h>( p0 c- z( t& j# g' n+ a1 M  Q
  38. #include <mach/irqs.h># {0 p: a5 x, D8 @- }
  39. #include <asm/hardware/edma.h>
    # G4 z; ?) R5 t4 \. ?3 T' h' g

  40. " T* J% o+ J/ @: g! h6 M+ E+ s: c
  41. #undef EDMA3_DEBUG8 j; |' P' D1 B6 U5 U
  42. /*#define EDMA3_DEBUG*/! Y$ g) x3 m- x; F5 w* \% l
  43. ' t7 q& H0 p/ }7 r/ L
  44. #ifdef EDMA3_DEBUG
    : ~/ B* G4 c: L4 j9 C, B$ F6 z+ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 W6 n" O3 q8 L1 H2 z! p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 J3 ?* K* a/ J: ]+ |, U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ~( C$ T, o* _/ O% Z- `
  48. #else
      Y* ^2 ~% [; N8 ]
  49. #define DMA_PRINTK( x... )
    + ^, {% X8 z4 H- q3 J4 O
  50. #define DMA_FN_IN
    9 e6 X5 m: i( G6 \- V2 P
  51. #define DMA_FN_OUT# P$ r0 O9 ~8 G/ C. r! M# h' f
  52. #endif
    ! R. U+ C2 y) e; u, i, ~

  53. $ D2 N8 {3 s8 ^" }+ }: C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  F' c- V$ u) J$ G3 M
  55. #define STATIC_SHIFT                3. W/ ], P; _7 |; h
  56. #define TCINTEN_SHIFT               20
    9 e) {4 E  x/ @% m8 G4 t1 m8 F
  57. #define ITCINTEN_SHIFT              21
    + m0 M: k; f6 U5 W  j' |
  58. #define TCCHEN_SHIFT                22
    7 y/ X6 F, g. T4 ~* c2 q2 X$ W
  59. #define ITCCHEN_SHIFT               23" z8 `2 T: O, o1 h" ]. h

  60. : P# G' b+ d& k6 O4 m, o# X
  61. static volatile int irqraised1 = 0;
    0 s6 ~, a( s) m1 L( Z4 K
  62. static volatile int irqraised2 = 0;
    & K% h8 M" w! f+ A$ x/ n* t
  63. + G( o: t: {) ^& W+ W. {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; q- j7 X- S1 s/ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . \7 [& Z- i8 L; N! n; W5 c! D( h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + X2 s& N+ m( W# a2 d

  67. : c) g, B( W) ]0 Q/ ]! k
  68. dma_addr_t dmaphyssrc1 = 0;8 [* n) M: o4 o: J- V% U
  69. dma_addr_t dmaphyssrc2 = 0;
      w/ k. T# v! f- u4 `
  70. dma_addr_t dmaphysdest1 = 0;3 _3 D( L+ V  g# X' X9 ~' ^- o
  71. dma_addr_t dmaphysdest2 = 0;. \8 }8 O8 J* {

  72. : k% o# S3 Q, e1 w3 L7 f' W! S
  73. char *dmabufsrc1 = NULL;: ~3 N. c$ L5 E9 {: X
  74. char *dmabufsrc2 = NULL;3 E# x0 L# T' ^5 ]9 m, I# U
  75. char *dmabufdest1 = NULL;- s+ y- a6 O2 J9 T
  76. char *dmabufdest2 = NULL;
    0 y5 a1 U' d: L/ C9 X, `. f
  77. ! L2 A; a4 }; P9 U
  78. static int acnt = 512;
    & f; b& h, r/ S5 y9 J4 Y
  79. static int bcnt = 8;
    4 f8 J. L! {" J2 ^& C. |3 I
  80. static int ccnt = 8;0 \8 t, s( H8 U  R( j. N4 x

  81. 2 Y* p( W1 Z/ j( o
  82. module_param(acnt, int, S_IRUGO);( T; M" M3 Q' X5 g
  83. module_param(bcnt, int, S_IRUGO);
    4 j% @. b3 T  J$ W1 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  y# G* Z$ G3 ~- ?! e0 N, ^

& m0 R3 L; ~5 D5 h7 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& I$ A* ]9 ~; c$ x* ^( Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" e$ b6 @1 Y3 t; ]5 L% W3 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' g6 |* V- D8 D) ~

1 y$ R; a$ b. }" ~
4 D1 _; }5 I2 O  C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 02:35 , Processed in 0.038546 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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