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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 X) K- \7 _+ U4 R
  1. [code]EDMA sample test application
    : f- H3 C& w4 }6 \( _+ Y
  2. /*, D; H, B/ Y- A' {
  3. * edma_test.c" R$ I, L9 `* B7 i6 K& M4 N
  4. *8 L& x+ a, o6 C6 l
  5. * brief  EDMA3 Test Application, @+ B4 g6 I5 k
  6. *7 B/ J/ D. o) X+ [# l
  7. *   This file contains EDMA3 Test code.
    : m8 ?9 q) R% A' y. b3 j1 q
  8. *
    ; I' D8 M5 A% g5 ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. c0 Q% }' C0 z* s4 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 {5 W/ @1 C3 @- e2 ?6 R# W. L
  11. *         TO CHANGE.
    % v, _- F9 N1 M1 e
  12. *
    0 `, O" n4 ^8 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & A" g+ T- y# F# ]5 ^; L1 o4 R
  14. *0 }; s' m, r  d! q! R4 j" G1 H- W2 h
  15. * This program is free software; you can redistribute it and/or
    3 Q% k$ U" r9 Y8 Z; h) |% P8 v% j
  16. * modify it under the terms of the GNU General Public License as1 M, e2 y7 Y9 C3 ^: ^2 D" M
  17. * published by the Free Software Foundation version 2.; H0 G( D' z, `9 h  y4 l0 B
  18. *
    7 T3 f: r; z6 F, c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( b- ^! r# y& k) r/ e/ Y# y, |) z
  20. * kind, whether express or implied; without even the implied warranty9 g5 k3 ^5 x: L' _7 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 c4 I& ^8 a( O5 ]9 G7 w5 t- U8 e
  22. * GNU General Public License for more details.
    " M+ W& V2 L( v8 a" E! B, d
  23. */
    + x0 N. l% M8 {! F, m7 {& s

  24. : M$ [% K8 c; S: ]; p+ p$ a- n1 Q
  25. #include <linux/module.h>+ D4 p5 W7 _8 [6 U
  26. #include <linux/init.h>
    8 P: H3 b+ [) B! I9 v. y
  27. #include <linux/errno.h>% K' e( g$ B2 ]1 {* N
  28. #include <linux/types.h>- e7 W* C6 {! ?/ D
  29. #include <linux/interrupt.h># Y# ^: F& W& ^1 g
  30. #include <asm/io.h>8 A. X+ y" N- b9 J* q4 z. w
  31. #include <linux/moduleparam.h>
    9 z3 G5 N9 r+ _6 Z% r  n
  32. #include <linux/sysctl.h>
    / h! R1 z. R1 b+ o2 ?5 Z2 Z9 K
  33. #include <linux/mm.h>; U2 a6 b7 ]. y- g1 U" O, j9 l
  34. #include <linux/dma-mapping.h>+ z2 |- \0 H+ y+ r+ @# x$ ~+ F

  35. 2 @& u$ K0 O2 L- N! K, _
  36. #include <mach/memory.h>
    " T! y& G) w! G# X' ~; Y
  37. #include <mach/hardware.h>$ f3 l" D* j. m) B* t
  38. #include <mach/irqs.h>/ H* |  B2 J' r6 o8 B7 I
  39. #include <asm/hardware/edma.h>
    0 f0 R1 t. d7 w& H$ K0 e; ^

  40. % X- J) s/ X6 A* E5 F& ^- ^) Y
  41. #undef EDMA3_DEBUG& n2 W: D7 K2 [- k, u+ q! M  @
  42. /*#define EDMA3_DEBUG*/& E: u' Q4 I6 M$ o$ X
  43. ' R% x& D9 L) i5 W) _# _
  44. #ifdef EDMA3_DEBUG
    2 i2 C2 F/ Y1 \5 \, F! _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 @( N( w( W7 e, v! e4 U+ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) I/ k6 L  m. [; W0 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 \' k" o; S1 m! A8 P" o
  48. #else9 K/ }5 B' r1 U2 H! G
  49. #define DMA_PRINTK( x... )
    1 Y0 j3 H/ b9 i& n7 A! m- d
  50. #define DMA_FN_IN7 o3 O# a& V9 N1 t: N3 _% R7 h
  51. #define DMA_FN_OUT5 E8 l0 @) ?* a
  52. #endif
    8 L7 d; A% e0 ^4 b' A( e2 i/ z1 A
  53. 1 m' y1 Y2 A, P1 u: [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . y/ y6 H  _+ G8 z
  55. #define STATIC_SHIFT                35 w) Z# \6 I, n1 L. l* r
  56. #define TCINTEN_SHIFT               20
    8 E1 ]) I$ e" e6 C. O
  57. #define ITCINTEN_SHIFT              21! D4 P3 a  L3 `0 ?, `
  58. #define TCCHEN_SHIFT                22- o6 |* \- i- f: X+ S8 I
  59. #define ITCCHEN_SHIFT               23
    , m* z( A! \6 l4 c1 M* f5 s
  60. 7 s  n+ ]2 B5 }* D$ |) M, ?3 s  C
  61. static volatile int irqraised1 = 0;
    # ]1 q' r- h, G7 }
  62. static volatile int irqraised2 = 0;# |7 K7 u+ n: N( i( |

  63. - q$ b: e+ u: b# Y0 n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 J# a4 {) H8 Q4 r0 Z  p0 a2 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 y* t0 G( I/ |' a4 \) m8 _( w, s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 [( f- F: _1 I3 l' ~/ v2 ]. A

  67.   L' Y6 i, z6 z8 ?" u. e6 C) Y1 m
  68. dma_addr_t dmaphyssrc1 = 0;! N& F) Q9 E4 o" X1 G9 s0 Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ' s8 B( H/ @5 B$ \* S0 _4 c
  70. dma_addr_t dmaphysdest1 = 0;
    * ]- Z- u7 L: K; {( ~6 \0 R
  71. dma_addr_t dmaphysdest2 = 0;
    " b. Z* @+ p$ B& \

  72. 5 p+ }; C1 K) @7 D$ P; e, l
  73. char *dmabufsrc1 = NULL;5 r1 J7 l: i1 |) P9 Q
  74. char *dmabufsrc2 = NULL;6 _* F& X: Z, ]
  75. char *dmabufdest1 = NULL;! h3 A" P( T" Q
  76. char *dmabufdest2 = NULL;
    . C% l1 v8 ?8 N1 @- K! A1 ?% W  D0 v
  77. ; ?- p5 o6 L+ ?) Z/ O  e& k
  78. static int acnt = 512;( Z6 R4 b2 z$ B3 [
  79. static int bcnt = 8;5 l6 K- J) t, {
  80. static int ccnt = 8;' |, U4 R( _( C- E. [1 p& a
  81. 2 _0 T, x) z+ Y' _
  82. module_param(acnt, int, S_IRUGO);4 p. }* L3 R  q; ?1 }* @- J9 o' |
  83. module_param(bcnt, int, S_IRUGO);
    % h. I. o7 S, S! I( Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) @8 W0 ]7 H) p2 \6 L$ C% h4 }

7 m* d) ~8 w' f8 k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 ]3 h# ], I# v$ O9 I' c2 |: R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 o3 y; l) [# B; r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. Q6 G+ R8 s2 D7 ^. y
2 o7 Z0 g4 Y/ m) U  o3 I
- l5 @1 `3 k) r$ t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 14:07 , Processed in 0.039015 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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