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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* C& Y4 t/ h4 }3 A
  1. [code]EDMA sample test application7 Z) `5 p+ p2 f4 D1 i: w
  2. /** ?  Q* ]4 h6 t; G; E! X
  3. * edma_test.c
    ; q% A$ \1 s% [% c& i. ]
  4. *
    ; _: N# q+ ~4 v" Z: i
  5. * brief  EDMA3 Test Application5 W8 m* J$ [2 ^  k2 g4 R2 o+ r
  6. *
    ; l) j% e- }1 G- [$ S
  7. *   This file contains EDMA3 Test code.5 p- J; }1 M9 S- h
  8. *
    , I) z! K8 _  E: b) n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & N. k" n7 L- |8 R* [' c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 P$ {. n, p- T8 W1 d
  11. *         TO CHANGE.
    2 F) h; V( }3 L4 Y* D/ z- r
  12. *2 ?+ x. Y- Z  e. {3 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 y% N9 l/ s# Q5 m
  14. *
    % L9 s2 s3 |7 Q' b! i; p
  15. * This program is free software; you can redistribute it and/or% s1 H1 ?4 K4 e/ V+ K6 g& L! C( O
  16. * modify it under the terms of the GNU General Public License as6 B9 l( D: b" {( Y
  17. * published by the Free Software Foundation version 2.. L- J) l* [4 o! X; T* k
  18. *! r% D3 B' D  \% Z# D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 L- D- S: o5 D  P
  20. * kind, whether express or implied; without even the implied warranty% `4 h5 d& H2 S  _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % d) O( v: h( B/ g5 C/ k5 y- @- M
  22. * GNU General Public License for more details.& a3 J$ t7 @0 k
  23. */
    8 [# n# R. Y! Y6 N, ^% o
  24. 8 k  \" m+ A2 _
  25. #include <linux/module.h>
    ( c# o. U6 P% Z
  26. #include <linux/init.h>% b" o& t& [; k. O( Z6 Q, c; T
  27. #include <linux/errno.h>
      E- A" U" ?. h9 g: j' `
  28. #include <linux/types.h>, C  B( \7 R6 {+ G* J* w) v% n
  29. #include <linux/interrupt.h>3 k+ o4 w7 e  ^; E
  30. #include <asm/io.h>7 ~4 E7 [$ m5 H: A
  31. #include <linux/moduleparam.h>
      f' @8 d/ t" k+ S; R
  32. #include <linux/sysctl.h>& o( k4 Y1 n1 p
  33. #include <linux/mm.h># \6 e! U! Y5 E
  34. #include <linux/dma-mapping.h>  Q7 u% e8 ~. Y- v, @

  35. 7 ]9 p" k. q( m
  36. #include <mach/memory.h>" I: \: w) E% W, S4 V4 D
  37. #include <mach/hardware.h>
    : \" Y: M" b8 {. g6 j) G7 ?; w5 t
  38. #include <mach/irqs.h>
    3 c6 }$ g3 p0 e
  39. #include <asm/hardware/edma.h>
    - y2 r" ~; ~7 w2 H

  40. 0 j! V" s: `* K# ]# ^4 j3 y
  41. #undef EDMA3_DEBUG8 P4 N7 a- B4 b2 m- R- ]3 y% _1 a& N0 Z% J
  42. /*#define EDMA3_DEBUG*/
    ' w7 k  Z' t" B* L/ ^

  43. + ], b% r7 I. h
  44. #ifdef EDMA3_DEBUG
    8 T/ ~2 V  x6 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- Q; s" r: D' o4 s7 H* F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + y( O* V9 V- U& A' I$ w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 ~0 K) w! Z2 r
  48. #else2 B) Z+ t' m) G" w: U( S
  49. #define DMA_PRINTK( x... ); U+ n2 j( R: p' ?6 ~  k
  50. #define DMA_FN_IN! A6 ~1 n6 H( z9 s
  51. #define DMA_FN_OUT
    0 |! w& T3 O* }. _0 _6 v
  52. #endif. H1 L& F/ G: a" s) ?) d

  53. ! y2 E0 A+ C5 c6 w5 u5 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)9 ^' c' {( v5 _  m2 x6 c
  55. #define STATIC_SHIFT                3
    7 i( l8 u. W' V' J1 n
  56. #define TCINTEN_SHIFT               20  e) _2 M$ Y+ H% a0 F# b( Y2 a5 w
  57. #define ITCINTEN_SHIFT              21
    . Y/ S8 \0 o. z
  58. #define TCCHEN_SHIFT                22
    7 B4 n# R- l& _( K. _( S4 u
  59. #define ITCCHEN_SHIFT               23- E& o+ A. w4 d+ M+ V6 h% d

  60. + m1 O6 J) J3 V
  61. static volatile int irqraised1 = 0;/ r- u: o( S7 ~7 ~* I5 \3 x
  62. static volatile int irqraised2 = 0;0 Y. ]' z! m9 b# D) D3 _+ v& r1 r

  63. ' `8 V! W: ^9 b0 I$ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " b  K% z! |$ y' Y' d  _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / H4 E, m$ u8 }/ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) O7 Z+ h1 n$ u. r/ ?$ _

  67. * {8 `& ~" u, T
  68. dma_addr_t dmaphyssrc1 = 0;
    1 S3 w* `$ a, q# A) f6 y
  69. dma_addr_t dmaphyssrc2 = 0;
    $ m0 o& J; L- r5 B( \1 ]: N
  70. dma_addr_t dmaphysdest1 = 0;
    # e- l' g- h) J
  71. dma_addr_t dmaphysdest2 = 0;: q6 G$ A1 e3 c, J# Q3 r4 X
  72. : X! w. x+ O0 G5 C
  73. char *dmabufsrc1 = NULL;: v, O' s; z& G; B8 ^7 \
  74. char *dmabufsrc2 = NULL;  a' m) z0 M! L4 P3 G# ~
  75. char *dmabufdest1 = NULL;
      O: D$ \8 Z! P4 i
  76. char *dmabufdest2 = NULL;4 ^0 H# N% U! i4 u; ^+ V7 Y+ J
  77. + ^) U/ Y8 ^6 q+ V
  78. static int acnt = 512;
    4 }( H, r/ F( ^: H! q! A: D
  79. static int bcnt = 8;
    . }/ B! H3 V- p# c: s5 h
  80. static int ccnt = 8;1 y' `) h% y! b
  81. 0 i/ {  a0 K! L
  82. module_param(acnt, int, S_IRUGO);5 l: W% P; Z+ R* \
  83. module_param(bcnt, int, S_IRUGO);4 y1 l9 E* M% o0 C4 J8 X3 L4 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! v8 `! S2 G* g9 P& k

1 l, e1 R! U* D! V! |$ H" x. o! M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 @9 g9 @7 ~+ g% R% @% warm-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 e4 R6 J8 F) G  M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 r1 b7 s$ ~' Y0 n/ i

9 D2 x4 ?1 Y0 L9 O% f9 x  ^8 J( j9 A& j8 y. u: X; T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 16:45 , Processed in 0.042664 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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