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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \$ q6 t* t+ E# e3 X5 l
  1. [code]EDMA sample test application5 `" a8 _/ A& q$ B
  2. /*: T) S/ I& V3 ?' S% u& f
  3. * edma_test.c& C% C3 G$ |1 x$ n( b0 S4 o& Z
  4. *
    8 W% h" z- o# y/ P: W
  5. * brief  EDMA3 Test Application
    0 }3 u6 s5 ~  e$ ]' h, l/ d7 _
  6. *% q# ]# n! l: g' Q% a
  7. *   This file contains EDMA3 Test code.1 y8 R; h! I. R( o0 n
  8. *1 _7 Q1 Y( ^8 h7 ^. A. k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 h% X1 h) L1 E% i! }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 N: d; T. V# B. |# r& U
  11. *         TO CHANGE.
    ! _3 D( t+ h" L7 a7 S# {) T
  12. *2 f: s7 o2 N, Q( k4 u' E# d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 u/ B! n3 D% G  X6 _# k  M! B
  14. *
      U9 O1 o6 L1 [* @, s0 F3 J7 J
  15. * This program is free software; you can redistribute it and/or5 l4 q) S0 m2 K: U/ Q2 o
  16. * modify it under the terms of the GNU General Public License as
    ) t3 T( w  e: i8 ]
  17. * published by the Free Software Foundation version 2.: _! [5 _8 V+ D7 ]& R4 s
  18. *. }* P! X3 a) }: u  |, a+ V% x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , N. q3 G5 u, U0 Y1 ?0 |( D" }
  20. * kind, whether express or implied; without even the implied warranty  T1 x+ s6 d4 L" u) t7 e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 o0 o- D& @* U7 R
  22. * GNU General Public License for more details.
    : v9 P" j% Z7 y  g$ ?. f7 B
  23. */6 `3 B3 T" z# j4 \# |
  24. * |, s- i  f, V$ s: S+ h3 G: Z- C
  25. #include <linux/module.h>9 q2 U* v) V5 d. `  h2 y+ f
  26. #include <linux/init.h>
    4 N) H$ w# @' Y  m' d& ~% v
  27. #include <linux/errno.h>
    , U; J* C7 }( E+ J7 I: g. o' u
  28. #include <linux/types.h>1 a5 W1 \8 g( h" ?
  29. #include <linux/interrupt.h>9 I. _; y- r5 g
  30. #include <asm/io.h>6 R: I6 c( B8 o% n  E7 D8 \) `
  31. #include <linux/moduleparam.h>4 C4 v5 N3 @, Q- N, j: }
  32. #include <linux/sysctl.h>3 R0 t" E, c( \
  33. #include <linux/mm.h>! U1 F" ^" S" Q8 I5 g
  34. #include <linux/dma-mapping.h>
    9 v' Z2 [* m& Z& h. ]4 V4 J' u

  35. 9 }6 B! l  G* Q: ^' V0 {
  36. #include <mach/memory.h>9 {4 C) P4 Q. l! D3 M' k% ~3 i
  37. #include <mach/hardware.h>1 y4 p6 V4 i' i
  38. #include <mach/irqs.h>' p' V: q% t2 d
  39. #include <asm/hardware/edma.h>
    0 p4 ^: H/ B, O. x$ a3 R
  40. 5 c5 y1 B8 G5 v& ?7 }) R* F
  41. #undef EDMA3_DEBUG
    ) H3 G+ ?( X1 ^
  42. /*#define EDMA3_DEBUG*/0 v( S# X  ]' e
  43. " f7 Q9 E* v# {) I9 t5 U+ K& d8 \, J
  44. #ifdef EDMA3_DEBUG. V5 ?7 P, n; u- g" G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! _) l' O, A, m% t( E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" I* i: n& Y+ q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ v4 A9 n9 b& J; l$ l9 s
  48. #else
    ) ?! ~4 z! a+ Y
  49. #define DMA_PRINTK( x... )1 e' Q5 b/ h9 e' P- U+ f/ J
  50. #define DMA_FN_IN
    4 z% T4 f  T& S4 |3 f" D% q
  51. #define DMA_FN_OUT
    6 N5 i4 C1 s5 ^! e
  52. #endif
    8 B$ K& B3 U! v2 L  N
  53. 5 i$ p: A3 g5 a. X4 p# Y" t, F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ l6 B+ O' c4 o
  55. #define STATIC_SHIFT                38 p, ^- J0 `* F- M- K6 t, v# W
  56. #define TCINTEN_SHIFT               201 s+ W0 K  K  [1 s4 J. W
  57. #define ITCINTEN_SHIFT              21
    / X* g9 S' w4 t; C8 k* T3 }
  58. #define TCCHEN_SHIFT                226 T. ~9 M2 u; S6 i. X
  59. #define ITCCHEN_SHIFT               230 {; v/ [& p; I8 x) t: H, A1 R8 l$ Q

  60. 6 j, F4 E4 r( n0 R4 z( V& U
  61. static volatile int irqraised1 = 0;
    : F# }0 y% t9 D  Q9 H" h4 r) H; y
  62. static volatile int irqraised2 = 0;
    ' J% N7 G# D( _% \/ }% H
  63. . y9 Q3 V! s( _4 |3 j( ^4 ^! f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]$ F9 h$ }/ D, m6 i6 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 t. v/ y$ F" H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / P- T1 h7 v/ q

  67. ; E: H  W3 L8 C0 u; p8 Z4 h
  68. dma_addr_t dmaphyssrc1 = 0;
    ' \7 I' ^3 R% o% i/ @( g( _. v: @
  69. dma_addr_t dmaphyssrc2 = 0;9 R& E% w/ z# g7 e5 J
  70. dma_addr_t dmaphysdest1 = 0;3 p# g; C5 F* g3 G, e  M9 S
  71. dma_addr_t dmaphysdest2 = 0;& M' C4 q( R9 D* o; S
  72. 5 j/ |' F% w0 P2 b$ X
  73. char *dmabufsrc1 = NULL;
    2 p0 o* @' @0 j; b2 L5 U
  74. char *dmabufsrc2 = NULL;
    & Q" a. p1 J; s! \1 N
  75. char *dmabufdest1 = NULL;
    ; M) N/ @' G% Y
  76. char *dmabufdest2 = NULL;. ~3 _$ V1 T; l1 L' V
  77. ! p. O0 v) A. Q9 P9 O9 w2 t( Z8 w9 T
  78. static int acnt = 512;& F) ~$ g7 K7 k6 r( u6 ~: }
  79. static int bcnt = 8;6 W4 j4 [" ^0 A7 W4 g0 @8 Z
  80. static int ccnt = 8;7 c) c& ~# @# O) f
  81. ; B2 P% D- H  y, u* H
  82. module_param(acnt, int, S_IRUGO);
    . x' _& H" a/ X+ Z9 q+ O
  83. module_param(bcnt, int, S_IRUGO);4 \& D& a8 P! D; d0 t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 j  g) }- j  \" k' u+ H& q. n) ^0 o0 U4 P3 J+ x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' V- A5 d* h4 r0 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( y+ X7 z  D% T" u2 P7 D8 |& I     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 l! G* O6 b9 [2 F- u
' r& [6 N. g5 Y. a* O
. f3 n. U& M; H& s2 b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 08:31 , Processed in 0.063781 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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