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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 [5 w' k9 P3 A- K( c+ H
  1. [code]EDMA sample test application6 B4 |; l- f3 N5 ~
  2. /*) K; S, B& Q* C
  3. * edma_test.c0 X: D. V# p2 O  h0 v" m$ A
  4. *
    - V3 w/ m) s% F+ R5 ]6 q0 |4 i# e* n
  5. * brief  EDMA3 Test Application
    . o' c% w/ r% B: Z: _# Z/ T% x
  6. *
    % x2 y/ x& ~' Q) X$ {; R: z0 F: }
  7. *   This file contains EDMA3 Test code.2 e5 X; }) L0 e) p" Y. \
  8. *
    4 a( D( e' X4 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! @2 P9 L2 ^5 y7 n8 W" f1 i& g( L5 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 I9 i1 X2 u, Z& c' o
  11. *         TO CHANGE.
    8 @. V, R) x7 V4 z
  12. *
    + O4 i, j% z& |6 w. |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- d& I9 H* {4 q$ z  J/ e+ B& B
  14. *" y- @; Q- s9 ~; g9 y( J6 p: @6 {4 V# o
  15. * This program is free software; you can redistribute it and/or
    # o0 A9 k$ W' h2 |
  16. * modify it under the terms of the GNU General Public License as
    9 Q. c, f3 E5 G- C5 ]& `
  17. * published by the Free Software Foundation version 2., d0 [. ~5 @+ W. `, F, q2 F6 l: d; Z( j
  18. *
    . S" y& c0 h; R2 A# ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) Y. J! N2 r" y
  20. * kind, whether express or implied; without even the implied warranty' p. ~- a5 l8 D, n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 S' G6 x  w# ~+ V1 m* w- E
  22. * GNU General Public License for more details." K2 A# z( S7 _( J
  23. */, q, @0 x2 _; x

  24. - ~6 ~; V. @0 B4 @: G! c* K
  25. #include <linux/module.h>
    # U4 d2 ~' Q& l! e2 q( M; a
  26. #include <linux/init.h>
    ( U2 t0 H3 p3 k; y5 x8 F. o
  27. #include <linux/errno.h>" j8 Q* u) h" I0 ^3 K: x1 ]7 ]$ t
  28. #include <linux/types.h>0 W# _6 g# k/ i8 n9 A7 Q
  29. #include <linux/interrupt.h>
    ) v/ H& p( l' B( Y3 w9 T2 X% [3 R: p
  30. #include <asm/io.h>
    " G4 v* s" L6 z5 N' ^' l* e+ V
  31. #include <linux/moduleparam.h>2 E# v! u6 J! o- s& Z/ s
  32. #include <linux/sysctl.h>
    # r! H) N( f6 G; n- I
  33. #include <linux/mm.h>
    + z3 J/ K  B; |5 M. v/ E
  34. #include <linux/dma-mapping.h>
    * W0 E+ `# M/ V# Q1 R! `4 _; Z; x3 E
  35. ) T# \7 h0 U9 |5 b5 w0 @
  36. #include <mach/memory.h>
    # [$ a) A( b$ |7 ^5 L2 o/ G
  37. #include <mach/hardware.h>
    0 P" @: x7 w# s' r: @- G6 @
  38. #include <mach/irqs.h>1 H3 Y" p1 b5 z
  39. #include <asm/hardware/edma.h>( Z) \5 ]9 w' S; P9 W- c
  40.   Q" M/ c5 l2 J# [
  41. #undef EDMA3_DEBUG1 Z4 S$ M. k- d# B
  42. /*#define EDMA3_DEBUG*/% `/ _. t+ o4 Z0 |7 Y2 N3 H9 [8 F* B
  43. : z) w3 f8 u0 Z/ Q0 t  U6 f
  44. #ifdef EDMA3_DEBUG
    ( j! d: K1 U  E- Y5 y- @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& \, m  L, L; z  c- a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ]3 T: t; E6 Z7 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" p6 u( m3 r1 W4 x, m$ t. H; W
  48. #else
    & z- J: k3 a# U- B& {: B
  49. #define DMA_PRINTK( x... )0 t4 _3 Q& U! D+ [1 q: q
  50. #define DMA_FN_IN
    ' i2 R& B1 y) c/ h& i  N7 ?. o
  51. #define DMA_FN_OUT/ X( B/ O5 K+ \$ X. D( I
  52. #endif
    ! C0 x" l+ N0 H& o& g

  53. 1 _9 e) X& f4 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 K1 _3 c; w8 x* K8 l9 x
  55. #define STATIC_SHIFT                3. W* n% \( H5 y  j! [
  56. #define TCINTEN_SHIFT               201 R# f! y) N$ U7 a
  57. #define ITCINTEN_SHIFT              21
    7 `4 ^8 c( s, S6 b, @+ @+ G
  58. #define TCCHEN_SHIFT                22
    , }. [  `2 M( R
  59. #define ITCCHEN_SHIFT               23
    + ?% T4 S' `8 a  o3 }
  60. & I3 {. |# f- g! R
  61. static volatile int irqraised1 = 0;
    2 }" H& P& t' Q
  62. static volatile int irqraised2 = 0;
    6 c4 j" z2 f' k. A$ r$ ?
  63.   `1 D! s9 \1 |: q& X2 R9 f7 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( \3 C( Y9 y4 F* i7 g* ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! s! [& F7 w. F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + X7 u* L7 t) m0 G4 d9 f* q& P

  67.   t6 t% {) \: `; e
  68. dma_addr_t dmaphyssrc1 = 0;
    : C2 V# P% K# Q; F- C3 Q5 f
  69. dma_addr_t dmaphyssrc2 = 0;
    7 A  _& w5 ]1 u! f, [1 [' q4 ]2 b
  70. dma_addr_t dmaphysdest1 = 0;
    0 V' [: j/ V+ i  }' n# H
  71. dma_addr_t dmaphysdest2 = 0;1 ]3 Z' D8 b- b% }
  72. 3 z% p3 Q5 _4 v& w! c% `; c
  73. char *dmabufsrc1 = NULL;* }+ w2 R" B8 j1 r
  74. char *dmabufsrc2 = NULL;
    0 Q4 R! h; }4 F1 q! Z4 \# ~
  75. char *dmabufdest1 = NULL;6 E* _+ e  C( B7 g& y+ Y: t( a
  76. char *dmabufdest2 = NULL;$ @$ Q" O9 v. P

  77.   |6 S& f1 n- R$ g' d' x8 j3 p4 \
  78. static int acnt = 512;4 Y; K/ {# [8 `0 y/ r! _' h
  79. static int bcnt = 8;9 @1 v# h% I+ j
  80. static int ccnt = 8;8 u5 C# [5 Q- V0 U. w' S  G

  81. ( W: U4 A3 h! H" v4 k
  82. module_param(acnt, int, S_IRUGO);( a( I# x& U7 n2 X+ v% L$ Q
  83. module_param(bcnt, int, S_IRUGO);; r8 q$ {5 k3 i( L, B: U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ x2 ~  X6 Y9 l! I1 r
9 k- u3 V# R! k9 l
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! K! t, m" g5 i& q8 _' S3 y' g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 n$ |6 B5 S: I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! G6 S  x3 e3 |$ K
8 }# r1 W* \0 x1 j6 y0 _; @) ~- C

" v0 `1 h( J1 [, Z! W: \! n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-8 07:49 , Processed in 0.037452 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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