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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 l" `+ H% F9 K
  1. [code]EDMA sample test application
    7 ?: G+ i5 a4 n; g
  2. /*
    ; z% r! H3 P# X& u( e  [
  3. * edma_test.c
    % E7 H' l& k  {: K2 }+ p. [& S
  4. *
    . [' n3 Y  ~+ Z
  5. * brief  EDMA3 Test Application
    9 B" _) ^4 f; V- l% \! v. z  ~
  6. *
    % x( v# ]4 p4 L/ R9 r3 j
  7. *   This file contains EDMA3 Test code.
      ~3 u: a6 _; N1 g
  8. *! [, e7 D$ P$ b/ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& V* J: Q5 t$ r& Z8 i% z) Z  j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % m  I$ R( b# L  V
  11. *         TO CHANGE.4 d% p! }, i8 E/ k1 C8 C6 P% _6 W
  12. *. b. y/ \* s: j8 c6 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- W! m; h5 N$ g) d8 D- e
  14. *& L/ S6 v0 I6 K8 ^3 v; Z& H2 }
  15. * This program is free software; you can redistribute it and/or! Q! d- m+ d, B4 u0 [; O
  16. * modify it under the terms of the GNU General Public License as% d" K! |) u  I9 Q% P& _
  17. * published by the Free Software Foundation version 2.
    2 i9 Z2 L, {1 Z- ~
  18. */ G; o' c* ^2 r: g! X. M/ ~$ d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 Z1 Z  s! i. m3 p9 `  o
  20. * kind, whether express or implied; without even the implied warranty
    # ^- D  K% \) K; [0 O( {8 a1 m: A# p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 X0 N) Y: _, s; e/ {, J6 X
  22. * GNU General Public License for more details.( M. w/ ^8 d, b. y
  23. */, X( m0 U- f4 P4 o
  24. 0 ^. d6 N: v: Z& z
  25. #include <linux/module.h>  H& J5 u! E* ~
  26. #include <linux/init.h>
    5 n& Y5 ]0 u3 P5 _* y
  27. #include <linux/errno.h>
    ! P3 u& d+ k; M  N
  28. #include <linux/types.h>, S' y/ u7 |  |1 c; O
  29. #include <linux/interrupt.h>
    / h% Z5 k8 k: R, W3 x# m
  30. #include <asm/io.h>( V; r# ?" R) U) `
  31. #include <linux/moduleparam.h>
    ; @' W3 u4 E/ ^" Y7 r
  32. #include <linux/sysctl.h>2 }# I) Q% |7 h
  33. #include <linux/mm.h>
    6 s6 o2 J! W( g
  34. #include <linux/dma-mapping.h>9 N) g% s! C* z
  35. 3 {; ?/ @* s0 H8 h0 E5 q
  36. #include <mach/memory.h>& C# B3 L0 g, N
  37. #include <mach/hardware.h>- L4 ~. J  Q* |; a
  38. #include <mach/irqs.h>1 B6 r; x- l0 Z! M* x
  39. #include <asm/hardware/edma.h>
    , Q. p& O- a5 t, m

  40. & V! K) m& x2 S( r2 w: @' |+ K* [2 C7 f
  41. #undef EDMA3_DEBUG5 {. x9 B' T/ ~: V  S+ k5 X2 @
  42. /*#define EDMA3_DEBUG*/" e- _' X1 p1 g4 I3 |1 S/ c

  43. 7 J" {- r+ V5 w7 R! u0 o
  44. #ifdef EDMA3_DEBUG; z4 B7 y. i+ F& ~) P2 P( J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 `" L) \$ Z. y* M0 @: w* S3 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 B% ~% z" V! l% O' w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * p! v! W2 E3 O" \& p3 {# P
  48. #else
    . b8 Q8 F) p$ }9 R0 m
  49. #define DMA_PRINTK( x... ), g$ ~3 ~) S8 ]5 f$ C- j
  50. #define DMA_FN_IN
    7 y+ r6 `" |/ v- j7 P: Q
  51. #define DMA_FN_OUT
    / @9 z8 k0 K2 Z% }. k; F3 D
  52. #endif( v1 d$ K1 C5 a  G9 v

  53. 7 a/ V0 e1 H0 h& `7 {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 N* c' B+ U* E+ s7 `& R8 |
  55. #define STATIC_SHIFT                3; M& m7 g- e1 l& `) B( r2 `
  56. #define TCINTEN_SHIFT               20
    ; K2 G' s/ G$ J0 K
  57. #define ITCINTEN_SHIFT              215 b4 F, W" X# L- B) k/ i
  58. #define TCCHEN_SHIFT                22+ p3 f+ ]. T* L  A9 Q
  59. #define ITCCHEN_SHIFT               23
    2 ~( ]7 |6 z* Z' ^

  60. ' X, n: Y* B% h4 U
  61. static volatile int irqraised1 = 0;
    . S9 v2 x. ^. s+ F( z  \( e' s
  62. static volatile int irqraised2 = 0;/ _2 t+ c' P, ~' d/ @1 n1 C

  63. . K4 N* ^7 S+ H" {6 O( F( z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) m9 |7 t, h  w. {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 t% I2 ^/ @2 p' f" p4 i- m" W. E+ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 g" V% B7 m; T, J' B
  67. 8 H' o7 f7 A: K% q* b
  68. dma_addr_t dmaphyssrc1 = 0;
    3 L$ ]7 q: l# K6 A
  69. dma_addr_t dmaphyssrc2 = 0;
    0 s0 U5 H0 P8 M* ]- o/ k
  70. dma_addr_t dmaphysdest1 = 0;0 w% t2 U8 D" T4 ?  K6 S
  71. dma_addr_t dmaphysdest2 = 0;
    9 m: a3 I7 f' a" l) [9 a

  72. ) e3 r4 f$ _7 t4 h8 f- l. \' p" K4 C
  73. char *dmabufsrc1 = NULL;! h+ X! h6 m1 `
  74. char *dmabufsrc2 = NULL;3 ~* s! B$ N( I$ |' W
  75. char *dmabufdest1 = NULL;
    % T( R0 E+ w* v/ \7 y9 i
  76. char *dmabufdest2 = NULL;: p! z& c. K9 b0 A4 T* B
  77. ; B: t8 z+ ~! E) x" n3 ~
  78. static int acnt = 512;
    7 O* I' [, O! ]
  79. static int bcnt = 8;
    2 n/ }- A3 N0 _+ j$ Y. N% p5 e
  80. static int ccnt = 8;
    0 a, a8 {# U1 o3 X$ r1 M5 w
  81. 6 W$ g6 k2 Y* Y- I8 O9 N
  82. module_param(acnt, int, S_IRUGO);4 G- j" }$ H. Y5 |. }; }7 _
  83. module_param(bcnt, int, S_IRUGO);) S. O7 k' C7 D$ G6 f; f9 F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 b3 ]; Z; q5 i5 t& s

# b: z* X# B, T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 P, M7 Z0 _$ B2 f5 s9 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. w9 }4 A  r, H, t! f9 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ O5 H' j0 r# ^
6 K( }! S. a( c
' Q# }& F0 @* o8 Y( a7 I$ _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 13:07 , Processed in 0.039093 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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