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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # {8 e  g1 J5 @% ^$ `+ ]
  1. [code]EDMA sample test application5 g0 d4 P$ W7 n- A5 O9 [
  2. /*) Y2 Y- h$ g: D; c
  3. * edma_test.c
    1 E- j' U9 A) X# f
  4. *
    % z- f9 l: t' [* I
  5. * brief  EDMA3 Test Application
    " o6 w; H- c# J* H+ t, [9 L0 e1 ?
  6. *
    1 K6 W% u/ w6 `% @! Z: X& L
  7. *   This file contains EDMA3 Test code.) \# i7 H* n( X  [
  8. ** b$ N! c5 K! H1 d7 F) M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 k) a0 @) d$ ^9 o& h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 X8 b7 M6 F! w
  11. *         TO CHANGE.
    . a( w2 O) x6 l, N
  12. *
    ; @& c: l! C; |" m. ]" H+ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 ~! G' @' m) C9 _" X. }3 U# a
  14. *% ^4 p. b, B# d: n" m4 N3 u: G" q- K% Q+ e
  15. * This program is free software; you can redistribute it and/or, O! k2 O% R) i
  16. * modify it under the terms of the GNU General Public License as
    ; A" c# i' n5 h. m9 J. ?
  17. * published by the Free Software Foundation version 2.+ c+ F- U; F/ v0 K" i5 u
  18. *: O0 i3 W9 U, U+ }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" P: G) x% _- \3 f' P2 b) |* f
  20. * kind, whether express or implied; without even the implied warranty
    ( w" i+ P# P! ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 r5 f+ H' V1 D* v8 x# @4 c* X
  22. * GNU General Public License for more details.
    8 r5 u' U: Y" \. `7 F  C& B
  23. */
    + @) h7 C6 }8 s! U/ m8 O
  24. & O( y' ^, b' @7 ^3 u9 v
  25. #include <linux/module.h>
    - @  F! o2 H# D; D. C: J, c- H" y
  26. #include <linux/init.h>
    7 y/ {! l0 P) T! Q
  27. #include <linux/errno.h>
    % T- h! e6 `6 z% s7 R' l# Q/ G
  28. #include <linux/types.h>% B0 _! @- H4 K
  29. #include <linux/interrupt.h>
    # ~" r$ S! w% J7 J- U
  30. #include <asm/io.h>) l% U& i4 L1 U" m
  31. #include <linux/moduleparam.h>
    " b. G0 `& u, [" M, k2 b4 M
  32. #include <linux/sysctl.h># j9 k9 h& c" O# }
  33. #include <linux/mm.h>
    9 Y  z- G4 ~+ z8 {& R1 b
  34. #include <linux/dma-mapping.h>
    ' V5 y' \7 _" S) J6 ~
  35. $ ]! @4 S' u  \9 Z3 J( m
  36. #include <mach/memory.h>& Y9 c" O9 g+ f; B: G+ k/ w
  37. #include <mach/hardware.h>6 c5 _3 `# o/ l, Y
  38. #include <mach/irqs.h>
    % r8 }. P  N5 ]
  39. #include <asm/hardware/edma.h>3 @* _! p3 e6 l& S

  40. % s  x4 N- I8 ?( j) ]* P1 x
  41. #undef EDMA3_DEBUG; ?4 y/ M9 T# w
  42. /*#define EDMA3_DEBUG*/9 K6 D; U; L7 y' J8 y" \1 U

  43. " a0 Y0 N0 h) v
  44. #ifdef EDMA3_DEBUG
    2 i: N: X/ \2 M. Q  B4 e7 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* ]) V; u) a, c' y# ~; O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 |. D9 [! q. R. j: }; F: `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ `7 Z* p  I+ B! r3 A$ O
  48. #else; W. X2 N2 a- k! m9 \
  49. #define DMA_PRINTK( x... )8 U4 |& f; M  J
  50. #define DMA_FN_IN* I; o) f# i4 j
  51. #define DMA_FN_OUT
    0 r3 E( u3 a7 a
  52. #endif" w5 N8 o' F8 Y
  53. ( Y4 m* O# _% v+ z; {
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # U& j8 e) u5 B2 k9 |1 ~
  55. #define STATIC_SHIFT                3" P( `* G: u" X. P$ y  E- t' ^
  56. #define TCINTEN_SHIFT               20" h0 B* R9 s6 K) o8 B+ U0 D; j& h
  57. #define ITCINTEN_SHIFT              212 f; v! X1 S3 R' c( l6 b- \7 U
  58. #define TCCHEN_SHIFT                229 u& G7 |$ s; X5 P1 `
  59. #define ITCCHEN_SHIFT               23
    1 R1 H& P) t% B
  60. . S6 ~+ e& P4 B" [3 p  c: A
  61. static volatile int irqraised1 = 0;. }: Z3 t, Q8 p1 d5 ]$ ^4 V5 P
  62. static volatile int irqraised2 = 0;
    2 h, a0 d# @2 T$ t
  63. ! e% B  Q; g' ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 R) B  o% p# `0 G# y' ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) T# G! z1 G& W; E  q$ {+ R/ ~# X
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) O$ d* P$ P6 E" k2 r

  67. " M/ B3 P4 c: D" d  K* h  l2 \
  68. dma_addr_t dmaphyssrc1 = 0;; n. X% ^, I2 B3 p7 s
  69. dma_addr_t dmaphyssrc2 = 0;1 Y7 H5 V, ], Z5 v% |- r
  70. dma_addr_t dmaphysdest1 = 0;& n9 K2 q/ N/ G. _; C- A
  71. dma_addr_t dmaphysdest2 = 0;% V# L3 ~8 [! g2 f+ Y
  72. : P% m, _! B7 \. Y
  73. char *dmabufsrc1 = NULL;4 Q  o. \6 r" ]3 q2 u+ J
  74. char *dmabufsrc2 = NULL;2 D7 k- G8 j3 P( P# ?7 L
  75. char *dmabufdest1 = NULL;1 S3 R2 Z' R! G8 p  _8 z2 @
  76. char *dmabufdest2 = NULL;, R" g1 B0 e) ]) w; ?" @3 @
  77. 5 G) I$ D' u: u
  78. static int acnt = 512;
    . d2 X. _! ?- T9 c0 M7 V$ B
  79. static int bcnt = 8;, e4 y& M7 ?: i0 A( a3 m& R: F
  80. static int ccnt = 8;
    : Z* P0 x9 C9 m" `" j0 R4 S; \

  81. 1 l* z  m8 X4 N; L  f+ c
  82. module_param(acnt, int, S_IRUGO);% K6 a5 j+ T6 B. S; \
  83. module_param(bcnt, int, S_IRUGO);! X2 ~7 Q/ r' H6 R, S& `2 `, P$ c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 z1 h$ G- m. N& E8 t
# D9 j# A) s' P, \9 L1 ]% K4 r1 B      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: x! ?4 n0 [: X) S* ]  C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  @5 _9 u. \# a5 p( \) }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 T  C6 }2 v. d* U$ a& F  V8 b7 _
) ^- E2 N( e4 K) r! `9 E/ e- Q; Z6 j' \% Y4 A; ^$ R$ R; p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 12:41 , Processed in 0.039279 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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