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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 5549|回复: 0

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
发表于 2018-1-30 11:01:43 | 显示全部楼层 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! K) @/ R& w+ U6 `1 r1 }6 J
  1. [code]EDMA sample test application  N8 r' U/ O, }' x
  2. /*
    % Z1 S2 |3 }" F
  3. * edma_test.c4 R' \0 f( E1 c% T7 Q$ y+ E0 `
  4. *. F) x; p4 z% y. w, Z
  5. * brief  EDMA3 Test Application+ e! }" j1 y6 w0 m* J
  6. *' s, t2 A; R* y
  7. *   This file contains EDMA3 Test code.
    3 Z9 ?' G1 f# [8 r' r$ u
  8. *% ^2 z8 ~* D% \5 v" {. [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ J" f& H, F* w% Q; K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 V$ V" c& ^5 E$ D/ w
  11. *         TO CHANGE.( E+ E' u( ?, @/ H  k, t% `6 s
  12. *) N& D: I6 G; Y+ C8 i/ K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 H) ^) X$ p* L+ V) s- T, g
  14. *
    : ?6 k/ t) ~5 C1 I
  15. * This program is free software; you can redistribute it and/or
    5 j  r; `7 Z- X7 O. k: q7 e, o
  16. * modify it under the terms of the GNU General Public License as
    . J! r, b! r3 c) S& p  K' v: l0 b
  17. * published by the Free Software Foundation version 2.
    7 e; W/ f, ?# X+ \" q1 r
  18. *
    & v9 z, u- s9 T; J5 D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 f: _3 f+ x4 x  k
  20. * kind, whether express or implied; without even the implied warranty
    ) v8 O& c$ H1 P1 {) W( q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# P6 }8 e) l2 U& I) }( {
  22. * GNU General Public License for more details.9 [9 W; e- P- C) d+ H' r
  23. */. f" e- x" f7 I/ E1 H% d
  24. 6 p8 s1 C" J6 F" q
  25. #include <linux/module.h>
      `3 h: `  K4 y9 S; l( W6 t
  26. #include <linux/init.h>, N6 [8 j3 i6 G: s6 N1 {2 h3 q5 g
  27. #include <linux/errno.h>8 [6 n5 T9 F+ m- M
  28. #include <linux/types.h>0 M2 ?6 `/ d- ]6 C
  29. #include <linux/interrupt.h>. ?. o0 T1 v7 Y) l! ~
  30. #include <asm/io.h>
    ; W4 i, I! A4 U( k: y3 }  t
  31. #include <linux/moduleparam.h>, M: `% U! q; W
  32. #include <linux/sysctl.h>
    / X# _; v* b4 a/ ~9 w. l: X8 t
  33. #include <linux/mm.h>* l  l9 n! o4 A5 j/ K
  34. #include <linux/dma-mapping.h>* c! t% V) l) A5 [* D6 H4 @8 y. H1 Y

  35. ' l. u4 Y3 C" a, U
  36. #include <mach/memory.h>& a  h7 o, x2 I
  37. #include <mach/hardware.h>2 d# y5 d) e& i/ V9 J: Y
  38. #include <mach/irqs.h>
    . I! l8 F# u% v$ U4 P0 L' i
  39. #include <asm/hardware/edma.h>
    & U1 F, w# ~) m/ G9 L
  40. 7 [0 }$ v1 C8 t6 U$ P# N& k
  41. #undef EDMA3_DEBUG
    5 z( _% R  ^# V3 d$ N# O
  42. /*#define EDMA3_DEBUG*/
      b% D( w* J6 f/ G7 U$ x+ Q
  43. $ _: f# X' n  u, ^  L1 X% ]
  44. #ifdef EDMA3_DEBUG$ k, d# n: U' J8 }/ Y6 m$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 v2 ^* T. J9 O* B* a' h+ \; M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 z  T" G3 j' Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 m* ~/ z0 g' j# q8 `/ ^# I" B- m
  48. #else
    4 i4 u8 r2 O5 ^3 r
  49. #define DMA_PRINTK( x... )8 x( @& \" i. d# Q; y/ k( L
  50. #define DMA_FN_IN
    : A  e7 E9 o0 `/ t" H4 t, V7 a
  51. #define DMA_FN_OUT
    * g0 X+ M8 `# A: e
  52. #endif0 ]- {9 a1 U- _5 Y4 T" p5 F# N

  53. : Z) H! M6 o5 t; D3 W( P* h/ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 E  `9 x$ q  S- \
  55. #define STATIC_SHIFT                3$ d" j, `) U9 @; f9 g  f( ?7 ^4 J
  56. #define TCINTEN_SHIFT               20/ C6 f. {, f/ o  ?, x" W3 h# K5 N
  57. #define ITCINTEN_SHIFT              21, u" a6 w6 o9 T4 f& [
  58. #define TCCHEN_SHIFT                22
    # P+ S0 h' W$ f/ Z1 W$ B
  59. #define ITCCHEN_SHIFT               23
    9 @% e) q  N) H

  60.   ?$ w. B  c& G
  61. static volatile int irqraised1 = 0;) a8 o* _7 J& d$ h+ O8 j
  62. static volatile int irqraised2 = 0;
    . {/ a6 z+ J* A3 F5 U* W8 H

  63. / o, Q* t0 }6 r/ B# j. `9 l% y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 S( X* `# }$ d8 d1 @* i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      i1 Y  P# _) f& B1 ]# j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  |( U5 A% g' g
  67. ' o, Y# y2 [; G* Q8 n  Q1 R9 @
  68. dma_addr_t dmaphyssrc1 = 0;
    : D0 f+ N5 @2 ?5 i  p
  69. dma_addr_t dmaphyssrc2 = 0;6 y" W4 T# c+ s- @, ]. w! S
  70. dma_addr_t dmaphysdest1 = 0;
    & _4 G. a& N: S3 q( G
  71. dma_addr_t dmaphysdest2 = 0;
    ' Q4 @& s& N: Q

  72. 0 p7 e" g+ q6 {3 @, p3 [+ {
  73. char *dmabufsrc1 = NULL;7 m; B/ G) Y7 T, }
  74. char *dmabufsrc2 = NULL;
    . s, r$ n8 e2 e
  75. char *dmabufdest1 = NULL;
    8 i& @& ~3 }( r& H" Q2 ]3 v9 m7 r9 [
  76. char *dmabufdest2 = NULL;+ ]- M& ^, m5 \; r( U

  77. ! ]5 c6 g1 d  J; {5 e1 b
  78. static int acnt = 512;
    1 o3 `; t0 o7 }% E8 X2 \
  79. static int bcnt = 8;
    7 Z- Z" `/ C0 e; J) E
  80. static int ccnt = 8;5 @% k5 R1 o! q+ s

  81. 2 K" k3 _% `( V- x9 G7 w% R% }
  82. module_param(acnt, int, S_IRUGO);
    / u+ x# T( G% Q3 n) i1 `
  83. module_param(bcnt, int, S_IRUGO);. }* }$ o" z" {5 `/ N9 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Q0 @0 [8 p( J& n9 Z  x4 Y+ w9 {( Y7 a) `8 v" w* ~' i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: d% n8 f% M7 w0 j$ A! C* G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: }3 x4 |' X8 L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 Y6 k3 s1 N; f: a0 S+ B% N/ T
" b3 ^* |& y, t0 ?- ^7 J" D. c- F7 a, m3 h  {) ]$ E* b1 [2 }; Y. y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-16 18:31 , Processed in 0.037680 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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