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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ( L' r, r, A- Z% l* s. t% O
  1. [code]EDMA sample test application
    3 ~  b* ]4 p6 D& }6 p
  2. /*# Q4 Q0 \/ T- f2 c/ X
  3. * edma_test.c( I2 E/ j' ]3 D
  4. *+ c9 {. |7 V5 V/ z5 n: ~+ v
  5. * brief  EDMA3 Test Application
    ) k; D! B1 Z  N2 P. M7 I7 c7 K
  6. *
    ' k* q& z; z' S* U& S- ^- b
  7. *   This file contains EDMA3 Test code.
    2 Y6 z' {: ]% n0 E2 J% \
  8. *& Q" p) a4 f# Q: G' f, P: E# }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - V2 m( }3 `2 E. q/ r# X" y2 }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 F; F' a* c9 ], ^+ f% t
  11. *         TO CHANGE.
    0 j# T) f, s, \
  12. *- z( h9 J  _1 X, N+ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 q6 k& k# G8 o* H# {/ r
  14. *% \( ~: s* X* q7 Z5 Q$ [( h2 b
  15. * This program is free software; you can redistribute it and/or
    & _# M4 E. M6 S
  16. * modify it under the terms of the GNU General Public License as
    # y$ ^6 S1 b) v, `- b( W
  17. * published by the Free Software Foundation version 2.# }) o9 Z- _& @. ]+ Q
  18. *
    7 P, {- v$ f% |* K" Z3 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , Q$ Y$ O/ `, F: o9 L8 l
  20. * kind, whether express or implied; without even the implied warranty
    - J/ ^  J- [1 g9 m6 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 d  u$ c8 M0 {# Y4 `& g1 P8 T
  22. * GNU General Public License for more details.
      Y/ z' q3 J9 n; @
  23. */, m& C6 T6 y  B" O" T

  24. # ~+ C  e( g7 W2 ^& ^
  25. #include <linux/module.h>: j+ R' k# a( Q( L7 T
  26. #include <linux/init.h>
    : {$ f4 u# M; {) f
  27. #include <linux/errno.h>) w6 [$ W3 l5 G4 I# t! F+ B
  28. #include <linux/types.h>
    0 O1 q% I; ^  Z: d# P9 b, ^' p
  29. #include <linux/interrupt.h>) x8 T4 o' N) g" `. n. @
  30. #include <asm/io.h>
    0 u3 V5 F5 J  h! F. j1 \
  31. #include <linux/moduleparam.h>
    ' u8 R! g: J! E# |( h
  32. #include <linux/sysctl.h>
    * q) L+ D; k4 Q/ c
  33. #include <linux/mm.h>
    - ?8 E6 z2 H) H! Z+ K# d
  34. #include <linux/dma-mapping.h>) o; l& e# _& D3 _* w
  35. & J# U) b. `, N* }& d
  36. #include <mach/memory.h>
    & v. L2 r9 C" w$ N
  37. #include <mach/hardware.h>9 @" U, h- w- Y! ~. l7 u7 n
  38. #include <mach/irqs.h>
    : _7 K' c( R3 S, k
  39. #include <asm/hardware/edma.h>! x. ]' o7 Y* \% t$ Z9 f) b

  40. 1 y# E: S. R# V3 h0 f$ ?; [
  41. #undef EDMA3_DEBUG
    ( p) }/ M: ]3 X
  42. /*#define EDMA3_DEBUG*/
    ' H2 Y. y; K6 E7 D' L6 t5 y! ^
  43. 9 a: G& J/ {4 ?) k/ u0 |- B
  44. #ifdef EDMA3_DEBUG
    + o8 `" w( `3 ^5 Q+ d# A$ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! ]! A* Z  r, ?! j# W6 i: i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# f9 N7 f# N( ?! G' V/ T$ m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 t! ?5 P- i* Y* m( R3 C1 u- c2 t6 r
  48. #else
    ' Y$ o: t+ M# r7 H3 S+ w; ]
  49. #define DMA_PRINTK( x... )$ x5 l: \& z$ q* \; r- P: V( c  e, Y
  50. #define DMA_FN_IN2 n+ P; `8 q9 [& ]/ a3 f6 b7 x0 _
  51. #define DMA_FN_OUT
    # C4 w- n4 _: Z/ s
  52. #endif# @7 s3 b- C  w6 F4 W

  53. 5 V* r' i4 x' x: p9 B' q- Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), V0 h) ?: r& U/ f  i& w! u
  55. #define STATIC_SHIFT                3
    . H% O. P: t( a  U& k6 X+ M% F
  56. #define TCINTEN_SHIFT               201 a; I" J& S7 \9 k
  57. #define ITCINTEN_SHIFT              21& D, s1 ?8 k( L2 j  n
  58. #define TCCHEN_SHIFT                22
    ' {, z( ?6 g" k, ]" E. H8 K" Z
  59. #define ITCCHEN_SHIFT               23
    3 U% n6 h& Q8 _% t0 o/ J

  60. + j4 M# p' I) S4 ^  h5 k
  61. static volatile int irqraised1 = 0;" X6 o8 ]8 d+ S
  62. static volatile int irqraised2 = 0;, x1 g8 l+ t# J/ D* e. g- s% D8 ~
  63. 0 ]: `3 S$ x3 x$ m: W. p7 R. d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 I6 o3 `! v9 E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 B, C8 t, O' Z% p/ J5 Q# h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & N, B7 W7 F5 e. `# ^

  67. : Q/ r! }" O  [+ ^+ n
  68. dma_addr_t dmaphyssrc1 = 0;6 F& V1 d: W1 _5 G* L
  69. dma_addr_t dmaphyssrc2 = 0;
    - h3 u* C% c  I
  70. dma_addr_t dmaphysdest1 = 0;
    7 I, F% u6 ?- R
  71. dma_addr_t dmaphysdest2 = 0;
    * E1 g  l1 i6 O" s- i/ n2 R4 Z$ {9 L
  72. 1 E) E1 C% ~4 |
  73. char *dmabufsrc1 = NULL;4 q, ~3 s: r# u& a& h' o2 b
  74. char *dmabufsrc2 = NULL;
    7 G, H9 l9 `( [' }5 g$ _& H
  75. char *dmabufdest1 = NULL;
    ' L0 d# |1 p- X, [
  76. char *dmabufdest2 = NULL;+ @& k+ J0 {+ b8 C" x5 U
  77. 5 {" |, s( j, B
  78. static int acnt = 512;- {# J( M4 }0 A0 v
  79. static int bcnt = 8;
    ' O; b' N. x0 }* R
  80. static int ccnt = 8;
    ! L0 _9 V3 o6 w& M2 H5 z" t% e
  81. 0 g! N2 l; H6 X, ?4 Q
  82. module_param(acnt, int, S_IRUGO);3 _/ v# A& Y' j( z( x& \
  83. module_param(bcnt, int, S_IRUGO);
    # y% N" }5 C2 h" ^) W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' Z2 ]8 X& v+ b6 I) M# J9 C/ g( M7 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) D, }) w! D8 c. }* {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 }' g: h2 s) O) {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 D5 O0 C# ]! F) V0 n/ i) \/ ?. s
6 Z5 W# }$ w6 x) i. P/ s0 f/ f  W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 08:06 , Processed in 0.039089 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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