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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # |4 B. C. W6 o  E4 d2 b% p
  1. [code]EDMA sample test application
    % p9 L. A% N; x1 M( s3 r
  2. /*, w+ }) q- a/ O  H1 o- m% V  b
  3. * edma_test.c
    / Y4 g% g$ e8 [5 J: k# _% T
  4. *4 R6 Q. v! o; t7 ]
  5. * brief  EDMA3 Test Application
    0 G1 _- ^: y. y, P' ]
  6. *5 b7 i9 U* N3 g8 b; a$ @- c  s- g
  7. *   This file contains EDMA3 Test code.
    . k- u8 x7 `  H; z/ d  |6 t
  8. *5 ]+ V3 N1 X4 U0 ]  o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& b) [% o- W; a$ Z) L  L9 x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; b5 c( W8 ~; t9 M
  11. *         TO CHANGE.
      ?  X& Y2 X) F9 b! c, n7 V
  12. *
    7 s% w$ K3 Z/ L2 j7 p% S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 Z4 ~" s$ u/ m6 B8 m- A/ s$ L* p
  14. *
    6 ]9 h0 Z: n& l
  15. * This program is free software; you can redistribute it and/or
    & O" Y. ?( v6 |1 T
  16. * modify it under the terms of the GNU General Public License as
    ( [9 @( ^+ m1 X4 T' Z
  17. * published by the Free Software Foundation version 2.# \. A5 f) E9 l: R
  18. *
    3 ?! I- O& g5 y) R) P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * b- P* P2 F; a
  20. * kind, whether express or implied; without even the implied warranty
    / R8 f; f/ x/ }4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * g) L6 t  p- [& C8 t8 @' M& u
  22. * GNU General Public License for more details.
    * d. M' x' J/ F/ c
  23. */
    1 g. }+ d" p* X

  24. - i1 v; Y$ Y% e9 ]
  25. #include <linux/module.h>
    6 c5 i& Q7 p5 w
  26. #include <linux/init.h>
    7 @# }( H: m8 q9 I3 c" o9 ~
  27. #include <linux/errno.h>0 Z+ c: @' e# ^0 r1 f8 X7 ]7 m
  28. #include <linux/types.h>3 ]% f7 G7 A) l: [) k7 B
  29. #include <linux/interrupt.h>5 o& t- B. S% w, Z' Y2 a
  30. #include <asm/io.h>) e7 {+ O' d! n
  31. #include <linux/moduleparam.h>
    ! o) c+ L7 w3 v' b9 T0 u
  32. #include <linux/sysctl.h>7 c$ ]( Z# E1 t
  33. #include <linux/mm.h>
      u4 k/ }/ y8 T
  34. #include <linux/dma-mapping.h>
    0 k) m& K0 Y- w8 J: W' E- H/ n

  35. * r! u8 @' k& y  `
  36. #include <mach/memory.h>( W$ M+ u! E3 f  K
  37. #include <mach/hardware.h>" z- ]2 i9 @5 q+ l. O
  38. #include <mach/irqs.h>
    9 S0 l" P7 a$ `3 C: s
  39. #include <asm/hardware/edma.h>
    & }. W3 \# ], `* ]; t& d
  40. 2 G8 \' @2 K2 f( y8 a. B  j" Z
  41. #undef EDMA3_DEBUG
    - f4 {* D1 _! |9 w7 V- H  D
  42. /*#define EDMA3_DEBUG*/' ^& S9 q- h3 B2 G: Z' Q8 I% v

  43. # |" G" ^! b% a, ^- A# i! y* y: x
  44. #ifdef EDMA3_DEBUG
    ! f3 y# N" ?& O2 B# l, d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , H3 C  U1 B% s; H/ M. `# C& u( l6 s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , d. V, C4 r6 F2 d7 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 o* ~+ M" [7 i4 h1 F
  48. #else
    / e  K3 y. n: j* T
  49. #define DMA_PRINTK( x... )
    % E9 |  U! i9 D
  50. #define DMA_FN_IN' k* n: v! d* b; u# R" x- O* N& o5 k
  51. #define DMA_FN_OUT
    6 W+ K* G$ R# F, H: b  m) d
  52. #endif( g7 \: S1 ~% g( c
  53. 8 E$ C6 B" a1 l1 \1 J. x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 m, }# X+ V  ?7 y
  55. #define STATIC_SHIFT                3, Z9 f2 n+ X3 _5 j9 S
  56. #define TCINTEN_SHIFT               20
    ' J) Q9 T/ g. V# D; V
  57. #define ITCINTEN_SHIFT              21
    % o' m  N* c) T* J/ q1 v0 f
  58. #define TCCHEN_SHIFT                22
    ' f) Q; ^" w% N7 e$ L" Z" v% B3 d
  59. #define ITCCHEN_SHIFT               23
    8 `8 Q+ y7 z: O9 s3 r6 z% |

  60. 7 m5 Y: }0 K- Z7 _4 h3 U# a
  61. static volatile int irqraised1 = 0;: n. M7 A: O  A# ^- b
  62. static volatile int irqraised2 = 0;+ t+ w# C% s- v0 r# B

  63. 4 M- T3 Y' D1 i9 J) D/ I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ e& E' ?7 p6 W9 m  \: G& m% n6 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 \6 X! v& r* D3 w! Z" g) a* c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / H4 i+ L% e6 `, O# l  f0 g6 z
  67. & R4 ~. e4 G% O8 u6 O
  68. dma_addr_t dmaphyssrc1 = 0;
    & J: v( v7 m0 g& Z1 O- @
  69. dma_addr_t dmaphyssrc2 = 0;: R0 O( h+ I+ d7 T' {
  70. dma_addr_t dmaphysdest1 = 0;+ [/ Z2 ]8 z8 T0 {& J" p* u
  71. dma_addr_t dmaphysdest2 = 0;
    ' x8 K( T, i& L& X7 Z2 s
  72. # D+ D0 p5 \# B  m2 X5 H  K
  73. char *dmabufsrc1 = NULL;4 Y. w6 D  M+ c# W. r
  74. char *dmabufsrc2 = NULL;
    5 x+ e; f" s/ H% p& G* z
  75. char *dmabufdest1 = NULL;7 j3 n/ f2 W4 u  A
  76. char *dmabufdest2 = NULL;5 R  c2 {' U5 u/ k" v# a5 D

  77. 0 |' r7 ?% c8 m" U" f+ k* U
  78. static int acnt = 512;9 j9 `$ _( N* O8 O
  79. static int bcnt = 8;
    2 [  ~) _0 i# q! H" s% _
  80. static int ccnt = 8;: B% x0 y/ z* M. @

  81. , D0 A; i7 s2 ?/ h4 J8 g" M/ b
  82. module_param(acnt, int, S_IRUGO);
    + k$ V$ Z" t7 h( u
  83. module_param(bcnt, int, S_IRUGO);6 ?2 f  B7 l% s/ q& P$ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! j/ T% Y/ H7 M! I6 ]4 G% W3 M- V( [$ Q7 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, u' P( ]& G) u& B2 ~" J7 M
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ l( i1 i4 {) }* P0 g2 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: K+ N. g* e; y8 h$ d
( T, _. z5 g+ m6 q1 A7 l! F0 h% M* u3 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-9 21:13 , Processed in 0.038260 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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