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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 v" x/ r, ~/ ?+ }: _6 q- l
  1. [code]EDMA sample test application
    . z& e; P( c: n! G' D3 n& J
  2. /*
    . ]0 e! W. K2 T( l- S5 ~, m- H0 `
  3. * edma_test.c
    4 o  ^. L1 [' i& m6 }' ~
  4. *
    5 U, P1 s1 L! [
  5. * brief  EDMA3 Test Application
    . x8 v+ A2 F6 ]
  6. *' r" O& A/ r: q; ~# a
  7. *   This file contains EDMA3 Test code.: C- Z; a7 v6 @1 k; p( z
  8. *9 _- l9 w  ]) T5 ]/ ^  }. Q5 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( w" [+ @% W$ r# N, g. j8 }' I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ Y# l* A$ I* Y: ?8 R* s
  11. *         TO CHANGE.8 J( r: @9 l: |
  12. *
    + k/ p/ X8 D% _- [" E" E: v9 ^" n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! T: X: @( s2 {  t
  14. *4 A9 ]' m5 L7 M) j. E) c& e1 P
  15. * This program is free software; you can redistribute it and/or
    # Z2 Q6 e3 a$ Q' ?; e* @
  16. * modify it under the terms of the GNU General Public License as2 u' ^' j. ?1 U; f6 H) {7 m' C
  17. * published by the Free Software Foundation version 2.- D3 b' u8 z; C1 d+ [# D
  18. *4 o$ J7 W; v& S; y) W6 K* P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 p- T  o( U; }: P4 X' E4 L
  20. * kind, whether express or implied; without even the implied warranty0 [: |% E& }, Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( V0 |- V$ ~% }' A& r
  22. * GNU General Public License for more details.4 Z9 |% R" {. Y7 c9 g( i
  23. */
    : S' }  S2 E$ F! p: l3 X9 ]
  24. 5 m0 d; k0 |1 z8 R- {; l- S
  25. #include <linux/module.h>* f% W7 \  Q8 j4 Q$ Y, E) b: A; S
  26. #include <linux/init.h>
    7 H7 e  I8 r; p$ W% J* I/ y7 l) M' v8 ~
  27. #include <linux/errno.h>
    2 e% f. F) J, E! [6 X6 [5 Y
  28. #include <linux/types.h>
    # X+ V& Y3 u* i, F
  29. #include <linux/interrupt.h>- F8 O' z1 c! G: }0 v) Y
  30. #include <asm/io.h>
    1 q8 g- Y, ?1 T1 }, H4 z
  31. #include <linux/moduleparam.h>
    % z! O+ s$ V% R1 g" V( G
  32. #include <linux/sysctl.h>
    + x0 ?0 {5 f4 {
  33. #include <linux/mm.h>
    ' u5 t/ I4 v+ s4 ]! p
  34. #include <linux/dma-mapping.h>5 k/ o0 X1 H. H8 Q5 C& d8 _3 k! {7 U) `
  35. & H3 M' l$ s$ ]1 i( O& H4 d/ j
  36. #include <mach/memory.h>
    % a6 H: x( M6 x6 S
  37. #include <mach/hardware.h>7 O. U1 K9 X' F) r
  38. #include <mach/irqs.h>" h1 p) O+ X& N( B) z
  39. #include <asm/hardware/edma.h>8 B; o4 p& p# P) ]4 x& t( P9 ?5 p

  40. $ l. v" P. Y# k+ n, J7 ?9 n
  41. #undef EDMA3_DEBUG
    : ]! `9 }" @! g* [
  42. /*#define EDMA3_DEBUG*/
    9 s( ^. A4 ]- |% K! k

  43. ' G4 t  M$ F4 c: P
  44. #ifdef EDMA3_DEBUG
    / e2 `* V0 b1 I5 T% ?+ _; x9 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ F! \* C" z; {6 B0 ^. }  n- a# X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  c: ~  n5 o, C$ K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % V0 Y0 H) Q' M: t$ k5 Q
  48. #else
    - n  s1 Z9 G1 |
  49. #define DMA_PRINTK( x... )
    ' g+ z6 Y/ t; X% z
  50. #define DMA_FN_IN! f6 W' ?( b0 @2 v! X1 P6 W, n
  51. #define DMA_FN_OUT5 h. H1 _# q, u0 n8 v5 I( A- K
  52. #endif
    ) \$ I+ Z! f: Z6 v" O; t" _! S# J
  53. 4 U4 y# r+ d9 `/ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - w' z) P( W% [' w
  55. #define STATIC_SHIFT                3
    , ~: J0 q+ w; U$ S
  56. #define TCINTEN_SHIFT               20" d- N( V# r  T7 ]: I* `7 B
  57. #define ITCINTEN_SHIFT              211 g% `0 c7 T0 S5 X' u3 X
  58. #define TCCHEN_SHIFT                22
    ( U  a$ {  I8 S* S6 i
  59. #define ITCCHEN_SHIFT               23
    # G. ?/ ^6 k# e/ E

  60. 6 Y1 f8 `4 `6 p+ z& |6 o! d
  61. static volatile int irqraised1 = 0;
    + y4 {0 l( {" h6 ]6 `
  62. static volatile int irqraised2 = 0;6 P9 H) H+ k5 |- r5 z
  63. 3 e' J5 O# G9 I/ _* _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t" X+ Q( E5 T0 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 f9 S/ M- G$ z1 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 v/ d& M- H4 b
  67. / ]* {$ |4 |# J/ ~9 T' t
  68. dma_addr_t dmaphyssrc1 = 0;6 n/ [' e0 i2 z
  69. dma_addr_t dmaphyssrc2 = 0;
    ' P# ~% h6 [7 F* K1 P4 `5 D& P
  70. dma_addr_t dmaphysdest1 = 0;' c. J% Z: N* ~
  71. dma_addr_t dmaphysdest2 = 0;
    / f9 N$ g- I4 y& g3 h9 r

  72. 1 d/ A2 w, W" Y5 |$ H5 O, G
  73. char *dmabufsrc1 = NULL;
    ' N$ j  a0 Q5 L+ U0 E! g! e5 Q8 v
  74. char *dmabufsrc2 = NULL;& u5 `( v0 I* w  t, {! ?: w' {
  75. char *dmabufdest1 = NULL;/ |2 ?" Y- H1 d6 p! D
  76. char *dmabufdest2 = NULL;
    " q2 I- c  ]9 |% _
  77. / U4 `. A1 m/ n% }
  78. static int acnt = 512;
    - M! p( |& _5 ?+ y' w
  79. static int bcnt = 8;
    5 r% x% U! X  |  f( e
  80. static int ccnt = 8;
    & m! z8 S: ^- G2 j* k: l0 b7 g

  81. " T" k  H8 B3 C9 S7 A: d
  82. module_param(acnt, int, S_IRUGO);
    3 E/ K4 a( v: `4 M8 G3 v% m
  83. module_param(bcnt, int, S_IRUGO);0 u/ P# ~& q, i& K& o/ g# ^! `% o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 A+ e8 L8 n1 d6 j+ }& Z0 Y! L1 i8 _+ B3 T. S+ P, d3 R0 _1 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. b5 W, U6 N4 i- G: s6 U4 X' R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' [2 f. n5 H  \1 T4 k: U7 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, }, ], Q# @; c

7 t8 g" }& K5 k1 x! x2 z. |/ f2 N
1 D3 ~; \3 V% I  G8 R; P5 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 01:55 , Processed in 0.040085 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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