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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) x1 t) v6 `9 x2 \6 I& a" f) a
  1. [code]EDMA sample test application' l2 ^0 h9 L7 G
  2. /*
    * l3 B/ M% N1 k( V
  3. * edma_test.c
    ! M5 k8 l$ B! t) R
  4. *2 o9 s: V, T% `& T/ g% h
  5. * brief  EDMA3 Test Application& r- ]( r$ \, ]" m7 u8 U+ ?
  6. *
    0 _+ I5 k: E' v* `6 |+ n. i) {- k
  7. *   This file contains EDMA3 Test code.
    3 g8 I' U3 G7 ^& n1 g7 Y
  8. *6 N: j! ^; A  ?7 ~3 |: ]0 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 r4 U$ c0 V! w) S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 o4 G3 h* H* I$ O- F3 O: X
  11. *         TO CHANGE.
    4 Q/ k0 M$ Y0 P: E
  12. *
      \  ?: R' Z$ }* o# T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % P5 \; c# b$ _- M
  14. *
    ; Z( \2 S0 ~6 G# R# x7 ]0 q
  15. * This program is free software; you can redistribute it and/or2 j6 n& }3 {3 V$ V
  16. * modify it under the terms of the GNU General Public License as( e6 L( k& g! \* P
  17. * published by the Free Software Foundation version 2.
      ?1 D5 K  r4 d! Z' ~- W
  18. *$ Q% W9 p2 j3 [2 _' x  p$ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , a$ Q6 l9 B: @3 h( a. B
  20. * kind, whether express or implied; without even the implied warranty
    5 m# P' P3 K# ]9 x# `, ^. f' v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) B8 y' m+ F% X, _7 [9 S
  22. * GNU General Public License for more details.: R! a  A" }( C& R. V, J2 P( R7 K; U7 A6 z
  23. */
    ' M/ w5 `6 V0 V6 F- m
  24. 3 z/ W3 k& B, ~1 |3 h4 e
  25. #include <linux/module.h>
    7 E" v, P1 \0 D/ ~- [' g2 q
  26. #include <linux/init.h>; j" u3 G; N+ v  |4 n! ?
  27. #include <linux/errno.h>
    0 |! w4 b# }! N: _$ ~" R9 F
  28. #include <linux/types.h>0 c8 t0 K3 v# a% {( N: k1 M# h
  29. #include <linux/interrupt.h>
    , P  c9 Z( k& ^% t0 ^+ r% ^; G
  30. #include <asm/io.h>
    # ?$ J$ d4 u3 M8 C9 K
  31. #include <linux/moduleparam.h>8 i* P) |# a4 F* N4 U! U5 H
  32. #include <linux/sysctl.h>" D3 c/ S7 K* L
  33. #include <linux/mm.h>
    + l& }7 Q3 X0 S" E6 i
  34. #include <linux/dma-mapping.h>
    & e7 \# w0 Y' D  Q% p7 l% U  U4 V

  35. * y1 ^, h, o& v& x- Q( L
  36. #include <mach/memory.h>, J4 w5 f+ C* ]* W* s, K
  37. #include <mach/hardware.h>
    8 j* _. q+ Y& z* p  j4 D
  38. #include <mach/irqs.h>
    + I' p- `1 S! X- g7 |
  39. #include <asm/hardware/edma.h>
    / }+ m; I: ~2 r4 ^, s

  40.   W8 Q/ t! i, \3 n; f8 w
  41. #undef EDMA3_DEBUG4 y9 R+ U; W5 Z, z
  42. /*#define EDMA3_DEBUG*/
    8 Y" U0 x9 y& j2 {$ Z2 z4 l' R
  43. & w/ G" G- t* v# \' T
  44. #ifdef EDMA3_DEBUG
    ! ?  H" E6 w6 P: J1 H5 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). m. g2 W; Q3 q9 K9 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 }8 p( S5 \0 I' J$ x$ h2 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - T1 r9 C" k6 D4 K' j: W0 H' |
  48. #else! ?2 _; y! \: c( T
  49. #define DMA_PRINTK( x... )
    4 F4 V! M* Q+ w5 J
  50. #define DMA_FN_IN' I* x, H! I; ~/ A# A" r
  51. #define DMA_FN_OUT
    , C. }' P7 |" Q) _, G1 z; b" F
  52. #endif2 z0 K* @- i2 s( _6 f/ a" M

  53. 7 h% ?) R0 G5 [# S8 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / b# y, K. ~. c2 {2 n
  55. #define STATIC_SHIFT                3
    / Q! e, ?& f- W+ m3 L; `% _
  56. #define TCINTEN_SHIFT               20$ E% I2 Q) u: R
  57. #define ITCINTEN_SHIFT              21( O, j- p- o: N& k' s( x! d
  58. #define TCCHEN_SHIFT                229 ~1 R' v! n+ B5 m2 f( z7 h$ H
  59. #define ITCCHEN_SHIFT               233 m) l: \, T/ G+ i. I2 M/ O. {
  60. + [+ D/ E4 J, Q+ c% y$ k. G. n
  61. static volatile int irqraised1 = 0;# s! L5 P5 w; K1 m
  62. static volatile int irqraised2 = 0;6 e+ l, Z4 j) ~6 `2 S1 m

  63. % L$ |4 [0 x# X8 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 x0 }) _) I: y# C, _, c" ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 k6 W3 }4 c/ J5 V5 l( R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 p- q( K6 D1 ?4 ]

  67. 9 j* l% u( T; c2 T
  68. dma_addr_t dmaphyssrc1 = 0;, a. B2 j+ N7 j+ I. z1 |
  69. dma_addr_t dmaphyssrc2 = 0;
    ! D6 {- s9 k+ e$ M- B
  70. dma_addr_t dmaphysdest1 = 0;' u. v9 z5 D  }. F3 M
  71. dma_addr_t dmaphysdest2 = 0;
    ' k% m4 _: ^# N. M5 z% _( ?0 f
  72. . S! n" e1 B7 Z! g4 g( q
  73. char *dmabufsrc1 = NULL;7 ?9 V8 P& Z! K
  74. char *dmabufsrc2 = NULL;
    8 f6 C6 {8 \5 \. g& E% Q
  75. char *dmabufdest1 = NULL;
    0 q) s& P# L6 F) C
  76. char *dmabufdest2 = NULL;& T  B$ ~" R  e+ [* a6 ~
  77. 8 C" \! f. J7 X/ b2 x
  78. static int acnt = 512;! O) ?7 D) @8 L
  79. static int bcnt = 8;
    : F6 h  L/ H. F- s9 {0 @7 s
  80. static int ccnt = 8;
    7 \6 ~: K4 [' z  j6 F! _
  81. 7 M. Y9 f6 `8 G
  82. module_param(acnt, int, S_IRUGO);
    , h; i" }2 ]6 F, O
  83. module_param(bcnt, int, S_IRUGO);
    8 {5 e. `: K2 w) w! Y  g) q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- P: x" D1 ^2 I) `; n& {, R# M0 j' t& Z4 s% g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% G  o: S+ z$ a$ C' u/ q2 f% x
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* S, P( B8 c. E% h4 P     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ N! r; s, T9 Q' e( V6 W" |$ C# p) r5 M5 Y$ e) a  L* d1 r8 o
" t5 M& s4 C, i4 P( p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 05:34 , Processed in 0.041776 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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