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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 S) X' Z, \2 F% S- Q3 R. J
  1. [code]EDMA sample test application, v$ f$ e' W3 q& V1 Q' Y# a
  2. /*7 S+ Y- B# C/ c/ v( w- b
  3. * edma_test.c
    4 j# `' o& g" h: a' |) n; G
  4. *# a9 L8 X; v5 a- w+ _) x0 ]) `
  5. * brief  EDMA3 Test Application
    ! P+ M9 O& x6 ~2 z' B
  6. *
    ' g  P# @! x9 \) f
  7. *   This file contains EDMA3 Test code.
    - [- N9 c7 q2 k  i
  8. *  E0 o" J* S+ K* q0 x1 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ }) ]: g4 f( b7 W4 {5 U6 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " u3 @7 D: J/ \) ]$ m% Q4 }7 |! z' [
  11. *         TO CHANGE.
    ' I) x4 m3 g7 W/ w3 L, f6 }9 R; P
  12. *
    1 N) u. K7 Y+ R" b% n' U" P- o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 V* g6 [  V* s( N* a
  14. *$ h; k3 i/ o  m8 B3 s
  15. * This program is free software; you can redistribute it and/or' i7 g* q  R: u6 i1 {7 Z7 U, O
  16. * modify it under the terms of the GNU General Public License as- A& d1 ?5 D$ s$ |2 O9 R7 V! w
  17. * published by the Free Software Foundation version 2.: Q: ]( q1 {5 n9 K3 e2 b
  18. *
    3 T+ F6 n: q, e" U# i; n1 q" l: U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 N" _2 j" w/ n9 E/ L
  20. * kind, whether express or implied; without even the implied warranty
    6 e) K! t" W# _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- L& n5 k1 [1 I* f- S
  22. * GNU General Public License for more details.
    " k$ A4 h! y0 ^8 q# T
  23. */+ R  j2 n8 d* ?, c

  24. . Q' v( @2 _3 i' r% j& f8 O! G
  25. #include <linux/module.h>  B; K. l, X' C3 c) ^& T/ J
  26. #include <linux/init.h>. ~- p8 m$ \0 g8 ?7 q% O
  27. #include <linux/errno.h>. x! w4 s! ~+ a# R4 ~2 A! q: p# M
  28. #include <linux/types.h>
      S: Z( y! D3 h3 w5 R
  29. #include <linux/interrupt.h>
    " G+ [( E3 C/ @. h
  30. #include <asm/io.h>
    0 X7 e  E2 R$ t$ K) ]! f
  31. #include <linux/moduleparam.h>
    ! t6 J$ K+ r& d
  32. #include <linux/sysctl.h>- b0 _- _( K4 [. _6 y; v) G
  33. #include <linux/mm.h>' B* X$ u# k( `% ~! U/ j; Y
  34. #include <linux/dma-mapping.h>) S% C7 `1 z9 S+ H3 Q
  35.   d1 w& Q: _7 l; S0 D# z& N/ f9 L
  36. #include <mach/memory.h>
    . Y- ^4 x% h, E; ?' \5 G
  37. #include <mach/hardware.h>
    / w: @7 i1 g  _+ H! k( d  A
  38. #include <mach/irqs.h>
    5 I& b! K( @8 ~, S- `
  39. #include <asm/hardware/edma.h>
    1 S( {0 Y0 W/ Z
  40. ; A6 d' p" \0 T3 r4 U
  41. #undef EDMA3_DEBUG
    . v. W4 X4 \9 n2 i/ G
  42. /*#define EDMA3_DEBUG*/
    5 }( e5 ]% _: N7 x
  43. ( ^  h6 k' {* X( k$ I3 a9 z, u
  44. #ifdef EDMA3_DEBUG) c' Z; g3 s) h/ q: \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- I2 t" k, T0 i: `8 e1 U, ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 s3 M- ?5 s9 F2 O) D+ k3 I  Z1 M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 r' d2 v9 _4 V: B, o9 D
  48. #else
      @) _4 h, l9 z
  49. #define DMA_PRINTK( x... )+ F9 h1 i5 D- Z9 a* D
  50. #define DMA_FN_IN; R' X  [! h  s+ }& e
  51. #define DMA_FN_OUT. g8 A' X- E5 w) P- X1 k
  52. #endif
    / U& f) \+ e' a
  53. ( D' I9 ^& o; |- ~/ R$ P) k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 H' U" X# {, n  F" I' M
  55. #define STATIC_SHIFT                3- p  y3 T5 X/ ^! W# A8 E3 W
  56. #define TCINTEN_SHIFT               20
      G* H$ `( G5 Q  p! a
  57. #define ITCINTEN_SHIFT              21
    7 V; O  s/ q7 S5 Y
  58. #define TCCHEN_SHIFT                22
    ' [$ Q* j# D0 O% @& W! Y
  59. #define ITCCHEN_SHIFT               23
    ( X. n& U+ p* }
  60. * Z5 L- j, i5 H1 P
  61. static volatile int irqraised1 = 0;
    % q& R  [1 [0 A) Y5 N' l
  62. static volatile int irqraised2 = 0;% B; X/ j) T/ Y5 d) a# [# }( Y
  63. 3 r% u' G5 Y5 s* l3 }0 z; u. j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ]& q; K" I: S9 E5 T0 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , j  ], H# b- [' Y0 x: N) D  u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?! l( o" K1 F
  67. 7 b9 [5 H% v! U  f1 G
  68. dma_addr_t dmaphyssrc1 = 0;! H9 T- i! `3 D( g0 k( R2 H
  69. dma_addr_t dmaphyssrc2 = 0;
    ' F. j  u* m# I; s$ L& T
  70. dma_addr_t dmaphysdest1 = 0;# o4 j+ Y; \% p5 A, G" N1 [) J* w
  71. dma_addr_t dmaphysdest2 = 0;( G- W: t! M! Z

  72. ! C. b) s5 Q' B) g' `4 a, P+ M5 U2 K
  73. char *dmabufsrc1 = NULL;: L# i& R; V2 j' X
  74. char *dmabufsrc2 = NULL;7 F" a) a9 ?( Y0 c, \. m
  75. char *dmabufdest1 = NULL;
    3 {) C  w! k: t5 @
  76. char *dmabufdest2 = NULL;
    : G1 W( F0 ^) V* ]& Q$ T

  77. ; r( ~) A' Q" j" A6 i
  78. static int acnt = 512;& w; G# `1 W7 s# @4 q4 m8 B
  79. static int bcnt = 8;4 V6 S# x8 k1 P- ^0 j( S
  80. static int ccnt = 8;. z7 c- ^0 i9 L+ M6 V- x! T

  81. & g, L" U% `' b- B  A7 f; v
  82. module_param(acnt, int, S_IRUGO);
    # f. D4 n/ L3 w; p  d& p( J
  83. module_param(bcnt, int, S_IRUGO);
    ; g. ?1 [: M2 @8 h. m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* s$ X( i' {% T  s, `
  f7 D5 c; P3 Y1 G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) s9 y* H7 |& H
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; r9 Y+ D; b7 |. ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 D0 |3 ^- c& m+ J& P

% B: f/ x* `; I+ f% n
: \  J( ~, o( b, G4 `, O$ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 02:39 , Processed in 0.040580 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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