OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! J. s* R" l4 w5 R
  1. [code]EDMA sample test application
    # ~9 c' ~4 ]3 `( H, B" }# z% |; z
  2. /*% ^9 p# E7 d+ A- x' }& v( R
  3. * edma_test.c
    5 J0 U  l" i" W
  4. *
    ' N& y5 f' z+ C0 b" R* W/ s
  5. * brief  EDMA3 Test Application2 W4 i) H1 K7 N; R! R; D
  6. *
    ( z2 F1 I1 t* y4 i4 g# I! Z* V; |
  7. *   This file contains EDMA3 Test code.9 d9 `# R& g. g; G$ [9 x
  8. *
    $ u* [, t, X" ?# X) X# y# F" d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , D) ]  b3 C! p# W5 S- O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # b; |+ E5 x" M* p
  11. *         TO CHANGE.& D0 g' V# x, L' S
  12. *
      O1 R$ u/ r+ x& S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      H# r+ `" {7 Q' ]! d# Q( ^
  14. *$ ?. y! T% ?, b: N7 e( S: O8 H9 j
  15. * This program is free software; you can redistribute it and/or
    , f, w* G1 S& i1 `3 P# z0 o" d! `
  16. * modify it under the terms of the GNU General Public License as7 K/ v! ?( V/ M) ^5 c/ r' \
  17. * published by the Free Software Foundation version 2.
    + U, F9 R! x; s+ L7 P6 f5 r
  18. *
    7 p- v# g6 V. C( x# }8 O1 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & X% I" T% H+ i' d/ d/ V8 B, I
  20. * kind, whether express or implied; without even the implied warranty
    , p0 t+ p4 v& D4 A5 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 c* M" G* P; J6 U
  22. * GNU General Public License for more details.
    $ q/ a0 z: D1 B/ p8 p2 M( [' ~
  23. */
    * C: W2 q( O9 G( E4 g7 Y/ g  ~
  24. : n9 c% [% t2 p% h0 E' @5 |* G
  25. #include <linux/module.h>/ @6 g. F+ h3 n- Q4 t$ Y, O" u5 k
  26. #include <linux/init.h>
    ( S1 g* ]! d5 t8 A
  27. #include <linux/errno.h>
    * l5 U& n! W( ]4 J7 ]+ r) R0 y8 }+ j
  28. #include <linux/types.h>% m* F  R- C3 G+ {# s8 g
  29. #include <linux/interrupt.h>3 g  `0 h0 d; k) k
  30. #include <asm/io.h>
    9 l9 L( L& q/ k
  31. #include <linux/moduleparam.h>
    . _% g# }" Y1 m& n' y- T
  32. #include <linux/sysctl.h>6 d4 G, |* j8 x
  33. #include <linux/mm.h>
    , Q' w; s: Q- D9 c! W' [/ V8 C
  34. #include <linux/dma-mapping.h>
    0 m; t4 |3 k1 S8 ]& D
  35. $ [: f" H/ z" [
  36. #include <mach/memory.h>9 C5 o9 d3 D  t: R4 z, G
  37. #include <mach/hardware.h>
    + ^4 X# M1 S/ q. l
  38. #include <mach/irqs.h>
    # }* b3 D8 Y' _
  39. #include <asm/hardware/edma.h>& G& Y% q' ?* q( |

  40. 6 `' G/ ?) t) v2 l) N: J0 O
  41. #undef EDMA3_DEBUG
    : F3 T. k! h, H5 B, [
  42. /*#define EDMA3_DEBUG*/7 V3 {6 `7 ?1 B

  43. 8 @+ q3 A) j6 ~! _- x0 n: b; }
  44. #ifdef EDMA3_DEBUG/ ^% {. @, M' l. q" r2 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * v9 {5 K8 R, Y6 ?5 ~& i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) T1 Z7 P# ]3 k8 O8 ~" }7 b& u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . M- p0 w5 a; Y, j% s- F6 c
  48. #else: C; j0 w/ E' D" q" O' J# {
  49. #define DMA_PRINTK( x... )4 z3 K# x% d# }; f' b: M
  50. #define DMA_FN_IN
    ; G, u: F3 ?# a  U
  51. #define DMA_FN_OUT, P) l- z# z0 z( p- {. U
  52. #endif
    6 f8 [' n3 d6 M7 d1 r4 u

  53. - W, ~5 V8 V( u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 o- |- ?+ y1 Q7 e7 a
  55. #define STATIC_SHIFT                3
    ( I  H3 b* j1 A' ?
  56. #define TCINTEN_SHIFT               208 j! [3 d- q, e: S8 Z2 n& N4 M# D3 o8 ^
  57. #define ITCINTEN_SHIFT              21
    & d0 ~2 w: d( H5 p1 W
  58. #define TCCHEN_SHIFT                22& u- T9 A9 N7 ?# H+ T# B0 K
  59. #define ITCCHEN_SHIFT               23) b8 ?" ]9 T7 [+ w
  60. ' c2 K4 f% e; L) l4 N4 p$ `
  61. static volatile int irqraised1 = 0;3 j; {# g& N9 G7 ^- h& `7 e
  62. static volatile int irqraised2 = 0;
    1 f9 U4 g6 W9 H) o0 Z" D
  63. 7 a9 P0 J, N" n0 t9 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ]4 }* H- P% g$ y+ Y2 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 P' ?/ H8 K! O) G; r1 P4 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ E9 T- J' s8 S/ Q8 _* _
  67. ( r( S" Q2 R/ j* q3 t9 Q# l* t6 W
  68. dma_addr_t dmaphyssrc1 = 0;  F/ Q; P4 h6 t; G: I$ h% q4 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ( k. c! w3 f% U) B
  70. dma_addr_t dmaphysdest1 = 0;
    , I/ q) r2 A* Z. `: z+ f2 S
  71. dma_addr_t dmaphysdest2 = 0;4 o- }1 k: o7 f: M6 S
  72. ; a7 Z% Q4 ~% q! }2 o, f  i
  73. char *dmabufsrc1 = NULL;
    5 R% f/ @! d0 u& G1 ~
  74. char *dmabufsrc2 = NULL;
    7 P: v  R+ L# c8 \3 z: J( ^
  75. char *dmabufdest1 = NULL;+ L: A/ J7 y+ P8 ?( H- n
  76. char *dmabufdest2 = NULL;
    4 T: U' @8 ?: Q- J1 J8 ^

  77. % `" B# G0 S+ g! O& U
  78. static int acnt = 512;
    1 f5 g5 p( a( j$ {& f, j
  79. static int bcnt = 8;
    - Y% X, s3 k; [* J8 y  b
  80. static int ccnt = 8;$ n0 U: C! Z  ~( x
  81. / J8 v( n) _# [4 @! y0 L, L2 C- \# y
  82. module_param(acnt, int, S_IRUGO);
    2 }6 H; E" f3 u
  83. module_param(bcnt, int, S_IRUGO);
    . _5 f: G& `' Q% S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 q4 G1 K. f8 g" o  F2 y1 J
6 w& F9 t( i( T& X! N/ N5 N9 P5 Y: N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, E& j  g& }: V1 C* [, i0 e' V1 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Y) E3 h" u$ q& h. |, |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! v5 Q# l: b( b# H
+ D9 L. G+ T0 F, X# D
/ O2 }; i8 C6 j4 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 08:17 , Processed in 0.037280 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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