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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 [4 g7 |0 y  D) Z+ g2 }  r
  1. [code]EDMA sample test application- }5 I8 [2 P/ n' ~( C
  2. /*
    ! \: t7 E: h# l% M; _' ]' t
  3. * edma_test.c
    ; r# ]+ a" U2 B: S9 f
  4. *
    4 u* A1 M8 l5 o
  5. * brief  EDMA3 Test Application! O4 f9 ~! ]( s3 _5 _2 Z
  6. *$ n6 S9 P1 P3 h$ F  |
  7. *   This file contains EDMA3 Test code.0 n! D$ _/ G, b/ C8 b1 |2 A5 g& ^+ O
  8. *  ]6 k- A2 d' C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- p% [, `2 g5 R9 v! O; s0 X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& F8 }+ _: [: {: _
  11. *         TO CHANGE.
    : T7 H" a+ w! O% p7 L) S1 [! H1 b
  12. *; X+ |/ L# t( L" V2 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, _1 @8 {8 I7 N, U! S3 S
  14. *
    : t7 t0 L6 E6 k0 B9 \. J! u
  15. * This program is free software; you can redistribute it and/or; [* F& ~7 n5 S
  16. * modify it under the terms of the GNU General Public License as
    , D  i! I& ]% Z
  17. * published by the Free Software Foundation version 2., k- @9 M! J0 |% v- d+ [) q
  18. *
    / K  K& M2 r6 m: |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& E+ s, H) z6 L6 }% A0 p$ v! g  J5 b- h# f
  20. * kind, whether express or implied; without even the implied warranty: n4 o$ G* t" L, }/ f- ^! Y' K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 W% I3 v6 W1 n) Q& s& i
  22. * GNU General Public License for more details./ q3 j+ c/ D( b1 l; [
  23. */9 k, s$ r8 O8 R, o
  24. & _4 F  I- u; S; o
  25. #include <linux/module.h>
    . T' R) H; t0 U) w! ]/ j1 G* X
  26. #include <linux/init.h>" Z: _) K* }! ]( U8 ~3 a
  27. #include <linux/errno.h>/ C2 n' Z+ c" D* l" X
  28. #include <linux/types.h>9 O5 `0 S, m: D1 A) o
  29. #include <linux/interrupt.h>
    1 r! h5 w/ X+ _8 g9 H8 c* e; u8 I
  30. #include <asm/io.h>
    & g) _/ M- C. m+ L) O& B
  31. #include <linux/moduleparam.h>% F8 e: y0 g, f$ J' _
  32. #include <linux/sysctl.h>
    % c0 L% }2 r4 J
  33. #include <linux/mm.h>4 i7 {) h& k* g# m( f$ t2 j, G% u1 a
  34. #include <linux/dma-mapping.h>
    - [( K7 V. u, e/ Q

  35. : T" ]! \" M) F: T  J' F
  36. #include <mach/memory.h>
    # \$ y0 y/ E* I# H0 |& z
  37. #include <mach/hardware.h>3 X' g: [4 t& @! k: Q7 t. ~) X+ `
  38. #include <mach/irqs.h>
    : h) |- m$ S. a( b6 h: _. o* V$ @) c
  39. #include <asm/hardware/edma.h>
    $ D! w4 j# F% r: x

  40. 9 l3 ?6 s% G9 f/ {1 ~  ]
  41. #undef EDMA3_DEBUG/ @1 ^0 K2 J/ D" R4 v
  42. /*#define EDMA3_DEBUG*/" a- i+ F2 q8 M& ?. P9 f

  43. - g, B, A# x" O% d( ?
  44. #ifdef EDMA3_DEBUG# W- M! s# P7 W& `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- @& I' j& [5 l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 X# y: D$ A& ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' i4 t, {; X8 U: r- l0 S
  48. #else
    " g- w" D8 n# ^. M& c* Z0 Q% X3 S0 z, v
  49. #define DMA_PRINTK( x... )
    ! V) P( [: O8 X. F3 ]$ _! ^3 Z2 g
  50. #define DMA_FN_IN
      A2 ^0 J! W: C9 f$ _; R* v
  51. #define DMA_FN_OUT  c% v+ f6 d; Y2 B7 L# ?4 a
  52. #endif$ v( x9 W9 J: ~+ a  S4 t+ t$ x# a
  53. " V4 x  ]6 k# D* F% l( g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; p5 K/ _! T; I& E
  55. #define STATIC_SHIFT                3
    & F) ^' E- V) x- [' S# x0 u
  56. #define TCINTEN_SHIFT               20( L( a2 y/ ~( ?# r8 G& K3 u
  57. #define ITCINTEN_SHIFT              21
    ) O+ C8 o( n+ C- [4 M2 E. W
  58. #define TCCHEN_SHIFT                22
    , y! Z$ u2 \# W( t1 J% m% W
  59. #define ITCCHEN_SHIFT               23% `' J0 h  l$ ]" N6 f% ~3 D1 I. O" |

  60. , A, a9 M4 ?% D7 q. n3 x  B
  61. static volatile int irqraised1 = 0;
    ; A* D+ J) ]6 ?, I
  62. static volatile int irqraised2 = 0;
    : `$ G& [- _3 A1 C+ e9 d

  63. ; q! t& c& V* ]5 i7 J4 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 X+ a! H# X: U1 m4 m, ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 w: p8 }+ M6 b- S- h8 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # r. ~$ {" s* M" G

  67. " M& F, n; Q, H1 _: ]
  68. dma_addr_t dmaphyssrc1 = 0;) E) E3 F1 Y$ u
  69. dma_addr_t dmaphyssrc2 = 0;
    + M4 }9 m, }! R& B
  70. dma_addr_t dmaphysdest1 = 0;
    + T* @' `' t1 D9 H8 D! P4 q5 n
  71. dma_addr_t dmaphysdest2 = 0;
    + A+ G, r- G( d  ~

  72. 9 {. W. {+ F" w, z
  73. char *dmabufsrc1 = NULL;
    8 N1 V; N% C5 S. I1 f/ }6 p% v
  74. char *dmabufsrc2 = NULL;
      L% ?9 {3 u9 L+ C+ J6 ^
  75. char *dmabufdest1 = NULL;
    5 p8 \) j0 j; ]- l" U( D* R
  76. char *dmabufdest2 = NULL;+ f8 D" U) {4 B

  77. , F$ [7 V# R7 L1 w# K% s
  78. static int acnt = 512;' c& Z+ q$ k4 a+ H( G. V
  79. static int bcnt = 8;# ^5 y. v  [/ c& b$ k5 d5 ^' P
  80. static int ccnt = 8;9 C4 Q% F3 X3 O( Q

  81. 1 {5 t+ Z* v( R
  82. module_param(acnt, int, S_IRUGO);+ d1 C3 J* V  r  B& e, P
  83. module_param(bcnt, int, S_IRUGO);; o  _! l1 V, f1 I( u1 n3 ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ n- i( C: h/ ]2 M4 Z$ N6 i/ ~1 r& J( \0 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 `3 Z* C$ z8 O; E9 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 x' x# B+ v) m6 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ q6 {' r% Q7 r* N, k
) F8 @* S& D8 {) ]0 q4 N
/ T' u. {/ y2 Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-31 00:36 , Processed in 0.037960 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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