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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 V$ c# P- k* u9 `' k1 Z, f* r- q
  1. [code]EDMA sample test application
    ' Z; b7 I/ ~& u3 b( H
  2. /*
    # s7 f7 {  \& V$ r8 p
  3. * edma_test.c
    6 Y- U- b% z6 Q  ^4 A) }
  4. *
    ' U7 I6 w, I9 {& `2 F" ^3 {& e" D  Y, \
  5. * brief  EDMA3 Test Application
    & Q- j: q2 D+ ~
  6. *3 t  `. ?' {% l: V0 l
  7. *   This file contains EDMA3 Test code.
    % y8 b6 R& a3 P
  8. *6 C" g( }8 l' m3 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& N: [) }3 C1 v% h1 n/ S% T3 o5 n/ F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 U( |+ I5 V( O
  11. *         TO CHANGE.) k7 x! Y6 g8 u) k2 x
  12. *
    ) h+ O! v0 D) N: E0 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 h; v/ b! u! T/ ^& W. i
  14. *
    ; J& G# k! D1 W
  15. * This program is free software; you can redistribute it and/or! m7 i; F8 D% Y
  16. * modify it under the terms of the GNU General Public License as
    / n; ?- I- ]2 H
  17. * published by the Free Software Foundation version 2.
    1 `* Q1 t! b, E
  18. *. B4 O/ H% r; A+ H5 w/ [2 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 `. f; q0 A; O" K8 n
  20. * kind, whether express or implied; without even the implied warranty
    # n' D1 y/ t% Y- F$ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 t& p# k6 S# j( `
  22. * GNU General Public License for more details.8 i$ U6 g$ W+ _. |; ~, S
  23. */3 q' N" U: w: y8 \! d' b
  24. ' _- f4 H3 W; M/ p
  25. #include <linux/module.h>3 C  h8 W6 m2 O7 h6 t" O  S
  26. #include <linux/init.h>) @2 |: y( `* f0 V( J( L
  27. #include <linux/errno.h>* I$ q. Q3 F& c- S/ S1 H! z
  28. #include <linux/types.h>0 P4 h7 B* u8 g& w( O
  29. #include <linux/interrupt.h>, z. ?0 ~) x# {3 o: {; o) J
  30. #include <asm/io.h>9 s) f4 C" Z% t$ A4 K" {* f- p# f2 s! D
  31. #include <linux/moduleparam.h>
    3 E9 y: ~6 K! N5 B/ z9 K; Y
  32. #include <linux/sysctl.h>: B) P; b: i4 q. w2 a
  33. #include <linux/mm.h>
    % x& _1 T/ B# X
  34. #include <linux/dma-mapping.h>
    & l8 }- y- C; `/ T" Q/ g8 d% D/ V& y6 K
  35. 7 o4 l' z' H2 q. ~9 @. ^
  36. #include <mach/memory.h>
    ) J+ K9 j; k5 L- ?2 ]
  37. #include <mach/hardware.h>
    8 M) @' H( A- j+ b. k
  38. #include <mach/irqs.h>
    - U3 A; J& r, u' k9 h/ a
  39. #include <asm/hardware/edma.h>
    8 ?# g* ^3 K4 P- N# u& m

  40. 8 a+ E) r$ l& ^) H3 T
  41. #undef EDMA3_DEBUG
    + v5 J6 E  i1 R6 Q" P( `. j
  42. /*#define EDMA3_DEBUG*/
    ; C$ o# H7 U- X, `) q5 @2 J0 q
  43. 7 O5 ~/ @3 x" U& R: f" V, |" o; p
  44. #ifdef EDMA3_DEBUG
    & C) e" ~. k0 x+ m# q9 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ j3 y, b7 r6 e" G; H4 c& l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). q# c% d4 h2 e6 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 Q$ J; t! D2 \$ E1 _
  48. #else1 |0 D- m4 Y: N: M& ?- D
  49. #define DMA_PRINTK( x... )
    2 l. Z5 s0 y0 q
  50. #define DMA_FN_IN" w5 C" a8 w# y$ k) U( S
  51. #define DMA_FN_OUT! R( O- H$ N# J. O; z# C# U" s8 N
  52. #endif
    / w9 X- S, L+ b( k9 V* Z
  53. & x. \  _5 U$ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# F: j5 B5 R8 O% j2 D
  55. #define STATIC_SHIFT                3
    9 [' O" y, y' \2 h9 A: M8 p# }
  56. #define TCINTEN_SHIFT               20* }$ A% q; A8 Y& y- Q2 [& y
  57. #define ITCINTEN_SHIFT              21
    $ {. D+ t. E4 {' E, v
  58. #define TCCHEN_SHIFT                22
    2 P& @/ ^7 Q& o0 a4 o, c: ]
  59. #define ITCCHEN_SHIFT               23
    ; _' |9 O3 T4 F9 |) P3 U

  60. ; L9 n" D; u' _. q
  61. static volatile int irqraised1 = 0;
    ' J- t. b. v, W+ \! T- d) W; U4 e
  62. static volatile int irqraised2 = 0;  }- d8 \- y6 b- ~  W% e
  63. + e: ^, R0 _& N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      C! v" K6 Z) H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 G( [4 p( M5 r6 T2 k$ B% e$ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: x' D" Z6 o7 g7 I
  67. ; t7 F2 e- Z# E1 h5 B
  68. dma_addr_t dmaphyssrc1 = 0;6 L8 ~4 h- d" J  h% r6 ~0 o
  69. dma_addr_t dmaphyssrc2 = 0;3 v: S1 w" |  U0 p7 I' f
  70. dma_addr_t dmaphysdest1 = 0;4 N9 p  o" q* Q3 p# _
  71. dma_addr_t dmaphysdest2 = 0;% V) Y- e; y! v

  72. 2 E5 X) T9 }1 O8 [
  73. char *dmabufsrc1 = NULL;! g- a, _, `; M0 x5 v- P7 _+ q1 k
  74. char *dmabufsrc2 = NULL;& e2 }$ N# G/ p+ |% o
  75. char *dmabufdest1 = NULL;
    ! x3 D- b) H: {3 X7 T& ^
  76. char *dmabufdest2 = NULL;; O& s' }( k5 v6 P% P2 D" E
  77. 4 U3 a) j7 w# y4 A0 r
  78. static int acnt = 512;
    2 M% \& e! ?7 H4 x
  79. static int bcnt = 8;
    6 P( Y  ^/ @4 E6 m
  80. static int ccnt = 8;
    & t& ]# Y- M( k3 {* F
  81. 9 j) D$ a/ n% p7 ~
  82. module_param(acnt, int, S_IRUGO);
    , \1 z  Z+ ~8 w# j6 u, p
  83. module_param(bcnt, int, S_IRUGO);1 K$ }0 M$ V$ b* ?& F7 }( a+ k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 E& k3 S9 ?) V7 _
( G" l9 m# @9 B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ q$ U5 n( H+ x+ j: 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* E( H2 R  y! ~. R  ]4 K4 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 H2 _& `. @/ H% K  J- G& W
! ]( ?; g' ~. F( u7 c5 w" o  @9 R

- O, `+ W8 R' ~: w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 01:30 , Processed in 0.038473 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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