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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / y; g$ E, c3 f6 I# c
  1. [code]EDMA sample test application) ~7 A" D9 X: q! r1 w# u) f% @7 ?
  2. /*
    . ]! C( X, k$ g* g3 z2 f
  3. * edma_test.c
    ; F& d9 K5 n" i8 @7 N
  4. *
    $ X: i" k* J# g& z4 c; W8 i5 W9 S
  5. * brief  EDMA3 Test Application
    ( k! J' i+ n8 B
  6. *
    6 ?6 T6 V1 j% q. L) u( ]2 W2 o, H
  7. *   This file contains EDMA3 Test code.
    ! g4 @% @7 B6 M4 y
  8. *
    1 h2 A. C$ I! N/ a' q, ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! f  z, b) j3 m! q+ b3 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 c) p# u0 c" Z+ H/ M
  11. *         TO CHANGE.
    0 P, T1 V, `9 G  ?# C& P
  12. *
    3 f; q5 a: Z1 Z; \/ `) z5 D% p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* d/ m. |/ J$ _, c! `+ S
  14. *2 }- h  k$ S6 D) {! I2 ?, T
  15. * This program is free software; you can redistribute it and/or
    + L8 k  ~' c% }( ?/ D
  16. * modify it under the terms of the GNU General Public License as
    , }2 O* @# X3 P3 D; e# h
  17. * published by the Free Software Foundation version 2.
    # i4 }# H* y8 P9 h+ _
  18. *6 I2 |' z( V5 K$ }. `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ U; Y. M9 O2 v# r6 k8 Y% }
  20. * kind, whether express or implied; without even the implied warranty+ v- |3 R8 ~6 T0 c" u- X! s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 J8 z& B$ }/ L6 W" f# ^3 i
  22. * GNU General Public License for more details.! c. o' p' O% H9 \3 Z# M7 `+ A! M
  23. */
    . ], ?" {$ ?. ?) |5 }7 T/ I
  24. % @+ O& l0 Q+ n7 _1 e2 F9 D
  25. #include <linux/module.h>3 l3 z7 ~  V! [, n& H, b! N
  26. #include <linux/init.h>- A' I" G( X* L8 F
  27. #include <linux/errno.h># T5 O) B* r8 p
  28. #include <linux/types.h>2 f' P/ t- }& C' _( D/ G
  29. #include <linux/interrupt.h>
    ! G8 e6 i6 }6 ]$ v
  30. #include <asm/io.h>
    ) J' u$ J& V7 V5 i9 ]
  31. #include <linux/moduleparam.h>  `. B3 ^# W1 T; k' Z
  32. #include <linux/sysctl.h>! U1 L( @5 i1 _/ K
  33. #include <linux/mm.h>
    $ V' {( H4 n/ B4 `8 B9 ?
  34. #include <linux/dma-mapping.h>
    9 [' E; z/ \9 e* p7 s

  35. 8 j) S7 J: M( L2 c7 H# F
  36. #include <mach/memory.h>
    , {6 q+ ~  B- s) t% h+ f4 |
  37. #include <mach/hardware.h>; O# k7 L5 P- @! k
  38. #include <mach/irqs.h>3 g, X! q1 M+ z( X- x8 H
  39. #include <asm/hardware/edma.h>
    8 [8 \5 o) H& J) H. W/ n

  40. 8 H; B2 C7 B/ {: L/ g
  41. #undef EDMA3_DEBUG
    ' v3 W* v% X4 s, f5 C) m
  42. /*#define EDMA3_DEBUG*/
    5 ~+ |/ O5 S) _

  43. & p, Z. U' {( l  ~- Q1 u5 j' j- B0 }
  44. #ifdef EDMA3_DEBUG
    4 Y, f; G# J/ V. r$ _/ h* |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & C+ M! [8 [4 f) [( g9 D* w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      M$ ~& K% e- j1 T) }7 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' z: K' g' {# P+ M0 u
  48. #else: n4 ?! l6 f3 c  T) p
  49. #define DMA_PRINTK( x... )
    0 Q* C* j  [7 O, e
  50. #define DMA_FN_IN
    3 Z! }* j$ ~1 v" Y
  51. #define DMA_FN_OUT$ z7 ^3 V/ F3 F8 a& k1 B" `
  52. #endif
    ; c3 I, P& g$ ~& i) o: a5 ?/ X. B

  53. $ Z% D1 c4 Q! C# e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# I0 J. C/ r# G, B1 Y- g  d
  55. #define STATIC_SHIFT                3% g9 @+ m" [( z1 I- ^+ G( s
  56. #define TCINTEN_SHIFT               20
    - C! |" q/ K5 `! |' h# A8 |
  57. #define ITCINTEN_SHIFT              21, v+ `- K6 A) ?# H0 S( s- ^& R
  58. #define TCCHEN_SHIFT                22
    4 F: K( a# w. v; ^
  59. #define ITCCHEN_SHIFT               233 O( ]) P8 H; \  P
  60. 0 ?0 F: `) K" Z# _" {0 W
  61. static volatile int irqraised1 = 0;
    $ g7 G" _8 w; A# |3 [
  62. static volatile int irqraised2 = 0;
    3 |$ ^, z7 P. @1 T$ Q

  63. / B) G3 \( S; c; K0 J( w" T1 S' v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! W8 ?; R  t6 W/ m0 K4 i: T- d% a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: |8 i- M# l+ @1 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 v) P5 X$ k9 B/ l

  67. + q) G/ D, _- F$ _* f* B
  68. dma_addr_t dmaphyssrc1 = 0;. J. E' j5 p8 T1 O; d
  69. dma_addr_t dmaphyssrc2 = 0;
    9 }" c& i" h9 g7 m# ]4 W
  70. dma_addr_t dmaphysdest1 = 0;
    3 z$ k& F4 V' d! s" s
  71. dma_addr_t dmaphysdest2 = 0;. Q* l6 v3 d6 S/ n6 m6 G
  72. 6 C3 A# q3 b1 w, C' x. v! H
  73. char *dmabufsrc1 = NULL;# b5 k* h; U  \) k$ a
  74. char *dmabufsrc2 = NULL;7 d0 P( o+ G  G& O/ N/ v1 J
  75. char *dmabufdest1 = NULL;7 }( J) ?" N3 ]5 a) Z
  76. char *dmabufdest2 = NULL;) Z2 a3 E5 ~; }

  77. 1 a7 D0 H' \: I% d0 a
  78. static int acnt = 512;& G: x- T3 G- R/ m1 A. H  o
  79. static int bcnt = 8;: B# ?. H: T% G
  80. static int ccnt = 8;+ t- K1 F0 B! ^) T3 y
  81. # Z+ W3 `7 L+ P: X
  82. module_param(acnt, int, S_IRUGO);
    % T4 l  |( [& ^! m, L
  83. module_param(bcnt, int, S_IRUGO);- ]! n' z3 H) @1 ]% G) a0 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. Z7 @7 K  F" N1 ^7 s- {
. B4 l; m7 c" K/ q, c6 N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 g3 M: I6 H* C) d8 N0 I( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ?. K( r* A, C% G; g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: c' s- ?- g- ~9 X4 h% T
9 ]0 j+ }8 D) P, \/ x; m" b1 i

- }3 F* X- S0 W3 W' j0 H) W7 ]* l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 09:43 , Processed in 0.046584 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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