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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 ~5 w! D) Z5 ]  p" r
  1. [code]EDMA sample test application% ?- N6 O( R6 m& E  h
  2. /*: c& A* g2 ?; P) t' H/ q' Z  p' E
  3. * edma_test.c/ Q' S/ S( [5 L" I1 O
  4. *  k3 h5 a1 t: h
  5. * brief  EDMA3 Test Application# }& Q  O0 V* h" K; g1 r" L" L/ T
  6. *
    , f1 n0 L/ o7 W# b, `& D$ r' y
  7. *   This file contains EDMA3 Test code.
    0 W' Q! l$ K$ t4 B; \
  8. *9 s$ Q7 l) {! X# g) W2 u5 m4 k" H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; \6 @( C) z. H( R' a8 H/ N3 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. ?; W' @  F# t0 Q
  11. *         TO CHANGE./ A. I& l0 |, A+ A: x
  12. *
    ; n  S! c+ x5 C) Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 T% r. a% P& r( G$ V2 V
  14. *
    , J( r/ O( S: h% C6 U
  15. * This program is free software; you can redistribute it and/or
    " `; C) i, Y  d* T
  16. * modify it under the terms of the GNU General Public License as
    % f# u% t! O, D% Q) c: k4 |
  17. * published by the Free Software Foundation version 2.% [( a: [% n3 `, e! {' `
  18. *, k4 [+ o  ?2 m' a& B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 M- p1 v7 f# b; ~% ~
  20. * kind, whether express or implied; without even the implied warranty0 ^: S* m: A* d& h6 Z2 c: y/ y6 z" A4 j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & U) {& J) T/ n8 T# C* i2 J( \; J
  22. * GNU General Public License for more details.
    $ H  e9 J+ C! p/ t  d) [
  23. */) k- z3 Z8 z- \/ P3 ]/ Q$ g
  24. ; J# W  Y0 @4 z7 T
  25. #include <linux/module.h>
    * f6 _$ d% B) E" g( J9 P1 d
  26. #include <linux/init.h>2 r) x, u' K% Q5 F
  27. #include <linux/errno.h>
    $ I! x* ?- [! D8 D
  28. #include <linux/types.h>0 c7 `2 W& R1 N; y$ o, X. f" w( L
  29. #include <linux/interrupt.h>& }; w$ a3 p' [+ x2 o' r5 m
  30. #include <asm/io.h>& R8 k4 o( q% p, X
  31. #include <linux/moduleparam.h>
    6 g" G0 K3 J4 E( O$ {' Y
  32. #include <linux/sysctl.h>
    * m, |% m7 N& R6 e, ~+ @/ J  k
  33. #include <linux/mm.h>& t. x6 J$ K+ ~# `8 q, K
  34. #include <linux/dma-mapping.h>
    * H8 y# g' h9 D0 U( [8 j8 b
  35. 9 U5 E; @7 U9 s. w1 Z  T
  36. #include <mach/memory.h>3 y& I3 t3 |1 l+ e' _: Q# \9 f
  37. #include <mach/hardware.h>
    4 {3 ~; i2 {% `' w& T
  38. #include <mach/irqs.h>
    ' k, U/ s1 [9 q. {" Y/ n9 f7 s
  39. #include <asm/hardware/edma.h>! }: b3 C- O7 i# d. x; D

  40. 5 m6 n( h) T4 r4 h& [/ N
  41. #undef EDMA3_DEBUG# T! t% P- i( R8 u  S$ G$ [
  42. /*#define EDMA3_DEBUG*/
    , w+ ]" z, [+ z, B5 x3 v% X6 s6 x7 }
  43. ' ^1 q+ B0 g+ P
  44. #ifdef EDMA3_DEBUG0 w* u2 N  I  C1 J* s7 Q  \# x0 b: q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 l1 z4 b  ?( `$ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 O" c0 Q- b# p3 p* n$ K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m3 k  v: I, Q
  48. #else( E! y! G- u7 _
  49. #define DMA_PRINTK( x... )- c5 _- I/ @" v+ T( Q
  50. #define DMA_FN_IN
    # ?; b/ x5 |8 L1 N0 l% v1 W
  51. #define DMA_FN_OUT
    ) r5 L; ^: Q) A- c- U: g/ }
  52. #endif2 e, W' X* b6 H
  53. / q1 M2 U) Q4 B! J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), [0 J7 D! \9 ^* F
  55. #define STATIC_SHIFT                3. W- O4 y2 P. x- I( D6 ~
  56. #define TCINTEN_SHIFT               20
      s- A( C7 K* Z( N
  57. #define ITCINTEN_SHIFT              21
    & b$ |4 C6 ^1 D! b- ?9 k6 v
  58. #define TCCHEN_SHIFT                227 L0 t) @# t" @, K6 ?
  59. #define ITCCHEN_SHIFT               23
    4 ^8 b5 `4 `9 N# k3 d

  60. ( a  ^6 t' M( h% U( Q
  61. static volatile int irqraised1 = 0;2 N! _  n& L3 }, E+ d
  62. static volatile int irqraised2 = 0;
    . X; A3 ]( n9 W: Z& A
  63. ; A. ^0 h. f' H+ Q2 @; C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 j, b) k7 B+ k# o- _7 ~$ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |* x) Q) ], J! ]4 ~! v" [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 i$ K- o$ Z: H% j6 f

  67. 2 ]  ]2 H" y8 G$ g
  68. dma_addr_t dmaphyssrc1 = 0;
    " U" o  L, b( _6 V# t* v4 e: F! x
  69. dma_addr_t dmaphyssrc2 = 0;8 N; D0 k) s5 _' i0 _2 S: `
  70. dma_addr_t dmaphysdest1 = 0;- d! i. n8 J/ \8 s# X
  71. dma_addr_t dmaphysdest2 = 0;0 p: z% }6 {& `) m  c; N: `, F2 J
  72. 3 _& c& B5 Q% O9 T8 z0 t% F) U
  73. char *dmabufsrc1 = NULL;: @# w* J- H) [8 K) }; x/ s
  74. char *dmabufsrc2 = NULL;
    ; S1 o2 i2 _+ u7 }) O2 Z) t
  75. char *dmabufdest1 = NULL;' V3 A0 B# E! R- x8 q8 B# T0 s9 z" f
  76. char *dmabufdest2 = NULL;
    2 O+ g; R8 p. i8 G1 f9 {& `

  77. 8 ^: |  Q/ t- _) v% I; `& c
  78. static int acnt = 512;: A: |2 I9 ^- Y! P. @" C# M
  79. static int bcnt = 8;
    8 g/ P1 C7 w. _4 q! G- ]
  80. static int ccnt = 8;4 h& ~! m3 h. O4 w  F9 Z
  81. & j4 n7 k! ^; s6 \% }$ Z
  82. module_param(acnt, int, S_IRUGO);, a' O0 }" z$ Y# c; y" M( W
  83. module_param(bcnt, int, S_IRUGO);9 D5 A0 o, E4 D  K# l0 P  x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 a5 ~" B; i1 C; ]) Q" U$ M2 K0 s) |. V% {) T
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ U! [4 x' [6 ~) I( h9 c; [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' H' {4 Y/ N5 x6 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 ^9 e6 m& L  v' q1 X' @6 m# K1 d& p+ w9 ~  O. X

% k5 F' ?, t- m* c# K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 04:38 , Processed in 0.038696 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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