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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 Q( @# C3 I, Y, b# r! h, R
  1. [code]EDMA sample test application
    $ E2 V6 ?; T6 y1 I
  2. /*- i$ H8 u$ U1 l9 D4 H
  3. * edma_test.c
    " u) w8 l: l1 K" s: W/ g& t% E4 a0 d
  4. *5 g2 C  b" f5 ~
  5. * brief  EDMA3 Test Application3 Q* G- z7 X+ x2 j0 B( t
  6. *6 k. ]1 w0 Z# L5 F  ~3 z2 k9 T; _2 y7 e
  7. *   This file contains EDMA3 Test code.
    ( R% e- a  U, z. n6 w0 V+ I0 g
  8. *
    ( O) A: T& F) p- C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 Y% `6 U4 Q4 E  b% E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , r2 f+ Y% t# X: ]
  11. *         TO CHANGE.
    % X% I  h9 y# s# L3 R! P
  12. *
    9 t- o. t+ I8 ^, b4 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: k& h, p- j! O. ?. O
  14. *) ^& _- C7 F. v6 W, Y
  15. * This program is free software; you can redistribute it and/or
    7 [8 z* y2 s- j3 J
  16. * modify it under the terms of the GNU General Public License as6 D# r5 G) \9 t% z) L
  17. * published by the Free Software Foundation version 2.
    # Q; S5 H0 M1 b+ ?8 J9 k
  18. *. g1 f: \$ v9 m+ m& p+ q+ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Q& @* p: T2 n  d9 H
  20. * kind, whether express or implied; without even the implied warranty
    4 ^4 @' K0 \) [$ e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ \  ~; s+ Q" t, c" }" ~; v
  22. * GNU General Public License for more details.) k$ B3 m! z2 t" y1 ~
  23. */; t( J7 w- v+ ?* \
  24. 8 {; h" l! G5 P
  25. #include <linux/module.h>
    . T4 P7 p7 {9 t/ N" P
  26. #include <linux/init.h>
    1 \8 c1 {# v# h2 d' m
  27. #include <linux/errno.h>4 S: o3 @, F4 {/ V; C% Y- j2 X% p
  28. #include <linux/types.h>
      K( m& c9 L* O1 D& {3 U
  29. #include <linux/interrupt.h>+ X! {8 g: K' n; z  I8 \
  30. #include <asm/io.h>' o% W; @2 C1 }: n, N8 x! n0 q
  31. #include <linux/moduleparam.h>
    0 Y. [' E4 F& G4 R, p
  32. #include <linux/sysctl.h>
    & m2 i) @  Z# Z4 [5 q! j0 Q
  33. #include <linux/mm.h>+ n  X7 @9 h7 }) L( k5 X
  34. #include <linux/dma-mapping.h>
    : F9 E6 K( |. C7 u2 B

  35. - Y* L/ @; S' D  E: E  `% y
  36. #include <mach/memory.h>
    ) }) ~+ p. X" M
  37. #include <mach/hardware.h>
    1 N# X& T7 U* P& A. t% Y" w
  38. #include <mach/irqs.h>
    5 s6 {5 ^+ `8 v, c  Z! A/ m4 O
  39. #include <asm/hardware/edma.h>
    - }8 _/ _7 S9 g; H9 `( A
  40. # ^6 L! u8 ], d2 w  K, f  F
  41. #undef EDMA3_DEBUG
    # _- b9 [. R( B# P6 e1 c0 `
  42. /*#define EDMA3_DEBUG*/4 _8 E- p4 @& i+ X- F

  43. 0 Y. B+ u, G' G! L9 o: p$ g9 H
  44. #ifdef EDMA3_DEBUG
    4 F% a6 [0 C' A! P$ y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); L; {; d9 O, x0 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : \9 D* R; h9 e7 h- B3 {' k3 \/ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `) _* B' Q. v0 w' v
  48. #else1 n4 e7 f" t" k0 _. Y/ A7 b3 x; Z
  49. #define DMA_PRINTK( x... ). N& J4 q) ]( h/ m5 E- }
  50. #define DMA_FN_IN, C2 {/ m& a. D% c2 D! N
  51. #define DMA_FN_OUT
    ; D' }9 j5 f- ^& v$ X; G
  52. #endif8 W8 j/ \% f5 {: M

  53. ! X, D5 @+ C$ q& k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 O/ f( L; l$ B
  55. #define STATIC_SHIFT                3; {) ?; U' A, {& t& c
  56. #define TCINTEN_SHIFT               20
      P0 H$ y6 K$ S( R
  57. #define ITCINTEN_SHIFT              21
    0 J* S, s8 X# _# Z
  58. #define TCCHEN_SHIFT                22
    4 V+ q7 b6 F4 \. P2 r) P
  59. #define ITCCHEN_SHIFT               231 w( c3 t8 Z: n1 H: q7 \) \
  60. ; f- w5 p& ]4 Z/ U$ T7 G
  61. static volatile int irqraised1 = 0;' d  g: w2 s. X! s" |
  62. static volatile int irqraised2 = 0;* g7 f  D" k* a& a' F- H5 ?+ f
  63. " \; W% z  _1 J4 ^& \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 }( F5 _9 C0 z. C/ d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * K" K: e) W2 k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% U( y9 D: V# v* A

  67. 5 }  _6 _. x- \  m* s, p% T
  68. dma_addr_t dmaphyssrc1 = 0;
    % v3 A# N6 V7 G4 t' x% B% }. K$ Z
  69. dma_addr_t dmaphyssrc2 = 0;) R# Z0 i; S" m% i1 X4 r
  70. dma_addr_t dmaphysdest1 = 0;7 c' s" v; z1 P
  71. dma_addr_t dmaphysdest2 = 0;
    ( x% k0 L7 ~7 G' h3 L' p1 Z8 c4 S

  72. 4 X' s: ~! K0 }' J2 g8 `$ Q, n
  73. char *dmabufsrc1 = NULL;' ?9 ^0 [0 |6 X7 ?9 O
  74. char *dmabufsrc2 = NULL;
    1 t9 K; V3 A( L1 K  w7 h
  75. char *dmabufdest1 = NULL;
    ( d& u4 F8 v, ]" T
  76. char *dmabufdest2 = NULL;- p1 R5 [4 i, Y3 z  K

  77. / h5 B( U4 y( l/ y" H8 M7 \
  78. static int acnt = 512;- V* g  T! `8 V# k# B
  79. static int bcnt = 8;
    3 Z* T2 T/ C0 G- M$ Z
  80. static int ccnt = 8;' e( J1 F3 N' T7 A
  81. , o% w" C7 V: E, W: a
  82. module_param(acnt, int, S_IRUGO);; r$ Q) l# S- j1 i' w$ r9 f* z; w
  83. module_param(bcnt, int, S_IRUGO);
    5 R' S! F: c$ a) k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 s. K* U( t1 ~: {& T3 p# g) m) Y0 M, A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' O* b9 [- C9 S0 N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. X) l5 X7 ~9 I) ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 ~& [, @7 r4 t8 ]7 e0 E8 B  @1 B

/ s: H! ^6 A0 U% K4 V( V7 p% Q1 T% ?1 m# s7 U9 V: `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-2 21:59 , Processed in 0.036675 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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