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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 z3 O7 }( H. }- b
  1. [code]EDMA sample test application) m: N' S2 ?) H7 S/ _9 D" I
  2. /*% b! ~7 T$ v* D6 D7 k6 y7 c
  3. * edma_test.c! I+ t* w+ Y6 P
  4. *9 H, A# X* H# `- p' U
  5. * brief  EDMA3 Test Application' N8 D! k3 e# c7 {0 i
  6. *( d* ]" Z- P$ }5 ]+ C5 p
  7. *   This file contains EDMA3 Test code.
    2 N* @3 E1 K  `( M0 y& p
  8. *0 S# r5 A% f# k! `: g' U8 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 |, z5 B; s& o4 x% S" c4 {# ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & j7 p8 I0 B! }, @. a9 s
  11. *         TO CHANGE.* A# p6 b( D- a) _+ {+ e
  12. *6 R: g& z7 X4 ?) t! U# h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + r# f; U3 I; P% ]. D
  14. *6 W- u5 g' ]9 m7 }  A- A
  15. * This program is free software; you can redistribute it and/or7 a8 d4 K( C9 A7 s4 R& R' a0 x; C5 }- A* D
  16. * modify it under the terms of the GNU General Public License as
      O+ S1 ^5 A! x+ V" U
  17. * published by the Free Software Foundation version 2.' I, A' T5 e( _+ z- M" j8 M
  18. *4 @4 H4 k6 A7 E$ P0 F( @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. n3 A! q# X, E4 N( Q8 r
  20. * kind, whether express or implied; without even the implied warranty" b$ s! H& z9 e5 A; |, C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 K2 `5 U6 @* c* N+ N$ p; z2 T+ A
  22. * GNU General Public License for more details.2 g$ C" ?6 }$ x
  23. *// z  v+ P% }8 @9 i5 J8 `6 V
  24. 7 D; H: E5 o4 C( R5 n# T
  25. #include <linux/module.h>& x6 o+ {7 ?0 f; \6 c
  26. #include <linux/init.h>) U* E) J/ m# S4 z% W. e: u
  27. #include <linux/errno.h>' I3 K9 [9 d& x& x
  28. #include <linux/types.h>) S+ M7 R; i# Y' G
  29. #include <linux/interrupt.h>
      {3 f, e* T1 d$ O. k% c
  30. #include <asm/io.h>
    1 A6 q  i& W; ?6 F( l
  31. #include <linux/moduleparam.h>
    " O0 V* k; o* f+ O5 l
  32. #include <linux/sysctl.h>
    * |7 N+ s) u/ _# T- B3 ~
  33. #include <linux/mm.h>  b+ t  h4 D5 V# L
  34. #include <linux/dma-mapping.h>4 Q; e- `) O- Y  z! u4 h# E
  35. & E- C- V4 ^' ^4 @, V) X7 ~$ w
  36. #include <mach/memory.h>
    3 A$ O4 B. Y1 ?+ }! D
  37. #include <mach/hardware.h>
    / ^# U) w3 n" M, b% _
  38. #include <mach/irqs.h>- j) r$ k" d" P3 P7 F9 k, ?
  39. #include <asm/hardware/edma.h>
    8 k* x9 v6 B" D) @2 f
  40. 8 O3 }( e. A+ V0 I
  41. #undef EDMA3_DEBUG3 S" n9 D9 v* V# i5 z/ O1 B
  42. /*#define EDMA3_DEBUG*/% d4 |1 z2 b7 n5 P% i

  43. " j+ [/ d2 u1 w4 q0 Q
  44. #ifdef EDMA3_DEBUG4 U$ \! F- a! e( y) Y- m* ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 [: t7 I* z4 h/ a. |9 v5 ^/ \* h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 L, |6 F- `% D1 K7 x& r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . R; }# a& u% e' k" [1 n
  48. #else
    ( _/ b) r. O. i1 \, `7 V  v9 A
  49. #define DMA_PRINTK( x... )4 ~3 R, X( r; e7 i" Q7 Z& p
  50. #define DMA_FN_IN
    7 E0 J/ J# @; G& X( k  i; ^+ q& A
  51. #define DMA_FN_OUT+ {, c4 N) K8 j+ g0 T) h
  52. #endif. J& n# ?8 ]) ?# i' L$ E' T; b
  53. . W( _" H$ r- ~% l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& \1 s5 R' M$ Q4 s) Z8 Y5 W; P$ s
  55. #define STATIC_SHIFT                30 f- u2 Q# T! _( [! Q: P9 _, C" F1 r
  56. #define TCINTEN_SHIFT               20+ h: F' p+ Z& l* p+ k/ ~
  57. #define ITCINTEN_SHIFT              21
    ' f* f2 t- f5 d; d# w
  58. #define TCCHEN_SHIFT                22
    3 m5 J* W; \2 m4 T
  59. #define ITCCHEN_SHIFT               233 j3 j8 u# A. `

  60. . X' U. {  Q, o. z, l6 t& Z! u/ n" c
  61. static volatile int irqraised1 = 0;
    . m  I4 P9 k( f# r/ K
  62. static volatile int irqraised2 = 0;
    ; O5 ?( M) |) x9 H
  63. - j) E  n$ o4 o5 T( `9 F! @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 }- s2 V) E6 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . l( L4 ~1 U- S  R7 H; k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , z6 N4 D$ _# g6 J& I

  67. ; x) g: `* d+ x
  68. dma_addr_t dmaphyssrc1 = 0;- ~; `! u- [+ r4 B8 m$ ^; [
  69. dma_addr_t dmaphyssrc2 = 0;% H) b" u* V. o# Q- t2 H1 k
  70. dma_addr_t dmaphysdest1 = 0;( I- c- z- b7 x0 D2 h
  71. dma_addr_t dmaphysdest2 = 0;
    1 G! d: \! y" ?7 v8 Z0 K6 R0 d. g

  72. , ]  x# N( ?0 p: O
  73. char *dmabufsrc1 = NULL;: R2 S" K5 w, d# B3 h( J
  74. char *dmabufsrc2 = NULL;
    # p( Y4 v: S& B9 M5 `# |
  75. char *dmabufdest1 = NULL;+ B; ^* g- \6 `4 o
  76. char *dmabufdest2 = NULL;
    ; |# z; E0 B, `" ]4 C6 `, X
  77. : C( _, b7 K+ y/ t  m
  78. static int acnt = 512;( J& p8 s, Q, b
  79. static int bcnt = 8;
    3 H8 T" m# n& _7 m
  80. static int ccnt = 8;
    9 Z! `' G  ]8 t# C- c, p

  81. : w# }# G6 |# R
  82. module_param(acnt, int, S_IRUGO);
    $ J* x# t& z4 [3 o
  83. module_param(bcnt, int, S_IRUGO);
    9 t% }2 V9 c4 v# ]* v- \% D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! w: d1 A4 P3 B3 S1 V$ z9 B& G- ]
8 a$ c- i, S7 k
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  ]7 ^+ f4 R2 N5 V: v' b5 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; F: N' w! w' Q+ e: }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 x1 h5 W* g$ ^+ p8 U
& q* X5 K3 @- n

( L" w. l  H: ^6 F" W6 K/ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-16 18:46 , Processed in 0.046028 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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