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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 d4 X" x7 K2 P5 x; T) l
  1. [code]EDMA sample test application
    5 ^1 i- P3 e5 \; R4 o
  2. /*: L8 |! f; Z) g9 _
  3. * edma_test.c
    8 e4 c& l8 f1 p! Q3 f7 Q2 {
  4. *
    7 a$ g% }% e& t/ U
  5. * brief  EDMA3 Test Application  x) U  d- K! u9 C
  6. *! b; I/ P# Y& B9 T5 @# @/ t
  7. *   This file contains EDMA3 Test code.( T! M& s+ ~) z
  8. *
      }) W2 C) c1 @' \0 Z% ]0 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / Q% H# B; L2 m, P  @+ F7 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 N1 b2 z- H- ~
  11. *         TO CHANGE.
    ( y! G" I, I% [4 u! X
  12. *
    - p% `, h( V1 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / v/ L: `8 w; _8 @; a9 i
  14. *& b; Z0 W- o/ |6 C) \  Q6 m
  15. * This program is free software; you can redistribute it and/or( z* T9 c  v7 R% W) R% b* m
  16. * modify it under the terms of the GNU General Public License as
    # O4 b# Q3 F. ?, x# K$ d
  17. * published by the Free Software Foundation version 2.5 y! M( ?- j- A( w8 W
  18. *, H& B/ p3 ]  g# l4 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # G1 e0 B8 }9 T
  20. * kind, whether express or implied; without even the implied warranty$ I/ u' z. k% y5 P& n2 p9 E1 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! r0 R% [8 [& b4 T
  22. * GNU General Public License for more details.
    , ]1 U8 B0 _9 n- S0 Z- W
  23. */
    ' r8 A& t, M4 x
  24. $ @0 H( F7 r! Q7 g( M/ P
  25. #include <linux/module.h>- b) M# Y$ F! t# j
  26. #include <linux/init.h>
    " R  K% w4 p' M+ X7 [
  27. #include <linux/errno.h>6 M7 T; L4 |, p: v! f& `4 ^  O
  28. #include <linux/types.h>
    ( C$ a! n* K" A0 s. m2 }5 R
  29. #include <linux/interrupt.h>8 g) F6 }! m$ G
  30. #include <asm/io.h>: v: b# g& n' s" e
  31. #include <linux/moduleparam.h>
      q7 P. F3 a" \  M* A
  32. #include <linux/sysctl.h>
    ; L- Y* G& }5 {7 K
  33. #include <linux/mm.h>' ?2 N! w5 t/ v5 R: G% ~( f
  34. #include <linux/dma-mapping.h># T; f0 H- c' N

  35. 0 R" |" H1 F/ O+ e$ {' J# ~' h& h* j& D
  36. #include <mach/memory.h>
    # ^. U# e, o+ }- y5 {' @
  37. #include <mach/hardware.h>. v: f6 s  o) p& ^
  38. #include <mach/irqs.h>) K3 a# k# |+ f! c# `
  39. #include <asm/hardware/edma.h>+ N2 o% Q) k# E' _
  40. " [: b  j2 r+ e/ P0 E
  41. #undef EDMA3_DEBUG
    $ E0 W  K0 r8 f3 k  P$ Y
  42. /*#define EDMA3_DEBUG*/, }, h/ w( d7 F9 l1 x& {. V$ z
  43. . J5 `8 u; \, ]* G, @6 X* k
  44. #ifdef EDMA3_DEBUG7 n/ }& r# Q1 F% p, Q. j- D3 ]5 \& F: {: I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % \/ H, e$ P, t4 X- z4 D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 y5 a: E7 b' [9 G  s8 N0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 h# z; M6 `- Q9 J1 {
  48. #else
    ' ?- Y: ~/ D! R2 `3 L, g
  49. #define DMA_PRINTK( x... )
    4 `1 X0 O- n# D
  50. #define DMA_FN_IN& u0 p' y& I% S% C. s
  51. #define DMA_FN_OUT2 T/ Q# D+ [3 E* w, _
  52. #endif
    0 t# h% n. B7 V7 C) t

  53. % U, e6 G3 }7 R1 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / D9 G2 b: f$ v. ^+ V6 }7 x6 Q
  55. #define STATIC_SHIFT                3
    # d+ y7 m# I* e# u3 o  Z
  56. #define TCINTEN_SHIFT               20
    # f# ^% A$ Y# s  W1 ~
  57. #define ITCINTEN_SHIFT              21$ [6 _4 `& Z4 e" b
  58. #define TCCHEN_SHIFT                22) W6 w' A# O1 @" s2 V2 b0 g# B
  59. #define ITCCHEN_SHIFT               23/ q  |/ i( C; z) L) j8 F) a
  60. 9 t: c" F% t4 u2 k% d
  61. static volatile int irqraised1 = 0;1 W! A  J9 o/ Z1 K: }2 |
  62. static volatile int irqraised2 = 0;5 Y/ C2 M3 M" b. a4 p

  63. 5 N" G8 h3 }% J7 Q8 F4 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 H( Y" W4 D. _& w4 u1 e  `7 q/ S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % K; N8 t: z* \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      }4 u7 ?) m* P9 x4 y# c
  67. 1 }! k8 d% l' A/ X
  68. dma_addr_t dmaphyssrc1 = 0;
    % x- l" G- s" f8 K
  69. dma_addr_t dmaphyssrc2 = 0;
    4 D3 C7 P* g0 K$ d; H! {
  70. dma_addr_t dmaphysdest1 = 0;
    * D+ L( Q) J1 z$ p
  71. dma_addr_t dmaphysdest2 = 0;( e2 [0 e6 B- C
  72. , h4 T6 n) V; Z! j: r8 V1 E
  73. char *dmabufsrc1 = NULL;% h+ a) r+ v; C( g# d: J
  74. char *dmabufsrc2 = NULL;! d' A; |. m, V- I" u" y5 u+ Z
  75. char *dmabufdest1 = NULL;
    5 B! X, O# ^# R' w
  76. char *dmabufdest2 = NULL;
    9 O1 g9 }3 t. Y; `4 Y4 `

  77. 7 k$ k% q8 Q' q1 ?8 a! X2 f2 t  I$ |
  78. static int acnt = 512;0 S8 Q2 O7 e" v! P4 n
  79. static int bcnt = 8;0 P' Y5 Q1 \7 C; j2 ^
  80. static int ccnt = 8;8 ]( s) E5 u5 ], ?/ R9 s4 u

  81. / D- F, l7 h$ d- r' s( y  l2 i
  82. module_param(acnt, int, S_IRUGO);
    ! k0 ]1 S. X) k  F0 r
  83. module_param(bcnt, int, S_IRUGO);' {6 ]- g. U9 @7 x4 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& _: ~9 g! k+ O

  a5 h% Z2 m/ G      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 c2 Z: f- u. K* q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  ?: R: ~# i5 o+ C0 C5 d/ }9 T* V5 `9 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' y8 ]; T5 D# v# |6 @6 F* \4 i' O# E
/ z! K  j* _; S1 f1 U+ v7 I- q5 h5 Z8 G8 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 06:03 , Processed in 0.038435 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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