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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- j' \9 `8 v2 U  o+ C
  1. [code]EDMA sample test application
    ) h& W! B( g/ B8 ^
  2. /*; {3 m; j- v3 E- H+ n5 _
  3. * edma_test.c
    ; n, s5 ~0 R6 d1 `5 `: l9 o
  4. *
    5 q+ y$ }) s+ A! ?- n$ `- S
  5. * brief  EDMA3 Test Application$ t" V& L. |  ?) a0 [5 l
  6. *
    ; t# h3 B4 w2 _5 `6 ~
  7. *   This file contains EDMA3 Test code.! r0 q8 v) _' D2 k+ _4 s
  8. *3 n6 m4 q5 M/ {1 |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + {0 N2 o6 T4 c: r: A+ E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 V# i, s3 [# L
  11. *         TO CHANGE.
    4 v  ~6 V$ _- q0 J4 v* ?
  12. *
    ' R& m+ V9 _8 x( r9 T* b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 T+ `( `" t$ c7 X
  14. *! \( S& f7 Z, Y$ f) w
  15. * This program is free software; you can redistribute it and/or% P8 t9 Z, B( E7 H7 a
  16. * modify it under the terms of the GNU General Public License as' c- @1 G$ D5 R. v  a
  17. * published by the Free Software Foundation version 2.8 [0 \1 d% r5 P- t& P, f
  18. *# B# P+ T5 L; M5 X6 K; U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + g/ i: V8 R" \8 i* q/ k( c
  20. * kind, whether express or implied; without even the implied warranty+ u" {. b/ F- l: Q, r& Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : m$ S8 U) M4 t% v, F0 @9 T
  22. * GNU General Public License for more details.$ ?6 i) i1 ^8 a, L" R
  23. */
    * J8 {: K% e5 x; J, k9 G
  24. 7 [7 H  ^+ @1 e' c7 i% `, v
  25. #include <linux/module.h>
    $ p3 ?; I) {7 |) H
  26. #include <linux/init.h>
    # l8 g- E- k2 b% W6 U
  27. #include <linux/errno.h>
    1 ]5 L/ J9 z; g  c- z4 r
  28. #include <linux/types.h>9 f: p- H) t. @% W6 X
  29. #include <linux/interrupt.h>
    - J5 x8 J9 d2 u+ Z" x
  30. #include <asm/io.h>
      {; w2 _$ b; o, ]: |) L
  31. #include <linux/moduleparam.h>
    4 h' z  Y% j) ?+ O
  32. #include <linux/sysctl.h>5 E! b2 I! t- \3 h' H* h# d
  33. #include <linux/mm.h>
    6 @7 m' G+ N9 c; h1 T' k) W! @
  34. #include <linux/dma-mapping.h>& t% R! }2 D/ Q' ?4 _- }% v

  35. * i1 t; H! H; d0 [0 f6 }
  36. #include <mach/memory.h>
    # j/ u$ Y* |2 m. p
  37. #include <mach/hardware.h>
    ) p2 c0 h! \6 z$ R; ~; h7 m+ x
  38. #include <mach/irqs.h>' |; I0 w; H6 o$ `
  39. #include <asm/hardware/edma.h>
    & b* {! x: l" ~- {8 E3 [
  40. $ X1 V  S* K; S  B/ J
  41. #undef EDMA3_DEBUG# b, Y# y' V9 D% I
  42. /*#define EDMA3_DEBUG*/+ V8 ^0 L7 T' I8 c3 a. d; P
  43. % N! g, x  w7 E. |3 u6 W) @- z
  44. #ifdef EDMA3_DEBUG* [. H* K7 f& D( y5 g1 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + e) f1 s1 F( o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' [9 Z6 v* ?7 Y* I5 [9 [- y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 d4 ^5 v* p0 j. o+ L0 a% }+ o
  48. #else
    5 J* e; |+ o: n5 f! v- b
  49. #define DMA_PRINTK( x... )# i. m' j! E) r" T3 w
  50. #define DMA_FN_IN& N; G+ r8 c, A
  51. #define DMA_FN_OUT" l% G4 P  w& ^$ W
  52. #endif' N' X) L% g5 q( k* E- L

  53. $ c) ~3 x+ w% Q% |# A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 v) Y: }$ s7 x6 x1 c) u
  55. #define STATIC_SHIFT                3! h0 o( f: a7 L. P
  56. #define TCINTEN_SHIFT               209 [" ^. M- i  j$ M% j6 W2 D: D
  57. #define ITCINTEN_SHIFT              21' Y: R. k, f' _
  58. #define TCCHEN_SHIFT                220 N$ m$ m# k* n2 u2 p
  59. #define ITCCHEN_SHIFT               23# g8 o8 O5 ^; q, T! h5 g- R$ t8 |3 b

  60. $ u& d- P, l, m& }6 h& d& B) S
  61. static volatile int irqraised1 = 0;& T$ _& B+ B# a: G$ C; G
  62. static volatile int irqraised2 = 0;
    + ]8 l. z0 C6 P: _* r; q: z
  63. 6 _% ^% |# G' S6 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 L* }6 ]; _- K$ i9 ^* t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N, G- j4 t- R! X) G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) n- }) ]) U/ w. \9 f: O
  67. 8 q, g' B" D% \/ F
  68. dma_addr_t dmaphyssrc1 = 0;
    9 A4 O* A! o! ?# B, W( s8 m. Y7 b& m
  69. dma_addr_t dmaphyssrc2 = 0;9 |  c' n7 U6 d+ l8 U
  70. dma_addr_t dmaphysdest1 = 0;( z# o0 ]" Z+ u! \) O
  71. dma_addr_t dmaphysdest2 = 0;7 g0 e3 m( v0 e, ~7 z; `$ I

  72. " ~9 R1 L; q6 I% l$ w
  73. char *dmabufsrc1 = NULL;
    - @! H# k2 J& h0 h: P: f
  74. char *dmabufsrc2 = NULL;
    5 y$ t( N2 j+ ~- Q& N+ f2 w
  75. char *dmabufdest1 = NULL;1 Z. z3 B+ d; R8 Z- @3 A
  76. char *dmabufdest2 = NULL;
    * d5 p5 S( g) \5 r: @

  77. 1 ?) A: E2 d  l) ?8 C: C
  78. static int acnt = 512;, m" ?# N- U- T( O
  79. static int bcnt = 8;
    9 J0 L9 _# Q* F( _* F; V
  80. static int ccnt = 8;: F0 E& ^. L2 F* U7 C4 ^

  81. 9 \9 B# q' B  H' Q
  82. module_param(acnt, int, S_IRUGO);
    ; T6 R9 \. J% ?$ g" N" b- f/ f
  83. module_param(bcnt, int, S_IRUGO);
    % u* i& ?" {1 a  s$ b" K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; A8 z( D# `( c( N, q
3 z7 s$ p, ?8 Z* |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 e. Z+ A% T7 i, U3 K# t2 U0 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  S: f5 o+ f  Q0 Y- x! [( _2 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ g  h7 Y" W1 @2 ^0 b: _3 I9 p! {) N6 x  W; a& [
2 }" d3 {7 ]3 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 10:26 , Processed in 0.043499 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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