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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* P! ]7 ]# ?3 x
  1. [code]EDMA sample test application* _5 _1 s: N$ k) J. g, ~
  2. /*
    & v0 y: J2 q8 q1 J
  3. * edma_test.c
    " v0 f; ^8 S* ?9 |( _8 }
  4. *$ G0 t# k- ~2 H5 F) Z
  5. * brief  EDMA3 Test Application
    . O9 p; M3 ?7 @
  6. *# O0 I7 [( Y* p! {0 L2 V
  7. *   This file contains EDMA3 Test code.
    & c6 w8 P0 l0 d
  8. *
    5 G  D  `3 @4 c  e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; |! D/ J, c. f8 C! O, o' U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : b, i3 q/ Q0 f2 o
  11. *         TO CHANGE.
    - d. |% ~+ N8 V* L6 E& x
  12. *
    $ B% q9 `2 D1 n( m( l  t2 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 Y4 W& T& i6 O
  14. *
    ) k  }$ e9 A- J4 U, {! C- E% G
  15. * This program is free software; you can redistribute it and/or4 v3 c3 Y  L  G; V
  16. * modify it under the terms of the GNU General Public License as2 w4 O; @4 Y$ P
  17. * published by the Free Software Foundation version 2.
    4 I$ P, L1 c7 ?: x3 p
  18. *
    7 k' e0 G* a" ]$ G+ s% c' _% m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * S5 A' r. R$ ]* O1 p
  20. * kind, whether express or implied; without even the implied warranty
      {$ T: y7 X6 i2 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 r. N4 W; K* \
  22. * GNU General Public License for more details.1 r5 T: U+ W% N0 j
  23. */
    + r, v: m5 ]$ ~
  24. ( h9 x- V  a6 N. z  ^& r
  25. #include <linux/module.h># j  V" J  c) Q1 F- X
  26. #include <linux/init.h>! t6 k( d1 _, q
  27. #include <linux/errno.h>1 g% Q6 d; b) c/ ~) p; w, f% `
  28. #include <linux/types.h>& n* }# w) z  ^% E. D0 T' v
  29. #include <linux/interrupt.h>
    6 [  l$ T- ?' M& b9 i1 X
  30. #include <asm/io.h>7 a! G& Q, ]; J1 `/ M# S. K: ~
  31. #include <linux/moduleparam.h>$ G+ d" }9 p( X8 L- e. ]9 G  J
  32. #include <linux/sysctl.h>; x! F9 G6 W. |5 q% E! n
  33. #include <linux/mm.h>
    ) G+ ^! `6 q& f
  34. #include <linux/dma-mapping.h>- o( z- ~$ U5 x
  35. + b0 `7 z8 J: M7 S3 g
  36. #include <mach/memory.h>
    / l9 j1 u: A/ j. L! V1 n2 ?$ G
  37. #include <mach/hardware.h>9 U2 ]% p- ~/ R, u8 s) L
  38. #include <mach/irqs.h>
    + `# }/ M& u+ @0 t& l$ h  e$ p% U
  39. #include <asm/hardware/edma.h>3 l5 l# e; F3 g: R, u" W+ `
  40. 0 V2 v# X0 p& Q  i0 {
  41. #undef EDMA3_DEBUG
      A/ B9 R0 p: h
  42. /*#define EDMA3_DEBUG*/
    9 |2 p! U6 F# X) O
  43. ; Q- J* E% u1 @8 I4 ?$ A/ \
  44. #ifdef EDMA3_DEBUG9 u! ?: n; l* {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' F# P  ?1 F1 \$ c- x& ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ d/ }( s, z' r5 Z( c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 p; S! D7 c  m% @% u+ S
  48. #else
    % f9 A3 E+ s( Y, I, a+ L
  49. #define DMA_PRINTK( x... )
    + M/ P( ^7 @, }6 D  A
  50. #define DMA_FN_IN
    5 O5 h, O7 J; `6 N2 S
  51. #define DMA_FN_OUT9 F% k5 |( Y0 z# E9 V6 B5 m! U9 E4 C3 {
  52. #endif! o5 j5 b" W8 a* x2 ]  u; e
  53. 0 ~& ]# L3 J0 n1 A' }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' V9 Y, V9 ^5 [+ ~1 e% {# l
  55. #define STATIC_SHIFT                3
    . v, g4 k- J! K$ ]1 H2 c' W
  56. #define TCINTEN_SHIFT               20
    + C. c+ F3 q4 P  Q* H* n
  57. #define ITCINTEN_SHIFT              21
    9 k7 C7 o3 ]  v6 S; K  U
  58. #define TCCHEN_SHIFT                22
    ' y& X& F4 U5 s% u- b, X4 i
  59. #define ITCCHEN_SHIFT               23$ j; s- Z) X5 r% Q

  60. 0 `9 ~$ C& i8 Z* E
  61. static volatile int irqraised1 = 0;
    ) E) M, e3 \! c* J
  62. static volatile int irqraised2 = 0;
    ) q) p# @3 A* \

  63. 7 a" q+ n2 n- ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w3 U6 h) ~; g, ]7 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 t# t5 n3 n$ q# z( \& }- V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 {9 e- W! ~0 o# W  Q
  67. , z+ W( y( E4 U( ]8 l
  68. dma_addr_t dmaphyssrc1 = 0;
    2 L  Z! ?% `+ }$ \" J1 k
  69. dma_addr_t dmaphyssrc2 = 0;
    ; E& O8 P5 `+ O: \- ]1 V1 F
  70. dma_addr_t dmaphysdest1 = 0;2 T4 l1 t3 @" Z! {
  71. dma_addr_t dmaphysdest2 = 0;
    + i; P: W7 y. m8 T2 Y
  72. 2 Y$ e1 a2 w* q2 G5 N
  73. char *dmabufsrc1 = NULL;
    4 |- B5 d) P+ `
  74. char *dmabufsrc2 = NULL;
    % a3 b1 w$ e0 C% @- B% ]* A
  75. char *dmabufdest1 = NULL;2 l6 w) [3 y" Y! m) b: P$ B
  76. char *dmabufdest2 = NULL;9 ~& F# \/ X( H$ p8 N3 v

  77. 9 g* N3 ?/ O- j! @3 q$ Z+ x
  78. static int acnt = 512;
    " ]. l# d7 v; q$ F) E1 J' ~% |2 K
  79. static int bcnt = 8;
    & Q6 H* I: q, X* D! P
  80. static int ccnt = 8;9 b; D3 l+ Z: z- t: t) \

  81. . @3 k2 a# @& c2 m
  82. module_param(acnt, int, S_IRUGO);5 D, |: A. w/ S9 X
  83. module_param(bcnt, int, S_IRUGO);
    , v* c+ m. \/ r, Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 c- i7 F* y. M* @
5 N. ]4 v. }' v) ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ~  y4 v; N1 O4 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- C+ q0 ?* r0 \7 E3 ^6 c) b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& g0 |" [0 \- C2 X, V  E% I2 N  @3 U9 T

6 S8 o& u; s6 L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 19:50 , Processed in 0.041029 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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