OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 U9 A  i* v' h. Z$ |) Y
  1. [code]EDMA sample test application2 e! z! K* f" o# m0 X! B6 Y
  2. /*
    $ u' G3 e$ i0 O, E  k
  3. * edma_test.c
    7 a2 h0 S- ~- ]0 Q( A' S) v
  4. *$ w& u' b/ `5 D* \
  5. * brief  EDMA3 Test Application
    4 A+ z% e* ~* g! j; D% V
  6. *# q: a7 n. z$ R$ ?2 c" }4 B
  7. *   This file contains EDMA3 Test code.
    ! a! u' r$ ~& t/ f6 [* P& J7 W
  8. *
    ! I( X% N  d4 F. t! U$ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- `4 x/ N) m3 ], H5 ~- K: Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& ]( H% s0 M* O/ ]3 n1 ?) W3 j: N
  11. *         TO CHANGE., `" L- i3 E7 g4 N3 s: v
  12. *! C5 T- f5 M& l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 m3 O" T3 k3 e3 n1 s& T8 x7 G
  14. *
    : s4 s0 Z$ g4 Y+ r! _) J& V
  15. * This program is free software; you can redistribute it and/or- `, G) d  f) d9 \  N
  16. * modify it under the terms of the GNU General Public License as  [8 j7 R% n8 ~/ ~" e, E3 w0 m
  17. * published by the Free Software Foundation version 2.! }5 l. W! }7 a5 r) Q
  18. *
    . l2 p* Y# e5 y; I! @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ I: U* h2 `# K# x8 C2 Q8 ]
  20. * kind, whether express or implied; without even the implied warranty
    + x2 o8 c" S9 I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 W" Y) K8 Z5 Y* b2 |
  22. * GNU General Public License for more details.
    & b# B  Q9 q4 D) Z" ~4 b
  23. */
    $ W1 e; ?3 h. E5 u

  24. : A0 V1 a/ V$ g2 T3 ~0 m
  25. #include <linux/module.h>. v: G& v7 l5 g0 ?, |7 f4 m
  26. #include <linux/init.h>$ a$ q& J* L. I+ }. }
  27. #include <linux/errno.h>
    7 m8 L% `' S- K
  28. #include <linux/types.h>
    5 O: q& D* ]: m. I
  29. #include <linux/interrupt.h>
    1 i9 K+ e& _& i2 J( _
  30. #include <asm/io.h>- ^- [+ S# O; M0 u$ {: G* [
  31. #include <linux/moduleparam.h>
    - }- f& u  u; D  V9 c; |* ^
  32. #include <linux/sysctl.h>
    3 k2 t8 P9 t; F/ P5 j  m
  33. #include <linux/mm.h>
    ! ]/ G( s* v8 w- q+ n, N' E" X) X
  34. #include <linux/dma-mapping.h>( F  ~+ M& X( U5 w8 {2 {8 B% ?2 I

  35. ; A* O" s! d3 s
  36. #include <mach/memory.h>3 R1 A2 @2 e2 w3 z: \$ W4 v3 e+ N$ N
  37. #include <mach/hardware.h>, a7 B$ b& t" z& X/ ]5 n
  38. #include <mach/irqs.h>9 f* f% u4 e8 x# D
  39. #include <asm/hardware/edma.h>! B- }- I' l& u4 C' ~
  40. ! T& R" [9 \5 Q% e. X2 O
  41. #undef EDMA3_DEBUG
    . p, y+ N1 h- F8 b$ a9 K# z
  42. /*#define EDMA3_DEBUG*/
    3 o  W! T0 _" T; a
  43. / |/ {  [; _2 |) H$ V& ^, ?
  44. #ifdef EDMA3_DEBUG
    8 ]  m$ x6 e- c8 g6 W" i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 w2 P: w" F3 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 q; E* Z1 K9 `8 H9 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! r# L. ]4 n; f- Z5 |! H
  48. #else6 a1 `( I' }) Z- y* O( }. n
  49. #define DMA_PRINTK( x... )# m* P: x# o8 o1 g6 y4 i
  50. #define DMA_FN_IN$ Y2 s& H- J4 u1 c8 Z+ M
  51. #define DMA_FN_OUT- ?. y4 P% x; C- n- e
  52. #endif4 @4 ?, B6 V% z! E+ c* d

  53. * N) J$ L- x0 `' ]$ r( ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 Y$ l' T) f  A# m7 ^# ^! _
  55. #define STATIC_SHIFT                31 f: Z6 ?5 r. T+ v" [/ |  l
  56. #define TCINTEN_SHIFT               20
    " T  m: ]3 {* o; u
  57. #define ITCINTEN_SHIFT              21
    ( p. K- c1 A+ D4 B9 ^& q; w
  58. #define TCCHEN_SHIFT                220 b! D4 V4 w" Q
  59. #define ITCCHEN_SHIFT               23
    ' b8 W6 s$ g0 E2 T
  60. 9 x1 _7 L+ t8 f' M+ S9 _  G+ ]6 U
  61. static volatile int irqraised1 = 0;
    / B: j& S+ a2 I4 z' Y
  62. static volatile int irqraised2 = 0;
    " i& _/ [8 H, ?, Y3 W. S5 ?* H
  63. * m  D! [, J+ v; h( a0 I$ L$ M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 N$ E3 ~% w3 B; E6 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( f# A7 n9 ^; n! [7 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s% K7 @  y  m+ V9 u7 T1 P

  67. ; A* o* l/ b% Q1 m: g/ c
  68. dma_addr_t dmaphyssrc1 = 0;& X% l- v! a& i5 y# G. T9 O5 m7 Q
  69. dma_addr_t dmaphyssrc2 = 0;8 A# S& X" \; \- T
  70. dma_addr_t dmaphysdest1 = 0;
    ! o! w7 ?. D9 w, u- F) z
  71. dma_addr_t dmaphysdest2 = 0;/ G9 I  g4 j# K
  72. $ J& J) v; n2 s5 r
  73. char *dmabufsrc1 = NULL;% H& I3 T+ A0 }% O/ a
  74. char *dmabufsrc2 = NULL;' G4 M1 u2 s$ }7 i% S
  75. char *dmabufdest1 = NULL;, T7 E6 C3 l$ K( J# W
  76. char *dmabufdest2 = NULL;
    7 x; b5 v5 r  b

  77. . T' U9 k. J# ?; H: w
  78. static int acnt = 512;" T# g4 g4 o# J! p' ^
  79. static int bcnt = 8;1 ^$ m9 A4 T$ d; _% l# s
  80. static int ccnt = 8;
    ) J4 n7 g) m+ u! j+ F( ^7 {; a
  81. 5 B; R, J$ u  b2 P, r# W
  82. module_param(acnt, int, S_IRUGO);$ r: W! r$ u3 K1 |/ R9 ~
  83. module_param(bcnt, int, S_IRUGO);3 |3 c1 i/ U( a
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' c* q; O  `/ p/ x3 t0 g
$ C$ q/ ~4 h7 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# Y+ ?7 P/ J- e; U; O' C  Y# Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, O* S0 J5 O& c# j3 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% U' X$ b: C9 [$ n+ |1 f/ x' P" [

" ]: ^4 u% k- Y6 n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 15:36 , Processed in 0.037579 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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