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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / y5 p2 o* j  f1 v8 Z& J
  1. [code]EDMA sample test application
    8 F: ]( @$ F: r( g0 |
  2. /*
    / p8 j9 W$ N4 K' D5 s% E
  3. * edma_test.c
      q8 X/ X, |# n- F7 V
  4. *+ p2 t$ r; {6 t' c% r: j" z
  5. * brief  EDMA3 Test Application
    7 l- _. ~' q, K; ?3 D
  6. *. n) D8 J0 b0 J
  7. *   This file contains EDMA3 Test code.8 e4 }& T: @) V  W
  8. *  U9 E# Y' d/ @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 t1 }/ E( }3 ?1 i* E) l  k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 q& E/ [5 Q8 X% G
  11. *         TO CHANGE.! K' |; n8 N. r8 F6 c* Y) m
  12. *7 F+ q0 [, ?6 U! q3 \+ B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & {  r* S( g3 z& p' T1 ^- y! A) g8 `
  14. *
    2 F" y$ @1 c* w; m7 d: Q
  15. * This program is free software; you can redistribute it and/or
    ! @& A/ r2 E8 K4 ?9 J% d' I+ O
  16. * modify it under the terms of the GNU General Public License as" q( w0 _3 w$ l1 r) ?
  17. * published by the Free Software Foundation version 2.
    9 b1 l! ?! f$ k7 F( e( D
  18. *
    5 ?' b0 c$ e: {6 e/ f" H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 E9 s4 @4 T' v) A" a
  20. * kind, whether express or implied; without even the implied warranty: o$ a7 i' ]% ]' w! l$ l$ s5 |5 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 m3 d* }. D) V1 m1 \4 o
  22. * GNU General Public License for more details.
    9 w0 W! z, J! ?6 v6 M
  23. */9 X6 |8 a0 r! Q1 L7 `' }
  24. 7 N% m. L2 A% c9 R6 V$ w
  25. #include <linux/module.h>
    2 F9 l1 y$ i! x+ d  C9 }8 ^
  26. #include <linux/init.h>5 c- D$ H; d5 \* W2 k
  27. #include <linux/errno.h>( ~) g( i* Q  `" P1 c6 f- E. e9 G
  28. #include <linux/types.h>" e  q& |& ]8 X' I* Y- \( m! p
  29. #include <linux/interrupt.h>& A" E2 W' K" J, o. }+ d  Q3 X
  30. #include <asm/io.h>* ^0 q4 u7 P1 z
  31. #include <linux/moduleparam.h>% H2 ^7 j" o! E  S) M) q
  32. #include <linux/sysctl.h>' z6 L4 k3 [; D8 j
  33. #include <linux/mm.h>
    8 ^$ l/ _  A! Y% ?0 G
  34. #include <linux/dma-mapping.h>
    , E9 ]2 D8 P, Q
  35. ; j) v% n/ \9 G; {
  36. #include <mach/memory.h>
    & |7 S% [. f% p/ l0 t) J
  37. #include <mach/hardware.h>1 b; H, e1 y/ c' b9 Q' J. r
  38. #include <mach/irqs.h>
    " l: t  g* R$ U: ^# n/ `4 _
  39. #include <asm/hardware/edma.h>
    / e$ D3 l- `3 E: X' o9 H1 `" s5 {
  40. : q  O7 H" a9 E+ g! j
  41. #undef EDMA3_DEBUG, W% U2 A  F, y+ y& J, }( [
  42. /*#define EDMA3_DEBUG*/; b7 x4 @* e9 H8 S! c
  43. " D8 d3 w/ y  i, d+ |6 }7 V
  44. #ifdef EDMA3_DEBUG
    $ h6 w8 J3 H, z& k  F
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 N* i* M4 e* `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 `5 R% E' ~" R4 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , @2 `4 ^! P  l! g/ ]1 k; H
  48. #else
    - m: a! {7 Q! y  V, I1 Y/ C$ c
  49. #define DMA_PRINTK( x... )
    & \6 j( r3 \0 z/ g
  50. #define DMA_FN_IN
    / h5 I+ a1 k5 l: j& h% F0 `& J0 v. t
  51. #define DMA_FN_OUT
    1 O9 d, M- T6 R. k  T1 f3 A
  52. #endif
    & F; S7 t4 d7 \" W

  53. . f$ v4 h) X) u) N; X* Y7 T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). d* S2 U- Y# }; D
  55. #define STATIC_SHIFT                36 f1 l, f( s9 j
  56. #define TCINTEN_SHIFT               200 N% P2 Y2 |. h- P) G& Q( q0 I
  57. #define ITCINTEN_SHIFT              21
    + }  ~+ }$ r$ v+ ?
  58. #define TCCHEN_SHIFT                22
    . k) B1 L0 F! E7 S
  59. #define ITCCHEN_SHIFT               232 O  F" b3 V3 h" o+ m% q7 _
  60. $ y7 k  C' r5 u( f4 v5 [
  61. static volatile int irqraised1 = 0;
    4 ?) b) F/ `% F. e/ j: |! y
  62. static volatile int irqraised2 = 0;
    9 c4 P& ^9 z  H. m% E
  63. 8 J, q. Z7 u0 U  ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ s7 ~7 o# W  A- o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* J) \  p" m: G8 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % l. u8 X- V2 U. g& R# i

  67. ( _) e/ L3 @/ Q- c$ k; n& p6 ~
  68. dma_addr_t dmaphyssrc1 = 0;9 l, L- ?- w6 Q! F8 W! ^- Z
  69. dma_addr_t dmaphyssrc2 = 0;
    : p. ]  W$ J- _4 d0 [  J/ K8 W
  70. dma_addr_t dmaphysdest1 = 0;, \" t+ x: Y* Z* V' J! p
  71. dma_addr_t dmaphysdest2 = 0;
    ( P1 U# A6 {) U% o  o& }: O

  72. ) z' `( d; p/ B3 P% k% ?
  73. char *dmabufsrc1 = NULL;8 s3 s9 r9 X% h  t- |
  74. char *dmabufsrc2 = NULL;, a( D2 B, C& g; L* O
  75. char *dmabufdest1 = NULL;
    8 C' y0 b5 y& [/ M7 W( }6 x( ~+ c
  76. char *dmabufdest2 = NULL;
    8 G* `0 f* E% f' i/ l& R
  77. " {; F& x3 [4 O9 z; `
  78. static int acnt = 512;
    " @6 U* u! H6 o% {, }$ a
  79. static int bcnt = 8;! C/ Y; c# C* Y% {
  80. static int ccnt = 8;  }8 \8 Q% `. X& ^
  81. # M# M$ a: k( ~, i" ]3 x" \% \& L
  82. module_param(acnt, int, S_IRUGO);( o. @+ {8 y) O9 P
  83. module_param(bcnt, int, S_IRUGO);
    & X- K  x: e3 H4 O5 |6 `3 r3 r$ R% {& c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# ~$ ?3 g: C& ?3 i( F3 W5 B( m6 ?" @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 @5 m4 j; s( E8 s" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& @0 K' b: [0 N1 r! R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; i! B4 @! O8 m; O" Q: p. A( m
# T3 @9 k) D2 M: b3 [: p
8 }" e6 A* G% q: r: ?8 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 13:02 , Processed in 0.038841 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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