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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) K% K& c& U5 n( ^7 n
  1. [code]EDMA sample test application
    ; w/ @; }7 {7 c2 `
  2. /*9 }: j" h6 b" H
  3. * edma_test.c
    5 F7 x/ e% Z) u3 _2 o
  4. *
    # @& |: H9 H+ E8 K) `* E& D
  5. * brief  EDMA3 Test Application" s) ?, M  T% s
  6. *" ^! d# L& D- w; j. b$ s9 W
  7. *   This file contains EDMA3 Test code.
    + E1 G0 U$ D$ P. |- y
  8. *
    / _+ Z% t3 T' s6 p- Q0 M" H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      ~' o: C4 C, m+ L) e- U" }" E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. s" F8 O8 S6 U' l" t) y" Z
  11. *         TO CHANGE.
    . z2 h2 b4 B9 d$ [
  12. *
    ( J1 v$ |6 m) ^# R( u# R6 G+ n5 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- ~- M& x1 Z' K0 |0 V  q" o9 P' b
  14. *+ h  p& l# h( J# ?
  15. * This program is free software; you can redistribute it and/or6 {/ \) ^# ^, E/ M1 N* a
  16. * modify it under the terms of the GNU General Public License as
    $ ^5 [1 J( W( p- X2 L
  17. * published by the Free Software Foundation version 2.
    0 f! B2 m" t; q( M+ a
  18. *5 r' ~7 c6 d1 o& v1 b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 J( J& a# l# Q, [  A6 F. f
  20. * kind, whether express or implied; without even the implied warranty9 \: t- p. A3 G3 R2 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, I  o  K" ^: y
  22. * GNU General Public License for more details.
    # s; n9 V: P7 t/ l+ R
  23. */
    7 U$ ?  g4 U6 x8 S+ c- \
  24. 3 s2 N' k) m3 o1 W2 f
  25. #include <linux/module.h>4 N, r! C% `1 D  k9 @
  26. #include <linux/init.h>
    & |) N9 Z' W$ _1 v" E$ o7 y+ p3 N
  27. #include <linux/errno.h>6 {; i" ]2 i6 Q8 M) o
  28. #include <linux/types.h>
    % w. z1 O; ?4 @# _
  29. #include <linux/interrupt.h>' w5 h' d, L  M! W# U, b! G$ h
  30. #include <asm/io.h>% k  T& E* _3 _' {; W. |3 o
  31. #include <linux/moduleparam.h>
    ( Z9 j( d' _/ z7 M6 P% n1 s
  32. #include <linux/sysctl.h>) w. [3 q  d+ q# S
  33. #include <linux/mm.h>2 J0 E& k  J# A5 f7 N* {0 u
  34. #include <linux/dma-mapping.h>3 Q- g. k2 w* w! |4 o/ w

  35. 2 Q; p' W2 l4 e) W
  36. #include <mach/memory.h>
    + E1 m3 {9 N6 X$ c6 {5 B1 |2 s
  37. #include <mach/hardware.h>
    8 w9 l! E- v& l/ ?
  38. #include <mach/irqs.h>7 v1 X  N, d, D) e" b! y
  39. #include <asm/hardware/edma.h>  M2 b4 |2 F  n9 t
  40. 9 e5 B5 M1 i0 u) s6 E$ l' H) Y
  41. #undef EDMA3_DEBUG0 M+ ~3 {: u8 l  e; X+ h
  42. /*#define EDMA3_DEBUG*/5 M' ]/ Y# O0 }- S% A+ e& r( J' X

  43. 3 h1 n( L: |" T2 ^1 \
  44. #ifdef EDMA3_DEBUG
    $ Q4 h& O6 ^3 a( A. C( C2 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / n4 `1 ^' B' A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! @5 ~: x- n! S+ @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 ]* `0 q: G8 x- A( A2 E: n# D% ~
  48. #else# P) z% Q) I$ o" M1 i" ^. C
  49. #define DMA_PRINTK( x... )
    * I. C$ t! H8 b. d  G6 k5 P/ t
  50. #define DMA_FN_IN% E7 D1 J% K( y* z/ a6 e7 r
  51. #define DMA_FN_OUT$ c/ ?  s& s* h4 I& T9 ^' S' l
  52. #endif4 O; M: f4 q% e9 F% h% ^5 s1 X
  53. 8 b9 K' ]* e4 W) n* A0 J! f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 f  k2 \; D9 u- ^' l" P) _4 t8 l
  55. #define STATIC_SHIFT                3
    " B% X5 v( ^: N2 F6 w
  56. #define TCINTEN_SHIFT               20" [& J/ v# k0 {# R: |% O
  57. #define ITCINTEN_SHIFT              21
    & {! c2 ?! W4 l5 R+ [
  58. #define TCCHEN_SHIFT                22
    ) f) k- g5 y( H
  59. #define ITCCHEN_SHIFT               234 N8 A# x% ~& O

  60. / y7 r% o& O( R# `
  61. static volatile int irqraised1 = 0;
    # t7 h4 a; j0 P2 o
  62. static volatile int irqraised2 = 0;
    4 o/ j2 v, q; X

  63. + s, _6 m4 C" Q$ a; Y3 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! @! m3 y! R" k4 u- m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ g; L# v$ k, i, S7 e1 z. H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & a$ W+ J- u+ D. S1 B" u* D! }* a

  67. 8 Z1 f" `8 v# _; D: m. D
  68. dma_addr_t dmaphyssrc1 = 0;
    4 T. N/ q; a' p" `8 d
  69. dma_addr_t dmaphyssrc2 = 0;+ _9 E( P) b7 C: @( B! c  l
  70. dma_addr_t dmaphysdest1 = 0;: l4 n" O) {! [1 _2 |- E! f3 M0 Q
  71. dma_addr_t dmaphysdest2 = 0;" K, D+ g8 ]2 `( b7 Y

  72. ' I+ G0 ?; D+ V
  73. char *dmabufsrc1 = NULL;: |9 R" E& s3 {
  74. char *dmabufsrc2 = NULL;
    , m1 t0 P0 G, O( H0 s
  75. char *dmabufdest1 = NULL;% o+ F  G; Y2 f7 W4 l( f; z" _4 H* ?
  76. char *dmabufdest2 = NULL;
      n9 j* x, N- J5 q
  77. & R% A! L1 ~1 }: o% T  c
  78. static int acnt = 512;2 f  {: P# p9 K! `7 |
  79. static int bcnt = 8;
    6 ~7 S& I- C+ g1 n7 C
  80. static int ccnt = 8;* B, P0 E( g1 e6 A

  81. 8 \! I* c9 N5 Q; g4 `
  82. module_param(acnt, int, S_IRUGO);
    ( n' p! j2 M, N# K$ j6 B
  83. module_param(bcnt, int, S_IRUGO);3 ^- `- V6 F. @$ Q1 ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 ~6 |4 v; Z$ j. L9 ^" H
& C3 U- x8 B1 P6 Y5 C4 y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) V, a6 y1 B7 j/ }; K0 w) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 l: [  y8 C7 H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) y+ W$ a" c& `, X
$ R5 \0 x1 c$ [! X9 }0 H1 _

$ A4 E) m+ m5 V8 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 10:17 , Processed in 0.039815 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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