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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * e! i; g; k& d" h/ k/ c
  1. [code]EDMA sample test application
    + i; Z: c( ?$ K9 p$ u) Y
  2. /*6 q* r4 j- m  C: j
  3. * edma_test.c2 K: @4 B5 [' t' m( z. r
  4. *
    3 i* Q( S3 l8 G  ^
  5. * brief  EDMA3 Test Application' _6 _6 b+ M. @7 I; Z
  6. *
    # {; \+ D( e, [3 n5 s8 O
  7. *   This file contains EDMA3 Test code., G6 Q0 f* Y& Z! p2 ^0 E
  8. *( }8 `9 O  n3 h" R# X+ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; |: a: ^7 Q4 U, R+ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( w; J' k( J5 ]  \
  11. *         TO CHANGE.
    - C% ]- f' b8 W: z  C7 f  y, c8 d! E
  12. *
    9 B0 X2 u9 d. D* \; h$ y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# m3 h6 Y# s7 ^7 }% Q
  14. *
    8 Y- f: P8 c: R/ _% N) y
  15. * This program is free software; you can redistribute it and/or- q" _! e+ D; {5 M' c5 ^
  16. * modify it under the terms of the GNU General Public License as3 L" I/ p' A9 ^' C) l# I$ I
  17. * published by the Free Software Foundation version 2.
    + O; R( M) ]2 @, `# Q  Z
  18. *" p$ [( b: L' }- _4 W  y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : f: v$ t  H. p$ A; N) [
  20. * kind, whether express or implied; without even the implied warranty
    / p0 f. R, W: m+ V# ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 F" n! }' k9 e, x8 s
  22. * GNU General Public License for more details.8 b# _- y: K! K1 J. c' M/ A
  23. */
    5 W4 Z' ]/ F" G/ a6 w
  24. : n& K8 z1 `8 t( H$ v: ~
  25. #include <linux/module.h>' X+ F$ U( R: z; }# {; f$ x8 x) m% T* g
  26. #include <linux/init.h>
    . g7 d# N- O8 B3 |5 g! Z; c" _
  27. #include <linux/errno.h>
    4 @; N7 w# F/ P$ r" w  |
  28. #include <linux/types.h>2 _9 ^4 z5 k% G0 Q* {4 k
  29. #include <linux/interrupt.h>/ `( n5 l" n+ T: g" J0 i
  30. #include <asm/io.h>. Y% W) z) i6 o' }
  31. #include <linux/moduleparam.h>
    * i3 o# }# |5 t& w& j9 F! W, T
  32. #include <linux/sysctl.h>3 }. Q/ B7 L- X
  33. #include <linux/mm.h>
    , {4 W5 b# V- r: f
  34. #include <linux/dma-mapping.h>9 ~- m6 S9 v" N: x( `& L

  35. $ l* m5 y( Y( X# `1 ?8 k4 g
  36. #include <mach/memory.h>$ c0 E2 o' [% }! Z, O
  37. #include <mach/hardware.h>
    ' g% L/ ?0 i! V6 ?9 S; N
  38. #include <mach/irqs.h>
    . G9 j( N5 v5 R# U2 j7 J7 p, N6 t
  39. #include <asm/hardware/edma.h>) B; b  k+ ^1 I2 e% S' [
  40. , `3 B# i' m% p3 Q
  41. #undef EDMA3_DEBUG
    $ V6 _* q! S# Z0 W& {
  42. /*#define EDMA3_DEBUG*/
    4 V9 _5 |; h: q  U
  43. , p1 o5 N) \' y% [) M
  44. #ifdef EDMA3_DEBUG# \; @/ A# d! _0 k# v' k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ~/ ]; H3 t/ M1 m+ _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # @% M$ G( _+ x6 Q! v: b/ s! b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 h7 L$ ~( q. p# ^2 d
  48. #else" z, |) A/ |& l4 z: L: T3 [+ W
  49. #define DMA_PRINTK( x... )
    : g7 _/ r. a/ d7 S$ W
  50. #define DMA_FN_IN
    & {+ ^" {  p1 s  ]
  51. #define DMA_FN_OUT' @0 i7 F. U9 W: w1 A% f; B
  52. #endif: N8 O9 Z& T9 _+ ?

  53. 0 Q" s% [4 Y4 R+ \) M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * l7 g5 H' a2 L% F: ?) `: ?
  55. #define STATIC_SHIFT                3; l  y9 ?8 T9 a
  56. #define TCINTEN_SHIFT               20
    6 Z6 D; _5 ^7 b6 b- Z
  57. #define ITCINTEN_SHIFT              21
    & B/ b  j/ Q1 Z
  58. #define TCCHEN_SHIFT                221 e1 ?7 _; ^8 R- [6 a6 [
  59. #define ITCCHEN_SHIFT               23) W$ b% O" b  a% y, d) c

  60. 4 p# t0 m! G$ k3 G9 R3 q, W) n
  61. static volatile int irqraised1 = 0;) c7 X; [& P& M0 h
  62. static volatile int irqraised2 = 0;
    # S$ i: {& v  s
  63. & M5 Z+ P; |3 M- b2 A! y# u0 P# N8 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & M) c! U  I0 W9 Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 m" A8 w' r, Q3 T. I) b* B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % j6 O; J9 T) H/ W* Q& E

  67. ) t, R  \" n. ~" k$ T8 M3 b$ V& w2 I9 K
  68. dma_addr_t dmaphyssrc1 = 0;- R4 M7 K4 r) {$ ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ' K; E( R$ e7 g% W( ]' ^
  70. dma_addr_t dmaphysdest1 = 0;$ f8 j& k2 N. t6 B5 T
  71. dma_addr_t dmaphysdest2 = 0;
    " `: s, C- Z. C) c  k

  72. ! p0 d6 A5 ]9 W8 J; R
  73. char *dmabufsrc1 = NULL;
    ) u% [) Q2 `4 X0 p+ }/ j$ n
  74. char *dmabufsrc2 = NULL;
    0 N, ?6 C1 p5 h# u4 q# A- D" E
  75. char *dmabufdest1 = NULL;! B3 H- s3 P: U' t* T6 u: {/ w
  76. char *dmabufdest2 = NULL;
    7 w% e$ Q, h# s& x% c$ M

  77. ! [/ A( g, h+ X2 b
  78. static int acnt = 512;4 l6 t$ D' D9 y" m/ T& N% @
  79. static int bcnt = 8;
    0 u# A, h/ A+ W) t; Z
  80. static int ccnt = 8;, n. B4 {) n6 s7 H6 {) l' q

  81. ; T" S' G4 r4 z* S6 H2 i8 t
  82. module_param(acnt, int, S_IRUGO);
    ! n; f/ g4 l3 `, t+ a1 v
  83. module_param(bcnt, int, S_IRUGO);
    " t, Q6 u" j4 c8 h" H9 n5 T6 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 ?# ]$ u7 L4 \5 l4 t' K  \( N, \

- o( I% K8 m3 c% ]- d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ j1 G* W6 R" L7 ~- w; n7 u" zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 Z8 l2 t8 r+ f% X' e8 Q" C9 _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% i3 O' `$ Y6 P2 P' B
" Y2 L6 M2 W9 ~$ W( A& g2 M8 q' S: D& r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 18:09 , Processed in 0.038958 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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