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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, `( u% b; R# q4 {
  1. [code]EDMA sample test application
    3 I+ h! l# y$ z7 o
  2. /*
    ) L; D( b/ }2 O* y! I, [
  3. * edma_test.c
    0 n) ]+ W1 A2 ?2 m5 }4 E
  4. *
    # \5 u: a2 Z$ }! s
  5. * brief  EDMA3 Test Application
    8 p( d/ z/ U1 F* L
  6. *
    9 O' G- w  S: \. Q0 e( K
  7. *   This file contains EDMA3 Test code.5 d, H  I; a: `0 |
  8. *# B3 u" K3 U1 Y) {! j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ t0 |4 e8 N' [" S6 j8 {$ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, l* V$ u: M7 E( ~9 E+ F+ t, K
  11. *         TO CHANGE.; X  ~$ U2 W5 i3 y# p" `
  12. */ p6 ~. y2 C! F8 C# o- M3 L- ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; w" w. k% z# X" D" H1 }
  14. *
    7 A; z7 A  ]: g/ g9 S6 C& N1 |
  15. * This program is free software; you can redistribute it and/or
    . f1 _. K' w' O) M$ D9 V$ H
  16. * modify it under the terms of the GNU General Public License as
    0 L! G. T* k% M- [
  17. * published by the Free Software Foundation version 2.
    9 N1 t( q8 H5 N0 J) P
  18. *' ?0 X0 Z5 W$ F1 I9 {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / u, U! r  L; _/ C8 @
  20. * kind, whether express or implied; without even the implied warranty& a, \" o& U9 @" R7 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, l4 C1 A! U9 f9 ~6 X
  22. * GNU General Public License for more details.
    " y4 E3 z/ I& C: d1 ]
  23. */) U/ m( y' ]. ]5 k& C0 n
  24. % p  p) p% d# J+ D
  25. #include <linux/module.h>
    ; S  Z5 ^( s- h
  26. #include <linux/init.h>
    7 d9 K: @$ @6 T% I
  27. #include <linux/errno.h>
    9 i$ U3 d4 |' c# H( {% n
  28. #include <linux/types.h>! z0 F- c$ w) M0 z7 A" [( Z2 {
  29. #include <linux/interrupt.h>
    , _' l2 X; h3 C( @" P
  30. #include <asm/io.h>
    ; P/ ^/ ^! J& l9 Z- T) f
  31. #include <linux/moduleparam.h>
    . o# v- k) `- o+ h: r
  32. #include <linux/sysctl.h>* A5 G" M' h; ]2 E' s
  33. #include <linux/mm.h>/ j) d) {+ f, m
  34. #include <linux/dma-mapping.h>
    6 q2 n1 X9 N1 @, d( x7 h0 ^

  35. % _+ q; ~- V, `- w- Y) B9 T
  36. #include <mach/memory.h>$ A( d& o2 n! U1 f) X9 ~$ x
  37. #include <mach/hardware.h>
    4 v3 Y- U8 \& S
  38. #include <mach/irqs.h>5 g0 N$ D( ^" A7 R' z
  39. #include <asm/hardware/edma.h>' R) U' L% I. u1 D4 \* S

  40. # ~- |+ @6 J& l$ e" c$ _, U
  41. #undef EDMA3_DEBUG
    . ^) `' W$ u$ e$ n, c( e) p2 C
  42. /*#define EDMA3_DEBUG*/( p# W' ?$ y( i3 C

  43. / E# D# E$ t) h) B8 Z% C8 g
  44. #ifdef EDMA3_DEBUG
    3 A* w8 k- G, q. k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 p; f& Z/ Z* ~# P7 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 C  Q; g) p0 K0 v' P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 y/ E1 t8 h3 _( g9 F5 H4 @, c
  48. #else
    . z5 q" X, x: i- A0 ~  l
  49. #define DMA_PRINTK( x... )' d7 g& T: R. r6 }" e
  50. #define DMA_FN_IN/ h- V  T' R. T! ~) d  i! K
  51. #define DMA_FN_OUT
    , z; {7 ~. Q9 f- D- y
  52. #endif
    1 z+ u! w( }: r1 l# ]. ~
  53. / y/ {' u1 D' o9 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& g0 W" v) ^( A1 E% }6 o$ p
  55. #define STATIC_SHIFT                3
    # m& a6 S* M5 N# J) l7 Q/ S
  56. #define TCINTEN_SHIFT               20
    + t. n1 p' z& n3 G1 Y* Q. B. b3 m9 h
  57. #define ITCINTEN_SHIFT              21
    ; M( |3 C* x1 o% Z# {7 g0 I$ I
  58. #define TCCHEN_SHIFT                22
    ! l5 A3 W% `& S9 L) k2 u" a6 D$ p+ [
  59. #define ITCCHEN_SHIFT               23
    7 N6 Q: p1 w7 N& X9 e* Q

  60. : _6 \* x" @$ K9 }7 v
  61. static volatile int irqraised1 = 0;
    8 s" O$ C4 X6 h/ T4 [# n# F
  62. static volatile int irqraised2 = 0;0 k4 n' Q: C' v0 m  R
  63. , Y  {( R  ?' g% `' q8 Q' f2 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      q* o( |8 [( L3 ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! M/ R9 V& w/ E  x5 P" {, [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: z; E9 ~1 j7 O/ V0 ^
  67. 5 z3 V. @& J# T* f9 E* _
  68. dma_addr_t dmaphyssrc1 = 0;  f! U7 y) x+ @0 P) V3 w" o
  69. dma_addr_t dmaphyssrc2 = 0;
    . s* p, n$ E2 C5 J& M2 w) M
  70. dma_addr_t dmaphysdest1 = 0;5 i7 w9 D$ f, c; Y& X8 j
  71. dma_addr_t dmaphysdest2 = 0;# s" i0 c* e9 l$ W9 a% k) I& o* J
  72. , ^/ C1 B6 C5 J) l$ A2 u
  73. char *dmabufsrc1 = NULL;
    2 D% m- g6 P  k! o+ ~  P
  74. char *dmabufsrc2 = NULL;& C* N; a2 T! a$ f4 h& E* S! U1 p
  75. char *dmabufdest1 = NULL;; ]+ e! p- E2 U5 |: P: m* D
  76. char *dmabufdest2 = NULL;4 g6 e" g- m; [* }+ A
  77. 5 ^! S* y0 Z5 l+ C5 j+ A+ o
  78. static int acnt = 512;% N( L5 s- c0 h, L4 p
  79. static int bcnt = 8;1 [& y% F( h+ z7 K$ s1 u' ?
  80. static int ccnt = 8;  c% \+ ^& R9 i$ p
  81.   Q5 B& b% U! e8 R$ _
  82. module_param(acnt, int, S_IRUGO);2 n/ v% b; X. a( P
  83. module_param(bcnt, int, S_IRUGO);
    ' b( T% M: u! H. t/ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! u  _+ `' ^1 _- i0 |

! s5 E+ W  U: S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G& J5 f- m) ]$ K* F  ]& `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; j6 h+ ?& F2 S6 l) e5 g' D! [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' H1 k/ ?4 g( D* r; R2 v1 U+ S8 a* t* c0 a: o3 A! K" |

; q6 r5 [% Y0 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 03:34 , Processed in 0.047576 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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