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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ o) M8 \- a4 L; b
  1. [code]EDMA sample test application$ s) J0 Y' \9 c# n
  2. /*) B" S( @& h& _' b
  3. * edma_test.c2 H) x& N) v7 _- x
  4. *" j6 ^# o7 }2 K, ?: d! C
  5. * brief  EDMA3 Test Application# I2 ?4 P" w2 f3 r( F
  6. *
    ; K# B: a& c' o8 v
  7. *   This file contains EDMA3 Test code.4 B* o5 J  v& [( y3 i
  8. *
    5 L3 o9 e# o6 S7 h/ N, b( |; h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# ]7 X8 c8 H5 n" L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 S# j9 z. K$ W( G$ R$ D" O
  11. *         TO CHANGE.
    ' Q! X0 o  E. H! _- c  I, x' \
  12. *
    & {. T" H9 q+ e8 H# L7 `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " @- k. k; O9 {# b8 }' S0 O
  14. *  h+ G- ^; ]# O9 D3 f% n& h
  15. * This program is free software; you can redistribute it and/or7 g5 O2 u+ w. H! s. z/ ~3 q& D9 u
  16. * modify it under the terms of the GNU General Public License as
    5 \" Z8 x5 D  U5 [( e
  17. * published by the Free Software Foundation version 2.
      j. N5 r7 R4 l+ S3 r
  18. *" r" F5 l  r; n( L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" B7 b5 d4 @  a' \7 f& |" Q
  20. * kind, whether express or implied; without even the implied warranty
    " @. M+ y6 ^2 q" r; ~# F- m* x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ X* p) D- v% u3 W. [, j
  22. * GNU General Public License for more details.
    ' d$ }! S9 ?4 _6 E8 _
  23. */
    2 ^5 P% s! }1 k! u- {
  24. 2 R) Z+ I6 ~+ s) @; }
  25. #include <linux/module.h>2 c0 ~2 ]1 A5 T) @6 R: |3 X$ v' J
  26. #include <linux/init.h>
    6 j; p% I9 k& A
  27. #include <linux/errno.h>6 o: E7 n3 W! s5 n9 i
  28. #include <linux/types.h>: c. X: k) F! |8 j4 Q% b- t
  29. #include <linux/interrupt.h>9 n7 c. d5 G6 I! }" s
  30. #include <asm/io.h>2 n- H* z, j$ T& U
  31. #include <linux/moduleparam.h>( Z& l9 n& @$ H2 L+ ?# w5 o, }; J
  32. #include <linux/sysctl.h>
    ! A% L3 B4 [4 Y6 V
  33. #include <linux/mm.h>
      L9 y6 E7 {' G7 J
  34. #include <linux/dma-mapping.h>  d  K4 O$ ?' I; g/ w% g

  35. * N3 E* B! q. B5 n7 W) b
  36. #include <mach/memory.h>
    : u: m: {* r- I9 h  M
  37. #include <mach/hardware.h># [9 N' c& C/ Q6 F
  38. #include <mach/irqs.h>  Q5 p+ n0 q) Q/ H
  39. #include <asm/hardware/edma.h>
    # W* P- t  b9 C! T" O& @9 r

  40. 3 }0 \9 G0 Y/ a8 O. }2 f7 u/ E* z. g
  41. #undef EDMA3_DEBUG
    ' h9 n1 j2 L) X4 |2 _1 A2 |
  42. /*#define EDMA3_DEBUG*/+ _8 [  q% j# C5 E
  43. 5 ~& X7 c3 [2 |# Z% q( _! A9 M' ~
  44. #ifdef EDMA3_DEBUG6 e8 ]" D' }  {' l; l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      l0 k1 ?6 D+ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). ^* t4 ?" |- _$ k  U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 F5 _  C1 U9 w) a) {5 D
  48. #else
    ) n$ t" f3 Z/ \- W2 T
  49. #define DMA_PRINTK( x... )
    & @2 D& j9 n+ q7 `! ?1 Y/ K
  50. #define DMA_FN_IN
    . p( J) y; c; F' w
  51. #define DMA_FN_OUT
    7 m7 M5 b5 F; P" H
  52. #endif& |5 N0 Q# o/ N" U

  53. ( @4 z- g/ k5 a7 H; B/ p- b/ r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - e! o' G" j0 D6 {9 s
  55. #define STATIC_SHIFT                3
    ; a3 Y& N, p* y" y( v
  56. #define TCINTEN_SHIFT               201 K: F3 ^+ [/ y0 L0 @
  57. #define ITCINTEN_SHIFT              21
    & F! x% b3 a8 n7 u
  58. #define TCCHEN_SHIFT                227 N1 m; N6 O; n
  59. #define ITCCHEN_SHIFT               23
    - x& A/ H+ f6 o( y# ]) H
  60. & ]- {1 z3 s5 N4 \
  61. static volatile int irqraised1 = 0;
    & j7 [5 K& e2 v% }/ t
  62. static volatile int irqraised2 = 0;
    # ?, O& k5 `2 D. w% P
  63. " z& V1 Q: G# u: X, |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : u% i, o) y5 r+ Z: }& j/ |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; x. z+ m2 f* n" ^% U& f& y1 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; j) _% z& b' h+ V- e
  67. 5 Y2 W9 t) ^! u7 c( C! d! |6 L
  68. dma_addr_t dmaphyssrc1 = 0;
    / F% y8 }: p* `7 H0 T" w
  69. dma_addr_t dmaphyssrc2 = 0;) ^3 F  m1 D+ Q2 u+ \" U
  70. dma_addr_t dmaphysdest1 = 0;
    5 v/ l) g. r/ ~
  71. dma_addr_t dmaphysdest2 = 0;
    + J# w0 ~, Z! G- M; T& ?

  72. & i4 Z, ^2 f/ \
  73. char *dmabufsrc1 = NULL;( t2 W- ]% n) b" l" f& t
  74. char *dmabufsrc2 = NULL;
    5 l& k! a9 S- p8 q
  75. char *dmabufdest1 = NULL;
    # g% _. A8 B! F2 _) _
  76. char *dmabufdest2 = NULL;6 r& ^5 g  P) S
  77. 8 q- i" r* J& v% W3 ?4 M" A
  78. static int acnt = 512;
    & m* \$ w& b$ O. d
  79. static int bcnt = 8;% K/ n$ j) J% a& S+ ^$ N4 P" L$ [
  80. static int ccnt = 8;. u6 u7 @3 \: Z' @
  81. 7 j# V5 b: l7 d1 g
  82. module_param(acnt, int, S_IRUGO);8 C$ V& O! L, c- n! _( \
  83. module_param(bcnt, int, S_IRUGO);' o# Z/ x, b/ o+ ]$ y) _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
* L. K3 W+ M) |0 W# {4 p  i( G8 c
' s- w" ^5 v1 l0 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" O/ Y! \5 }! P" }8 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ o, d3 O7 O  i4 c( e3 m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 k( w1 P0 a9 e. d2 h7 i7 B
7 V' L& v0 [3 D4 _4 d2 C! m5 E6 ?9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 20:59 , Processed in 0.038092 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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