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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! r& d4 ~, Y% K- `$ y* L0 n
  1. [code]EDMA sample test application
    4 q' d' _( F2 w0 A% ~( `
  2. /*
    # b& c& d2 _. O
  3. * edma_test.c
    4 t  c& h9 T9 ]7 W6 z
  4. *, Y) P& O" g8 L/ j, x' l/ S
  5. * brief  EDMA3 Test Application( {, J0 \+ }" Q* H7 W) f+ \1 `" G
  6. *
    4 l/ n) \) o3 T. Z0 O0 }3 Y
  7. *   This file contains EDMA3 Test code." y, r/ ^* [- i# p5 t. N" I, M) B
  8. *
    % u/ z( U; v$ K6 l. Z9 U% o4 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 R' w( R5 G3 ?' f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 P# _2 W/ p' h. c/ z7 b
  11. *         TO CHANGE.
    " d( |) I3 D0 P( f0 Q4 k2 }
  12. *2 w4 \7 w. i9 S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % R& _8 y5 P+ I$ M& B+ v
  14. *7 w" T1 \" Q. [% F" _. g
  15. * This program is free software; you can redistribute it and/or
    5 e% w) V# }7 {" d% W
  16. * modify it under the terms of the GNU General Public License as4 P) x1 s; W4 V. C
  17. * published by the Free Software Foundation version 2.
    4 u3 k: U. b9 y! t: e
  18. *4 v2 S" g' E# g2 ^* J# L) r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- `1 `& }  j4 K( b
  20. * kind, whether express or implied; without even the implied warranty1 o/ o% E3 c$ N+ ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - H/ f1 H. C# r3 C: u+ g
  22. * GNU General Public License for more details.
    & t  X/ t- s- q
  23. */
    8 }2 w7 T, @+ e, N
  24. ; H2 }7 I4 q8 z) ?; J
  25. #include <linux/module.h>7 T& k2 x' o! A- a5 w/ e% g1 O- ]
  26. #include <linux/init.h>
    3 o( a% a/ `; W* N5 A
  27. #include <linux/errno.h>
    4 {9 l9 h9 c1 A3 K! e
  28. #include <linux/types.h>
    $ k' c# U8 o" A7 e
  29. #include <linux/interrupt.h>
    : Z9 g9 z  f& F; x
  30. #include <asm/io.h>/ o, W- N8 @" K+ l/ T- {
  31. #include <linux/moduleparam.h>
    + o4 |8 \. s$ t. ?6 I5 _
  32. #include <linux/sysctl.h>1 i  {' m, w: I3 O' w
  33. #include <linux/mm.h>5 c5 c, r- N* V( x+ n2 u8 b
  34. #include <linux/dma-mapping.h>+ V* e) x/ D" y% _
  35. 2 `+ F7 ]. \- g+ V  u4 \
  36. #include <mach/memory.h>
    3 o8 T2 W2 C$ n+ u6 u
  37. #include <mach/hardware.h>
    3 w$ v: V, G) }
  38. #include <mach/irqs.h>2 z! y' D% w! c1 y: K- M' L+ L
  39. #include <asm/hardware/edma.h>
    + c" [+ v$ n, z; |* a( e* Z" Y* T
  40. $ Y) w: a$ {/ r* \+ n. r( r
  41. #undef EDMA3_DEBUG3 E: i5 r8 M" D7 [8 \
  42. /*#define EDMA3_DEBUG*/0 u. r8 F. b% m1 Y& `3 J1 i
  43. 7 E: i4 j# l9 z' V" v2 W
  44. #ifdef EDMA3_DEBUG1 A, D( z: D0 N2 C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g7 ]- _* R! v3 J: T6 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 p, E- @2 Q" R  e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 t8 k  x( A. P/ m, c
  48. #else, e0 ?/ E8 r! R# s+ U: J
  49. #define DMA_PRINTK( x... )
    7 {4 v  i3 Y- l9 ]
  50. #define DMA_FN_IN
    / t2 [8 d! ?# @5 B0 b5 p
  51. #define DMA_FN_OUT
    7 K; p# G* t% @2 l
  52. #endif
    : d0 z. a; ~5 O+ U2 r4 s
  53. $ }- G3 R* |3 t- ?1 G0 H4 h) a2 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 Z6 v/ w: U8 y
  55. #define STATIC_SHIFT                39 L3 L* J: Y% v
  56. #define TCINTEN_SHIFT               202 t4 Y) n" g) o1 d6 U% F
  57. #define ITCINTEN_SHIFT              21' [1 y: j. Q2 H4 w
  58. #define TCCHEN_SHIFT                22
    % N  }: ~: u  W6 O
  59. #define ITCCHEN_SHIFT               235 A' q5 a. W6 O2 d0 y  V5 C
  60. " b. j- R) d% j3 N* m! D6 B- t
  61. static volatile int irqraised1 = 0;% B. d7 i. A0 l4 E( Z" u
  62. static volatile int irqraised2 = 0;, O7 _9 k4 P! k4 j2 J

  63. + L( }4 X( y2 g3 h% Q* N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! \' B. L8 K, u2 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 Y5 K+ ]4 _+ T! d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s9 `3 O5 h- Q( [+ x. @. }( K
  67. 4 ~3 F2 D% Q: w2 D# O# D# ]
  68. dma_addr_t dmaphyssrc1 = 0;
    , ~2 n+ N- l: {* f
  69. dma_addr_t dmaphyssrc2 = 0;  R$ R" X# S5 u
  70. dma_addr_t dmaphysdest1 = 0;* i3 \1 u- h  l, l. s" T
  71. dma_addr_t dmaphysdest2 = 0;. W$ g/ ~, X- l% y2 |

  72. % @& l8 b) G& F# O5 z
  73. char *dmabufsrc1 = NULL;
    2 r$ A; H" _  h2 M2 \
  74. char *dmabufsrc2 = NULL;8 I5 `2 v9 h3 v
  75. char *dmabufdest1 = NULL;
    ; }# D' s& T9 c) H' D* z9 \2 V
  76. char *dmabufdest2 = NULL;
    7 q! P: g  G. J$ O$ p2 @$ T! v
  77. : D5 `* n( O' c$ r2 E! n
  78. static int acnt = 512;
    * c8 k" ?. a- |1 \$ q( R
  79. static int bcnt = 8;
    ' F$ T$ e% N4 t" Q' K0 u8 F
  80. static int ccnt = 8;  D- r+ Z  l: o
  81. # o  ^, z) O$ V6 c2 A
  82. module_param(acnt, int, S_IRUGO);9 d) d6 G7 n0 X7 A' r- O
  83. module_param(bcnt, int, S_IRUGO);8 }- G6 H. n  C2 S& ?5 ], }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  h8 y. J$ D' f% W* ?  N# W! `+ V. M6 \% `4 \6 g) n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ X, b4 X$ a8 J, |' H- m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( D6 E  \% `8 j. H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! M6 R* {6 ]& z

8 d# i5 @' m  `4 ]1 Q# [
' S2 I, q0 ^7 V) I$ R0 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 23:12 , Processed in 0.041413 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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