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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # t1 V2 X5 g9 v) t/ O) Y  G' i. o
  1. [code]EDMA sample test application% t  w4 P# `1 }/ {
  2. /*
    # d" f: N  ~; T; U) L  N! d( L) |
  3. * edma_test.c
    $ n5 q1 t1 h. `5 m: K$ v
  4. *% t  c2 y, v/ \# o3 C
  5. * brief  EDMA3 Test Application9 t9 X* d) u- F
  6. *
    : a/ Z" S' X1 |3 f6 H; z
  7. *   This file contains EDMA3 Test code.4 `5 Z  a; M7 J  b1 j2 ^: D4 f: ?
  8. *0 ?+ x( J( W( Y1 M/ Y) k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- S3 @( P6 Y/ a5 W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & p4 w- m' C6 C# r) ?3 {
  11. *         TO CHANGE.
    " m6 O  b4 }/ ^8 w' h1 j+ w
  12. *
    - v1 s' |, x: I0 x! N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 f$ w; _+ ^0 T1 ?2 s& L0 C
  14. *5 H  q8 k* c3 A/ [
  15. * This program is free software; you can redistribute it and/or5 d. l" b9 o: ]' t
  16. * modify it under the terms of the GNU General Public License as
    9 a# h6 J- h. k! M0 A
  17. * published by the Free Software Foundation version 2.
    4 P8 _, D( ~2 |$ o$ Z
  18. *
    9 [2 e, k& R; K/ J8 P( S  ~$ @1 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 K4 I6 b! w" v8 l+ ^- ^8 i) K5 y
  20. * kind, whether express or implied; without even the implied warranty
    8 {; y$ B7 {2 g! f7 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' b; I4 }7 H0 S: [
  22. * GNU General Public License for more details.' V, [$ j* u7 ^& G* }
  23. */
    ) @. v6 E; j% I8 z$ t
  24. 2 [' v0 l' [! n. {' [8 B2 C
  25. #include <linux/module.h>
    7 \6 h0 A0 k! c  `7 G& [
  26. #include <linux/init.h>
    1 w! u% i5 a/ i2 O; @
  27. #include <linux/errno.h>
    + i) w# K, c# b2 {7 Z  w
  28. #include <linux/types.h>
    4 x! _& C, ^! t: [" G3 V' E
  29. #include <linux/interrupt.h>
    4 ^7 g' F/ {6 ]) O9 l' S* \
  30. #include <asm/io.h>. u8 h1 X0 \0 P( S9 b  t
  31. #include <linux/moduleparam.h>3 Q3 v. J2 L; ]+ U' i) B4 c
  32. #include <linux/sysctl.h>
      G) k4 N8 b, j" G9 i6 i, u
  33. #include <linux/mm.h>+ F1 s+ C( d% I3 K
  34. #include <linux/dma-mapping.h>  G3 o" T2 W1 J1 m% v  l0 M) u
  35.   O4 k& W3 W+ Q5 `! j! @
  36. #include <mach/memory.h>
    $ q% l' l) t4 f# |+ z7 X/ O
  37. #include <mach/hardware.h>$ p3 S" _- i+ Z2 F# [. X5 j
  38. #include <mach/irqs.h>0 x3 ^$ `( I0 \6 b4 m9 n
  39. #include <asm/hardware/edma.h>* d6 c# `% g+ ^; t. f: S: ?
  40. ! S4 i6 F7 \/ X% d
  41. #undef EDMA3_DEBUG
    * I9 r& t+ o4 I' X6 G
  42. /*#define EDMA3_DEBUG*/
    ! P# x5 c" W! s! p3 E! U8 ~+ U. [# }# q
  43. ; H! s& u" E5 Z4 A7 E
  44. #ifdef EDMA3_DEBUG
    * ^0 m6 E3 r+ w$ _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); L$ p5 F" _% _9 h8 m- B: o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# m3 |) I; c( f( S- q6 e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ J/ M0 V0 p2 X$ G0 R; W
  48. #else
    / j0 k- e$ I/ {6 E7 o# c1 ]* C& }
  49. #define DMA_PRINTK( x... )) c2 ?4 F  G& q. \' N
  50. #define DMA_FN_IN
    ! |1 O  f2 K! F3 S
  51. #define DMA_FN_OUT
    $ [- s; C3 w2 B: ~9 _! d0 I" S
  52. #endif
    : |+ w+ W3 g8 Q0 o9 s) |

  53. ' H  H3 S' v, _8 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), ?0 h* G  M; L7 p) n* c/ D8 @, g2 d$ Q0 f
  55. #define STATIC_SHIFT                39 ], `, I: r6 u
  56. #define TCINTEN_SHIFT               203 I- |4 l. l* U- n
  57. #define ITCINTEN_SHIFT              214 f$ t9 M& f! c0 [3 [; S2 n
  58. #define TCCHEN_SHIFT                220 t' @) J; J% x& g5 ~' c
  59. #define ITCCHEN_SHIFT               23! N0 T( L/ m4 X7 S4 G0 R
  60. 4 h1 I, ^3 O4 G4 B+ P) t
  61. static volatile int irqraised1 = 0;
    : s, T* Z1 V+ k' O+ i7 l
  62. static volatile int irqraised2 = 0;6 p- p( P) T3 X9 {, g  E: H
  63. 4 L! R6 Q- c* p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& J; H4 G3 M2 D; K6 ]0 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 t, f, m2 U. z0 u6 l! m+ J5 x! r. |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. p$ {3 h) _7 x
  67. 0 B( v/ E7 t6 [$ k: x/ Q
  68. dma_addr_t dmaphyssrc1 = 0;
    * X* Z% t8 W1 O3 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ( k  J9 A7 F! L0 d+ w
  70. dma_addr_t dmaphysdest1 = 0;
    ( C' ]9 K( u! u
  71. dma_addr_t dmaphysdest2 = 0;" U6 N- n# \; V+ G& y' [; |

  72. : J: o5 x) v  W, X% n* Q
  73. char *dmabufsrc1 = NULL;
    " f; _+ N, b* J, X' I+ B/ l
  74. char *dmabufsrc2 = NULL;1 ?! j: Y$ u* Y  F% ^0 e
  75. char *dmabufdest1 = NULL;
    3 k6 M& u- V# C/ e0 ?9 ~
  76. char *dmabufdest2 = NULL;
    , u& ?! k5 j3 M0 H/ i3 _% Z

  77. . c" m7 V  g+ q' c
  78. static int acnt = 512;/ n) T7 h* I7 m1 J# |) f+ Q5 {- s
  79. static int bcnt = 8;% z6 A8 r1 g- K6 R. U
  80. static int ccnt = 8;
    ) G, W% W5 U" v5 l
  81. " m  Q4 t/ Q; w/ r* q1 A
  82. module_param(acnt, int, S_IRUGO);
    ! I5 N& X) @6 |
  83. module_param(bcnt, int, S_IRUGO);
    ; `2 ^0 b- q  u/ `4 h. {2 e3 M
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# @; U, R8 {* [# B- U- {# u+ W* B! A8 v9 }5 R8 ?$ [1 D' j. g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ [( k1 M1 u5 t1 oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& C2 P& z% s, {3 |3 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ [; X" y# y% U3 I5 }6 `

6 _/ O1 d  c4 [9 |8 G! Z( M0 }( }  o# D, B& ]* }0 x8 [; G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 05:18 , Processed in 0.042789 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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