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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, L: C& @. ]/ f
  1. [code]EDMA sample test application
    , G) `5 ^) ?. y, H9 a
  2. /*
    / e* N, @* s7 B/ Q# H. K
  3. * edma_test.c
    6 P& z& Z. ]# ^0 V1 b. F+ s
  4. *
    & f. z* v' X1 W+ ]
  5. * brief  EDMA3 Test Application3 u8 b$ o2 _7 n! b) D6 Y. W7 M
  6. *
    " L- m  s  P0 V/ C
  7. *   This file contains EDMA3 Test code.
    : p* y8 I, Q; U- O8 g" k# y$ B
  8. *
    8 e8 s4 t. {: S! K  P* x, ]/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * g  _: l' Z$ c/ r* S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 Z  B% ~' p( F5 |7 H' b0 ^
  11. *         TO CHANGE.7 y* R3 J4 x0 [1 Q2 l. d* i
  12. *  e. N! C8 W4 z' N: ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  c4 V; @  k1 e) X6 U
  14. *
    + `& l* x! |1 K) r- X
  15. * This program is free software; you can redistribute it and/or% M5 Z7 ^# }/ r: u7 y' M
  16. * modify it under the terms of the GNU General Public License as# T3 k+ {( c5 ^7 R, U
  17. * published by the Free Software Foundation version 2.& r1 E. H1 k# a9 `/ p
  18. *; q- J% X! c0 J6 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % }7 b1 n9 T/ `; ]8 }
  20. * kind, whether express or implied; without even the implied warranty  d' H5 Z* z" u, |; o( V! f: v- N  ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 ~* m/ O/ X1 _* r) ?$ H
  22. * GNU General Public License for more details.
    6 }  G3 G0 ?* |0 c+ v5 O& e
  23. */
    - ^+ C; T% A, S# [, Y# o
  24. ( Y+ L( l& G9 q9 n7 p
  25. #include <linux/module.h>* O/ @# m- q% G7 v
  26. #include <linux/init.h>0 i/ Z. s$ M1 C1 Y' n( K9 v
  27. #include <linux/errno.h>
    . ~$ ^# M' P. q
  28. #include <linux/types.h>: d3 d3 T2 Q5 h  S
  29. #include <linux/interrupt.h>$ s% T% A0 L2 g) k" W
  30. #include <asm/io.h>
    ' N3 n4 Y4 L: c/ U4 S! j" S! H
  31. #include <linux/moduleparam.h>& x9 D* `) y5 a+ S
  32. #include <linux/sysctl.h>6 j6 V: P7 h9 y- d
  33. #include <linux/mm.h>
    3 D0 p4 R( ?) [4 l2 B" Y$ X
  34. #include <linux/dma-mapping.h>
    & K5 H9 z. E! P1 m4 N" \
  35. ( u* r! ~0 h* C5 V+ b
  36. #include <mach/memory.h>/ I' Z, A5 v# h: @0 ~; B
  37. #include <mach/hardware.h>& F1 F! ]9 a* J" @% `6 N
  38. #include <mach/irqs.h>: t& {2 j: E) E% e# G8 ]% g+ h5 M
  39. #include <asm/hardware/edma.h>
    / H9 _9 m/ j4 ?

  40. , j; Z0 A! G4 M
  41. #undef EDMA3_DEBUG
    $ K% L% [6 D0 r, z, X
  42. /*#define EDMA3_DEBUG*/
    * z7 ]% y! B' P% R( h: P
  43. 5 C+ e5 o9 o6 |8 Y8 x; t. _; u
  44. #ifdef EDMA3_DEBUG
    9 u) l6 A% m4 x: F. L: s5 x2 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% `! u9 {5 T) ?7 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), g$ \* c; X, }7 \6 j0 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  y$ A5 r6 H3 T6 k& x* Y5 u7 W" S; |
  48. #else
    * g1 }: V0 J7 J, l1 G8 O
  49. #define DMA_PRINTK( x... )
    4 X; ^; c1 l0 P" s8 X7 x: M) v
  50. #define DMA_FN_IN& g9 B; z4 i1 A5 r0 D
  51. #define DMA_FN_OUT% U! P6 r6 P1 b5 R- J' V( P( i
  52. #endif1 ]% [- h" X1 p$ s/ H
  53. ; L- x( e0 [4 m/ p  w8 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& a  F5 J% @+ N% y
  55. #define STATIC_SHIFT                3
    5 o& t. x3 h9 E
  56. #define TCINTEN_SHIFT               20
    % e# Q7 j# h$ z0 a
  57. #define ITCINTEN_SHIFT              21
    8 o( K/ |* d& L' m6 ?7 R( j9 k1 _
  58. #define TCCHEN_SHIFT                221 X$ y, ?8 P6 Z! f
  59. #define ITCCHEN_SHIFT               23# r8 l! j% C! w

  60. - b4 @4 {7 b8 n# j( Z! {
  61. static volatile int irqraised1 = 0;) W. ]* |4 l9 D; G8 w* V7 i
  62. static volatile int irqraised2 = 0;
    * v* a( c; {! t& o; f6 u- Q: B' z9 F

  63. # }  ?) [6 J  C& f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; u" p0 z" J9 x0 U! Z- H% u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; X, O! f, b1 M, U& ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 e6 V4 M# U) O  x( G( J# \3 A" _

  67. ' r+ O) d# r8 i) Y& K7 ?( x
  68. dma_addr_t dmaphyssrc1 = 0;
    2 u+ O" Z; N' h4 B
  69. dma_addr_t dmaphyssrc2 = 0;
    4 O( I: C& ~8 G& h
  70. dma_addr_t dmaphysdest1 = 0;# d/ S/ q5 N4 P" F  y% |
  71. dma_addr_t dmaphysdest2 = 0;
    . G* s4 b* A6 ?* q/ r
  72. 2 e8 J9 f" Y0 a( u, v
  73. char *dmabufsrc1 = NULL;
    4 X2 w: M8 v, ~& p+ S
  74. char *dmabufsrc2 = NULL;
    ) s9 Y  o+ D9 s9 M1 f+ B
  75. char *dmabufdest1 = NULL;6 S0 l) n. t8 \: ]! d
  76. char *dmabufdest2 = NULL;
    - [) v9 z* s- P9 g

  77. " J' y9 ^) g& J% Q% y; j
  78. static int acnt = 512;
    ; a5 x2 `* x2 {( T8 z* T9 C, w
  79. static int bcnt = 8;1 b) }; Y' z) E! \9 N- A
  80. static int ccnt = 8;: d: g' \% ^' i7 }; H- E2 a* s
  81. 4 ^: A3 n1 b( r# X' B6 i
  82. module_param(acnt, int, S_IRUGO);
    1 Z" S% [8 `: R6 ~% v5 |5 Y# L
  83. module_param(bcnt, int, S_IRUGO);: Y% ], E. _/ l' [, ~4 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 r+ q6 f6 L$ u: e4 }

+ g2 H5 w0 }6 \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Z8 j$ @: ~0 T  L& e% ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 q2 M5 e% F0 ^2 E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ R5 ^$ F) S; }8 Q: A. C' i8 \% {* u2 [! U, ?6 M

' j% ?( `8 w! l, |. {' s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 05:50 , Processed in 0.052310 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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