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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ]" F) @6 U, {0 S; {5 s( g1 O
  1. [code]EDMA sample test application
    3 A. y" \% z# R3 \
  2. /*2 F: _" ~5 S* r( Z+ x! ]
  3. * edma_test.c8 A- W1 p  f- w1 p1 O( ^1 f& A
  4. *  N# b; t+ h+ ^: g
  5. * brief  EDMA3 Test Application
    8 Q8 Z! {1 D; b. V4 s, A- D. T
  6. *" B# K( ^5 R  A) D7 A7 v1 [4 N
  7. *   This file contains EDMA3 Test code.
    6 ~  Q9 G4 o' o
  8. *
    / x' X( e. N( b# T: {6 `3 L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 A/ t2 U$ x, X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / O0 a2 w( ^0 F; S& ?3 ~
  11. *         TO CHANGE.4 e6 `0 f% M- o' f3 z2 ~
  12. *7 P2 H; f2 |9 D: p+ j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' T4 u0 z) L. x! e
  14. *
    ; I7 C" z" {# e2 F. ]8 {
  15. * This program is free software; you can redistribute it and/or3 f4 w# s1 M' d. ?' q5 G- S3 C
  16. * modify it under the terms of the GNU General Public License as% I' a3 @# |$ q+ x* O6 b$ H  p& ]2 Y
  17. * published by the Free Software Foundation version 2." _6 f/ C; Y  N, z
  18. *
    + e8 e5 G  [8 t% u/ P& F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% S0 P# b% Q. u
  20. * kind, whether express or implied; without even the implied warranty
    . P. h0 J, T9 h( t- x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' q" o% T0 _8 j7 G6 D3 O1 O
  22. * GNU General Public License for more details.0 {. G: ^: J1 g& ?3 b
  23. */
    ; {! V; p# _# I9 Y7 N  o
  24. ! n8 N) w" ^+ G6 U& s# ^2 T' ~- @
  25. #include <linux/module.h>, {, [- i7 D* F
  26. #include <linux/init.h>
    1 Z, @: S/ s7 t
  27. #include <linux/errno.h>1 {  {) r# w) p# n4 i$ _/ M7 A' C
  28. #include <linux/types.h>9 C/ S4 U- J- O% ~( b7 e3 t$ J) i  z
  29. #include <linux/interrupt.h>3 M' \2 K% V$ A- E* }
  30. #include <asm/io.h>1 R  o# q/ ]7 T
  31. #include <linux/moduleparam.h>
    * e! v0 D# _1 O/ U, p& v! b+ q6 C
  32. #include <linux/sysctl.h>
    ' d* w) `* X& B9 w6 I
  33. #include <linux/mm.h>
    " }/ E" k- ~$ @, c) x0 w- v# Y
  34. #include <linux/dma-mapping.h>8 I9 H" [8 V+ X9 o2 S

  35. 9 X. }" n: u7 [) P  ^9 a9 L  u
  36. #include <mach/memory.h>
    ( I/ C+ S1 H& a% M! i* g8 M
  37. #include <mach/hardware.h>
      b+ y" o, H* k( r5 d1 ]
  38. #include <mach/irqs.h>
      C: ~6 t! D2 s
  39. #include <asm/hardware/edma.h>* C3 R- E- X' [4 @* q: u
  40. 9 d* C3 \2 Y* Q* K4 G7 C
  41. #undef EDMA3_DEBUG3 ^" V/ }' i1 ~/ w0 X7 z
  42. /*#define EDMA3_DEBUG*/4 d! F( @, H5 G# B
  43. # g+ T0 n+ A9 o! K
  44. #ifdef EDMA3_DEBUG1 b9 m6 s0 |3 W& h+ h: Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 F- T1 z6 R8 z$ Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + @) O  e' p* Q/ ~: t. \0 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- O0 v3 |5 X5 S+ f4 S% V& V
  48. #else% F6 x# W+ `' r- H
  49. #define DMA_PRINTK( x... )
      r1 n  s* T- r
  50. #define DMA_FN_IN
    0 B$ _5 i+ D- [. P" L9 a
  51. #define DMA_FN_OUT0 u( g% p9 r8 H. g: X
  52. #endif( \; L+ H; K; ~; ]' p

  53. & L8 p7 F/ D$ `1 [- [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* D% Z: u9 O( ?5 Q' I6 O0 h/ M
  55. #define STATIC_SHIFT                33 C3 b/ R- F. J' V' @: a
  56. #define TCINTEN_SHIFT               20# [' i3 \4 W& F  r8 H) z7 n
  57. #define ITCINTEN_SHIFT              218 m' J( {% t* N$ a& D+ V
  58. #define TCCHEN_SHIFT                22
    - q: r5 y! g9 K- L& H
  59. #define ITCCHEN_SHIFT               23
    * \) r) W& }, {; s' B' ~: W

  60. 7 U6 e( M3 j7 K$ F) P9 V4 ~) r; _
  61. static volatile int irqraised1 = 0;
    1 B# J' E( B% \6 b( ~' g- C
  62. static volatile int irqraised2 = 0;1 ^8 [$ s# ~0 A. U7 D+ _* {
  63. / o4 R9 e5 w( z$ |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R' g! f* c: `: G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I6 b- U7 E- Y# v  k, I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 i9 V6 J" P. c

  67. 4 k* s3 }5 C# F' h
  68. dma_addr_t dmaphyssrc1 = 0;. z: s1 j" K' n! N
  69. dma_addr_t dmaphyssrc2 = 0;5 ]2 m7 j/ @" D3 o! M3 O
  70. dma_addr_t dmaphysdest1 = 0;2 [. U5 a7 s% R6 ~3 F
  71. dma_addr_t dmaphysdest2 = 0;
    7 ^7 G1 o; n% b2 @

  72. 4 f2 I4 ~0 g' r2 e
  73. char *dmabufsrc1 = NULL;- x+ I, U1 ?% h; }$ R0 y; E
  74. char *dmabufsrc2 = NULL;+ b% U5 Y: T1 e; S
  75. char *dmabufdest1 = NULL;8 @: U4 L$ \  ?
  76. char *dmabufdest2 = NULL;* e% @. m- k% N6 x4 C6 A, g# b
  77. - [% h; G  w) E! W. ^( k/ m- i. L
  78. static int acnt = 512;# r" u  ?3 h( R) }# Y
  79. static int bcnt = 8;
    / U* A7 P  r8 r8 c' L2 j
  80. static int ccnt = 8;  ^6 T9 `) Q2 N  {% P8 O
  81. : d; a8 K3 h) B5 i* S, H$ I3 x0 j7 h+ [
  82. module_param(acnt, int, S_IRUGO);
    / {- ]6 |4 b% |0 X. S: ]8 Y
  83. module_param(bcnt, int, S_IRUGO);+ L. J, K6 O: _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ B! x! D+ U% f9 ~0 C$ D8 t
1 ?  T" C0 a0 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
* v0 m# x$ A! v# p! V' Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# k; M; E+ ]5 R' ^- G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" I2 a; Z1 f/ F/ D' C* E5 V' \1 J& r& r9 h0 w/ x

  e" Z/ I6 O2 `8 c* w% a5 W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 21:18 , Processed in 0.039524 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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