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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 `! W3 ~6 k0 l1 Q! r# v
  1. [code]EDMA sample test application
    8 d  j  ^, w+ K# `5 M$ O
  2. /*; L$ Z" x7 X7 o+ I! ^
  3. * edma_test.c/ {$ X" n* S6 K0 O1 @$ g# W9 Q1 f& B
  4. *  R# ?4 h* H) w% w# d- A6 }+ x
  5. * brief  EDMA3 Test Application% m: {" _9 Q. E; r) }
  6. *
    ( u- \+ a: J% q
  7. *   This file contains EDMA3 Test code.( {" l" t. B7 {: z% [* V5 n
  8. *8 [# J7 m. ~4 }: U3 j3 |" Z4 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 G" T; i3 Y( Q' p- a' N5 }6 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 L0 S/ q( F0 O7 U5 ^* L
  11. *         TO CHANGE.. M5 I) |# ]( `' [9 Z
  12. *2 |% g6 W; j0 \: G, K, T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 U& f# u& W' E7 ~2 T7 q
  14. *
    6 x6 E$ a# n0 @. ]1 w" q+ z
  15. * This program is free software; you can redistribute it and/or
    ) P) Y% I7 l& ?2 ]$ I; p
  16. * modify it under the terms of the GNU General Public License as
    1 M5 L! L1 q+ C' |
  17. * published by the Free Software Foundation version 2.
    % _$ z) V" ]! e5 w5 o5 W2 h
  18. *. p. }4 ~2 C; L- Z: s* w3 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' w+ X6 w$ L0 s" `2 I8 S  \
  20. * kind, whether express or implied; without even the implied warranty/ B, p% s; I  g/ H! m# N( A: ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* Z- P! j0 {6 Q7 R/ `6 J0 x
  22. * GNU General Public License for more details.# {; e6 R0 H. A4 a4 N
  23. */& t: U6 t* O* N2 x! @
  24. 2 a9 I, }6 i5 C! z1 k
  25. #include <linux/module.h>
    ' `+ l9 a5 B- b
  26. #include <linux/init.h>$ }. c- k  H. Z: \3 `  _- c& ]
  27. #include <linux/errno.h>
    7 B, z1 R/ Y& a3 y
  28. #include <linux/types.h>. M% Z. O5 Q, _3 f1 e3 _/ U, ~
  29. #include <linux/interrupt.h>: ]! _# `9 }$ {" z6 R" L
  30. #include <asm/io.h>
    . m- v+ b+ X( x# C- F' U
  31. #include <linux/moduleparam.h>
    5 W, Y" G& _# P+ L
  32. #include <linux/sysctl.h>
    " y( ?8 j4 d! ], _
  33. #include <linux/mm.h>
    ( h: o3 b, d, U# m  g2 p  K
  34. #include <linux/dma-mapping.h>4 F0 a3 U/ w0 Q! C4 M6 H

  35. # C7 C. k9 p! Q* A; s% E2 ]
  36. #include <mach/memory.h># x" ~+ p$ }. R' K! }
  37. #include <mach/hardware.h>
    2 j( C% z9 E) }
  38. #include <mach/irqs.h>
    ) @, o7 U) @. M+ J% l5 h$ k
  39. #include <asm/hardware/edma.h>
    $ v7 _9 v( J% \9 z
  40. . c) s% z9 F# h" D! F( a& T. s9 Y
  41. #undef EDMA3_DEBUG
    1 o4 A" S% a1 \' p: J' I: G$ ^
  42. /*#define EDMA3_DEBUG*/
    ! Y6 A  j0 D& i* K/ M4 _

  43. ' b9 F! H- @; p) q# `$ d: S
  44. #ifdef EDMA3_DEBUG1 p( S$ y3 H/ {5 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ S0 L+ I8 {$ ]6 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* N5 n& E+ f* `0 z, s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* w( |; O* p6 |, {( @8 k8 ?
  48. #else6 }6 P/ ^7 J1 f7 Z6 N/ }
  49. #define DMA_PRINTK( x... )
    : n( v& Z; x. t2 J
  50. #define DMA_FN_IN
    8 Q$ u# s# @; _( ]
  51. #define DMA_FN_OUT
    - s  a" n5 r) E9 a
  52. #endif
    " I- d8 h* D+ E+ {

  53. 2 u) c! ]9 b/ y7 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 N) Z: k. M0 b2 x3 n" u
  55. #define STATIC_SHIFT                3% `. U+ b' G: X' n; C% M! l
  56. #define TCINTEN_SHIFT               20$ W' p. G# `* j( h% ^- I
  57. #define ITCINTEN_SHIFT              21: @# a4 N# e! x3 s7 D) q! D7 q
  58. #define TCCHEN_SHIFT                22- l/ Q# B& p# [- m
  59. #define ITCCHEN_SHIFT               234 \: u1 i+ o7 W. A/ B5 W  V
  60. 8 u5 b# U: K% p  |8 J
  61. static volatile int irqraised1 = 0;
    6 j4 n, u/ z5 y- `, h, D" |
  62. static volatile int irqraised2 = 0;8 \, e' F! p( U6 W! N  ~8 L3 S2 v, ~4 _6 C

  63. ' ]; S' g/ G0 G- h" v8 B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: S9 c0 _; H/ Q2 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) r" |6 h$ j7 m$ X, k- x  o# x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: v  M7 W, q- \' C" U" k
  67. - O0 J) F2 q8 H+ Y* i( Q/ R. B: |
  68. dma_addr_t dmaphyssrc1 = 0;
    2 [3 a, Z0 T7 n& c
  69. dma_addr_t dmaphyssrc2 = 0;9 T" j; {- }# {( D
  70. dma_addr_t dmaphysdest1 = 0;
    ) R& X+ t8 }8 h; W1 _
  71. dma_addr_t dmaphysdest2 = 0;
      c/ O" V6 [7 _( ~( O, @
  72. 4 \8 \: V. ]0 j4 ~1 _, ]
  73. char *dmabufsrc1 = NULL;
    # @0 V$ q5 P0 w  a' ?8 J
  74. char *dmabufsrc2 = NULL;5 V- U4 R* m( B3 m, P2 {  }& U+ W- l
  75. char *dmabufdest1 = NULL;, e  U4 z* v2 K
  76. char *dmabufdest2 = NULL;
      p$ n% I) q  P6 ?5 b

  77. 6 f- f# X/ f& R. Q: s0 c
  78. static int acnt = 512;
    " l- f7 Z/ q. `' l* E
  79. static int bcnt = 8;. W  c* L' s: r2 [. N( [2 v: E" {
  80. static int ccnt = 8;# T6 L& x& i0 Q$ n9 ^. }6 u
  81.   e2 ?  V3 x( O" g& o
  82. module_param(acnt, int, S_IRUGO);: U6 U$ c" n3 G$ g) l
  83. module_param(bcnt, int, S_IRUGO);
    + m' ~# l! j/ l: Z0 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 x1 X& \) H9 o1 R5 H
6 K& k* _6 b$ p1 y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; U# c: y6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# Y8 K$ B* f+ k" _# t$ I7 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% ]2 }! p$ N. `( \/ F
$ A+ v' w$ q& h3 q" E% |- ?, B
* Y+ [7 ?, y0 @6 F0 w% ?, n% y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 13:57 , Processed in 0.039776 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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