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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ V/ h  o, W' \* \# Q/ t
  1. [code]EDMA sample test application; y/ u; Q% e. T- X
  2. /*5 ]3 o& D) n4 h3 E$ o2 ^
  3. * edma_test.c
    9 w* r1 ]* r% q- C
  4. *
    $ M  C" L7 R. A/ \. M( X- X
  5. * brief  EDMA3 Test Application' L' ~( P$ m! o; M) N
  6. *% [- b( l( Q: {4 I4 L# O/ Q
  7. *   This file contains EDMA3 Test code.: ?4 Z& h, W% y9 i4 ]( k
  8. *
    ( f! O2 H+ K2 t$ ?! t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. X' c8 c. N8 B& Z* S" n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 B/ V( P2 X2 J: h: ~! D/ f' k% l* j
  11. *         TO CHANGE.
    8 ~* ]+ a: B% X2 i
  12. *$ v7 f4 N. }6 L$ C2 H* ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* U0 X$ P( h: r
  14. *. Z2 o! ^8 \# z, u# _
  15. * This program is free software; you can redistribute it and/or
    . k; d  X2 O. A
  16. * modify it under the terms of the GNU General Public License as8 Y! O& R7 t. D/ A# z
  17. * published by the Free Software Foundation version 2.2 A2 M0 T0 g9 G) j* G( V. i: Q
  18. */ L9 j  |6 X- u$ Q+ w. x: K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 J0 `3 @$ y( ^  |7 S: O
  20. * kind, whether express or implied; without even the implied warranty! U' q$ ~8 O, r" P7 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / k7 o5 T$ k8 c+ W' p' u
  22. * GNU General Public License for more details.4 ?( F0 J4 d% I
  23. */. D! E) b5 a1 f

  24. 7 w8 V1 _0 z6 O1 R- a: m
  25. #include <linux/module.h>
    5 s6 Z, v& b  N' e- i  h5 f
  26. #include <linux/init.h>2 V! r0 X# A7 z6 d9 g$ T6 }
  27. #include <linux/errno.h>
    " I1 R8 g1 ~/ O5 y
  28. #include <linux/types.h>
    8 P2 b7 d/ ~' `. F: F
  29. #include <linux/interrupt.h>) \4 D1 R1 t! v/ c. A5 B1 R
  30. #include <asm/io.h>5 {2 q/ ]9 h! ]
  31. #include <linux/moduleparam.h>, [  R) Y% U( ]/ B; V
  32. #include <linux/sysctl.h>
    ! t+ v6 [' Q$ G1 F* r
  33. #include <linux/mm.h>
    3 D4 |: `1 V. x
  34. #include <linux/dma-mapping.h>! Z, r. U- X4 z" W
  35.   X9 P! y( O) B) ^0 |
  36. #include <mach/memory.h>$ H" l& U2 n9 l5 V! ~
  37. #include <mach/hardware.h>, _% U% G3 X- x; ]
  38. #include <mach/irqs.h>
    * u" Y% u5 P8 d6 }. l0 P0 d
  39. #include <asm/hardware/edma.h>
    5 r9 C* v6 ?" T% {& I3 u
  40. & e% |- h  D7 ]& p5 W
  41. #undef EDMA3_DEBUG
    ; \6 G6 \7 ^$ g9 l9 A1 I
  42. /*#define EDMA3_DEBUG*/4 C1 P& _4 T6 c
  43. " ?5 d: p" D* T4 m
  44. #ifdef EDMA3_DEBUG
    3 z, P0 a6 r8 a4 {. G! D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + q! f: F9 I6 A2 n9 v0 X7 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 N, w1 E* ~7 m, Y1 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ]- ^# o- |- k( ?. T7 M  d
  48. #else" T8 e) H0 o# k1 W% M$ z2 u
  49. #define DMA_PRINTK( x... )
    & Q4 r7 t6 P2 }& B& ^" g
  50. #define DMA_FN_IN
    $ ]+ T2 m0 T: Q. ^* g
  51. #define DMA_FN_OUT
    4 U2 h) Y7 E) R$ A+ u0 \
  52. #endif9 a$ M' i* L7 X" E% I; f8 f
  53. 5 }: E9 F5 j1 ?, W. A+ A3 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 P( k, ~- h& B/ I! Z" H
  55. #define STATIC_SHIFT                3
    ) q( S3 l  f) n( X! d
  56. #define TCINTEN_SHIFT               20
    8 X  V3 Z+ t% H& W- S1 C
  57. #define ITCINTEN_SHIFT              213 F. q' C' {+ F/ |5 I- {  C
  58. #define TCCHEN_SHIFT                22
    1 S7 r& b) ]3 v+ ~: G
  59. #define ITCCHEN_SHIFT               23" f  C+ M+ B) h4 u& M$ c
  60. : b0 w" r3 z- K/ y1 _1 @2 d" m
  61. static volatile int irqraised1 = 0;2 j9 ?7 m, p& s( H, G$ G: E6 ^, }- {
  62. static volatile int irqraised2 = 0;
    : T: r* s4 u& w9 W+ Z3 {. s2 N
  63. 8 U" q; x$ V. O8 r1 x9 {6 B7 j; X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; l6 a# z1 r! i; Y! P0 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 l2 ]" U2 p  |* c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " J& I, m# ?+ z: x7 A0 S5 R
  67. ' {; \: w% j& ~  Z8 |8 M
  68. dma_addr_t dmaphyssrc1 = 0;+ m' }$ X9 n1 K! L! j2 B
  69. dma_addr_t dmaphyssrc2 = 0;+ }  r! ?1 [2 U
  70. dma_addr_t dmaphysdest1 = 0;2 v, Z% w& ?9 g+ d. u
  71. dma_addr_t dmaphysdest2 = 0;
    / y* D9 @. o' }. W
  72. - f& J( Z# J3 R
  73. char *dmabufsrc1 = NULL;
    + ?) f, \( T! D- f; S. a5 \2 |* V
  74. char *dmabufsrc2 = NULL;
    * |( }2 A# y; x
  75. char *dmabufdest1 = NULL;
    " ?) ^" h: z# X8 j! e. k; c
  76. char *dmabufdest2 = NULL;  d  @3 e% u  D9 i
  77. 6 v8 x  d) a% I! K* V* G7 q4 f
  78. static int acnt = 512;# F% y9 N' a# `% @* D
  79. static int bcnt = 8;
    * H" a0 d$ }" Q
  80. static int ccnt = 8;; ]/ l' b7 r( W! T& L0 ?  P- n4 I

  81. * A" R9 F7 H- G( B. ]: C
  82. module_param(acnt, int, S_IRUGO);
    8 E/ D7 ?* @# K% r, |
  83. module_param(bcnt, int, S_IRUGO);
    - P' z$ w" J  j$ ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 h: ?3 R; Q' M+ A2 C* N
' c( i& O- v2 s" p0 c( ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' b6 q, m3 @6 W2 ~- D: v( J1 j6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& h" Z2 ]5 n; s" q3 s8 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 d: w% i5 K' J' x6 ?/ P

, C0 ~# r5 o8 I2 w/ n8 l
8 `( Z0 e  R# b2 ?- \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 13:05 , Processed in 0.041076 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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