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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 p$ v$ G- f* L0 T9 {8 j" U
  1. [code]EDMA sample test application
    2 O% m4 j. v3 ~* b& r
  2. /*
    & r/ n/ n! C  P
  3. * edma_test.c! J+ n* D0 ~6 b( y0 W7 F
  4. *
    ! j9 c  D6 O! k, B; t
  5. * brief  EDMA3 Test Application4 U9 u' H  S/ B) \6 X
  6. *
    2 y# u# e0 j( h3 y5 X3 E
  7. *   This file contains EDMA3 Test code.$ M: t) g; R2 K
  8. *
    1 l6 I7 B& f% _/ L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % V( F( u" b- F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % G+ A2 \; x, j1 R  ]6 C6 h* ?
  11. *         TO CHANGE.
    7 c" w- {) e" G7 A/ U0 D
  12. *1 o/ B3 P8 N( u/ \$ u" c1 o+ ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 K7 j" f4 _0 f9 h2 u9 x2 M
  14. *
    ) T$ t1 y) s' \0 m/ b7 I$ Q7 M" e
  15. * This program is free software; you can redistribute it and/or- _2 J. m& p& S5 O0 L
  16. * modify it under the terms of the GNU General Public License as" W: R; T6 B+ q) v% c
  17. * published by the Free Software Foundation version 2.
    2 f7 k7 d/ R, }7 @& x# U/ H
  18. *3 j% w3 P) K) c3 T8 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; x; f! E# s( U4 n5 X# t1 Z
  20. * kind, whether express or implied; without even the implied warranty0 v" d+ F3 r7 w' U2 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) t2 F( }% h& p+ m
  22. * GNU General Public License for more details.. u6 P* n. N; ]6 s; I# ^' D
  23. */  ?+ [8 C3 O# y1 _5 A/ Y$ B
  24. $ S7 I$ z1 i! m8 C
  25. #include <linux/module.h>2 l  u* z3 s4 u$ _
  26. #include <linux/init.h>) w( m/ w: y0 K3 {
  27. #include <linux/errno.h>
    8 ]  d. P! a, g+ h7 e5 X
  28. #include <linux/types.h>
    0 y! V1 B1 Z: e( f8 ^
  29. #include <linux/interrupt.h>
    5 l7 b& E$ F) [' e# Y2 {
  30. #include <asm/io.h>, F5 w3 Q& \9 \- Z6 [0 t
  31. #include <linux/moduleparam.h>8 z% T7 B7 _& M$ E, M
  32. #include <linux/sysctl.h>9 c6 ~( D% _" z- y% [
  33. #include <linux/mm.h>( {- b2 E: ?* R! V
  34. #include <linux/dma-mapping.h>
    2 `- I, }8 X& L) b4 S
  35. % w2 {# W9 g/ P$ \2 B0 e* y- ~4 ~
  36. #include <mach/memory.h>
    : R+ n* J/ J; ?1 q3 L" c; x, ]
  37. #include <mach/hardware.h>
    $ h4 ?% T$ v; R4 T; Q5 N! X1 G
  38. #include <mach/irqs.h>/ `: B8 f6 O! J- Q+ f$ U
  39. #include <asm/hardware/edma.h>
    $ q5 Y6 V! O, y: J& q7 S" w

  40.   V( }. l# O% N1 m1 i
  41. #undef EDMA3_DEBUG
    1 d. N. f; e; x8 Y# s
  42. /*#define EDMA3_DEBUG*/
    3 W3 a' s. o, c
  43. 6 J+ G8 K1 t7 [1 Q- k$ V
  44. #ifdef EDMA3_DEBUG7 \% C* V4 e6 R3 m% L. I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / X. a0 R  |9 X- e* p: r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 l6 f+ d: V1 W8 h# T( H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ p( U$ G5 e1 ?0 v( U5 w
  48. #else
    , t9 S2 g8 e4 _/ y: C
  49. #define DMA_PRINTK( x... )& N/ o# S% |2 @1 Q
  50. #define DMA_FN_IN- \4 x4 i1 t( o/ @0 J  o
  51. #define DMA_FN_OUT: z5 a- B; i6 U  t5 ]
  52. #endif
    + m; r4 D/ [& R& C' T. a

  53. 7 S4 e6 h" f* N- n* s. [7 a6 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' T/ @- _- U; K; N! ]+ Q
  55. #define STATIC_SHIFT                3; N* D: y7 R2 B# c/ R, Q
  56. #define TCINTEN_SHIFT               20
    - D3 C! R1 \  F7 F5 f: X9 `% n
  57. #define ITCINTEN_SHIFT              21
    : y- W5 q( V, U, W- T& D- k
  58. #define TCCHEN_SHIFT                22- w# I& Y3 m3 P& m
  59. #define ITCCHEN_SHIFT               235 R) |  V  T  E  L  k

  60. 0 C, S% m4 d1 E  I
  61. static volatile int irqraised1 = 0;
    ! r8 t: x3 G1 m* D: X  e
  62. static volatile int irqraised2 = 0;* k! x! ~/ p+ G
  63. 3 v! q5 b* p* p0 c% y6 E; I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 I( e) U; o7 C& W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' Y4 S( \8 C' r1 X3 q  l. J+ h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^8 |. C0 P4 c( S
  67. 0 c! P' H/ F4 L8 j
  68. dma_addr_t dmaphyssrc1 = 0;
    + Y+ q, y6 V. K' q: M7 n* ~1 T
  69. dma_addr_t dmaphyssrc2 = 0;# P6 g( a2 J& f+ U* E! o
  70. dma_addr_t dmaphysdest1 = 0;& j6 F  b+ v  O7 s' D, O
  71. dma_addr_t dmaphysdest2 = 0;
    1 o, _8 h1 x( W% u) ^6 Z5 ]* T
  72. 5 ^3 G1 T. W* g, r! h8 J% P  ?
  73. char *dmabufsrc1 = NULL;
    + @/ [; ~) _5 x5 `: D4 S  P
  74. char *dmabufsrc2 = NULL;
    3 g8 e* @1 j" R3 v
  75. char *dmabufdest1 = NULL;; }% u; W- C3 L- z
  76. char *dmabufdest2 = NULL;
    0 g/ A; |8 p) Z. Z" P
  77. # R. r9 f  o4 {+ S  F
  78. static int acnt = 512;! @# i0 g  N" R3 r2 o. @
  79. static int bcnt = 8;
    + J0 d& j! R* U. v9 q" C
  80. static int ccnt = 8;; H; b7 c7 S, U$ q  t# m) w: {
  81. 1 T' J1 J7 A9 y( B2 d
  82. module_param(acnt, int, S_IRUGO);& p$ c8 W* Z, ?6 G% Y3 V0 m
  83. module_param(bcnt, int, S_IRUGO);
    ) f1 E2 I7 s% F% [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, Z# R* F) }1 ~3 y/ @& I

5 Y- q( j. a* D8 ?; G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 @7 K/ ?+ W+ ?; N& |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 {7 C& m6 N7 |* z) y5 a2 N! ~
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ F! M0 I2 i  t& i% S' s! {& c5 A8 z4 b0 Z) n) |2 Y3 S' d
2 |# R8 v3 B& p$ V2 w8 K$ d1 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 18:12 , Processed in 0.041333 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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