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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 m" x; C$ Z: k7 r4 E4 Y! ?
  1. [code]EDMA sample test application  P/ D) T! t6 G
  2. /*
    ) x4 }+ m; _* @% J" E& s, P
  3. * edma_test.c* Y, |2 C4 z+ w: r4 O+ U: f
  4. *
    0 F4 G: H; }" y/ b0 ~9 k
  5. * brief  EDMA3 Test Application
    , W' i4 `8 @8 K' e6 c) ~1 x2 i
  6. *
    ! B+ k5 Y  k& z+ E+ z
  7. *   This file contains EDMA3 Test code.
    4 @: \2 f. o+ h! l4 C
  8. *
    & s  K2 N6 |: I. r! E) T& A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / [! _& H4 k  e
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% s3 P1 O7 _( p& @; z$ m9 @
  11. *         TO CHANGE.
    - z3 s7 z1 l% v) p
  12. *+ a5 |1 g0 P  N, N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      a" a: @5 k$ H. }& C
  14. *
    ' o1 [3 P% i1 I- O' D: m
  15. * This program is free software; you can redistribute it and/or, G/ i$ s% P3 F3 a2 g6 N
  16. * modify it under the terms of the GNU General Public License as
    . U$ W+ @1 e$ S( g8 i
  17. * published by the Free Software Foundation version 2.3 s( A& R2 h" I- ~8 ?% Z, h8 Z' a' q
  18. *
    # _9 {( r" z4 m) B& |4 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , Z8 B, n1 U8 K3 B5 r
  20. * kind, whether express or implied; without even the implied warranty
    : P: k1 C* h0 h3 {$ R+ `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - t& H# a! y; D. @3 o4 e( N  N" C& }
  22. * GNU General Public License for more details.  j5 M$ u6 w1 {' n/ |3 C. A
  23. */
    3 D! v% K7 `$ S& [% _0 ]
  24. % M, m" e3 U8 s4 Q
  25. #include <linux/module.h>3 I1 _2 a2 r( Y$ l2 t/ G! k+ p
  26. #include <linux/init.h>; u& A7 J4 O8 j( S$ J: N" x
  27. #include <linux/errno.h>
    3 d0 V9 }+ Z& j. N
  28. #include <linux/types.h>
    + n5 a+ |$ k+ q* @: u- [
  29. #include <linux/interrupt.h># d1 _7 \& Q  A. q: \
  30. #include <asm/io.h>% n, m# S7 M1 k1 t
  31. #include <linux/moduleparam.h>* @9 p; |" T4 {* o* X. l' {
  32. #include <linux/sysctl.h>
    . i3 \+ c8 X8 T0 j
  33. #include <linux/mm.h>
    4 V$ n( K6 x, ]6 |4 e& O
  34. #include <linux/dma-mapping.h>8 B; S. k) K) Q

  35. $ b0 A" L2 W& j% B6 g! I- |
  36. #include <mach/memory.h>
    : y7 g  v4 i2 @& a% P/ D
  37. #include <mach/hardware.h>+ @3 g. B7 T; P
  38. #include <mach/irqs.h>3 ^, U" c6 A8 J, Y( U9 Z! s
  39. #include <asm/hardware/edma.h>4 M8 v, }# [& V" }2 x% i

  40. - T" `& b' M( J3 P8 t; m
  41. #undef EDMA3_DEBUG8 x1 C) B( u; p1 u6 S0 X
  42. /*#define EDMA3_DEBUG*/& b3 K, m# d, u( f
  43. % O5 ^4 p7 v7 r1 G9 I
  44. #ifdef EDMA3_DEBUG
    + F/ x2 L) K! c8 p! P  k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) Y+ `) }6 j: _3 m& O% m9 P' G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % J& f7 c. d5 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; G; O: S5 |, a1 q; v
  48. #else
    ) h+ a" |5 a, ^+ B! R  P/ c2 H
  49. #define DMA_PRINTK( x... )5 s' X) t( @  V
  50. #define DMA_FN_IN' B' T0 u  r& p5 T- E; Z
  51. #define DMA_FN_OUT. p% ]* z$ G/ {+ G/ l
  52. #endif
      \) u7 `& o/ w. I1 V; t, \8 q1 p( z

  53. 6 G) U6 q; W6 c- ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . q# k5 h! `5 p& ~6 l
  55. #define STATIC_SHIFT                3
    ' S5 i) @7 B; H7 T5 B
  56. #define TCINTEN_SHIFT               20
    & s& ]. i% Q4 z4 i2 H+ j
  57. #define ITCINTEN_SHIFT              21# }6 `) B( p$ x; E$ [' p
  58. #define TCCHEN_SHIFT                22. T; ^$ l6 g3 t8 m
  59. #define ITCCHEN_SHIFT               233 U8 S# ~9 y5 ]; A; E. f1 S* \7 v
  60. , i/ j2 e2 B' Y6 N2 V
  61. static volatile int irqraised1 = 0;
    , c3 I- Y) r7 v; X( f1 z
  62. static volatile int irqraised2 = 0;- F0 \9 Q! g* ^1 ?8 t

  63. 8 O! N7 S* d' k/ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ z9 w/ ]' h4 y) v4 X: n: E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H5 S& X0 T. I' l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Q4 T1 q7 f+ [: B. o/ d' K- ~

  67. . K1 Z6 @+ s$ R! Y; `7 W' l
  68. dma_addr_t dmaphyssrc1 = 0;9 h9 l5 `' W/ G/ [2 h
  69. dma_addr_t dmaphyssrc2 = 0;$ C# K: ]3 a; \, a' E+ G
  70. dma_addr_t dmaphysdest1 = 0;
    : p8 y  z" ?- v, I: M9 U8 A  l) f
  71. dma_addr_t dmaphysdest2 = 0;, d$ h* ?. `8 `

  72. * ~5 q: I2 b& Z+ D8 ^
  73. char *dmabufsrc1 = NULL;
    0 [# Q4 d- z) J* ?1 Q
  74. char *dmabufsrc2 = NULL;
    4 C; ?, b( {$ o9 i1 F! S
  75. char *dmabufdest1 = NULL;  r, g# ^4 d) X
  76. char *dmabufdest2 = NULL;, Y1 K1 H- m+ G, ~* N  |

  77. % l7 F% c& j, x* T; `! P; V
  78. static int acnt = 512;
    0 Q3 |; a( n) A3 E+ z1 u( E
  79. static int bcnt = 8;
    + c! `8 c  n7 R) S3 E
  80. static int ccnt = 8;
    # P) o% o. y+ G, }3 b4 c+ X
  81. ; u- k/ ]6 `: l( G( p
  82. module_param(acnt, int, S_IRUGO);. ?8 g2 n6 Q# F- J$ D
  83. module_param(bcnt, int, S_IRUGO);
    - N+ l. Q9 R3 ^' x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 u" c7 @! _6 P% ~/ d" O
2 ]" b2 J. c6 J" g2 ]7 y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; g  e: q0 q1 w; U6 Y9 D0 Barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* `; m. x! M! }  b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' e: a) r$ G" `8 G/ `7 H7 t8 A3 {4 A) `/ s

7 |$ C7 i* {7 \1 F/ p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 18:54 , Processed in 0.040032 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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