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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" Y9 b# G* i( M
  1. [code]EDMA sample test application
    * |6 @& x7 ^: y) n$ y8 S3 j
  2. /*
    $ N0 w- s) o5 B1 s# s0 l
  3. * edma_test.c1 v$ V+ \$ m( X* K  s0 z& g4 C  b
  4. *
    % _  X2 ?8 m( l, k# a& Z, c& \( e: T
  5. * brief  EDMA3 Test Application
    * W) [! C5 B9 X4 Q. R, S( j8 z
  6. *
    3 F6 q! R  R) l8 \, B2 ^2 A$ K
  7. *   This file contains EDMA3 Test code.
    ) T+ S( C2 W6 i, _# U
  8. *
    / l! m" l2 w& p; B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 W8 ~" u" m: L, v/ n9 A0 w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ?4 ^  x: o/ t) O
  11. *         TO CHANGE.
    : K# f7 U2 i8 r3 p5 @! u) Z$ n
  12. *
    ) i4 P3 p/ v0 `* ^4 f! r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + @5 |8 `- x# E5 A3 U, ~5 j9 [5 L
  14. *
    - M% N& v& J  T+ w$ q- K
  15. * This program is free software; you can redistribute it and/or% m3 O" H/ T+ C$ I4 m
  16. * modify it under the terms of the GNU General Public License as* n; b' A4 _+ a3 O
  17. * published by the Free Software Foundation version 2.
    ' c6 d! Y7 m- D" ~7 M' n2 l) t0 ^# g
  18. *
    & @& @7 N$ {0 q- f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 g6 |; \; b' |7 H
  20. * kind, whether express or implied; without even the implied warranty
    : \! U! r0 N% |$ T. U7 d3 C  [, x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + _) x+ t( g# F. `9 M$ _
  22. * GNU General Public License for more details./ _4 E" a7 s, v$ I8 k+ b: R
  23. */
    ) r# c# D" r4 ^, A' |7 p
  24. 5 P! y. l- N. k' ?3 C) s2 l( Z
  25. #include <linux/module.h>4 y- A9 |" R! V9 x6 K
  26. #include <linux/init.h>
    % J7 K+ U) U7 J
  27. #include <linux/errno.h>6 {$ ~& {) \! Y- A0 a' N
  28. #include <linux/types.h>! d4 m' H6 z. s4 L6 z
  29. #include <linux/interrupt.h>
    / n3 K9 `- Y, V& @: x" s
  30. #include <asm/io.h>
    9 U  t4 r% W  C5 q& Y
  31. #include <linux/moduleparam.h>7 `* \: L2 R1 R9 U1 x& O
  32. #include <linux/sysctl.h>& n6 r+ z4 v& f3 c/ I
  33. #include <linux/mm.h>. s* {$ m. b: y1 }0 _8 F8 S
  34. #include <linux/dma-mapping.h>
    - P. X! V! D1 y# o# f1 z, i6 r
  35. 3 f- F1 O( ]& r
  36. #include <mach/memory.h># b% D+ o; L# ?: l' @5 d7 f
  37. #include <mach/hardware.h>
    0 q. U2 R) g/ ^- A& x6 m
  38. #include <mach/irqs.h>/ p1 n) {4 B% w/ Q) V& |+ Q) l' o
  39. #include <asm/hardware/edma.h>
    ) v9 x9 ?* C& T' p. q( K

  40. 0 R8 N- Y5 I# d+ b$ r4 K% b
  41. #undef EDMA3_DEBUG4 r; k0 I) \) j: R! S; {
  42. /*#define EDMA3_DEBUG*/, j+ V/ B( v+ p8 A# t
  43. 7 w' L4 X; L# Y% T  o. }
  44. #ifdef EDMA3_DEBUG$ p; D7 S. K) g/ @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) s! a. u8 l# @5 j5 M% ]% z0 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 ~3 U) {4 A" R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- D6 M# [, H3 U8 c8 e% j3 B1 w
  48. #else$ X! J6 _3 e# A# g1 a; x' g6 G
  49. #define DMA_PRINTK( x... )
    " L: `. D; F5 d  [
  50. #define DMA_FN_IN
    * |  l0 e9 Q3 M6 f* D& k; W
  51. #define DMA_FN_OUT
    7 O8 A; q. z7 N2 u; [; J4 y
  52. #endif( V6 `8 H) U5 U* @

  53. - G3 E/ ^3 \5 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' d: X! g9 i" r
  55. #define STATIC_SHIFT                3
    & F  R7 A: ]9 O5 F3 H
  56. #define TCINTEN_SHIFT               20
    0 M, F: s& M& \. e' V
  57. #define ITCINTEN_SHIFT              21
    + v5 z# j1 M5 f: e8 T$ ^
  58. #define TCCHEN_SHIFT                221 \$ F: j3 i, |
  59. #define ITCCHEN_SHIFT               23! ?& d2 Z1 E, X5 w& V

  60. 9 G, r# z+ `7 k- I' v2 n) O# Y: M' E; o$ U
  61. static volatile int irqraised1 = 0;% `% g3 a5 q9 b5 C# }. [
  62. static volatile int irqraised2 = 0;$ \: c4 i9 X+ I* H" `1 x

  63. ) v7 n$ d3 y1 y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Q; ?3 z* j  s1 f# y2 m5 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t7 P5 R% |2 p( F) i0 e' W! r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 D8 _* N$ X3 U; P
  67. / N- o3 J2 F. r0 R: P
  68. dma_addr_t dmaphyssrc1 = 0;/ E7 a/ r2 C/ Z5 d
  69. dma_addr_t dmaphyssrc2 = 0;
    ( i9 S1 |, r4 f# Z8 e
  70. dma_addr_t dmaphysdest1 = 0;
    + @1 a- V1 d# Q$ A$ ~. C2 y
  71. dma_addr_t dmaphysdest2 = 0;
    + [1 N0 M  w) @/ V! t! w* U
  72. 9 ~" T2 w' {% v$ {
  73. char *dmabufsrc1 = NULL;) Q8 Q6 s4 D  g/ c3 O7 v' S0 T% U- @4 ]
  74. char *dmabufsrc2 = NULL;
    ( g+ ^, S- }/ U! f3 B3 a
  75. char *dmabufdest1 = NULL;
    2 f" ]) E3 E# H  w1 l# U
  76. char *dmabufdest2 = NULL;; u& R. j/ a/ }
  77. + C4 E1 M7 B' ?
  78. static int acnt = 512;
    " i, s$ }- n3 X. x: f. ^- L
  79. static int bcnt = 8;
    $ ^' u3 l- x& \$ ~- m
  80. static int ccnt = 8;
    ) w( T" R0 |8 z, D. y( |
  81. / \6 B! f2 B- Z4 E2 s# i+ |1 H
  82. module_param(acnt, int, S_IRUGO);5 T& o; U' I6 H7 u
  83. module_param(bcnt, int, S_IRUGO);
      G, B" U9 {6 W/ n  N  B- d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ~6 y6 O0 U/ A* \; j) |! q  a, I$ t- ^1 B3 a
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* v4 ]3 _- j4 e& Z6 `9 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 i/ Y( {- P+ Y: e3 \1 ^- Q3 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# j4 k% Q3 u6 |! M, l

, u& R. t. N1 N# C
+ V1 A$ T# G0 n3 k$ x  q+ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 06:54 , Processed in 0.039570 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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