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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) E& C/ `8 {. J5 V% L9 e0 z; ?3 h
  1. [code]EDMA sample test application2 e+ J/ r- Y- n
  2. /*
    + C. b: }% c( b& B& q- B  X
  3. * edma_test.c9 t2 g4 [0 c, m- U3 o- D7 `1 v
  4. *' ]/ D7 H7 e  J0 C
  5. * brief  EDMA3 Test Application
    2 f  }4 o. ^, K' ?4 T; G$ v
  6. *
    9 V' ~  j2 g! v
  7. *   This file contains EDMA3 Test code.
    & Q" y0 C1 v$ \+ j
  8. *
    + f5 Z2 e9 d' k& A- v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 n0 g, Z0 l: ~7 w' c: S+ p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ ?% a( O! O' D9 v) Y( b
  11. *         TO CHANGE.( e& \& w/ t5 d
  12. *
      [3 C# k  V# H: f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' ?- o, R! Y) A/ I% ?6 s
  14. *, q, a0 n' d' b. _# B
  15. * This program is free software; you can redistribute it and/or( z8 V( D- n: o4 Z4 j
  16. * modify it under the terms of the GNU General Public License as' p3 Z  M% m, n( U& G9 ]; c
  17. * published by the Free Software Foundation version 2.
    . |8 I/ T/ p& Q/ X( X8 Z- S' G. C
  18. *" u/ _" K' t# E1 i3 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + b) b8 o% }4 U; J8 h; ^
  20. * kind, whether express or implied; without even the implied warranty
    : z9 g; v1 K+ ^( f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 f/ y0 B: F0 U! ^
  22. * GNU General Public License for more details.
    ) G/ K2 K4 w+ J0 V
  23. */- }: P5 K4 P/ a  v

  24. * Q4 I- x) j+ j7 a. m. C! W
  25. #include <linux/module.h>
    * s' c1 `: h3 [0 N6 |
  26. #include <linux/init.h>
    - \) G! Z( s+ w% D. U' _! \  n
  27. #include <linux/errno.h>
    4 C0 d7 h6 }$ [
  28. #include <linux/types.h>, u$ F. m! h. x+ ^
  29. #include <linux/interrupt.h>1 k: |8 r1 M# C5 u8 g& Y
  30. #include <asm/io.h>( ~! e# U) `8 n2 q
  31. #include <linux/moduleparam.h>& Y5 {3 i  ^' W" a7 x) T! u( u
  32. #include <linux/sysctl.h>
    6 U" j" O$ T. F/ {0 K1 Y/ L
  33. #include <linux/mm.h>( h% Y1 B5 _2 @" U* W0 c
  34. #include <linux/dma-mapping.h>
    ) @- W6 Q4 h' U" C
  35. $ H! o2 a; J+ e0 I2 T4 D
  36. #include <mach/memory.h>5 V8 t" i) S5 w" k  u
  37. #include <mach/hardware.h>6 C8 e6 e+ T% C: ~8 x  N' d, ?, K. N
  38. #include <mach/irqs.h>
    ( R. k; @* q6 |- M
  39. #include <asm/hardware/edma.h>
    * A" M! d/ \6 z- m
  40. " v, j, V7 l7 W; j
  41. #undef EDMA3_DEBUG' x: g, F7 y) Y& f
  42. /*#define EDMA3_DEBUG*/9 E3 _. x4 x9 c0 [
  43. 2 Z4 b, d; V$ f/ S! a( u) L
  44. #ifdef EDMA3_DEBUG
    ' |0 @/ ^, g9 }  W# z* I5 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ `$ `: K4 J5 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 U' @. u6 z. j1 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 k# y5 {) ~, ^7 B4 b
  48. #else/ c' l% f, _& c6 Y9 ~8 ?8 }8 Q
  49. #define DMA_PRINTK( x... )
      T' P) ^! g( `& E0 q% B9 z
  50. #define DMA_FN_IN! e  ^& g- j! B: |1 s6 I/ c$ G: d
  51. #define DMA_FN_OUT0 G+ k7 q) u. [' O
  52. #endif8 F4 ~6 d! b; P1 q

  53. ' x; z4 Z" A. c+ E7 o" W2 f1 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 ?% g$ ^5 A: @( T, K" g* [$ V
  55. #define STATIC_SHIFT                3
    0 t8 A. Y3 ]' @! k2 j
  56. #define TCINTEN_SHIFT               20
    2 d3 `* N  W- M- C
  57. #define ITCINTEN_SHIFT              21
    / c' T/ g5 D1 j8 Q; f  a" g
  58. #define TCCHEN_SHIFT                22
    , j( X: M& P3 o
  59. #define ITCCHEN_SHIFT               23
    " V) [& b5 E. ]0 X1 b
  60. 0 n5 r4 j- M) H
  61. static volatile int irqraised1 = 0;
    $ T4 n8 ~0 l6 m; `0 k
  62. static volatile int irqraised2 = 0;: e, H" B+ ?; e0 D! Y

  63. 4 e: ^" [# W, t4 H  r" F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ^5 K1 q1 I( x9 F, z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # A; I, I  H6 E& }) W* _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }% a8 |" R  t* v9 c, y* j
  67. ' v$ D/ F1 m+ F/ K  ]
  68. dma_addr_t dmaphyssrc1 = 0;
    % G3 l3 Z0 l% Y0 u" G7 X1 A
  69. dma_addr_t dmaphyssrc2 = 0;
    + r+ k8 S  N0 f  ^; ]
  70. dma_addr_t dmaphysdest1 = 0;
    % S5 @7 |& n. q2 B! ~
  71. dma_addr_t dmaphysdest2 = 0;
    & N, `1 g3 J; B$ ]
  72. ) z4 e& K! E6 G0 e0 d& c
  73. char *dmabufsrc1 = NULL;+ ?4 p5 j; p( _. F1 R
  74. char *dmabufsrc2 = NULL;
    ( X" {; k4 ^$ e; U
  75. char *dmabufdest1 = NULL;
    6 c5 m4 y6 F7 j
  76. char *dmabufdest2 = NULL;* B9 v5 _$ W9 s" K& A+ ^1 ?2 E* K- W# R

  77. % @# Y+ \; ?; U% M# t( c; F. i- s9 H
  78. static int acnt = 512;
    ; B' v" k. s6 c0 p
  79. static int bcnt = 8;
    5 w- a, H4 C) i" ~8 n6 T. E
  80. static int ccnt = 8;
    9 S% O4 y+ s1 A4 Y$ w# `
  81. 8 T# o+ \4 V7 ]- M" R( o: k
  82. module_param(acnt, int, S_IRUGO);' p0 |- a  M% G# P( F: s- W
  83. module_param(bcnt, int, S_IRUGO);3 J, r5 }+ Y* X, o+ G$ f! d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 n# d& Q" B9 t! T' H9 u
. m& Q- W) d' n8 e- L5 [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% _0 [+ v( E6 M: T: Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. Y% |& N+ z* D2 ]$ ?2 y0 T6 ^: s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 K) O) A- }8 Z5 y  f

, d- D+ Y8 T% m- N( y; ^: M) D+ s& r; s7 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 18:31 , Processed in 0.050776 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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