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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 _1 T, q7 Y7 j3 v
  1. [code]EDMA sample test application
    7 ~  _+ Z3 }# v1 T" A7 S6 `4 y
  2. /*$ m0 y7 v7 q5 F. }( E
  3. * edma_test.c" }3 |/ F3 ~3 o* k2 ^3 X
  4. *
    : z  ?2 v" e" k1 s- E0 b2 y4 Y
  5. * brief  EDMA3 Test Application; P$ Y0 B/ Q% E3 C
  6. *( ]: K2 O* y0 B" y# L- V2 x
  7. *   This file contains EDMA3 Test code.
    : T; v: O1 U; ~
  8. *8 a% N& d5 V* m) w# B4 A/ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' K( s/ w, \- D" D* _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) a2 Q$ H% Q1 E& a/ w+ T4 D
  11. *         TO CHANGE.! [/ b) i/ y! C" n8 C4 d, m
  12. *- E4 Q8 U* i; e" T# }0 U( h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , `* g( Q: z2 q
  14. *
    - `- z3 ]# w: a% e% F
  15. * This program is free software; you can redistribute it and/or6 e0 [7 [$ c8 W: `. ^( e1 {0 a
  16. * modify it under the terms of the GNU General Public License as
    & Y  \4 k0 v/ t4 |7 A, T0 P
  17. * published by the Free Software Foundation version 2.+ a' A. K' a9 g1 U! A0 C5 J
  18. *+ v+ b3 _- z/ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {5 e9 k& z3 y9 l
  20. * kind, whether express or implied; without even the implied warranty
    0 T6 q$ J! n" c" z! @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 ?& q; ?8 s2 i5 K% _
  22. * GNU General Public License for more details.8 Z, y2 l4 L  O$ B
  23. */
    4 ]5 K2 C6 S7 S" u3 ?: V$ a

  24. . S( Z% P8 W2 }
  25. #include <linux/module.h>9 Y' L- r. |! o  H2 M' G
  26. #include <linux/init.h>; U4 [" B+ a+ B2 ^& p" N! k
  27. #include <linux/errno.h>5 U7 C$ D6 J7 ?7 d: i6 U
  28. #include <linux/types.h>+ t6 w" w# J! E& {( @3 y! g
  29. #include <linux/interrupt.h>
    0 Y3 F9 H) _5 M/ y9 E" D. u# G
  30. #include <asm/io.h>
    & m$ G$ ^4 |9 e+ X( C6 m
  31. #include <linux/moduleparam.h>5 c: ~1 ?8 F5 K# H  e" d# v  D
  32. #include <linux/sysctl.h>
    ( F, }( N7 n. t5 M- J
  33. #include <linux/mm.h>
    2 t% X. x& l+ q6 {& X8 x
  34. #include <linux/dma-mapping.h>
    * r$ n. Z* ~! ]4 A. H" T

  35. ; U# z6 q4 ?2 c* F
  36. #include <mach/memory.h>" y  G5 Y6 v& E- [. R2 M. \* `* H+ y
  37. #include <mach/hardware.h>, V# w- h$ x+ {. _  q$ q5 |
  38. #include <mach/irqs.h>4 k8 O" k  W5 [, r
  39. #include <asm/hardware/edma.h>
    % U, C. F4 C; c3 a- l- Z$ E/ f
  40. 7 Q! Y7 I: [2 m: _
  41. #undef EDMA3_DEBUG
    ) A+ g7 T4 b. x3 Q  b
  42. /*#define EDMA3_DEBUG*/9 U, B% G4 k  R4 j3 R
  43.   b+ J6 u) V' l! ]9 y8 R8 m4 \
  44. #ifdef EDMA3_DEBUG/ q& z5 D5 X. O. @( a$ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* }; F5 ]/ U( B0 s1 r3 M1 I3 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 j* \: i3 i7 Y" Q6 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ I# s9 I  z9 f. {4 x
  48. #else& p) d; Q: ]+ s2 K) C
  49. #define DMA_PRINTK( x... )
    ) M+ O! i+ C* L  V, d& _
  50. #define DMA_FN_IN2 ~0 U* U4 T9 q. j! W
  51. #define DMA_FN_OUT
    6 B! z2 A6 ^  p+ [
  52. #endif
    7 F( e/ F7 j, P1 b1 h$ l
  53. 1 T5 A% \( o, ~) n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) F* |5 \+ x4 ]) v
  55. #define STATIC_SHIFT                3
    8 I3 Y$ ^' L' q9 M
  56. #define TCINTEN_SHIFT               20
    & y: f/ ^; }9 C" y
  57. #define ITCINTEN_SHIFT              21/ {; B5 Q) Y2 `; R! O# i
  58. #define TCCHEN_SHIFT                22" d& B6 }  o& I9 e, p: t7 F- \
  59. #define ITCCHEN_SHIFT               23
    & }2 K: n% }- L" A+ `/ G6 C

  60. 8 i( N+ f, \1 C) w
  61. static volatile int irqraised1 = 0;
    , D% s, i* {7 E% R2 K% M
  62. static volatile int irqraised2 = 0;
    ! I8 L4 i# h: _; R

  63. ' N: V" a' p9 ]% d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 z: |  j1 V6 F2 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 U, v. q7 S& v5 T; A/ [. O' z# a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f5 l( n; U9 [6 r
  67. - s8 u, u! d/ e
  68. dma_addr_t dmaphyssrc1 = 0;1 W& t4 T# F) H2 s
  69. dma_addr_t dmaphyssrc2 = 0;. \: E* f! ^7 y0 B1 z$ \# p
  70. dma_addr_t dmaphysdest1 = 0;* g5 K3 N' O" v& l9 b5 h
  71. dma_addr_t dmaphysdest2 = 0;7 P  J9 K8 f, Q, j& y! b( ~

  72. * o- \2 ^& b& R, S" Z3 J+ _
  73. char *dmabufsrc1 = NULL;
    + Q+ D  l3 x% U6 F$ S- N7 J6 R2 ~
  74. char *dmabufsrc2 = NULL;, Q) {4 g& I9 T5 q& @  y! y
  75. char *dmabufdest1 = NULL;4 A  ?- m, {% M7 I  x; ?9 A. e0 n
  76. char *dmabufdest2 = NULL;# `) ]$ K/ j* g. R1 Q- q

  77. : O. t. y* K; j( A
  78. static int acnt = 512;! Q* l- ~( v3 T# Q, u6 P# R( F
  79. static int bcnt = 8;! m5 r- }: X3 p
  80. static int ccnt = 8;
    8 ?& W6 k! B! o8 l( m- `

  81. 9 Q  ~# z) g0 h( n/ n; {! W
  82. module_param(acnt, int, S_IRUGO);! W% B" O  Y# G/ c5 ~
  83. module_param(bcnt, int, S_IRUGO);1 v! V$ B- W. Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  h3 C, U- j1 j7 q0 y2 {9 O( l3 @6 A8 q+ a' c1 m" s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! A* n/ P, @0 X% v8 I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 t+ [6 k2 z' Z$ f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# C% y5 p6 z& n9 l9 @( }$ M3 E- q

- s5 K/ r. m) X. J8 C+ O4 y( n2 m" t0 R; m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 20:10 , Processed in 0.045277 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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