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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 q: j) l) f+ z- W* A
  1. [code]EDMA sample test application
    5 D4 r' h% `5 q; |
  2. /*3 t* W% ^( i2 ]$ Z( ^
  3. * edma_test.c% h! O4 F0 I. @" ?7 b- Q8 N2 ]0 f4 v
  4. *- U) A9 H. j/ A9 ^2 x3 h
  5. * brief  EDMA3 Test Application% m/ ]9 Z1 s% f4 a
  6. *4 r% P/ d4 p. v& }& P
  7. *   This file contains EDMA3 Test code.2 Q1 ^  H; Y2 [7 ~' N
  8. *& l, v7 w* Y5 J% {- x, p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 ^4 G  d. l, G) k9 E; ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 y6 H, V. L3 j2 K  r
  11. *         TO CHANGE.3 p. s, [3 G! q/ z! z
  12. *( c+ j+ N$ _$ j2 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' d' P$ O7 i. {5 A  d
  14. *; a3 k+ x4 Q+ ]* w
  15. * This program is free software; you can redistribute it and/or
    ; n9 r/ T4 Y8 E8 B
  16. * modify it under the terms of the GNU General Public License as- R" }5 j( J. ^1 o; k, Q! o& N$ W4 o
  17. * published by the Free Software Foundation version 2.  t& ^3 n( u+ |! y
  18. *$ W( m# g6 Z& l$ D: _8 P7 \- u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 v9 g0 m& y8 l, E  Q
  20. * kind, whether express or implied; without even the implied warranty
    4 v5 I5 ^# T% I0 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 g2 H" N" m7 T, y8 h) y
  22. * GNU General Public License for more details.
    0 r/ I+ d4 @; [0 U0 D
  23. */+ R3 y' D9 ]2 ]$ X2 f3 O$ M

  24. 1 ~& P+ W/ D0 \; I4 D8 d% z
  25. #include <linux/module.h>
    ) i9 E; ~. A" L* G+ ~
  26. #include <linux/init.h>* C9 h, n" W8 I! J
  27. #include <linux/errno.h>
    9 @: u- r3 T7 G3 M6 c
  28. #include <linux/types.h>
    8 j, L3 \3 o. q6 F- M) g
  29. #include <linux/interrupt.h>/ v4 z4 c1 d+ w$ b
  30. #include <asm/io.h>
    ( I+ c/ [6 j) a# e
  31. #include <linux/moduleparam.h>
    + n) L/ ^8 h! y+ h+ o
  32. #include <linux/sysctl.h>6 @, u0 l1 Y0 K6 P
  33. #include <linux/mm.h>3 x2 M/ G5 H6 z3 G$ G8 P! @
  34. #include <linux/dma-mapping.h>
    , r$ b! g; r$ n/ b- x& a7 U
  35. ! I+ V: ~8 l6 O3 j$ i* Y
  36. #include <mach/memory.h>) @5 W( k+ O6 d9 I! T& ?
  37. #include <mach/hardware.h>
    % Z1 Y8 X1 u" \/ h  b* ~
  38. #include <mach/irqs.h>
    7 I9 w5 o9 {7 S: J+ _& K
  39. #include <asm/hardware/edma.h>
    ; g6 [" h# ^& W) c& ]) a  ]# O

  40. # o- S* j- a7 J
  41. #undef EDMA3_DEBUG$ v+ i% D3 K1 |2 f
  42. /*#define EDMA3_DEBUG*/
    : d0 r4 g3 p9 X+ H8 I: |+ K+ F  @
  43. ; k# ]" Q9 p/ c# S+ n& ?" R0 T3 j. w
  44. #ifdef EDMA3_DEBUG7 K8 N/ \" M0 z3 E( o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 H% v- f2 C4 ?7 W. c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# `4 n. j1 C( Q' P. e& e1 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & {, f/ i3 S) y% w# g( Z
  48. #else: ?, d. o5 S8 x
  49. #define DMA_PRINTK( x... )4 ?; h5 a/ k: ?) u) P
  50. #define DMA_FN_IN) @& I6 x$ d1 f/ h1 E
  51. #define DMA_FN_OUT
    # L, O# g7 x" G9 t# c0 v
  52. #endif; d4 L$ n; J2 r9 b& V4 U6 q

  53. $ Q% h0 j9 F8 Y% W7 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ [6 M/ a/ Y  Q# F
  55. #define STATIC_SHIFT                37 [4 t9 f2 X5 h. ^% \& L
  56. #define TCINTEN_SHIFT               20
    & b4 V5 c4 n) N
  57. #define ITCINTEN_SHIFT              21# O9 U4 ]% k+ H9 m& M8 h0 w
  58. #define TCCHEN_SHIFT                22- C) }4 P! G# p/ f1 d  f) x
  59. #define ITCCHEN_SHIFT               235 V# i; V( E, j1 M
  60. " r3 x# e& B, d9 r3 J; {8 P
  61. static volatile int irqraised1 = 0;3 p" X$ Y( b! z& F( k
  62. static volatile int irqraised2 = 0;
    9 }' P6 n5 a, L
  63. 8 G+ o9 i) c  J, d# M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % P' ?# f! T. l/ N* }6 N6 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, L4 _/ F2 \8 _, l/ W- ~. P
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' n* ?: Z: `! `5 h, `% M) G8 k/ X" S
  67. 2 d* _2 P/ m- m
  68. dma_addr_t dmaphyssrc1 = 0;8 h8 n8 g. c# s# Z" n: y! j8 [
  69. dma_addr_t dmaphyssrc2 = 0;$ x( X5 T" u5 d6 N
  70. dma_addr_t dmaphysdest1 = 0;7 h4 }+ `6 c1 M
  71. dma_addr_t dmaphysdest2 = 0;
    2 E( V" r* W0 O- e1 o  s3 D  o& T! h
  72. . }0 T! N0 h3 C% ^; y
  73. char *dmabufsrc1 = NULL;& {: I2 e" T9 L  D
  74. char *dmabufsrc2 = NULL;
    3 r6 j) Y0 m  V1 t* a
  75. char *dmabufdest1 = NULL;
    8 r) \; ]) f5 n$ R& z  }5 G
  76. char *dmabufdest2 = NULL;
    ' O# T" O! r/ {: C/ o6 \

  77. ' d8 C7 E$ h9 h
  78. static int acnt = 512;
    9 s7 `! |# X1 l' R& Q# E8 K8 E
  79. static int bcnt = 8;  c8 O' |, p8 z
  80. static int ccnt = 8;
    4 W2 h, h: M# X: g
  81. 9 `- h% G2 ~" y* Y4 h; p3 `
  82. module_param(acnt, int, S_IRUGO);$ _3 V. b1 {3 i
  83. module_param(bcnt, int, S_IRUGO);. R- h* ~. P$ Y! Y: x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ e- I" S$ s& ^4 l

3 ]& n2 l& x& I0 ?+ L      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) |& t% e, S& B5 t2 p: Y* r) U  i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ H; N/ C, O/ Z( u3 P( k     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) w$ N0 w3 _* A* v; `
2 c+ u6 ]8 a+ R' \) z. g/ V1 j
' K9 u# b' Q; p* {" ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 04:33 , Processed in 0.040213 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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