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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 ?; k2 z. c, d. z
  1. [code]EDMA sample test application
    & f* q! z; c& K
  2. /*
    : w! X# B1 k" O/ M
  3. * edma_test.c5 x: u6 }5 j+ x- C- Q) \
  4. *
    " u9 ^* X  D( n
  5. * brief  EDMA3 Test Application) R/ l; c" Q2 X( X0 @% R) X
  6. *
    4 m& t# H8 V' y+ n
  7. *   This file contains EDMA3 Test code.
    8 E5 L6 K4 q& Y0 j9 ~2 x2 T
  8. *4 D3 F, ]7 P# l) X9 w$ W; B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) {  M- S3 i# E) |( L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, }/ |6 j1 K) Z
  11. *         TO CHANGE.
    ; @7 e6 H7 B7 z
  12. *4 X, R8 Q% P: l) E* F; q) b2 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ K6 @7 L3 t% u
  14. ** l/ i- f' W, r- b
  15. * This program is free software; you can redistribute it and/or
    1 _7 C/ k- @, R
  16. * modify it under the terms of the GNU General Public License as, N" c8 N+ `1 F5 e1 ]
  17. * published by the Free Software Foundation version 2.9 J& b9 i  G, _9 y7 a# C2 \/ J
  18. *
    3 A) P3 _8 C; G$ m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 u6 D% ]- G) @7 Y8 N3 `5 V
  20. * kind, whether express or implied; without even the implied warranty
    5 Z7 g3 [: b$ ^! B! u, |, \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 q4 ?$ P( l) W' ^: r6 ?; I- o
  22. * GNU General Public License for more details.0 y( M7 J& |0 T
  23. */
    ! M' ], d  w/ A

  24. + u: U3 Q  B5 U1 w$ H
  25. #include <linux/module.h>8 N7 j( @; `/ f3 o) o( ]
  26. #include <linux/init.h>4 z% z! K& ^& f, Y3 T
  27. #include <linux/errno.h>
    ! l7 Z  `$ p& G% k" Z$ l
  28. #include <linux/types.h>8 F7 @5 ]- E* a2 B5 A  h
  29. #include <linux/interrupt.h>; Q  I; A. Z4 W5 M3 C
  30. #include <asm/io.h>
    ' |+ u3 M7 F; z2 U, G- {( a
  31. #include <linux/moduleparam.h>
    8 y; ^- W9 b, l- U! {6 w
  32. #include <linux/sysctl.h>5 S! s% o6 z# e& }  h
  33. #include <linux/mm.h>
    5 J6 C' M3 m% V5 Y
  34. #include <linux/dma-mapping.h>, F& X4 z/ N4 }4 T/ j- Q; J/ i

  35. 4 z1 H3 p% e, B% W' e
  36. #include <mach/memory.h>1 p) i* N+ v+ ?, h7 v1 i; `/ l
  37. #include <mach/hardware.h>
    5 R: |" N6 |& P+ |+ g1 B/ w
  38. #include <mach/irqs.h>
    6 H6 X8 I8 I5 e+ q5 f4 t
  39. #include <asm/hardware/edma.h>. b* U- M* Z7 |  S) w+ s
  40. 4 I$ S' y, z9 L1 w6 j6 k) J, X
  41. #undef EDMA3_DEBUG
    5 P# \1 R8 ^1 o. k0 w
  42. /*#define EDMA3_DEBUG*/  f( {' a; S: x- V/ Y& K9 B- k! q

  43. : W' u& t5 T3 `7 z
  44. #ifdef EDMA3_DEBUG: x& y0 L! s3 [: F8 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  }2 E/ k$ v, e' T: x+ C8 o4 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! z/ d# v& D$ s" _2 [: i2 O: @+ v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " Z! F$ R% [5 z
  48. #else
    1 R: T# s" d3 c$ K$ O
  49. #define DMA_PRINTK( x... )
    ( z  C8 `4 @! U; x8 L1 e
  50. #define DMA_FN_IN
    ' j7 h& E8 N0 d: j
  51. #define DMA_FN_OUT
    $ y8 H5 E. P8 d4 [! |
  52. #endif
    9 r' v+ l; O% A
  53. ( ~+ i( O( m3 Q6 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 J! q! W/ c" L0 D
  55. #define STATIC_SHIFT                3
    , A2 `( o& T' ]$ }
  56. #define TCINTEN_SHIFT               20
    $ r( x) B7 b5 \9 J! @9 X
  57. #define ITCINTEN_SHIFT              21
    + X' ]+ g9 j0 d, b" o* v" Y. m) u
  58. #define TCCHEN_SHIFT                22
    * X3 ?  N  W0 i
  59. #define ITCCHEN_SHIFT               23
    0 \+ ]7 C2 C# D1 G, A
  60.   D/ D% G+ E' c( J( D" \2 X2 }% {
  61. static volatile int irqraised1 = 0;
    % p4 M/ I9 A8 `( V9 R
  62. static volatile int irqraised2 = 0;0 }! ?' ~3 p; w% B
  63. ! E& C& p4 v( d$ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 }, `1 O" H- L  X( a& t% ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! ?4 A. ^2 S5 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 K1 p3 ?8 Y: h4 j! _; }+ g
  67. 1 o" E1 k( A, U# r' [6 Z( m
  68. dma_addr_t dmaphyssrc1 = 0;+ U( Q. [# g2 e( W! N9 {8 G
  69. dma_addr_t dmaphyssrc2 = 0;
    : e: [5 h% n9 h# |6 b
  70. dma_addr_t dmaphysdest1 = 0;
    % @: |! Z: X- i
  71. dma_addr_t dmaphysdest2 = 0;% Q2 L/ O. v, }; t+ }$ x0 V
  72. , |; x  b3 f8 d2 o. Z0 S
  73. char *dmabufsrc1 = NULL;' L4 S6 U6 Y/ `9 H* |
  74. char *dmabufsrc2 = NULL;5 c7 t2 ~6 v0 i. O! N
  75. char *dmabufdest1 = NULL;% t: s3 L: t+ K# C, N5 f7 E; e
  76. char *dmabufdest2 = NULL;4 c5 z& S- I& X& {

  77. 5 A9 ~* k& I7 \) e$ Q
  78. static int acnt = 512;. b2 e9 R2 J; U! |" Y: _6 Y' t
  79. static int bcnt = 8;1 x% |/ i2 ?) @5 ]3 H
  80. static int ccnt = 8;
    ! R% Z4 X7 f8 ^

  81. + m& }) r1 |' q  ?) S" p# Q1 v
  82. module_param(acnt, int, S_IRUGO);5 ]* D1 [6 g0 }" W7 N. ~
  83. module_param(bcnt, int, S_IRUGO);; r! [- W, K) H9 c# Q$ W4 J! b5 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) ^0 {2 _  f/ ]) @
! [7 Q) R5 [- P# ]3 `2 Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* c- T1 ]; v; Q6 R$ J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 k9 P& s# {( k" t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 Y/ s, z! E2 ~6 R4 A$ l. s4 p$ @* O) C+ @* D6 I" N
! s  G9 Q8 q4 j+ [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 14:08 , Processed in 0.038799 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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