OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 U& l4 f, x8 `! U9 d. V
  1. [code]EDMA sample test application! u5 O  [1 Y* z2 z6 u
  2. /*
    ; J4 K5 Z0 ?/ U
  3. * edma_test.c5 y7 U: _! M( e/ \( N: Z& \; W; F* `, i
  4. *; p1 i7 x4 X  S( e" t* E5 G- l
  5. * brief  EDMA3 Test Application
    ' H3 ?' m9 J* t3 u2 \7 S! r0 t4 n4 b
  6. *& h- D: M* ]) D$ U  H. d
  7. *   This file contains EDMA3 Test code.( t, ?2 x/ y3 q$ U6 s! F1 l+ Y
  8. *
    ( b9 Q) N% X- [- F3 Y8 _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 s5 l0 N5 G2 s2 O1 c/ I+ y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 Y& U/ F$ w+ O2 |$ |: g, g
  11. *         TO CHANGE.
    9 v0 u' U, Z. q, K/ O# ^
  12. *
    4 R! U, }$ q( e5 v$ v# x6 g  F- S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; t2 W9 Y8 x) [$ P  N! y
  14. *
    ; Q3 H9 Q6 y1 e6 e! u$ t
  15. * This program is free software; you can redistribute it and/or
    0 x( l8 |8 j3 @4 p4 r- N
  16. * modify it under the terms of the GNU General Public License as: `3 X; u& B: M0 `' [
  17. * published by the Free Software Foundation version 2.' Z! k! X" r8 f; _1 s0 k
  18. *
    ' m) M4 W  `+ B( i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 U5 @$ c3 z2 H8 g9 B
  20. * kind, whether express or implied; without even the implied warranty
    2 ?9 H4 K" U. \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 M$ Z' c8 {6 w$ s
  22. * GNU General Public License for more details.! Q& b8 @' w1 Q
  23. */. M0 M4 V- Q5 G8 H: E7 g0 j

  24. - ^5 k4 l7 K- c$ J
  25. #include <linux/module.h>
    # Y- a! u' x# u# R( Z. r' t
  26. #include <linux/init.h>! c7 Z$ ^  @: X' a  [& D
  27. #include <linux/errno.h>: l0 `' w8 n, a
  28. #include <linux/types.h>
    / ~! O* D) z8 h9 f
  29. #include <linux/interrupt.h>
    ) r4 w5 e5 w/ s: @+ Z
  30. #include <asm/io.h>( B- y* \' Y$ a* |
  31. #include <linux/moduleparam.h>5 b  ]& X+ @/ o: i; h! E8 Z8 w
  32. #include <linux/sysctl.h>
    ( h- o$ F" A' a1 B9 p, Q
  33. #include <linux/mm.h>
    " \" }8 J( |8 l3 B( w
  34. #include <linux/dma-mapping.h>3 e! Z0 E( y9 |5 X

  35. * M( F1 {9 V+ h' \2 i8 b9 v
  36. #include <mach/memory.h># \. |  K1 y1 a+ b! G0 m- C: v; ^
  37. #include <mach/hardware.h>
    + j# v- U  B/ S6 O- T
  38. #include <mach/irqs.h>
    0 _/ f! L: I( ?* o
  39. #include <asm/hardware/edma.h>8 D( V1 r' d. S$ g" g3 R
  40. 3 q! u2 @! r' n- M% [  Z
  41. #undef EDMA3_DEBUG# o3 W: O) u8 R# H4 X5 d
  42. /*#define EDMA3_DEBUG*/2 w6 d4 x' `7 [6 ]

  43. 5 r4 X7 Y+ D+ R  V1 l; g! L
  44. #ifdef EDMA3_DEBUG
    ' z) z( u1 ]3 I& O$ T, q( P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      Y0 @6 V" F. Z. e+ s/ f" J1 M* C/ G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 ?9 A. t& d* Z* t. p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . @8 P9 b; Z: l, P( w; Z# M
  48. #else
    : c- c) _, G: _/ d5 A* ^2 R# j
  49. #define DMA_PRINTK( x... )
    ( X& i5 ~% Z. A' h
  50. #define DMA_FN_IN
    - }+ D) t+ M  v. I
  51. #define DMA_FN_OUT
    : I7 h3 q' B2 a7 T6 D* L- r
  52. #endif! i; x5 ]% O5 l* h6 ?8 K
  53. * J: ~4 N2 \  X& n7 e- v% }! _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  K; Q  \! F; F8 x2 L: _
  55. #define STATIC_SHIFT                3
    $ @! V2 G, B8 O  H  T, r% }
  56. #define TCINTEN_SHIFT               20
    $ C; I7 k2 `/ R) N
  57. #define ITCINTEN_SHIFT              21
    . U3 s3 |. d1 b% q6 q' m% x
  58. #define TCCHEN_SHIFT                22
    $ t6 W7 [5 [- V" z& E8 f: T
  59. #define ITCCHEN_SHIFT               23
    $ t, I7 n8 p" _9 G2 ]
  60. 9 b3 n* A8 V. @# ~2 N
  61. static volatile int irqraised1 = 0;
    9 p2 C% n, s# I. @" g
  62. static volatile int irqraised2 = 0;
    2 J) ?$ D) t/ s, E
  63. 9 g  @' [: R# g! D1 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ U1 Y+ P4 k3 z0 L3 i; o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% B# d" y9 L- u. U& |# B6 f  D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% J8 x5 A- P7 L/ q! L% U  J) T+ s

  67. 7 M( _. h# b% D8 ?9 M1 N5 C
  68. dma_addr_t dmaphyssrc1 = 0;6 E2 S5 X0 E2 }" T; S; o0 g* |) x
  69. dma_addr_t dmaphyssrc2 = 0;  D: |6 w* T  K
  70. dma_addr_t dmaphysdest1 = 0;1 a9 |7 y5 w+ P2 E
  71. dma_addr_t dmaphysdest2 = 0;
    ( v$ m8 d% n7 F* C- ^  a+ p
  72. 3 ^3 B) N: |) C. `- k
  73. char *dmabufsrc1 = NULL;* e1 C8 o1 x1 e$ @- q
  74. char *dmabufsrc2 = NULL;5 ~4 `9 e: g0 s# r. }+ ?: ?
  75. char *dmabufdest1 = NULL;  I$ b- j3 v, x( G, k2 k: t
  76. char *dmabufdest2 = NULL;# n3 l2 J, R& r9 C  ]* A
  77. : s, M: D# B  I% a6 L
  78. static int acnt = 512;
    " W9 g) R  ]2 g' o( t/ E0 h
  79. static int bcnt = 8;
    # e4 P9 N4 n# a8 k
  80. static int ccnt = 8;- w: D- d; n, g0 a  w  q

  81. ( P& r# y8 @! S; L6 l* e
  82. module_param(acnt, int, S_IRUGO);
    9 I$ d+ h% q$ D  m6 O
  83. module_param(bcnt, int, S_IRUGO);( M6 u/ R' t2 T( j: q3 X% `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% r+ W6 i7 X! A7 I5 o$ h
1 Q7 [  c- L, x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: Y+ y, `  v0 K% q' U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 {4 e  g1 ~& I& o. p* K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ x- E; k/ G. M  G+ [2 ~0 y) C

$ p) L! c8 S6 e. B/ }3 A' O' y* l9 u- n/ \0 t0 g# [2 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 19:26 , Processed in 0.037200 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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