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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . f" G* q- n7 P8 `
  1. [code]EDMA sample test application
    ( x' q% t: I; E( u( W' w
  2. /*8 o+ E3 k2 x9 j: T
  3. * edma_test.c
    & k! C- {5 a6 F
  4. *4 `- }+ g1 ^0 n+ A0 w
  5. * brief  EDMA3 Test Application9 n  e6 _6 f9 G" x  j0 j& a& X
  6. *
    ; ^4 n4 I5 l9 J4 c' J1 r
  7. *   This file contains EDMA3 Test code.9 g2 i4 y: N1 s' X% {. @) x1 ]3 h% I
  8. *. b9 ?" Y: P. m# [& h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 U+ D  o, r  v+ H: n0 [, D. i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! Y/ q9 N  {* d, E2 ^1 h  }% i7 `. M
  11. *         TO CHANGE.
    ( }) v# c; N0 {) a$ Z! t+ l  u
  12. *: b2 z6 `6 m* @" ?8 o; n9 k  `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; b: q# L! s: f& q( A
  14. *" X+ ^3 k& ?4 M, s2 x( o8 `. ^
  15. * This program is free software; you can redistribute it and/or
    9 g; h9 v# e+ b! [) Z7 \. Q0 p' t  k
  16. * modify it under the terms of the GNU General Public License as7 f3 l. h0 c. ~( N+ W. n4 P
  17. * published by the Free Software Foundation version 2.
    # H5 O* ~6 u% B) c/ ]. q
  18. *
    * F6 B1 U7 ?( m. F0 ]2 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 k7 Z+ c- `/ G8 U1 j6 k* H
  20. * kind, whether express or implied; without even the implied warranty# D" r& M3 Y0 A7 C; K4 L3 R6 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! b; ]8 K. P! t( [; Q# A# Y
  22. * GNU General Public License for more details.. q) R' f& X  A
  23. */
    + E% d& I7 X9 v* K2 {: q

  24. : _; N; x, w+ Q% \6 V
  25. #include <linux/module.h>- `- P' `' U/ X1 e3 s
  26. #include <linux/init.h>
      l, `, `, H5 F5 [) a
  27. #include <linux/errno.h>
    + v4 M7 r. k2 R; e* h" G
  28. #include <linux/types.h>
    ( A# T# u& ?. d, s! H
  29. #include <linux/interrupt.h>
    2 H; X* r. n8 ~5 S* Q- b8 f
  30. #include <asm/io.h>: J' A. X/ {1 _+ d& q5 O
  31. #include <linux/moduleparam.h>
    5 F% k) N* f2 y0 X. c2 R
  32. #include <linux/sysctl.h>
    0 q: L* G/ u, P# v$ h
  33. #include <linux/mm.h>
    8 b/ G8 q  `6 n! ~) ~
  34. #include <linux/dma-mapping.h>
    ' y, I) v# Q1 p; l! B! r: E

  35. / ]7 K$ y# _0 b6 F# ]
  36. #include <mach/memory.h>+ g' h3 Z4 L! h, [4 q- ^+ ~7 |+ p
  37. #include <mach/hardware.h>8 Q2 K4 }# ]& ^  [8 M' f) L# c
  38. #include <mach/irqs.h>
    0 v# Q  {  p: x$ {. }
  39. #include <asm/hardware/edma.h>
    ' C3 F6 E, o' ]% K* _* U; d& `- m5 U; {

  40. , |" e# m4 e4 d! C: b8 J
  41. #undef EDMA3_DEBUG
    - @$ Y7 u* m' S+ n, F: q8 U
  42. /*#define EDMA3_DEBUG*/3 ?# u/ f) j4 ]8 H& c3 z6 V

  43. 5 S/ |$ [4 O! [" k- k
  44. #ifdef EDMA3_DEBUG
    ! y* d- F- G( t# F4 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 _5 f( v& I: b+ h) }; C( G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 T' u$ [) Z( m' `& S) @9 W0 ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ {  P' e( R! U& Z" \
  48. #else
    % C; ?5 x3 P$ |/ g+ }1 z
  49. #define DMA_PRINTK( x... )1 ^0 t/ f  `: F, O5 x
  50. #define DMA_FN_IN
    & v  d. j! \1 T) `  P3 R& A
  51. #define DMA_FN_OUT" g) W; l: Z  Y; V7 X5 Z
  52. #endif% V6 }5 H) j. k. p9 R( S; y
  53. 1 a, B% F! u$ e3 e; k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 m2 k# L8 m8 k, ?* o5 @9 D( D
  55. #define STATIC_SHIFT                3
    * {1 w2 I4 G5 ~
  56. #define TCINTEN_SHIFT               20& z* }  l' Q+ _' s/ V
  57. #define ITCINTEN_SHIFT              21
    - k, ]; q* K6 m2 z% @1 j
  58. #define TCCHEN_SHIFT                22
    8 A3 ^: p3 K# w) a+ _7 i
  59. #define ITCCHEN_SHIFT               23
    / K- x6 \% y6 g% Y2 a+ @

  60. ' D$ m3 w' V" O7 B. k. q4 z" P
  61. static volatile int irqraised1 = 0;  ^) Y4 |6 l; S! }# E1 N
  62. static volatile int irqraised2 = 0;+ v9 r+ Z1 W3 T4 b; X9 X
  63. ) f* Y, X# v/ }  N( f0 M" I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 H8 V1 _) f( E0 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N+ P8 _/ ^2 u7 ^- e8 t, `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " f' _+ W% P) C# K5 }. m

  67. ' O" Z) F0 Z- L2 v$ R: B4 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    & [. |' @. h+ U  ^) H! x
  69. dma_addr_t dmaphyssrc2 = 0;
    * x  E: E$ C8 e; k3 g
  70. dma_addr_t dmaphysdest1 = 0;0 S3 |9 ~# h. m2 T
  71. dma_addr_t dmaphysdest2 = 0;
    & g- q0 ^! U6 m& ]& a! t
  72. ( n; H. [' q) N
  73. char *dmabufsrc1 = NULL;' Y9 U% c% ^* H9 P" y( N1 _  U, t
  74. char *dmabufsrc2 = NULL;
    * J" c/ ~+ G! \# p
  75. char *dmabufdest1 = NULL;" d% E0 Y" z3 d. n2 U2 T8 ^
  76. char *dmabufdest2 = NULL;! j1 _0 {9 g0 a9 @
  77. ( e0 U% P3 a( U% o8 B( ~
  78. static int acnt = 512;
    " C2 D! E+ s1 Y6 N, H: ^
  79. static int bcnt = 8;- O( w" o' Z. e5 i$ R7 f3 Y
  80. static int ccnt = 8;2 i# R& Q. h  q6 n: [, Q6 v

  81. 6 e( T) e; Z- `" Z* m# V4 N
  82. module_param(acnt, int, S_IRUGO);( J: }# q6 P5 F
  83. module_param(bcnt, int, S_IRUGO);
    % a( X7 v3 @2 j6 A' @; B" i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- E, R$ [/ _5 h% M% [, m3 y# |

; ^; u8 }8 s: A4 J. N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& u/ N+ v, K/ V' F( t) K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* b. Z2 \+ n( N5 P( x+ P' z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- O$ b# s7 p( L- O- f1 e; V$ a
# U* ^/ [/ B& A+ j0 [+ J

0 Z* {1 G5 u' ]# s; N+ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 02:31 , Processed in 0.047218 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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