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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 m7 r4 W8 e# ]$ A+ [! v% b
  1. [code]EDMA sample test application
    # V2 q5 ?+ @0 B  `, q: \3 y+ R6 y
  2. /*
    . ]$ o, L$ p( T
  3. * edma_test.c& a* g8 O7 }  {9 q6 u6 _7 D
  4. *
      a2 y0 a/ l0 K
  5. * brief  EDMA3 Test Application9 j# g- S6 ?( O, B
  6. *% w1 A- i' E9 D( |* ~7 J
  7. *   This file contains EDMA3 Test code.
    # V$ c0 S8 L) z: G+ s
  8. *# I2 V; W; V: K: Z' k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 I7 J3 ^7 L5 U. z& p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 P  c8 r% ]% [$ m- [
  11. *         TO CHANGE.
      L/ [3 E" F  `9 s+ M
  12. *
    / O, b. c% ]" w8 Z# [9 N: m. a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 C/ m+ Y; _& A0 ~& r# C
  14. *
    # X* Y, {8 U0 }1 I  l2 o3 A7 t2 n1 p
  15. * This program is free software; you can redistribute it and/or
    8 i  n! u. E& D) }% r) [' y" p
  16. * modify it under the terms of the GNU General Public License as. N& W! E% c) r: \8 G3 C: Y
  17. * published by the Free Software Foundation version 2.
      L1 F: B; U' T
  18. *1 [* l& f1 A$ A. k2 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 ?2 }5 m" j+ f) u" M/ K1 W2 x
  20. * kind, whether express or implied; without even the implied warranty  \" U! i/ m+ j* \- x3 l8 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 n# w) Z4 V' |3 R* e3 I+ T
  22. * GNU General Public License for more details.
    4 |+ M- A" l) b! e$ |% P' S* k9 o
  23. */  s" ^8 W( \: P& G
  24. " ^& ^! S- S1 K6 R7 N
  25. #include <linux/module.h>
    4 u, C9 |8 {$ l3 S
  26. #include <linux/init.h>4 {8 p: ?: u  b# p6 M$ F
  27. #include <linux/errno.h>
    & n$ h! y& v* N
  28. #include <linux/types.h>) p7 c. P  {( Z/ c/ o0 u+ I' p$ u8 I
  29. #include <linux/interrupt.h>
    ! }1 q4 ?6 v: \7 v% a5 D- P% b
  30. #include <asm/io.h>
    7 B# S5 s6 W$ R! {" f/ {  p# H5 V
  31. #include <linux/moduleparam.h>7 t- M" [, a1 D
  32. #include <linux/sysctl.h>
    % f" L! R* l6 y- c/ H: T. {% }
  33. #include <linux/mm.h># |2 d. [5 ]/ f1 a/ M
  34. #include <linux/dma-mapping.h>8 ^( W$ o# {5 @5 y
  35. " a5 b- u" p* D; Y3 W# o
  36. #include <mach/memory.h>' u" |- P! d; M1 ?/ S
  37. #include <mach/hardware.h>' a% `# }% v) ~" z9 f0 Y, `
  38. #include <mach/irqs.h>7 F8 l; n5 y5 f  v! \
  39. #include <asm/hardware/edma.h>$ g  Q" l5 y- Y, F6 z/ h. |
  40. : n2 S: t7 q5 e( Q! y# N8 P8 `% o( Q3 o
  41. #undef EDMA3_DEBUG9 `  q$ v: s1 a8 z* q
  42. /*#define EDMA3_DEBUG*/8 \4 J, ]0 ^4 X+ K4 M3 v
  43. 7 O5 m' s3 G$ W* k- L
  44. #ifdef EDMA3_DEBUG
    : i7 ]* q$ {; S' p, H& B2 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 G6 L: \. Q# S' ?+ i' j% u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); I: m; Y  {/ c' `* L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & r4 [1 X2 i* g& [' L2 S; M# T# N, I# g
  48. #else
    / ?; l5 f6 ?7 O1 F0 |$ e2 Y
  49. #define DMA_PRINTK( x... )
    " P  a) A( S9 s& z) }9 w
  50. #define DMA_FN_IN3 k, Q8 I! z/ B+ G3 ]4 ?
  51. #define DMA_FN_OUT
    . _) \. a; E  s! T  \2 j4 P! E
  52. #endif
    ' p2 E' K' c: `5 r3 z

  53. - F0 V/ x, Z, e5 u* }( t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 k0 w- @$ l1 R3 J( X" {
  55. #define STATIC_SHIFT                3
    8 o3 C; B, v2 {3 F; ~. w2 n
  56. #define TCINTEN_SHIFT               20- a  O2 Z" i! A. U+ L6 j9 H
  57. #define ITCINTEN_SHIFT              21
    ' o* X+ D1 O  w" b* I! }$ {2 [
  58. #define TCCHEN_SHIFT                22
    ( R9 k; T8 A) {: A7 Q
  59. #define ITCCHEN_SHIFT               239 m1 Y! C4 q1 b9 t# [
  60. ; ^' s. H' c; h
  61. static volatile int irqraised1 = 0;, J0 h) k- Z: a" [' o9 {
  62. static volatile int irqraised2 = 0;
    $ ^5 ?9 l2 x/ o" i# L
  63. , s9 K) [/ o( l( Q/ M$ [% v9 T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 g9 {+ k. ~; m9 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , Q0 s9 v8 z! [0 k  _1 x% e1 ~5 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - X. `" h2 m3 M; e0 E

  67. 7 W% m6 a( z, t& |/ v7 z
  68. dma_addr_t dmaphyssrc1 = 0;& v) @) A# C' ~3 w
  69. dma_addr_t dmaphyssrc2 = 0;6 h8 f- A" ~) M4 }) \8 y
  70. dma_addr_t dmaphysdest1 = 0;% L- @+ u& [! ~
  71. dma_addr_t dmaphysdest2 = 0;2 r7 n9 x  P1 d; b3 {* `
  72. % L) F: ^% q2 C4 q) f
  73. char *dmabufsrc1 = NULL;
    9 D) S! v$ i/ @2 L$ Y' y% N
  74. char *dmabufsrc2 = NULL;4 u$ o. D2 l. _
  75. char *dmabufdest1 = NULL;% a0 L5 ^: O. s- y4 k% m7 ]
  76. char *dmabufdest2 = NULL;9 ?5 [3 S1 m6 W3 Q! i! A8 D& W/ F5 Y1 ~

  77. ! m! y7 X8 l" S1 n/ Z  j0 l6 T
  78. static int acnt = 512;2 f. W& |$ E. W5 C1 x; U
  79. static int bcnt = 8;% J5 }' Q; m! l4 Q* u  y
  80. static int ccnt = 8;* |# i4 Y1 g! z! U$ g* A5 K6 H  I

  81. 3 n8 u! W9 q$ x8 U/ P( D* y, p
  82. module_param(acnt, int, S_IRUGO);* E; j5 ^% i9 k0 {. ?$ W
  83. module_param(bcnt, int, S_IRUGO);5 q+ k4 M" j. R' `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 i5 g# w0 J' G* c, _
/ U7 G2 V7 a$ U0 k% f+ F  U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' e, M! b" z+ \- i4 C2 @# l$ 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  N0 v& e% t: S' g& u9 L5 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 H" s' b+ X2 g5 M# Y$ ~( h# A

7 }9 I( y# X1 `. x
4 J% Q& ^' G/ U  R. M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 06:56 , Processed in 0.040098 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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