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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ ^  E. i6 d3 s" s7 N) |% m# G
  1. [code]EDMA sample test application
    7 S" {, a1 p/ y4 t
  2. /*" A& E- U2 B& k( g3 P; d% M- f
  3. * edma_test.c! A( K$ }4 [, o% n. x
  4. *
    : G1 S/ M+ z/ B
  5. * brief  EDMA3 Test Application
    1 v* M( X; J0 P. O, v
  6. *( C9 n) S7 b3 h$ C/ c) Q
  7. *   This file contains EDMA3 Test code.
    2 j4 Q0 o# F6 `4 }! T
  8. *
    : k# a" Z8 n& ^. K* m# e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 U2 k7 \/ Y1 G5 _  u" d5 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 ^4 Q" j' c8 l' v6 ]' X: R
  11. *         TO CHANGE.
    9 b; f. e; ^( J) o. u0 s
  12. *
    1 k9 d, j8 C) A0 j; ~' I! F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. x. c+ A& D) C6 _' K  X* }
  14. *0 G9 `, D, B! m7 h0 c6 Q* E: }" z. _" W
  15. * This program is free software; you can redistribute it and/or
    ; b7 a2 `' f) h) D" O
  16. * modify it under the terms of the GNU General Public License as( _6 O: `- j* C& u9 I2 n' n
  17. * published by the Free Software Foundation version 2.
    # f2 |7 w1 K7 l. a: V+ A+ R; D
  18. *7 s  }# K( I" |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 u3 @- i) D; j6 z9 i3 }* L
  20. * kind, whether express or implied; without even the implied warranty
    4 }) g4 M' \$ s* ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 r- v) j0 I; Q
  22. * GNU General Public License for more details.. x7 d) b) Q0 T/ E! A
  23. */
    : w: Q# V1 Z$ G7 Y

  24. 8 r% a3 Y0 k7 X: r4 P
  25. #include <linux/module.h>7 ]8 C5 K7 s4 _) \- a" D
  26. #include <linux/init.h>
    8 J8 n3 ^& C3 ~* F: r- A/ N7 V5 w
  27. #include <linux/errno.h>
    : y" {3 ]8 p/ G6 v
  28. #include <linux/types.h>
    & R1 K' ]! }. o: o: W+ |/ b
  29. #include <linux/interrupt.h>
    $ `/ e1 D% Q+ {! x) V1 n; T' M
  30. #include <asm/io.h>2 f7 @& R& |0 `! C: ~  J+ q
  31. #include <linux/moduleparam.h>) c& s+ O4 I2 F/ x+ a$ _& n
  32. #include <linux/sysctl.h>% w6 r: ~- K8 v& W" ]- F1 y
  33. #include <linux/mm.h>2 S1 D! h2 m9 u# i7 d& x, P
  34. #include <linux/dma-mapping.h>
    9 H9 ~" s: g0 F  Z

  35. 6 W! L/ g6 C3 _" o( J3 Y4 x
  36. #include <mach/memory.h>! e: H! S: u2 d+ T+ _' k& _7 p
  37. #include <mach/hardware.h>
    $ a8 b/ X0 b6 J  [+ p0 r
  38. #include <mach/irqs.h>
    / e  |  Y8 r' g; W( ~% K
  39. #include <asm/hardware/edma.h>
    , ^# d. O$ Q& l. y9 Z3 A
  40. 9 \0 \! T7 c  A4 L
  41. #undef EDMA3_DEBUG
    ; X0 ~5 F7 F/ m* V+ `5 b
  42. /*#define EDMA3_DEBUG*/
    2 k8 {* U- `0 D3 J0 B

  43. 3 |4 C: u7 `0 H7 o; ^# \' K" m
  44. #ifdef EDMA3_DEBUG
    2 n/ i$ H: n/ s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 q) ?* P; w4 {( N5 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( n# T( A3 Y7 P, y/ A5 g6 S) {9 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + o$ d, G  ]1 }  V: u3 z1 t
  48. #else
    0 ~7 R1 }( V4 s
  49. #define DMA_PRINTK( x... )$ Y% b/ H5 ~2 c: N  c/ ?
  50. #define DMA_FN_IN
    ! f' k4 h6 [: U0 f, `
  51. #define DMA_FN_OUT: p" q% j+ _# ]6 M$ }
  52. #endif  O8 j4 Q' u. B: g' w3 _. d
  53. ) ]* X! ]6 Y. |* `9 s2 V8 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 E5 ~: @  }2 u4 o8 w
  55. #define STATIC_SHIFT                37 Q/ V) c5 v" g3 H5 B: H8 @
  56. #define TCINTEN_SHIFT               20; }' j6 D) b! M: ]# T
  57. #define ITCINTEN_SHIFT              21# w: H8 g$ ^. u5 N9 t5 ^* N! m: i4 q
  58. #define TCCHEN_SHIFT                223 s: t  t' ]- G% V
  59. #define ITCCHEN_SHIFT               23
      _$ h- i. }# S5 E7 s
  60. 7 j3 v! [! Z( o& h
  61. static volatile int irqraised1 = 0;# V. B2 |9 ?7 L- G/ U3 j$ [' s7 I
  62. static volatile int irqraised2 = 0;1 l9 Z# i, f- O: X

  63. 6 K( P$ n0 t/ y- q" f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( l. q8 }# V2 g0 y/ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; M8 g  C0 H: S1 t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; ~2 F6 r! ^$ [) n8 b- m# z
  67. 4 Y# U/ K9 S2 w3 a& ]
  68. dma_addr_t dmaphyssrc1 = 0;0 k2 t+ A9 T8 I' i2 j4 Y
  69. dma_addr_t dmaphyssrc2 = 0;& \4 i2 u4 A  J6 R
  70. dma_addr_t dmaphysdest1 = 0;
    4 ^4 t% N0 M& J3 Z/ `4 G* b8 m
  71. dma_addr_t dmaphysdest2 = 0;: H0 O5 U: ]! O- {
  72. $ L2 a' C; k' E. i9 E: ^
  73. char *dmabufsrc1 = NULL;1 s  v8 |! h) J% E9 y4 ?3 H; J+ l
  74. char *dmabufsrc2 = NULL;
    4 k. ?% X7 J8 p/ v' Q4 c8 z: `
  75. char *dmabufdest1 = NULL;
    & }" }) E% C) |
  76. char *dmabufdest2 = NULL;5 t6 Q% j( f7 Z, e3 m0 w# p# F& R- U
  77. 7 H( u6 j8 M7 w" Z( \% F
  78. static int acnt = 512;2 D4 L  {4 C; m  `" f" Z
  79. static int bcnt = 8;, q4 \3 Q1 f" A
  80. static int ccnt = 8;
    / G( |6 ?. }0 K0 C& E/ x  E

  81.   L0 }" ?  ?) |% v$ J& K* y, f; P
  82. module_param(acnt, int, S_IRUGO);" o# F: Y3 L  _$ ~/ a* `
  83. module_param(bcnt, int, S_IRUGO);- s* p7 e( K7 |  Q% G) T
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 F: @' T* g" ~$ p  M

, U( B' w3 w, }' f! I2 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 N8 a& [. ^# r
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: k3 v. J/ z# A% ?. q5 {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j* k7 I2 |( J( w/ U* U' ^0 \. T# \9 c" ^
8 p% R  Z' T0 x! c2 @3 \: s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 03:37 , Processed in 0.038256 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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