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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" D. H* S. ?$ w/ p; _
  1. [code]EDMA sample test application# f/ h7 e" a  \, e2 T( y! [
  2. /*
    * n2 B1 E4 ]  @( @+ `+ \0 \
  3. * edma_test.c
    % U) w5 h# H* u  w! _
  4. *3 F& T+ O+ Z6 B* `
  5. * brief  EDMA3 Test Application) Q- k$ B5 D, c* z
  6. *) S& ]  ?4 w/ ?3 C" E
  7. *   This file contains EDMA3 Test code.
    5 D; ]' k# R4 t
  8. *
    " D' X1 l) j: w6 C/ ^3 g5 G3 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ ?/ e+ Y1 l( x, X5 e9 q+ W* Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / g$ w& M* M4 S9 G
  11. *         TO CHANGE.8 M1 t+ }1 Y: c: G1 b* V
  12. *
    * ?6 ^# B; b4 z$ I7 q8 y3 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! O( ~& V5 Y! }2 l) L& ^  X" o% Q0 j
  14. ** `0 h- }/ c6 D! R: {
  15. * This program is free software; you can redistribute it and/or) p- {6 z* |" M5 \' s0 l
  16. * modify it under the terms of the GNU General Public License as- ?- X2 b7 D2 _3 D2 m
  17. * published by the Free Software Foundation version 2.4 ~; u8 V" \: X5 [* h
  18. */ q, b* _$ D% Y; I6 e& j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 E! F# V$ X. w- T
  20. * kind, whether express or implied; without even the implied warranty
    7 X! l+ \4 m8 u6 @7 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; w: f& f( ~7 e
  22. * GNU General Public License for more details.( H; W5 h& F! J& W4 r
  23. */% r+ e# ?9 ~, i/ X( s% L

  24. + s! C5 F% h8 D( C
  25. #include <linux/module.h>4 L  u: F( U9 a8 q: O' }$ V7 c
  26. #include <linux/init.h>' o8 v) N0 ~9 w' V& _6 P0 x! v! T
  27. #include <linux/errno.h>
    * q  r; h& ~* Q1 D! [' q  q1 N( o0 h
  28. #include <linux/types.h>
    $ i5 j: w: V1 |) E9 {
  29. #include <linux/interrupt.h>
    9 f9 z& }* }- L9 P% Q/ ]
  30. #include <asm/io.h>
    - a2 e6 N  z/ x" |; x2 j
  31. #include <linux/moduleparam.h>
      t& |" E# ?* @& Y7 f
  32. #include <linux/sysctl.h>
    ( _7 W( C3 k, N8 j' g$ J% H
  33. #include <linux/mm.h>& g& W* o( X. Q
  34. #include <linux/dma-mapping.h>
    / g* |% y/ }7 K2 N3 P: d# v1 b+ E" j
  35. ! _/ ]) m4 J' M$ J8 U, V" u
  36. #include <mach/memory.h>% B) T; j) P0 T: O( h6 `! S/ ~
  37. #include <mach/hardware.h>
    5 m$ q6 n& G. b: I7 V
  38. #include <mach/irqs.h>7 C( g* K  L' O7 M" X& B% c
  39. #include <asm/hardware/edma.h>
    . T  a# g! p$ j7 t+ Y! j$ ?1 p) o( c
  40. , N1 O) {" z- }! K/ K
  41. #undef EDMA3_DEBUG0 v- A* M$ z- ^* }) i/ o
  42. /*#define EDMA3_DEBUG*/4 R7 x" X) B- i' Z5 E

  43. 7 W! j# R4 k# K& A: U8 q8 T+ q
  44. #ifdef EDMA3_DEBUG
    ' R. t: s, S! V; [/ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). F4 z' k7 d. Q) g7 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& g- ]: t& z; U$ h% Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 P5 @, G8 l7 R/ T' i
  48. #else6 {3 V6 I4 D0 W  l
  49. #define DMA_PRINTK( x... )) v4 x% E0 f2 E1 {" _2 n$ Y" U
  50. #define DMA_FN_IN
    7 ]+ z1 }+ @$ U% `
  51. #define DMA_FN_OUT
    3 I/ ~7 Z" @; ^( B$ p0 {
  52. #endif
    0 @7 `0 R1 D  \; A& [

  53. . U& A1 F4 l# D. A/ J9 P# u) k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      _) @) G/ m$ J- M6 t7 ^. g
  55. #define STATIC_SHIFT                39 @4 c- d/ u# c
  56. #define TCINTEN_SHIFT               20
    . h$ \+ W! V  b' @# i
  57. #define ITCINTEN_SHIFT              21  W  p8 d' N: @/ `
  58. #define TCCHEN_SHIFT                22+ }2 g2 p; i+ e' H
  59. #define ITCCHEN_SHIFT               23* c5 X2 C! Z- h5 m- f, L

  60. 4 P9 j( {2 t: K# r
  61. static volatile int irqraised1 = 0;
    6 @3 H; H3 w; w! X; z. X
  62. static volatile int irqraised2 = 0;
    , G; e# Q) k7 ~# o* ?8 ]# T5 m1 E

  63. " }( G0 {7 k2 m: q5 v8 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( s+ Z8 }# |+ Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 X' C3 y' C9 L$ O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 g4 M+ u% J0 _+ F5 O0 x

  67. ( A* g3 t( d; c
  68. dma_addr_t dmaphyssrc1 = 0;
    : A% }& U4 c( f- v. @3 k5 r
  69. dma_addr_t dmaphyssrc2 = 0;
    . x6 m1 L0 Z3 h
  70. dma_addr_t dmaphysdest1 = 0;* [! C  `" a. T( d8 r5 N
  71. dma_addr_t dmaphysdest2 = 0;
    ; @1 U( ]2 U7 J9 [/ L0 T

  72. $ T* K" ?& {5 }
  73. char *dmabufsrc1 = NULL;  E2 ~8 ~' v7 B) t
  74. char *dmabufsrc2 = NULL;$ G- t( {) P$ @5 p, X
  75. char *dmabufdest1 = NULL;+ N" j/ c9 h' i3 A3 Z# E' @: W
  76. char *dmabufdest2 = NULL;
    # X# v) e% ^! \

  77. % E/ O8 P8 |/ E/ b
  78. static int acnt = 512;
    - g# R3 D3 x1 i( u6 g  b
  79. static int bcnt = 8;- E7 O# r& K" ]. i, {; v4 \% H: z
  80. static int ccnt = 8;' g8 w9 i! B5 Y' j" J+ g% K3 u

  81. 8 L. x: G3 R+ ^* G% n# B
  82. module_param(acnt, int, S_IRUGO);3 _6 K4 R' x- {2 r& F( `! n! z6 H
  83. module_param(bcnt, int, S_IRUGO);
    ' D& R9 |0 M+ M2 S5 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, W# {6 T' J  Z2 j( ^4 e) s+ _) S" D" m! ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. C/ _0 M$ E& U, T6 s" r9 i& Z; Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 G  q$ `; c; V+ \. G% V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 o9 p- d4 F( c) K& Q2 g' V! N5 [7 D" D" R* {8 L- [5 E
8 c7 x# Z' ]/ S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 22:54 , Processed in 0.057311 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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