OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; m/ I! K5 [" I  l$ {! F
  1. [code]EDMA sample test application
    $ W! o9 e, [- G
  2. /*( o* @8 ]: o& C, O+ C9 ]' ]: Z
  3. * edma_test.c8 s8 j% U* J' r% ~5 o
  4. *, a$ Y$ m$ e6 i0 @, p% ~" }- l
  5. * brief  EDMA3 Test Application' n1 D0 O& H1 m, }3 d0 L7 n
  6. *% j+ X; \) E) S7 b1 i5 v# L
  7. *   This file contains EDMA3 Test code.# }6 J" D; L0 V+ Y; v6 W6 I
  8. *
    8 O' H% [7 v$ t6 I" u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ L+ L; q# \0 \& {9 p, l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % `2 D, q; u8 y7 o8 r! Z/ B8 L* H: |
  11. *         TO CHANGE.
    . k2 C3 h0 e) s) p  y# }. Q
  12. *
    % h6 F" V7 `5 C& n! f# I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . S+ r. L% Z1 Q1 Z* ^$ \9 i' }
  14. *5 Z+ y- T- i0 D7 i5 j
  15. * This program is free software; you can redistribute it and/or, v; S  V" Z6 ~+ r  A' x5 p
  16. * modify it under the terms of the GNU General Public License as
    & X6 d* v, P, F0 p( f/ f
  17. * published by the Free Software Foundation version 2.
    . o$ y4 f  }  ?" S( T9 }8 S* A
  18. *
    1 y1 [# B4 f! Z! X, ~2 L2 `1 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( l2 t7 c. j4 C- h
  20. * kind, whether express or implied; without even the implied warranty
    & X+ C5 b6 u$ C5 R$ l4 e* I; K7 C2 d* t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, \( r" ~! V8 i0 m" ?* x/ g
  22. * GNU General Public License for more details.
    # ?6 l9 A0 ]% ~. O3 ?  R
  23. */
    , K& V  |5 ]& F6 h) H2 U
  24. 9 M0 g8 l! ^. F
  25. #include <linux/module.h>
    & _4 O. l0 J% {* N
  26. #include <linux/init.h>4 ~# ~) K" @) S- I
  27. #include <linux/errno.h>
    . x. O9 Q* [/ U: w: ], I% a
  28. #include <linux/types.h>9 e& t5 e8 V: p' r) r5 w* s
  29. #include <linux/interrupt.h>$ S! m- d/ \+ j1 L
  30. #include <asm/io.h>
    3 Y: t! S' Q0 K* K) I  W5 U
  31. #include <linux/moduleparam.h>
    - V+ J; K# P  L$ {" b
  32. #include <linux/sysctl.h>/ s) |% U$ O/ _' _. i: e5 D
  33. #include <linux/mm.h>
    ! J  l" e3 r& C  [4 S! {
  34. #include <linux/dma-mapping.h>: J; @! a* C: g0 t: \- Z) x9 r
  35. 4 E; P& {; O! D( ~( |, O
  36. #include <mach/memory.h>
    ! e" j( F1 l4 _8 I
  37. #include <mach/hardware.h>" {" x, C& e1 ^5 y
  38. #include <mach/irqs.h>" c, a% c8 b. A/ L8 ?! Y$ ~, v9 o
  39. #include <asm/hardware/edma.h>/ T! j6 n5 w/ m+ l3 p
  40. 5 Z% W0 s% s0 N4 K; C$ y$ H: T
  41. #undef EDMA3_DEBUG: \4 k6 S- X+ T. |* [
  42. /*#define EDMA3_DEBUG*/
    & k& S8 U9 k2 J9 ~" R1 P4 s. H. P

  43. " G0 X- d& n) c. T, n& s* E
  44. #ifdef EDMA3_DEBUG
    2 k. r' x: ]8 W; w5 s6 J$ l0 l2 i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; x+ \! F) t+ ~$ ~& E; t) K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 R) t- c$ ]8 v$ ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 \" H" E) A3 i. \, T
  48. #else
    $ _3 J" w' O! t9 b* Z& R
  49. #define DMA_PRINTK( x... )
    4 N9 F8 y" G) }
  50. #define DMA_FN_IN
    ) j  Q7 \' Y2 T; |* K  y& U) e/ Q
  51. #define DMA_FN_OUT7 N9 a: ^7 p1 `' z/ M# R
  52. #endif; J: }  [& u) t6 l4 U0 t0 N

  53. 8 k: P; i9 c3 C# i( a2 {, T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' O/ O! b& _) Z" v
  55. #define STATIC_SHIFT                3& I  ]& k3 J( E3 s& W
  56. #define TCINTEN_SHIFT               20! }8 m; j* r+ k" U4 k5 G, u$ s
  57. #define ITCINTEN_SHIFT              21/ |; B% [3 z2 ~
  58. #define TCCHEN_SHIFT                22' M2 _. O' Q4 O; @! P" {3 a8 n2 x3 b
  59. #define ITCCHEN_SHIFT               23! R* s- x9 Y! D, }3 H

  60. + ^: ?; n4 f$ S
  61. static volatile int irqraised1 = 0;
    : Q' E  U6 h: {+ W# Y- k2 N
  62. static volatile int irqraised2 = 0;; ~  k  y. q, f+ {  M" n
  63. . `' ?, g8 }7 d" w2 K% f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 R$ M. |: P1 G; H  g1 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! b+ e4 z. |. r& c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 v& e9 [5 V9 @) ^1 `
  67. 1 v8 \8 y6 Q0 Z* I2 n
  68. dma_addr_t dmaphyssrc1 = 0;" c/ u/ @9 p# y" T+ d. y+ u/ }
  69. dma_addr_t dmaphyssrc2 = 0;
    1 t% O8 i; M. D, ^, A% p
  70. dma_addr_t dmaphysdest1 = 0;4 ?5 ]+ `& T" G( S' j0 d9 b" |
  71. dma_addr_t dmaphysdest2 = 0;
    , \- u* E8 m4 R4 I9 `  B

  72. 0 u$ o% w) x, ?, i& ~4 P7 F& \
  73. char *dmabufsrc1 = NULL;
    ! R* q3 Y2 ~: U9 z0 F
  74. char *dmabufsrc2 = NULL;
    ( B8 O" z" V5 e  X
  75. char *dmabufdest1 = NULL;- J# ^: _7 P; w% r- M- I0 K
  76. char *dmabufdest2 = NULL;
    9 S- N: u: u6 c5 q8 k$ g

  77. 8 L2 o5 ^4 C8 I; j! p( Z, O
  78. static int acnt = 512;
    8 Y/ @' j- E( x
  79. static int bcnt = 8;
    7 ~& p5 x: h  g3 u2 o
  80. static int ccnt = 8;
    ; r/ X, A; c1 W. H* v+ r1 h

  81. 3 g" C+ v, k' \3 F9 @1 g' m6 p
  82. module_param(acnt, int, S_IRUGO);4 s* k& o6 o8 U* B, Q3 y5 f( y: A5 X0 Y4 e
  83. module_param(bcnt, int, S_IRUGO);( s0 @2 ?; e& Q! d' C9 }. l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ }% e2 Q% J, Y  |
- @4 F' f: U" j! t" |: r* I9 H& n. I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; @: B8 p6 m& I7 Q1 t/ k: u2 q8 V3 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 ?# X6 J) S5 ?3 ?+ W& B' x8 }1 F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w) i9 }" u+ q2 b6 r

3 I# i: {5 ]$ D+ e- ~% B3 P1 C7 N$ r$ R( h  {6 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 08:56 , Processed in 0.037349 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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