OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , E" y) Y+ u6 _. X: Z3 r) D
  1. [code]EDMA sample test application- O  c' K& M- v1 n- B. r, D; g+ @
  2. /*
    1 N2 Y; @+ A( c1 B
  3. * edma_test.c
    & Y0 A8 w3 I0 q& ?! w2 J, f& t
  4. *; q; v# F5 D, |! B0 l1 |
  5. * brief  EDMA3 Test Application) f' ~9 z- `) i: m  d* B6 X: {
  6. *8 T# W- P& i- E1 k3 d) L
  7. *   This file contains EDMA3 Test code.
    0 p  I+ o, w( I6 C* u5 m
  8. ** D( x. [& Z8 b' v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) q  N" C" L; h9 a6 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * j: O# a3 b% j+ j9 Q. P7 I
  11. *         TO CHANGE.; Y1 ], `1 ?" _- P
  12. *
    , c/ @" Q' H7 ~' D4 @! A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % {& l4 D) y7 ]1 K& [3 ~& Q" W; b
  14. *
    , {; r3 b7 R/ V- z+ g
  15. * This program is free software; you can redistribute it and/or# R1 H" a' W7 M0 C
  16. * modify it under the terms of the GNU General Public License as
    2 f9 h1 g* p% g% ?
  17. * published by the Free Software Foundation version 2.
    5 R% \  V& x  @7 a* Q% d
  18. *2 A% j( b, H7 }1 K, x2 l) i/ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' h+ \7 X2 p/ N. i' C% e9 X' n
  20. * kind, whether express or implied; without even the implied warranty
    8 u) M& }2 ]! M: o$ u" A) z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# N# U2 l! n6 T
  22. * GNU General Public License for more details.  E0 Q8 p# [9 o! L
  23. */- Q1 T% ?& x5 E7 e5 s; `! d
  24. 9 ?: t0 @/ a8 V) w
  25. #include <linux/module.h>
      {9 G" e. E6 \; O4 [& d
  26. #include <linux/init.h>
    ! u  M) X' z, p+ l. j7 |( e
  27. #include <linux/errno.h>
    2 ~* R  W* U8 w+ e: q5 @; Q' e
  28. #include <linux/types.h>2 |3 D7 c- z- e/ r( b5 `9 `& z! T  p# h
  29. #include <linux/interrupt.h>: `: e' O% A# H) q' j
  30. #include <asm/io.h>+ N$ _' d! e0 q5 I2 W
  31. #include <linux/moduleparam.h>0 E) l2 O3 ]/ g8 l) H
  32. #include <linux/sysctl.h>
    + F9 G2 y5 T# f9 W' N
  33. #include <linux/mm.h>/ u. ^9 C3 y, w4 N
  34. #include <linux/dma-mapping.h>
    - W* Q" e5 ^2 Q% M& f
  35. - \( K  V# O3 U! i
  36. #include <mach/memory.h>* ]0 s1 J- w! u, b# [- d
  37. #include <mach/hardware.h>
    # s3 ~$ X1 I$ k
  38. #include <mach/irqs.h>
    6 N$ K: n1 [; L: Z
  39. #include <asm/hardware/edma.h>
    ! Y  P1 u& v' m( b! R

  40. 9 ~- i, M% ?9 S" I. y* f
  41. #undef EDMA3_DEBUG
    0 E7 k# ^; c' X" W
  42. /*#define EDMA3_DEBUG*/
    0 H2 B3 O8 G8 ~; ^5 G6 ]

  43. # ^+ x) R2 I# `1 d0 V
  44. #ifdef EDMA3_DEBUG
    . g& N) C0 h7 @  I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ J) z! H0 x* v$ ^! T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " _9 r% A, T. z: p' g# Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' @+ v5 q$ [$ J  m" V+ i! x5 `
  48. #else" p0 I9 H8 J* V% U, G, z; d4 W- f
  49. #define DMA_PRINTK( x... )  Q: m% A" c! f/ `' m
  50. #define DMA_FN_IN
    : X: Z0 ~" M7 x# c
  51. #define DMA_FN_OUT
    * x; f- u3 G3 v9 ^6 a, `3 ~
  52. #endif
    & [% M+ O! @' }& y+ [4 \1 K( s
  53. ; o/ ]! E) E# |% e# f4 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 F( S4 C. ]% m1 }) S; x# P
  55. #define STATIC_SHIFT                3. n6 u- g: E; a8 K6 I$ I
  56. #define TCINTEN_SHIFT               20
    8 g/ Q5 o3 n" g  O' {2 @4 f9 s
  57. #define ITCINTEN_SHIFT              21
    $ T7 R9 r6 Q7 Q6 A: R1 g6 L
  58. #define TCCHEN_SHIFT                22
    & M" p7 \5 X; M5 o
  59. #define ITCCHEN_SHIFT               231 u+ A2 S9 t- P4 d

  60. ) c" s. O! W6 Z  Y
  61. static volatile int irqraised1 = 0;0 F+ A+ \# E" @( v: w- b& ^
  62. static volatile int irqraised2 = 0;
    , _) C! ]( o/ N

  63. 1 g* y& g! G9 X' `* _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ~9 F$ h! b; C4 A4 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^  [6 j! G# W; V, v; n6 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 F  C2 C3 M! v. \' w0 x

  67. 7 r  r8 q( E( E; }3 W+ d
  68. dma_addr_t dmaphyssrc1 = 0;3 y0 I- {) ]. A% }& }$ U5 B
  69. dma_addr_t dmaphyssrc2 = 0;
    . [# b( x& v3 [; y
  70. dma_addr_t dmaphysdest1 = 0;
    2 _! R+ x& l: Q
  71. dma_addr_t dmaphysdest2 = 0;
    : u% O: H+ Z6 U: [

  72. * ^; z6 E& A( y+ ^- j% z$ F- A6 T
  73. char *dmabufsrc1 = NULL;) b9 \& z( _" ]8 R
  74. char *dmabufsrc2 = NULL;/ H3 _* C3 P* ?/ E  E) l
  75. char *dmabufdest1 = NULL;6 X- w1 U, Z0 @8 ?* D1 ^2 x/ ~
  76. char *dmabufdest2 = NULL;
    / c9 g6 c, I' r( t
  77. . t  }2 u5 G6 C7 ]8 S9 s
  78. static int acnt = 512;
    2 W/ v( W! }! C) D
  79. static int bcnt = 8;$ ~+ K# C7 E5 G% [1 T; ^
  80. static int ccnt = 8;
    9 j& _0 L" L/ m! z) k
  81. * f5 k" h; G3 |, J2 U
  82. module_param(acnt, int, S_IRUGO);
    0 Z8 L4 X2 @8 w6 ^- U* Q2 U/ [
  83. module_param(bcnt, int, S_IRUGO);- t: r' s- e: ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% m: O4 R( A' Y  n- {/ r, K6 Q

7 x: L! s  U4 F# u$ g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" f: V( `6 n9 z/ c1 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 A) ~( G7 k0 L1 p0 ]0 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ j7 E# t% R7 W2 M( R) M0 l
2 A9 e9 Y  m1 e1 s

5 H, P5 x# R9 q* \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-8-6 20:07 , Processed in 0.043799 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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