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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& W/ t4 j) y5 i1 V+ I: r
  1. [code]EDMA sample test application
    , K/ s! u" k% h; P
  2. /*
    & t& R! D+ j9 J  @+ r
  3. * edma_test.c
    * m1 k6 E$ X& V& s, p" W6 Z+ i
  4. *; z0 W$ z" j  N7 O
  5. * brief  EDMA3 Test Application
    2 |6 |4 o6 ^8 F5 p* J
  6. *, f, ?  k6 J  i& p6 M2 H
  7. *   This file contains EDMA3 Test code.5 `- `$ L# ^& t2 @& ?
  8. *+ x$ u9 Q1 D. y6 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 Y" B, l- W1 H! }7 R( g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 S" Z/ ?$ D3 X% s: o
  11. *         TO CHANGE.
    0 H. E+ ]1 D7 A' T; Q
  12. *2 M1 }$ P# y# e, Z0 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 M7 }2 _% S% V4 R9 k
  14. *5 m1 H, j! y# v3 u& H$ [8 S
  15. * This program is free software; you can redistribute it and/or
    ; Y5 n  M- o0 C
  16. * modify it under the terms of the GNU General Public License as
      t+ |: g% }8 M6 O' x0 V1 j! F
  17. * published by the Free Software Foundation version 2.
    3 k5 O/ f1 V6 {' V8 z# O
  18. *
    # d- t; s$ v' \$ }2 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 v7 c6 [! H7 G: g' @
  20. * kind, whether express or implied; without even the implied warranty0 [; [/ u( M9 ^2 I+ w6 i! \/ o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 s6 [) S" ?% {, i& ^
  22. * GNU General Public License for more details." N$ l- i. C- l" k* x3 _
  23. */
    $ I. ]  m! j( Z1 Z
  24. ' U* {, V2 g5 M, K" Q. V  U1 }
  25. #include <linux/module.h>
    ' i* f! F, q9 c5 l4 @
  26. #include <linux/init.h># X! K$ R- b% [6 x5 }
  27. #include <linux/errno.h>* h3 d0 E- m. _8 M3 z$ w" A
  28. #include <linux/types.h>
    . c, C0 z$ i+ U6 w/ j) F
  29. #include <linux/interrupt.h>4 w5 \, d1 V( W( G9 J
  30. #include <asm/io.h>
    ' }  K/ _7 ?  G
  31. #include <linux/moduleparam.h>
    $ t. j* L. w7 {
  32. #include <linux/sysctl.h>
    2 e6 j% _$ o7 N# I5 ?
  33. #include <linux/mm.h>
    + p! A$ _2 Y3 M% |; a1 M. C" E  M
  34. #include <linux/dma-mapping.h>" n9 h1 r2 A& D! r# v0 \( {$ M
  35. 6 Z8 q: E3 i1 j5 o, l4 ?
  36. #include <mach/memory.h>
    & H. C5 f- l# r5 T9 G! x
  37. #include <mach/hardware.h>' g8 U6 h. t$ r5 Q. s" y, F
  38. #include <mach/irqs.h>3 a- T0 y2 {/ \. g5 Y
  39. #include <asm/hardware/edma.h>
    5 ^1 F$ w9 O7 i) X9 ]. v8 F. B
  40. 1 a# |2 ]0 r5 U! X0 Q
  41. #undef EDMA3_DEBUG. x1 N) l6 i. O' q, g! y5 X% A7 I  ?
  42. /*#define EDMA3_DEBUG*/
    ) z! u# R; w" I1 Y, n1 W

  43. 8 [% z/ b1 b1 B, T
  44. #ifdef EDMA3_DEBUG9 ]% g2 m9 O6 a+ g8 j7 h8 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * ]) s! h) R6 W0 g5 _/ j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K. E3 R  z) b) r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 R/ `2 Q0 T! H3 w
  48. #else# b, z2 A: y' q# z" Z5 O
  49. #define DMA_PRINTK( x... )) `% u2 ?+ }2 e: F
  50. #define DMA_FN_IN
    2 Z" K. ^! f$ t1 e7 o6 [' d5 }
  51. #define DMA_FN_OUT( t# ?7 V$ E: F/ E
  52. #endif) A6 o/ u* q9 K9 a

  53. 7 l+ J0 x3 S/ e7 x  ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( o2 O# D1 L9 Z+ J/ H
  55. #define STATIC_SHIFT                3
    0 S, N# S% x- S3 G, }# ?
  56. #define TCINTEN_SHIFT               20
    # l  N0 W+ V* y8 ]8 j- l
  57. #define ITCINTEN_SHIFT              210 S- b2 t# v1 ^" \7 e; N
  58. #define TCCHEN_SHIFT                22
    9 V1 ?' P1 A, B' j- P
  59. #define ITCCHEN_SHIFT               23/ g* A, t  L; g5 J+ f9 s5 ?

  60. 4 Y" D2 j" E- V+ A0 j
  61. static volatile int irqraised1 = 0;
    8 a* H+ [; b: `9 x6 m1 M4 l
  62. static volatile int irqraised2 = 0;  b  y) K* y+ Q* [. W

  63. ( L+ D2 m, [' C1 H- Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ k9 f$ u+ q+ m- t+ T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / }0 d$ F* S& I# E* @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 z" P, {" U% C9 y5 E- N, s, `

  67. 2 H  S% a" ~/ b/ E, A" T$ d
  68. dma_addr_t dmaphyssrc1 = 0;# }1 N2 v) g3 F9 i- e$ c. O
  69. dma_addr_t dmaphyssrc2 = 0;' V5 Y- r3 k/ O, R# a) X0 y6 |  x
  70. dma_addr_t dmaphysdest1 = 0;( T- A* @  t# g& `- Q& s% z
  71. dma_addr_t dmaphysdest2 = 0;
    , c  u9 i, u. o4 z2 o) \# Z" t6 P% h% [

  72. ' g: i( E; z2 e9 C" F/ B. o
  73. char *dmabufsrc1 = NULL;5 J7 j7 ?- v7 j! k
  74. char *dmabufsrc2 = NULL;
    / W. K  u( [  h, W0 X  P
  75. char *dmabufdest1 = NULL;
    2 i1 I& a, j& n4 E
  76. char *dmabufdest2 = NULL;6 ^9 @' e& ]6 d. w" u" m

  77. 6 r" k1 z9 n+ ?  G) X
  78. static int acnt = 512;6 L. }5 S: y. X9 l' f
  79. static int bcnt = 8;
    ( h8 ^  G8 m6 l$ C2 z. o
  80. static int ccnt = 8;- o+ o) c# t. p$ _, e
  81. 6 Y+ i& E" z- ~5 e0 |* P# K
  82. module_param(acnt, int, S_IRUGO);
    ( R. s  Y* B, v. x5 p0 U, B
  83. module_param(bcnt, int, S_IRUGO);
    % P1 i! j: R; o! n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 D! _& f8 z. A7 V
/ {# U# F) j# A) l- T6 s" j9 U  ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& R5 D6 e. s( U) H" {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ~. ^! U! H6 k% O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ w( q& W" q- Y, a: I4 @$ r, X8 o' {& X) {& V

/ D4 M% s  N- ^$ o# u9 I4 K* _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-28 19:06 , Processed in 0.038464 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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