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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 f' y$ J, q8 V3 w% O0 m
  1. [code]EDMA sample test application  `8 v8 R2 V$ ]
  2. /*4 \  p/ ?8 o  @9 C/ U
  3. * edma_test.c
    1 ?0 f2 x6 Z& q& s
  4. *& d3 C5 B, N& c% ^7 f/ J$ m; v5 V9 E
  5. * brief  EDMA3 Test Application" ]- c" I$ D  g' k& g6 [
  6. *
    # d7 {) f  p. \
  7. *   This file contains EDMA3 Test code.
    4 P- u  T- T6 O8 g& ~4 F  `( p5 d5 a
  8. *4 v9 c, C" W1 T4 N8 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ z6 \2 u  p) A* D  T1 E$ ]1 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ q" a4 a' s! }- T$ F
  11. *         TO CHANGE.! ]) L! c# t- n
  12. *. R. @  X6 n3 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 z6 h: ~5 f# ]2 Y0 M6 Q. {
  14. *# l, ~" o7 _# p6 i8 b, ]4 t4 B8 r
  15. * This program is free software; you can redistribute it and/or6 G' b9 @2 m2 ^7 P% ?$ L
  16. * modify it under the terms of the GNU General Public License as
    & T( d- t$ i1 C1 l/ N7 x
  17. * published by the Free Software Foundation version 2.& c. o( m  o+ N) D  Y; l
  18. *4 C* c3 [8 S5 t# i/ m& S2 k. f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: z" W+ ?9 m. u
  20. * kind, whether express or implied; without even the implied warranty9 \! t) Q, C5 a8 E0 z) D* n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 y7 U6 I& E# p  q+ Z. n
  22. * GNU General Public License for more details.
    . U8 b9 }9 m3 ?8 G8 o
  23. */' g$ J4 {2 Y. K- n- S7 z
  24. ( t) i; S  l( d, v" [% Z( y8 M8 V  c# J. j
  25. #include <linux/module.h>% }0 s6 h5 G$ J1 Y
  26. #include <linux/init.h>
    ' o* t7 _( b* Z
  27. #include <linux/errno.h>; T, O: P- W, T) \( a
  28. #include <linux/types.h>
    + ?% \1 d  ~4 j- C' M) f
  29. #include <linux/interrupt.h>  @% s# v2 l6 ~7 m- k2 n
  30. #include <asm/io.h>
    : a$ B% k5 |$ k2 l+ J8 |
  31. #include <linux/moduleparam.h># Y2 |. b! i6 K5 q" L3 j* n
  32. #include <linux/sysctl.h>3 |; x5 k( X9 e& C+ p% @
  33. #include <linux/mm.h>
    " P5 T; v# F; p* C7 Z
  34. #include <linux/dma-mapping.h>3 Y, M+ G- u9 H, z

  35. ! Y  u+ ?% G$ j* m' ^
  36. #include <mach/memory.h>" T% W. R4 L" b# Q$ i1 H& z
  37. #include <mach/hardware.h>+ ~+ w4 |& x9 [2 O5 M
  38. #include <mach/irqs.h>5 I% v6 H$ m+ {9 B: ~
  39. #include <asm/hardware/edma.h>2 R& T% I9 k7 ]" K

  40. ; a' h/ v1 v2 e# Z- |% W
  41. #undef EDMA3_DEBUG, N) T9 Z! W. Q$ {7 [4 c, [" t& C
  42. /*#define EDMA3_DEBUG*/- p$ c' h) x% B
  43. $ n& P- n, b6 E# ?) Y
  44. #ifdef EDMA3_DEBUG
    ' N% G% y1 H1 N" n# I% J6 _6 _: z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 E) @5 I( ~, C. w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / P: t+ B- v- l; O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% c% `% b$ }2 J7 L
  48. #else5 q$ f6 [) W1 m$ U( T9 s
  49. #define DMA_PRINTK( x... )
    " |4 m$ _* g8 J* ?: w$ e4 c
  50. #define DMA_FN_IN
    / P% X; h& j3 C
  51. #define DMA_FN_OUT5 |* w" A# D8 {9 X- @" @  s
  52. #endif
      K9 v" O  \5 |+ ]

  53. ' o) E/ g, G4 x1 P! r$ j* S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( ^, a8 [2 F9 v. s5 \
  55. #define STATIC_SHIFT                3
    9 M9 c8 @0 h1 e6 c" K  }1 |
  56. #define TCINTEN_SHIFT               20
    + Z/ Z' C4 {: R1 Y' ?
  57. #define ITCINTEN_SHIFT              21$ o+ j. i5 f7 W
  58. #define TCCHEN_SHIFT                22
    + Y0 c' ~1 z7 e1 l4 M) }0 g
  59. #define ITCCHEN_SHIFT               23
    ; y2 }, i, P; o0 _- ~& |
  60. + I# r  Q* C1 k# T9 ^& J: v: H: Q' q
  61. static volatile int irqraised1 = 0;- X# S6 Z' T$ f/ I
  62. static volatile int irqraised2 = 0;3 E7 f( f5 x1 l# |0 I

  63. 4 L% S$ S/ g: W% L8 _, [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! V6 m7 `9 l' b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 u* u1 G. g! j8 B% }# f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      K$ O/ K( c1 b8 V' ?0 V
  67. . J( c" n! ?+ @: N' W$ Z
  68. dma_addr_t dmaphyssrc1 = 0;
    ! O* w; P. s% ?' ~9 W; J
  69. dma_addr_t dmaphyssrc2 = 0;4 ^% O7 d. g, j6 m% B, Y
  70. dma_addr_t dmaphysdest1 = 0;4 d. J+ z4 ^8 j# {5 B- y. `
  71. dma_addr_t dmaphysdest2 = 0;
    8 s+ ^0 ~" G6 b9 [' g7 e# [

  72. 1 K/ }+ p6 M- ~
  73. char *dmabufsrc1 = NULL;
    1 i! q" L+ O6 _
  74. char *dmabufsrc2 = NULL;8 h) B! d$ ?: s% U
  75. char *dmabufdest1 = NULL;
    ' r: l) @2 C. M2 M" d; \
  76. char *dmabufdest2 = NULL;0 L7 |8 [1 t6 N1 D4 Z2 B
  77. 6 l+ w- w, T& i$ r1 f0 q
  78. static int acnt = 512;
    ! X& \5 {* a2 X$ m
  79. static int bcnt = 8;3 c6 _" ?- U4 H4 c1 |3 F' R9 ^
  80. static int ccnt = 8;+ Y" S2 _, |8 s0 W6 |1 }9 T; z
  81. ) s4 u+ H$ S$ y  [# d
  82. module_param(acnt, int, S_IRUGO);# C& h2 N3 t7 {$ _
  83. module_param(bcnt, int, S_IRUGO);
    ' d; s5 G* O8 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 p; R% v9 F! h+ j8 X1 I
+ P* s2 K4 |- y- n; Z- U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! j) [6 D1 d) c) e' C) Q0 n) \# Y! j0 H2 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 Q) O/ Z* {& x/ ?
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 T- b' }% K$ k$ Q& P# Z
/ {( H( v2 U8 L1 ]3 g7 h. ?" s1 t) j( x$ m, `& n2 e% c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 11:10 , Processed in 0.039200 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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