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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 t  ~- }9 n. I
  1. [code]EDMA sample test application, y; v8 i3 m& b2 _! p# v
  2. /*- t% {. Y# ?. M  i9 j; D
  3. * edma_test.c
    4 M( A2 D/ K7 L8 n  f. a5 L
  4. */ m% b3 M" \) C( }' s% ]- F
  5. * brief  EDMA3 Test Application
    3 T3 \+ Q4 P) X
  6. *
    0 @2 q( B. Y3 Y3 E) _
  7. *   This file contains EDMA3 Test code." X7 P0 T/ n' z0 |4 g' {5 S
  8. *
    $ A" @) w9 R1 H+ C+ g1 n2 G4 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + O9 {& d8 G; z( _2 {- I- ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  i' }( ]6 s6 \4 [- k% ?& L
  11. *         TO CHANGE.
    : X- a3 ~5 \# v6 \
  12. *
    ' [/ a) {2 ^6 Y2 x6 U# H. K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 s. W, [: F" S, s
  14. *
    ) d! J* R- e8 W6 ~* \9 N
  15. * This program is free software; you can redistribute it and/or) k0 p. c: d9 W) G' U, h5 N8 W, U
  16. * modify it under the terms of the GNU General Public License as/ a. N* y, U$ [7 C; y' _  p( \
  17. * published by the Free Software Foundation version 2.
    , P6 g" j& n$ I, m
  18. *7 f3 t, g7 Y3 {$ e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 s0 J- Y' I# h$ a
  20. * kind, whether express or implied; without even the implied warranty
    1 P! ~! T9 }/ N; w& n& \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 g+ @( d" H5 ?5 y6 X
  22. * GNU General Public License for more details.
    3 S/ `  x6 W6 b- K- G7 @* E2 \3 h
  23. */$ h3 t9 y) ]. f' f/ G" n
  24. ! b& b. ]( \+ I  b2 B4 O& b
  25. #include <linux/module.h>) f( @& I# z0 {5 y) l. r9 v
  26. #include <linux/init.h>
    ; J4 Y; B2 @; D" F) B) R& a
  27. #include <linux/errno.h># v! v( m: l" y6 Y5 d) W
  28. #include <linux/types.h>1 b$ K  x2 [" X" A; @, k
  29. #include <linux/interrupt.h>
    " j! Y' f9 }- h" Z6 s$ U0 A
  30. #include <asm/io.h>9 K3 a* n4 m$ Q" c$ b
  31. #include <linux/moduleparam.h>8 C, y: b& H7 W. H, B1 R- g
  32. #include <linux/sysctl.h>4 p3 Z: Q7 i8 W9 w
  33. #include <linux/mm.h>& L4 l$ t/ ?( d* @1 C: z
  34. #include <linux/dma-mapping.h>
    . l0 ?3 h, O7 B6 F4 i( b1 a
  35. ' y# O$ V; x1 [4 i. e8 D3 N( b
  36. #include <mach/memory.h>
    - V1 G& f! }1 X4 ^! g; p6 h
  37. #include <mach/hardware.h>" p2 K7 u- x  c4 `; A- Q  P
  38. #include <mach/irqs.h>
    $ Q. P! R' b: M, H3 n+ s$ f
  39. #include <asm/hardware/edma.h>
    & j- S. q: K7 v( A% R2 h6 e2 h0 J: E

  40. 1 x% a! C' n, w5 W% A  X
  41. #undef EDMA3_DEBUG
    # E9 _/ y; i+ I+ U" ?( U
  42. /*#define EDMA3_DEBUG*/
    / X* b! O( N( n

  43. 8 C$ _( u  Y! n4 t2 m' e
  44. #ifdef EDMA3_DEBUG
    # p4 m+ q" j/ @9 V- s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 f& t8 Y; K9 l3 E  ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 N2 D" P, N" a% ^* u; O" f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( ^8 z- o+ W5 z. m4 ~' o' a
  48. #else$ O1 u+ Q, o) ^. q. J
  49. #define DMA_PRINTK( x... )2 e& |" x; ~- u* K( P1 l4 O9 i9 [
  50. #define DMA_FN_IN: w9 _6 N' [" V1 M: _  l
  51. #define DMA_FN_OUT
    6 z" H! H3 B- }  o8 F' B3 O0 U
  52. #endif/ M- u/ b5 |. a) h' \

  53. * ?, e2 W5 a9 J5 e9 W3 i) A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# }% K4 w1 p& o% ^  G9 z  Y1 r
  55. #define STATIC_SHIFT                3
    & G7 u$ ]1 @* V6 z
  56. #define TCINTEN_SHIFT               20& l) F2 G4 E) W$ w
  57. #define ITCINTEN_SHIFT              21
    $ S4 n# _1 f$ g- s" y
  58. #define TCCHEN_SHIFT                22
    1 K& O' a' T3 ^0 B" M  a1 L# ~! P
  59. #define ITCCHEN_SHIFT               23
    9 Q% H- {9 U3 h& U9 Z" m9 o# D

  60. . S' ^# W' a* j
  61. static volatile int irqraised1 = 0;+ U. }: l' q) A# @4 w
  62. static volatile int irqraised2 = 0;" G) a! g! I! Q! H/ l% {  O, p

  63. $ Q! ^6 j% w+ T1 T6 Z7 A' G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) u. n* o9 X9 C
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, V+ c/ V" B. V) X! ~- h2 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- c- w9 ^* S6 S. D  R: A; b8 O
  67. % n( p! y4 ^, y2 H
  68. dma_addr_t dmaphyssrc1 = 0;
    3 N0 b2 s6 L- K; u* _+ w$ \! E: A& @
  69. dma_addr_t dmaphyssrc2 = 0;8 b5 o* ~1 N% }' f
  70. dma_addr_t dmaphysdest1 = 0;- s$ x/ d' G8 ~4 w8 z
  71. dma_addr_t dmaphysdest2 = 0;
    4 O) |8 o$ W7 f" G0 S1 z3 q& m* r

  72. $ x: B. b& R. M7 o" b; U, }* H
  73. char *dmabufsrc1 = NULL;
    2 ?% R, C) V# p' d
  74. char *dmabufsrc2 = NULL;! h; ^+ P" `2 ~& U+ i1 W
  75. char *dmabufdest1 = NULL;
    * x6 V- Q; Q; R% w& x8 M' d+ @
  76. char *dmabufdest2 = NULL;
    : L/ V# b- u/ z& ]/ L; U
  77. % [" U# w3 J: k: u, ]  h
  78. static int acnt = 512;
    ) Q! S2 j0 f  S4 R
  79. static int bcnt = 8;
    ! R% g3 a; r* _8 I  z7 G% A
  80. static int ccnt = 8;
    . A- }- K& v! Y: u* _7 t

  81. ; Q% I$ [# [* T
  82. module_param(acnt, int, S_IRUGO);
    , d, }$ ?/ D" h0 C$ J
  83. module_param(bcnt, int, S_IRUGO);
    . B. h& ?: ?& j5 E: f2 e6 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 P+ |  J/ Z6 [( s0 V

5 z+ g& w. ]- Z/ K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 U- ?" s" j7 harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. R3 i  P0 |+ ~- O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( E5 L/ ~- w  h' l

) E2 t+ e" P, _5 F1 y8 k- J1 y0 {' a4 ^7 k- |) D7 e6 p; B* Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 15:49 , Processed in 0.040456 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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