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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C- {- p! E* a3 Y' E
  1. [code]EDMA sample test application  \* Q5 n; Y% y9 t( o6 I! m5 K' n4 r* V
  2. /*2 H" M1 ~! f6 t* l: m3 E
  3. * edma_test.c
    3 K3 ^& d% P; a4 i. H7 e
  4. *0 `& Z" B7 `8 W6 n( W6 |( A- p
  5. * brief  EDMA3 Test Application
    7 ^  c! e6 [& f: i8 G- [6 x
  6. *# u1 F1 p; K# Z" ?
  7. *   This file contains EDMA3 Test code.) \8 @" K: i, J  ~* N  M
  8. *2 e4 R! g5 S; e) A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : f! c1 I, Z* Q& n" k% I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& J. w0 j: Y8 M1 `
  11. *         TO CHANGE.6 U9 g5 h3 a. L/ j2 K
  12. *
    , u$ |. q. Y& @7 [( }- j9 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 h7 K. }7 g% D0 b8 S0 A0 B9 K& w
  14. *
    9 n- a4 a) m" V9 _
  15. * This program is free software; you can redistribute it and/or* j" |. B0 y  K7 k/ D6 `
  16. * modify it under the terms of the GNU General Public License as
    4 ]4 f$ P$ T& J( S3 b  q5 _
  17. * published by the Free Software Foundation version 2.
    : V4 d( N2 u! Z) ^
  18. *
    6 L  g& d/ ^9 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% D& q; f: d- r+ n# D# ?5 B; ?6 l7 G
  20. * kind, whether express or implied; without even the implied warranty/ o, d2 W5 h: w& P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  G# R3 I* C7 N$ N. h" D
  22. * GNU General Public License for more details.
    9 {4 _4 N, Y* x, I; R
  23. */5 A  t+ p: o3 M
  24.   O3 [- U9 E; x4 ~: v
  25. #include <linux/module.h>
    . {2 r: c+ V! q5 ~; y1 D
  26. #include <linux/init.h>
    3 y4 @* |# I1 X! {4 M
  27. #include <linux/errno.h>( o3 u6 I+ W, c4 r. J/ W, T
  28. #include <linux/types.h># ~6 U& S6 X3 r/ ~4 n! M, K
  29. #include <linux/interrupt.h>
    . g+ c; s2 T3 t2 y2 z: [* G6 `+ @
  30. #include <asm/io.h>
    4 U: ~5 O% t; r  v1 S
  31. #include <linux/moduleparam.h>
    % ~; Z& T3 i% @) L$ F
  32. #include <linux/sysctl.h>
    4 O5 C% i9 ~0 y
  33. #include <linux/mm.h>
    3 l+ P: y" d0 ~$ ]% F
  34. #include <linux/dma-mapping.h>
    ' h& I! [* R2 g4 U1 B7 l$ P

  35. , _" ~; M" o- l" [' T
  36. #include <mach/memory.h>
    : c* C8 v; h& e( ?
  37. #include <mach/hardware.h>
    1 }, y6 D  N  `9 }  o
  38. #include <mach/irqs.h>
    " i: l8 U- E6 X6 q
  39. #include <asm/hardware/edma.h>
    3 B" A& N2 S4 {3 ^
  40. # N' v5 p- o) G
  41. #undef EDMA3_DEBUG& o+ y5 a( p% g1 {' \( Q) J
  42. /*#define EDMA3_DEBUG*/# ]! q; k  Q2 r# t" k" R( @  X) a" k8 y7 u
  43. ; ^. v& q+ L4 x2 g0 B# R
  44. #ifdef EDMA3_DEBUG
    # S- [# ^& [1 g% N/ k  K/ [9 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & F  t7 a; H3 {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ r& W% C1 }0 `2 Y% q' v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( v5 ?2 F+ Z$ s5 q; M7 m
  48. #else
    ) r) d& @8 M6 }% v8 D: D
  49. #define DMA_PRINTK( x... )0 G7 |. v' U' ?
  50. #define DMA_FN_IN! G6 G8 P+ W: `8 O
  51. #define DMA_FN_OUT
    # A, ~6 y4 G, @7 ^! B
  52. #endif1 v% y: i2 I. f, h8 l& g# \
  53. * k. N7 `7 _8 v$ `! p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" u* `' S' o6 h
  55. #define STATIC_SHIFT                3- u' v6 m, z& D/ b/ f5 v3 K
  56. #define TCINTEN_SHIFT               20
    2 \7 ?; F$ Y/ R& X5 j7 ]2 Z* W5 E
  57. #define ITCINTEN_SHIFT              21
    - n8 B' W9 }! j" w: F( m; S
  58. #define TCCHEN_SHIFT                226 |4 J/ f$ B) u9 n( L0 I2 l
  59. #define ITCCHEN_SHIFT               23; x, U0 w4 ]$ P% U% C

  60. 2 X- o0 i5 A- a/ C3 W
  61. static volatile int irqraised1 = 0;
    : G& \4 {7 i1 ^9 w' ?8 N1 @3 L
  62. static volatile int irqraised2 = 0;
    ) J0 _+ q& i/ U8 [$ ~

  63. 1 V! J/ \1 {2 [# \2 Z! l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / l4 x* m% ~0 I+ b& }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & `/ T8 z; n/ c6 A  e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t: n* b: s9 P' D4 z6 ?& Q6 D
  67. 1 S; h1 D# \2 H* \0 Z4 B) ^
  68. dma_addr_t dmaphyssrc1 = 0;6 j" Y5 k9 a8 a0 ^1 o& Q
  69. dma_addr_t dmaphyssrc2 = 0;9 A6 l0 f  x2 {
  70. dma_addr_t dmaphysdest1 = 0;7 M, o& M  j- t# e9 z# v4 e1 @
  71. dma_addr_t dmaphysdest2 = 0;
    # X+ b9 n/ ^1 U& Y
  72. 2 Z7 y5 U0 u% I5 _# m
  73. char *dmabufsrc1 = NULL;* R* g6 v# l# |" h2 U. d$ N/ m$ x
  74. char *dmabufsrc2 = NULL;4 t; A$ K5 X& D: M
  75. char *dmabufdest1 = NULL;
    1 ]2 C' ~7 ?$ z1 `8 h  H
  76. char *dmabufdest2 = NULL;" [6 }4 ~3 ]) t* ^+ v! }& W

  77. # ~* u9 C$ n6 n0 W- B& i
  78. static int acnt = 512;
    ( {+ P& V- P% R6 T( M
  79. static int bcnt = 8;
    " i0 M. h$ D1 r" `
  80. static int ccnt = 8;
    ; \. I2 y" m& L8 `

  81. ' t% h3 E* d* y) y9 g" f) R
  82. module_param(acnt, int, S_IRUGO);1 @# i3 E2 m0 i9 X9 t' E5 D
  83. module_param(bcnt, int, S_IRUGO);
    1 x4 m  L& \- _- [; Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 z: I. S( c2 s# {% [3 g

; E) G! Q; @- v( F      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 |1 d* O: ?1 g. B: w4 ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! C6 V2 O, l) P' `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ g( [: D' O! q6 [2 ~; [
: W0 N# C0 b* p% G/ H* n/ Q' t) Y! Y9 N/ _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-24 21:07 , Processed in 0.040999 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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