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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + F" T1 g" x7 [* q1 y) b2 J
  1. [code]EDMA sample test application" m2 w7 E; ]! o
  2. /*# P3 G$ l- O9 K- Z
  3. * edma_test.c7 M; P+ g0 L0 d( H& S5 ?
  4. *
    ! N; N; [0 B% R
  5. * brief  EDMA3 Test Application
    ' D4 ~3 U+ G& _
  6. *# C2 l& Q1 o$ I/ U
  7. *   This file contains EDMA3 Test code.8 |  W$ _- C1 v6 O$ R$ U" X3 A: ]
  8. *
    0 K2 F% l$ G; y, q, o! c7 V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) ~" x6 d' T3 [; h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 o3 ?) X6 r3 p; }$ T: H- S
  11. *         TO CHANGE.
    / \5 A4 T6 u" Z: {& P
  12. *
      `# @: c. B2 N9 j  Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) _: o, H) ]/ w4 J8 g/ l! f
  14. *  v9 R5 ~. @2 e+ y* ?
  15. * This program is free software; you can redistribute it and/or$ S; Q( u! ^8 ]  X+ s9 e: h# X' [
  16. * modify it under the terms of the GNU General Public License as3 e/ [! l+ u: i' q9 ^! A
  17. * published by the Free Software Foundation version 2.! q" e; ~! U1 b# a# \; A7 a3 l
  18. *
    4 _& `; Q7 c# f3 s) h9 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * R( o2 S1 `7 G3 A, n3 g
  20. * kind, whether express or implied; without even the implied warranty. {) j* }" i) W7 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 P8 I. Y: E* @6 P$ @, K
  22. * GNU General Public License for more details.( y9 A# ?* X( s
  23. */' k* N# u- S2 `( }0 O/ \

  24. 6 {3 Q0 n) ?, v, p! L0 G
  25. #include <linux/module.h>
    $ Z9 I/ k9 G* j, y4 t
  26. #include <linux/init.h>
    3 M7 @% G) F2 k4 q) Y
  27. #include <linux/errno.h>
    # Z6 L2 l$ `3 m' d- e
  28. #include <linux/types.h>
    6 N# `2 _* t: e
  29. #include <linux/interrupt.h>
    * ]0 j7 x% T/ S
  30. #include <asm/io.h>
    ( e( g/ c* \* m( C* J' G
  31. #include <linux/moduleparam.h>! b: p  s  @* \
  32. #include <linux/sysctl.h>
    + z% v% x% k+ F# n
  33. #include <linux/mm.h>$ {* ]" o" Q5 U" v' O4 ~6 K! j" x- d
  34. #include <linux/dma-mapping.h>7 l' j1 J% R# y) {6 ^; u$ n
  35. / }8 c$ O8 p" g  b# D
  36. #include <mach/memory.h>" W0 P. B1 }, ^) u
  37. #include <mach/hardware.h>! w+ F& V! ?, k' q8 c7 F
  38. #include <mach/irqs.h>
    " |9 d0 |/ b" W1 [  J- ]- `2 M
  39. #include <asm/hardware/edma.h>
    5 `2 |5 z* s# s- b

  40. ! X% n# |; i. ^& @& W5 N6 z% c
  41. #undef EDMA3_DEBUG
    5 `+ J( a# }) @, @4 U7 s# B% T3 {
  42. /*#define EDMA3_DEBUG*/
    / f0 N7 Y9 |* ~

  43.   [% H& R7 z5 g( Q4 U# y7 `' U. U# u$ d
  44. #ifdef EDMA3_DEBUG
    0 ~  g9 @/ q. N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 ~+ M! r* s( _6 P% O% s) \9 ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ m. D0 V' _: i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      {( D+ C: R0 F* M2 m2 E
  48. #else
    ; ^  F  ~: b" U7 J
  49. #define DMA_PRINTK( x... )
    3 n  e; S* X$ h" I3 \, v: j
  50. #define DMA_FN_IN0 R0 Y# q8 b6 y: b
  51. #define DMA_FN_OUT
    . V, z# O1 ?! \
  52. #endif6 s5 T# d! `$ E
  53. $ d8 D1 J& S6 n. `" y/ D$ S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), r! z; @! G. ]# J% N
  55. #define STATIC_SHIFT                3
    , t( r' n: o8 |4 G# d+ X
  56. #define TCINTEN_SHIFT               20
    6 _/ F8 F3 {& r, z' o' q4 I  [
  57. #define ITCINTEN_SHIFT              21
    + E) f+ ?$ G* ]( G! P/ E7 K
  58. #define TCCHEN_SHIFT                22
    % G- p" n+ |, J; r2 O' {
  59. #define ITCCHEN_SHIFT               23
    ; R" I2 _8 D: p! e( e
  60. : z4 F6 H  H  |! b9 M0 o
  61. static volatile int irqraised1 = 0;
    & t" X- Y7 b# E3 T2 X3 d' s
  62. static volatile int irqraised2 = 0;1 s' @: M. E. ]5 N  b$ }

  63. 4 p% `/ L7 ?# }  K1 K. R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T( ?. E# L' B- @( i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, K# m$ M. `+ |7 C8 X/ }) w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 P9 L/ F, `0 s

  67. & V! T3 [5 {" K. ~
  68. dma_addr_t dmaphyssrc1 = 0;
    4 E! y; K6 V0 V
  69. dma_addr_t dmaphyssrc2 = 0;
    , U4 G9 l) `0 \
  70. dma_addr_t dmaphysdest1 = 0;' H! q  i- O" r$ s2 G. M
  71. dma_addr_t dmaphysdest2 = 0;5 E9 \" S9 [# ?! {
  72. ( S& O0 y1 r* T( N& P2 ?7 O* t& g
  73. char *dmabufsrc1 = NULL;
    % ~9 ]; \! k4 ^4 G+ q1 }/ S) b6 \9 O
  74. char *dmabufsrc2 = NULL;7 {- u( F( }( @/ ^) a" s
  75. char *dmabufdest1 = NULL;
    * S2 O- p4 Y( n) h8 I3 v  Z- [& U
  76. char *dmabufdest2 = NULL;
    , x; f% |1 [2 e- U& |0 m, l0 _: ]

  77. # v- I9 j2 z7 W7 t4 l
  78. static int acnt = 512;. Z# r" j$ e8 E0 E+ B
  79. static int bcnt = 8;
    & W( ~: i2 I2 A  f& H* t8 ^% k
  80. static int ccnt = 8;! d/ l5 F9 y* Y
  81. 7 |- b( L9 k* ^
  82. module_param(acnt, int, S_IRUGO);  D8 l' n* E5 g2 ]& _
  83. module_param(bcnt, int, S_IRUGO);% G4 h2 D+ F$ e6 r& z6 y8 \; ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 H  ^: N% O5 c0 O0 A4 W2 T1 m3 i  z: M5 }- d" X$ Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Z0 s  `6 X( b! R/ j8 P" Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 f0 G, b, F) O. }* L9 f+ J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& }+ l" M2 w& C1 C& L/ n" H# W
$ I# \2 d! A  F% g. K
; {6 a1 @" b  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-4 12:46 , Processed in 0.045287 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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