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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! [% ?/ S% L" ~* v& o
  1. [code]EDMA sample test application; Z+ ]7 _" o1 _1 z/ V$ {: j( o
  2. /*0 d0 }$ g+ P8 a# P$ c7 @
  3. * edma_test.c. `& }6 z7 C2 D
  4. *
    + q3 _* I: E5 m) A7 e% l% G9 V
  5. * brief  EDMA3 Test Application  |+ X$ M; L3 h
  6. *
    4 ]2 d" e; Z7 K1 l; P; J1 a, F% |
  7. *   This file contains EDMA3 Test code.8 N8 a- D8 @0 V" q& e
  8. *
    ) O& U0 c7 y& E8 |# O4 o7 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ Y8 _4 [! |' M! C7 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 t2 q/ g. o# k* X
  11. *         TO CHANGE.
    3 Z* `4 {5 I7 V
  12. *
    # R: E0 G: [( g4 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ E3 j4 k; ?5 U
  14. *
    # `2 g, W( b5 G5 L+ ?
  15. * This program is free software; you can redistribute it and/or
    * z& {( C# y) ]) ^- E9 A
  16. * modify it under the terms of the GNU General Public License as
    1 d; P- t5 ]) D; X6 m9 }& b
  17. * published by the Free Software Foundation version 2./ c' k0 R) S* }3 t. B  i
  18. *
    9 z* K* c4 Y- Z; w: l4 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) Z( m* z7 ]1 _' F5 y5 b1 \6 I
  20. * kind, whether express or implied; without even the implied warranty
    1 g1 M+ C3 B7 E, M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 q# {' X! ?# l+ y
  22. * GNU General Public License for more details.; e) U! J! ~( n0 p9 O( B8 O
  23. */% k6 o% D, N( `! l
  24. 5 l1 u! U8 e' |0 L- k; e& ?' X3 w
  25. #include <linux/module.h>8 h& L0 O; i( y
  26. #include <linux/init.h>6 E# a$ G% l/ R' F
  27. #include <linux/errno.h>
    + e8 ?! ]0 Z4 ~* U& Z1 F" Y" @
  28. #include <linux/types.h>
    5 S+ N+ F# w& D1 I- x' X$ r& O
  29. #include <linux/interrupt.h>  i" r4 @$ i- F8 ^9 q1 S6 W
  30. #include <asm/io.h>9 K2 u6 Y1 U. c: O3 ^  @
  31. #include <linux/moduleparam.h>
    7 Q* @: ?  q2 v
  32. #include <linux/sysctl.h>
    # s' w4 ?; P- X$ k% ]# G5 N4 T( Y
  33. #include <linux/mm.h>
    ! X+ l& f* G2 U) Y) z9 _
  34. #include <linux/dma-mapping.h>
    4 J- q( {8 D- |

  35. 8 s. C; {# I0 K5 P
  36. #include <mach/memory.h>/ ?1 h* b% i: a# X9 o: H
  37. #include <mach/hardware.h>7 {9 e9 x& U0 }
  38. #include <mach/irqs.h>
      ~  K9 ^+ w- C0 s7 D
  39. #include <asm/hardware/edma.h>* b5 F6 c0 M  I7 a* ~% g
  40. ! P6 K7 e( J* k' f; ]) U" f
  41. #undef EDMA3_DEBUG9 P* R- F8 \; p
  42. /*#define EDMA3_DEBUG*/
    9 [1 C# J4 {2 y& ~5 s
  43.   f7 d6 ~# D9 _4 ^* F
  44. #ifdef EDMA3_DEBUG- ^4 m, \- G$ b; D6 H8 m- C4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' H2 \& p; y" c9 P5 {" l; r# Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 }" u2 z% Y; F. _) T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 i% U0 I5 ?8 }6 n1 l" D2 ~" f
  48. #else4 P# U: i# o+ ^$ w: K5 |5 D/ X
  49. #define DMA_PRINTK( x... ): y0 W7 [* r$ W# E9 `0 ~
  50. #define DMA_FN_IN2 W* E& K1 H, g3 ?4 _6 i: I" `
  51. #define DMA_FN_OUT+ r- `* a( x) c
  52. #endif5 U7 \+ n# c4 \' o+ W8 e6 S* {

  53. " {; ^/ v# L. G; M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); V6 W0 }) ]: [: a; w# u& S$ ]
  55. #define STATIC_SHIFT                3
    $ h' p3 z/ G5 j7 T* r3 i1 t6 s
  56. #define TCINTEN_SHIFT               20
    ( c/ d& P  {- ^9 A! M6 y# h
  57. #define ITCINTEN_SHIFT              21* _* I1 C! P6 E( v/ i
  58. #define TCCHEN_SHIFT                22
    - E+ t* [$ l, H/ p6 S
  59. #define ITCCHEN_SHIFT               23* R; N- P, O$ J# u
  60. 9 ~0 Z6 z; P4 R6 V) g9 p
  61. static volatile int irqraised1 = 0;
    2 K' x! t, r! n! d4 ?' X2 f
  62. static volatile int irqraised2 = 0;
    # A1 z, i8 h2 e, K

  63. . R9 B" I! d" O! Y8 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' U- H' b$ Z! \8 q) Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . b% S# x3 {' T; C; G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z+ b# C3 R" H  c! Z2 h

  67. + r, U2 W+ I+ M1 d1 T
  68. dma_addr_t dmaphyssrc1 = 0;
    7 a4 a( q. o. Y5 E7 c( L  C0 m4 t3 @
  69. dma_addr_t dmaphyssrc2 = 0;) z, m! `  q0 W2 _# Z' |+ R
  70. dma_addr_t dmaphysdest1 = 0;
    # p, \! T" k. U" N
  71. dma_addr_t dmaphysdest2 = 0;
    / X  j# D+ u/ Y+ L% ?
  72. 6 B# `# }; b8 [0 |
  73. char *dmabufsrc1 = NULL;
    # V( p, L& @( U% u
  74. char *dmabufsrc2 = NULL;
    # b' {2 c! b0 ?' g+ }( Z- t& [
  75. char *dmabufdest1 = NULL;, [$ w" ?) ^! X: b& ~8 N
  76. char *dmabufdest2 = NULL;
    ) U6 x' H& ~8 H
  77. $ h/ r6 K7 o6 g8 k  ]: ^; x) L
  78. static int acnt = 512;
    " x$ A' q- Z0 N: B+ I3 N; F7 T" y0 F
  79. static int bcnt = 8;  ~$ ?7 k  E* h; j. i
  80. static int ccnt = 8;4 z8 b' o, ^, g: v
  81. 5 |& \6 }" L( q. h; z/ w# P
  82. module_param(acnt, int, S_IRUGO);( {' K9 d: U  z# A7 T# S2 P
  83. module_param(bcnt, int, S_IRUGO);
    7 G' }8 ?9 K2 K: m) [# ^# e" e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& [4 G5 Y  [. g0 J  u. v! s& ]

. n! Q+ s/ k4 }+ q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 `( [# W2 [+ u  k3 o5 B- h* }( L! xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' b0 ^& O- \; t( N7 q3 U! [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 \+ {/ w& S% }& j* i4 y2 P. a" n& I  K; M# h- |; y
3 t" c' Y3 S8 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-3 19:28 , Processed in 0.038143 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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