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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Y  }7 R- T9 W( g7 q7 {8 [
  1. [code]EDMA sample test application6 ~3 Y) m: `" ?' V8 v4 _
  2. /*
    * W. [2 }- E: N# p! Q  r  T" F( @
  3. * edma_test.c
    " s  f* E; g0 w
  4. *
    ! T" x5 K, P& a' v
  5. * brief  EDMA3 Test Application8 R0 N3 a, N9 i
  6. *+ f* i8 `2 W9 g. x! }8 d' t6 ?
  7. *   This file contains EDMA3 Test code.
    & @1 Y6 m# A$ X) @6 i: F
  8. *
    * A1 J9 B2 X) ?. W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 |, ]$ l8 `6 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) G- ~8 m5 T& y) ^( Z7 T* e
  11. *         TO CHANGE.3 z. {0 P# m/ p' `* L* S
  12. *) L% @& `! v" r& `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ P% Z" D$ j5 G. I/ G6 M
  14. *' h' }% A" M+ q9 ~) |) e) ]& J# u
  15. * This program is free software; you can redistribute it and/or
    ; i' O. j* A9 @) f' J  ~/ V2 {; [
  16. * modify it under the terms of the GNU General Public License as% [8 c' v( E1 W$ @/ g
  17. * published by the Free Software Foundation version 2.
    6 V( |, ?+ m- Q$ n' O1 A7 B6 \6 A
  18. *" U0 v- E$ D5 c2 l, W* V4 I- _# ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' b7 Y; Y" x9 P2 }1 U$ {
  20. * kind, whether express or implied; without even the implied warranty; K1 ?  `: k( z4 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' y) x+ N" W0 Z
  22. * GNU General Public License for more details.& I! c% \( I- Y8 j# f1 {; v
  23. */- e7 f1 `7 u) [- ]4 G. x
  24. , n9 u* k, \# l9 A; Y
  25. #include <linux/module.h>) ?- ~* J: G6 x% d* E6 ~; w
  26. #include <linux/init.h># @5 K" Y  l" R& c- |
  27. #include <linux/errno.h>
    * ~6 ]. V7 s0 m9 C$ l
  28. #include <linux/types.h># M  X) O7 P9 \: A. V: \" A
  29. #include <linux/interrupt.h>. f' g+ U7 E3 m2 h% O/ |0 A
  30. #include <asm/io.h>
    8 i; T* b) X/ n& J
  31. #include <linux/moduleparam.h>
    3 X# s6 l4 t+ }6 s) d
  32. #include <linux/sysctl.h>) \& t2 c8 I+ Z+ @* {& o
  33. #include <linux/mm.h>+ I; f5 t/ m; x' x9 O2 n/ c
  34. #include <linux/dma-mapping.h>
    - y: P3 I# `, F

  35. $ f9 G$ {* a) d- v0 B2 o
  36. #include <mach/memory.h>9 H0 z4 e5 S- {' p$ e
  37. #include <mach/hardware.h>/ f9 o5 f, T6 U
  38. #include <mach/irqs.h>
    . r6 P* F# s7 _0 k- V
  39. #include <asm/hardware/edma.h>
    - q- [4 M, j; U3 j
  40. & y4 t" V% P1 Z
  41. #undef EDMA3_DEBUG8 ^) k7 r) B# Q
  42. /*#define EDMA3_DEBUG*/9 ]( F2 Q, }$ r. r7 z/ v; p+ @
  43. / A1 H- ?7 {; v3 x, l1 ^- |, l! J
  44. #ifdef EDMA3_DEBUG% L- w/ B  H  J! s0 ]9 }4 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* d) @/ K* r! H% Z0 l( @% A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 w. R9 ~+ ?5 t8 ?9 z1 X% V
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; t/ r* p  s+ D: E2 Y5 V2 M
  48. #else+ s- e; v' @( \9 }1 q5 s9 f
  49. #define DMA_PRINTK( x... )4 `2 V- C, B1 x- [! H. O" e
  50. #define DMA_FN_IN
    % y; A6 u+ \" }4 p% {
  51. #define DMA_FN_OUT
    - _6 Y; H1 }* V- P8 A/ w
  52. #endif
    4 O; g% r5 X& r; e+ l5 @
  53.   M4 w& u* L+ i$ j/ M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , N2 F3 p: x% I& d% m5 T
  55. #define STATIC_SHIFT                3' [, Q* z  ^, ?* R1 a5 t
  56. #define TCINTEN_SHIFT               20! ?* J2 m% h" |2 U+ X
  57. #define ITCINTEN_SHIFT              213 R5 a2 V% {( [% x3 G; ]# w
  58. #define TCCHEN_SHIFT                22- b8 s( V! k/ t
  59. #define ITCCHEN_SHIFT               23. f3 B, D/ y# Y. e
  60. 0 f7 h6 j8 Q4 v% m3 G) A; Z6 B0 u  E
  61. static volatile int irqraised1 = 0;$ U; c1 X+ c$ [; |
  62. static volatile int irqraised2 = 0;: R* F3 R$ @& g1 F

  63. ' ~, b" C, a9 X* u( @9 Z6 C% i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f7 L( n: k' t7 s, f: {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t% b& x  G- c' c/ w1 ~! Y( G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : u; C- J8 j+ @) J8 f

  67. " D0 @5 {( e0 R2 e+ i- b
  68. dma_addr_t dmaphyssrc1 = 0;9 s9 D7 t0 b( q  e9 s, y, c
  69. dma_addr_t dmaphyssrc2 = 0;
    9 v( ]6 `) b: O8 H: d+ ?9 V
  70. dma_addr_t dmaphysdest1 = 0;' r6 H% R+ Q7 j: u+ Q8 F
  71. dma_addr_t dmaphysdest2 = 0;
    % D* p$ k1 ~* |5 L2 D& u9 b( Q

  72. 6 K* g9 Z/ m- E' ]$ H- P% l* G& N
  73. char *dmabufsrc1 = NULL;+ |. i) H8 w5 W# z; R
  74. char *dmabufsrc2 = NULL;( L" A) p/ X% j, e  Q- z
  75. char *dmabufdest1 = NULL;% X1 ]- U/ M! m. x! M6 l# \& Q! t
  76. char *dmabufdest2 = NULL;2 Y$ o6 C. \% B; a# U: R* {

  77. 1 [5 d, }' F4 s  Z: U. V
  78. static int acnt = 512;% M- V" `. q0 |
  79. static int bcnt = 8;
    - O& }, F+ |# p: \+ |& g/ S& G
  80. static int ccnt = 8;) G: M/ \9 O) c4 l$ S" g

  81. 1 S- O& {$ X  _5 z4 {
  82. module_param(acnt, int, S_IRUGO);: S$ u3 Z# [# H$ S$ N
  83. module_param(bcnt, int, S_IRUGO);
      y/ w1 J- ]' T1 n* j+ c( S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 Y2 n( r# Z& ?' |  \2 Y8 U

5 D3 S" V: F0 m" n+ {' x7 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, x0 G+ z+ t+ ?% y$ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 `' T" p5 o) {3 b& f8 P" c+ @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! M8 f# I. i/ `4 a# v1 F; L* H; Z9 ?8 a9 Q. N( N

) D9 R+ Z4 C$ J5 Z: O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-9 03:48 , Processed in 0.038660 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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