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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * K- ^- d2 e/ A% m! A; S1 w- p+ \
  1. [code]EDMA sample test application
    ) t" O4 d. O: h& b7 p
  2. /*
    0 ?1 w3 x2 M. V2 P; d( |
  3. * edma_test.c- s7 ~+ p2 W& e9 t) s+ t1 h, v% j
  4. *! w  Z+ j* N7 p2 Z* y1 u
  5. * brief  EDMA3 Test Application% M5 ~5 X$ U, o3 @6 m- ?9 k
  6. *
    $ F8 N- H3 R1 m/ M' _( U4 S# U
  7. *   This file contains EDMA3 Test code.. [3 a/ M# `- u3 D! B
  8. *
    & S3 G/ {- J% E* o8 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ~3 X6 {1 a0 p6 S1 e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * J4 j1 |' R- `+ g
  11. *         TO CHANGE.
    0 k9 P. }2 T" ?' c/ ~, X
  12. *
    9 [6 [  M- p# F7 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! O" M! E, Y) p: [
  14. *# h: \1 k. c, v
  15. * This program is free software; you can redistribute it and/or5 Z( a/ N& m8 j
  16. * modify it under the terms of the GNU General Public License as
    3 ]9 l* g% i* }+ w& B
  17. * published by the Free Software Foundation version 2.
    7 _: \& |1 S4 {
  18. *6 X% l; @" i1 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; \7 j1 I" f$ X/ y4 ~
  20. * kind, whether express or implied; without even the implied warranty
    2 f! V- Z8 z* K$ H# x7 f' d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( d" Q, S3 z1 |; |. ~
  22. * GNU General Public License for more details.3 z0 z8 Z5 E6 T  t! `
  23. */1 S0 B. b, A( [7 t8 ?5 K
  24. % N4 k0 M" `: c
  25. #include <linux/module.h>. o) R+ O4 F3 C4 }: }) |, j
  26. #include <linux/init.h>
    5 Q8 C! @' O, k
  27. #include <linux/errno.h>2 @. b+ J; M$ S. T
  28. #include <linux/types.h>0 ~4 b2 y& A) L" v& j* O
  29. #include <linux/interrupt.h>2 X9 ^% z0 ?1 Z8 y& J' f
  30. #include <asm/io.h>
    ; x% V+ t2 l; V  ]
  31. #include <linux/moduleparam.h>
    ; w, g/ F: i; T3 q. x
  32. #include <linux/sysctl.h>& E  `- A% U: I2 v' f0 I. C, w
  33. #include <linux/mm.h>1 X3 J$ g/ f. o
  34. #include <linux/dma-mapping.h>) ]7 A5 @& Y+ Z* s
  35. 6 w0 p- f6 P! q3 Z8 m; H
  36. #include <mach/memory.h>
    ) |3 p' J1 z% f$ N' ?- v
  37. #include <mach/hardware.h>& q: D* `3 `3 |" M% e" Z3 ^8 u
  38. #include <mach/irqs.h>
    4 S5 O. c6 A+ z. A8 [
  39. #include <asm/hardware/edma.h>4 i* @4 E7 Q" l: f7 R  G+ p

  40. 8 T) W' s1 l' o8 O. d
  41. #undef EDMA3_DEBUG8 H: D* D' Y5 T
  42. /*#define EDMA3_DEBUG*/: p7 _! `3 q+ p0 Q2 Y% c
  43. % g! M* S" z( l! ?& U; V' ^' p
  44. #ifdef EDMA3_DEBUG, d' T7 |3 o7 [* b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 t% R+ T8 b: p5 W0 `6 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ E& P1 H* |2 {9 \& m1 E; T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 Z) F% S5 R2 V' |
  48. #else
    7 i4 i# Z) r8 k  f" B9 o" n! q: E0 w0 }
  49. #define DMA_PRINTK( x... )
    . j' O/ \6 o) D  D# O2 p
  50. #define DMA_FN_IN2 D, [7 i6 X! Y# i  v
  51. #define DMA_FN_OUT
    6 ?" g0 c. p2 J6 U7 _
  52. #endif
    * o- h% V9 ?+ t+ V5 _
  53. 2 `+ o1 ], Z2 H  H4 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . j' P" t( V* @& h" a
  55. #define STATIC_SHIFT                3
    ) v6 b( M2 U/ s& r- R. }
  56. #define TCINTEN_SHIFT               208 _: l& q& z: P3 P; F  F
  57. #define ITCINTEN_SHIFT              21
    ) J7 F( y; z* Y: V
  58. #define TCCHEN_SHIFT                22
    4 W  F! E, o- D. a* ^" p- V
  59. #define ITCCHEN_SHIFT               233 z/ T4 u! ]) s5 \
  60. 9 M5 d, }$ k' E( u! F% C' a6 w- Y
  61. static volatile int irqraised1 = 0;
    3 F* U+ X1 D, a2 [- {1 t6 c) h
  62. static volatile int irqraised2 = 0;  l$ d& Q9 D: d3 c# ^# p! y* z
  63. & J8 M5 i5 w1 _- a, |+ U. c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " o/ [* Y% I7 f2 x, G$ e. Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! s( N8 n6 v8 A0 n8 R( f$ v" I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 H, p6 \, t& F  L( H& F+ V1 e
  67. , f5 k0 E8 r0 U+ T" M6 b, Q* m
  68. dma_addr_t dmaphyssrc1 = 0;) M7 l9 r6 F; t' _) B& a  |$ C
  69. dma_addr_t dmaphyssrc2 = 0;
    0 d/ p4 ^- z/ o" q
  70. dma_addr_t dmaphysdest1 = 0;
    : l- g) ~3 ?  ^' G
  71. dma_addr_t dmaphysdest2 = 0;
    & v! r# Z, s& t+ W' e! K

  72. # A7 t3 W8 F2 ~/ B) W
  73. char *dmabufsrc1 = NULL;
    1 a1 J8 {0 G2 ^7 Z1 h1 r$ e* ^
  74. char *dmabufsrc2 = NULL;1 Q: ~: [. W! y$ \
  75. char *dmabufdest1 = NULL;
    1 g; X" ~$ l: z
  76. char *dmabufdest2 = NULL;7 Q! F+ U. ~- l

  77. 6 x9 c* _  l: c. B9 P* S+ @
  78. static int acnt = 512;
    ! Z8 i, G$ t) j; a) d9 F  U  _7 f
  79. static int bcnt = 8;
      d. @7 R& o. x" T
  80. static int ccnt = 8;0 M1 [  g: w9 x! ?- D  V

  81. 4 D" L5 A) c; I0 P2 ~9 r2 q. t
  82. module_param(acnt, int, S_IRUGO);
    - C0 j/ V8 J2 S5 g9 |, a
  83. module_param(bcnt, int, S_IRUGO);
    8 @, F" J- \4 m3 D, w' Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ ?- B3 I, ~& t; A) w& ~
" Q! F% F( L, o; E6 O" n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 O& s  i5 t- D% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 [, K, J" j# |, _0 W5 ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, s$ |2 D. v4 b2 Q) Z: s9 x. Q4 C

" P; Q5 h- Y+ p3 R) H  q; R/ |8 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 20:05 , Processed in 0.039379 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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