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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # ~8 y' I9 s# z/ u! o
  1. [code]EDMA sample test application$ v* ^6 ~/ W+ Y- J3 E7 _; n  ]& w
  2. /*0 P1 P; ?: b" U1 x9 A  w
  3. * edma_test.c
    % V, S1 |; K- P9 s; }$ ^7 x
  4. *
    " z3 y# e. t/ Z2 R! s
  5. * brief  EDMA3 Test Application! H3 \5 F2 B; x! S+ E5 h
  6. *
    ) f+ `0 _, p7 H7 C% X
  7. *   This file contains EDMA3 Test code.. I: F9 f0 U& w, x. v5 a
  8. *
    4 _  p6 R- ^" K1 @" k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + t' F/ j- g/ Z% E0 U# q5 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      e; n( I; l2 I" T
  11. *         TO CHANGE.( H0 x7 h; C7 Y  i7 l
  12. *+ O" s7 x9 R2 g8 U# h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 J  }  \5 P' J8 D: N) w
  14. *
    3 {, p: F8 g. S$ p4 X
  15. * This program is free software; you can redistribute it and/or! |. X- u$ F* B6 r$ d
  16. * modify it under the terms of the GNU General Public License as
    0 w2 G# I4 Q+ `
  17. * published by the Free Software Foundation version 2.
    8 |3 f; G) g2 q6 y4 c
  18. *& \( r2 U2 ?- I" C# L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) X$ ^" d  R3 y6 r9 M/ V  V* s
  20. * kind, whether express or implied; without even the implied warranty  [/ S- F% c7 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # [$ W, y0 R3 F, h- V! L5 A
  22. * GNU General Public License for more details.
    . O9 J2 ]5 q5 ^' l3 O7 _2 E
  23. */, W* l- j2 Z( E1 D

  24. ( Y5 @- r( [; f: B( l5 e/ ^+ o
  25. #include <linux/module.h>5 r) X0 C) ]" ]0 P6 R  |
  26. #include <linux/init.h>; e8 A8 b+ N: F3 A9 }; n
  27. #include <linux/errno.h>
    4 `9 K! {" K: c: F7 W2 c0 V
  28. #include <linux/types.h>. n; f5 F5 m4 t- q' m" j2 n
  29. #include <linux/interrupt.h>
    4 l# n# w8 w3 {- V) F
  30. #include <asm/io.h>
    & F8 l4 J' [) V1 o& n% \7 w" C
  31. #include <linux/moduleparam.h>
    : p' x% U0 P4 P1 E
  32. #include <linux/sysctl.h>6 B( f, }2 G& _- y( s, u. o! x
  33. #include <linux/mm.h>
    8 G$ f% M! p  L( d; C1 w9 H6 D, h
  34. #include <linux/dma-mapping.h>
      U- s1 X6 c9 S( N' q' O' D
  35. # `3 Z7 F# B6 z  _
  36. #include <mach/memory.h>3 T7 L$ U6 S' u/ o; N1 @) ?9 l
  37. #include <mach/hardware.h>/ n- ~, {7 g; t$ G0 t
  38. #include <mach/irqs.h>' P# |9 x" Y- K: k# Q% _, `
  39. #include <asm/hardware/edma.h>- B2 |" `& p4 b
  40. 4 {' E$ W2 w, m: r; z8 g3 c, M
  41. #undef EDMA3_DEBUG! Z  t* n- b- }% ?# e0 x
  42. /*#define EDMA3_DEBUG*/
    $ v0 N! b8 B% ?- @+ m4 C* \& M, p2 d
  43. ) w; z! F$ f- {0 K$ F& V+ Y
  44. #ifdef EDMA3_DEBUG6 d+ P. z5 C; l; a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 r& L+ S5 K0 q. x6 f5 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 F4 K5 N) T$ X8 U0 F  M% ?, O$ A. O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 h: ~, \  G, x
  48. #else2 X. H/ P: ?9 i/ f8 C( `& r
  49. #define DMA_PRINTK( x... )2 m" T% y% O" K( [
  50. #define DMA_FN_IN9 |2 j. V9 V' |0 J
  51. #define DMA_FN_OUT
    . |2 D1 ?6 ?" _
  52. #endif
    0 ^6 b' D0 \7 @; v! G

  53. 3 O! ~9 v- R# ]1 D6 s9 x1 P# U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 r( S+ f' [* [1 J* T& w4 c+ M4 S- T
  55. #define STATIC_SHIFT                3$ K. x2 o" ^  U  o; R
  56. #define TCINTEN_SHIFT               20- {5 L$ k3 m# J0 x8 U
  57. #define ITCINTEN_SHIFT              21
    3 x( I- X3 z. M, T
  58. #define TCCHEN_SHIFT                226 C# B9 p6 k' L6 q0 s+ h2 n" Z
  59. #define ITCCHEN_SHIFT               236 G8 c% x- e4 G' ~
  60. & U& ~9 Y# B# R* X  ]! x
  61. static volatile int irqraised1 = 0;
      A+ R& P, t9 a0 G( ?
  62. static volatile int irqraised2 = 0;9 x; Y1 V% z( H7 I
  63. ! E8 a8 ~( a8 J8 c$ @9 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; Y+ x- N1 N/ ?# X" P/ i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" D0 o2 G! m& \- x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / o' K1 F! `6 G

  67. 0 N. q( G7 }7 P4 C: x
  68. dma_addr_t dmaphyssrc1 = 0;. ^/ n4 N8 I9 X
  69. dma_addr_t dmaphyssrc2 = 0;
    + k! v% W  A. f
  70. dma_addr_t dmaphysdest1 = 0;9 o2 i' J1 o' y' S9 W
  71. dma_addr_t dmaphysdest2 = 0;
    " b. S& m( g/ n
  72. % m2 f. z4 _( [2 k' L# U- E
  73. char *dmabufsrc1 = NULL;
    + d' C  R( Q' f  s
  74. char *dmabufsrc2 = NULL;- I7 S$ t& I- D0 |' V9 E: o. F5 Q, W
  75. char *dmabufdest1 = NULL;
    " G5 H, a* z1 ?
  76. char *dmabufdest2 = NULL;
    ; F5 l8 m4 r8 G& e/ I' w" m& f

  77. ( t# a9 M& W/ O6 p: ?! x5 ^
  78. static int acnt = 512;' F& g1 w4 U" Y/ T6 t
  79. static int bcnt = 8;4 @& o$ U! E! ?+ T( C& i
  80. static int ccnt = 8;0 z, E+ k3 `! g! \
  81. 7 j% @$ L- B$ P1 Q$ R+ e
  82. module_param(acnt, int, S_IRUGO);# R( p+ `( A# T8 [$ Y) w5 W; Q: J
  83. module_param(bcnt, int, S_IRUGO);
    + A! ^$ f$ J: ~0 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 N" N2 M) a3 g# Q5 m6 [( X

; ?# [  o& x1 K      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" c& m) |) E4 O5 H2 O2 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" Y0 O  L6 y/ i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' G1 W5 u! `% j/ k; n  Y# W1 |+ a# E# H& {

0 o& l! u# H( b) g" F* \9 S: u: b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-15 08:34 , Processed in 0.035429 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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