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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 J* K% l5 [7 @- s# K* y1 d( A
  1. [code]EDMA sample test application
    6 R" D: O, T2 {) _
  2. /*0 t2 E8 t# a  \$ t2 M. s% ]+ a
  3. * edma_test.c
    9 ]$ T6 l6 {$ i6 n/ A
  4. *
    ) ^8 |  `3 t0 l* y' k
  5. * brief  EDMA3 Test Application5 }4 P; X+ X" s, W
  6. *
    2 e) V8 R, M' S7 u) Y
  7. *   This file contains EDMA3 Test code.; y/ k6 x. N% d* {
  8. *
    ! J# n/ _' w5 O) B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! F+ W/ c7 b5 h. k3 @9 O2 ?1 n. G4 u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , k* Z( B% q5 s  r+ q* ^' x
  11. *         TO CHANGE.
    : s3 A6 P& |' F, X5 E1 D
  12. *0 ?0 ^* z( ^! O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ O2 Y; d! p& j  |' x# i- _
  14. *
    & }7 ^3 X: K0 j, ?6 g$ T" d; q7 M' I7 y
  15. * This program is free software; you can redistribute it and/or
    " I) D3 _# [: N: P# |, _
  16. * modify it under the terms of the GNU General Public License as
    ! {& D: L' L& v7 K3 M
  17. * published by the Free Software Foundation version 2.+ F7 P$ _- a' @8 ]" j7 Z0 c
  18. *; z& |  l* h% `* s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 D, h' `+ g' e# C  a
  20. * kind, whether express or implied; without even the implied warranty1 X. `3 P" I  J9 [/ ?9 I9 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& F. U; r; j+ r& }
  22. * GNU General Public License for more details.& S# K6 D, e# S5 q. N) N) n$ o
  23. */7 B2 @5 p% C- v/ w- ]6 G
  24. ( ]8 Z" w4 o9 x$ y
  25. #include <linux/module.h>* p: C6 W+ U1 Y4 x% I, j
  26. #include <linux/init.h>+ P8 a7 r2 i) |6 g
  27. #include <linux/errno.h>* a; H4 u: h9 {8 e9 `: Q# |" f
  28. #include <linux/types.h>( \( N# c8 `6 L. A
  29. #include <linux/interrupt.h>: P  j0 L5 \# _: ~  n9 S6 e8 L) |
  30. #include <asm/io.h>/ l* W, P' U, x" Q( k
  31. #include <linux/moduleparam.h>, `. w$ ~. i. Q8 ]/ W; Z% o
  32. #include <linux/sysctl.h>
    1 I! A5 w' _9 s' g; @; W
  33. #include <linux/mm.h>
    ) k  J6 R" j2 i
  34. #include <linux/dma-mapping.h>" h& h- Z* A8 h# T8 G; H
  35. 4 v2 ~/ ]9 C0 o% ?) ^
  36. #include <mach/memory.h>3 L# k& |" }# N& J) d
  37. #include <mach/hardware.h>) j* q! v) n/ R8 Y
  38. #include <mach/irqs.h>
    ( h* O. n, l: U6 O( D* W0 G
  39. #include <asm/hardware/edma.h>5 N( ?& o6 k  m6 M

  40. . ^1 `7 c( u5 l1 R# A# t( ]
  41. #undef EDMA3_DEBUG
    0 [) q" U( K" }. q7 r7 l( u
  42. /*#define EDMA3_DEBUG*/
    7 s5 U' R. m+ H, P& Q' J' v4 [

  43. 7 }% r+ ^  `1 s, S: }9 B
  44. #ifdef EDMA3_DEBUG! x" ^' l2 I! z  r9 j, i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 G# z* A6 s- d) E% C! @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 w1 k% C4 b: u$ y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , f" P; y7 i2 h: m& }% a4 _, P
  48. #else
    : A- M8 P) [  r
  49. #define DMA_PRINTK( x... )
    ' ?0 \- U! D) E& B! {; U  S
  50. #define DMA_FN_IN2 M4 I4 w% y3 d0 U& Z& D
  51. #define DMA_FN_OUT  d: P- x5 m- @
  52. #endif
    9 q" b' v) x% P
  53. 7 L3 m! M7 L* \1 A* ]/ {8 A% M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . b2 K4 L" `  E! O- ~
  55. #define STATIC_SHIFT                3) h: R7 }9 e( Q# o3 z, f4 |
  56. #define TCINTEN_SHIFT               202 L1 l5 {5 g  @& R
  57. #define ITCINTEN_SHIFT              216 z2 r/ Q) @# S. S
  58. #define TCCHEN_SHIFT                228 F5 ?' E; Q2 R; |  o
  59. #define ITCCHEN_SHIFT               23
    # {6 I. Y$ ^/ J. W; x

  60. + O. Q# H% R8 Q
  61. static volatile int irqraised1 = 0;
    ( b5 y+ ]$ p. P7 V7 d
  62. static volatile int irqraised2 = 0;6 Q) L3 t) K' Y" ~

  63. 5 J! [8 p3 h+ M1 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; Z: O- ~1 {& s# B- I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l# p" S, G& v2 V* V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - G8 L* U! j4 |# U6 M5 I1 X

  67. # K# J6 u* v, u' E. \" s  D6 P
  68. dma_addr_t dmaphyssrc1 = 0;& r/ |' W  v/ w$ b( Q- b0 x
  69. dma_addr_t dmaphyssrc2 = 0;
    ) N2 k  I. r! \5 s
  70. dma_addr_t dmaphysdest1 = 0;8 v8 P# h$ M" K7 X4 {
  71. dma_addr_t dmaphysdest2 = 0;8 K+ {# s! k: ?, y

  72. ' `- G7 w) k. m, t; P0 P& z! c+ J
  73. char *dmabufsrc1 = NULL;6 S; m+ K, f+ g& O/ V2 f
  74. char *dmabufsrc2 = NULL;, m* D9 \2 I& ^3 _, F
  75. char *dmabufdest1 = NULL;$ {8 D  Z* }: g. i
  76. char *dmabufdest2 = NULL;! `. i+ M% E4 ~7 _9 b$ s

  77. ( s0 N( F7 A4 [. S3 A
  78. static int acnt = 512;5 l' {3 K8 i# l+ H: Z! u3 g; U; m6 L
  79. static int bcnt = 8;7 L  q* J; E2 s5 p# L9 R6 f
  80. static int ccnt = 8;- Y3 J6 I9 ]5 x: i6 b# h6 |

  81. 5 r( N. Z, q0 N1 e6 H! j% ]0 }
  82. module_param(acnt, int, S_IRUGO);1 B  {4 p' K3 Z& h2 P; e
  83. module_param(bcnt, int, S_IRUGO);
    , h8 [/ q/ z# }  i# z: B$ b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 I# p2 U7 c& G) d4 x( Y( g. Q" I/ O) ^; h$ C
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 l/ ~  r% `- w' e' r- D' zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, {3 e1 J* S& @- n  d% q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 A* v1 ^( _- Z& A. e
1 {. d% J0 u  \: `6 M  H4 w
1 R: C' [8 F, E) J: V! d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-29 01:27 , Processed in 0.040662 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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