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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: t2 {. T1 `! q/ K+ d8 O/ i4 E6 n
  1. [code]EDMA sample test application
    : L0 H' e! C  T9 L9 B: p; o  E
  2. /*; z1 ^5 w) {% L9 K' b
  3. * edma_test.c5 F& m9 P6 {1 i4 H, r% X
  4. *6 J, N( ?" n1 r9 j: X, w
  5. * brief  EDMA3 Test Application  Z# X; R& K, z, K
  6. *% D- B. ^0 m  t3 Y' V0 K  M
  7. *   This file contains EDMA3 Test code.. i# Y! M' e3 X
  8. *! F/ Z1 `( q8 R- A0 v! s$ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 Y  M5 A# r3 ?- q2 D5 l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 l( s  V2 f8 x+ {3 f" O+ q
  11. *         TO CHANGE.( v0 H  t1 F) ~8 v
  12. *
    % y2 W% z) L8 Y; \5 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% o6 {1 y5 P* t+ y9 C6 p$ K! Z
  14. *# y* j+ H8 j5 k
  15. * This program is free software; you can redistribute it and/or
    $ B3 x) `# w# I) }# u3 c
  16. * modify it under the terms of the GNU General Public License as
    4 k* @& w# s6 L, v
  17. * published by the Free Software Foundation version 2.) d: x1 t* r/ y1 d$ k* S
  18. *
    + i; G' g2 N4 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! a- E, D0 n( W. G8 Y& B& l
  20. * kind, whether express or implied; without even the implied warranty" @4 u7 U4 T8 n- y0 t( c- ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * K8 R0 F; l0 _) b4 E5 Y0 K" w1 B
  22. * GNU General Public License for more details.
    ' I7 P8 x' M4 ~
  23. */
    3 S+ l5 B: t. D( y

  24. ) O( `% v! r1 M9 S7 ^( H
  25. #include <linux/module.h>
    ; w9 \1 v/ T4 |2 F* T- U
  26. #include <linux/init.h>
    $ B- S( |- `! @# C
  27. #include <linux/errno.h>
    9 I1 E( P1 Y: y. c! L
  28. #include <linux/types.h>& p; Z& n1 O1 R7 K0 a1 d9 |. l
  29. #include <linux/interrupt.h>
    : c) _2 n* a3 T4 v$ g3 `% r; `
  30. #include <asm/io.h>) i% ]: n8 x! c; |
  31. #include <linux/moduleparam.h>  Z3 U$ {. F5 O% z1 }
  32. #include <linux/sysctl.h>
    1 e! R) S) I, B# U' Q" L" R5 |
  33. #include <linux/mm.h>
    , R$ a0 v$ I1 a' V( ?! P0 r- U
  34. #include <linux/dma-mapping.h>7 i# o5 i8 m; Q, t
  35. ! s5 V: D; e4 ~; N* ~
  36. #include <mach/memory.h>
    + Y/ E6 t# M! h5 t. m
  37. #include <mach/hardware.h>) d2 ]- }: i: J9 P/ \/ s
  38. #include <mach/irqs.h>
    - H0 q3 J* k, i; @7 x
  39. #include <asm/hardware/edma.h>. `9 ^* w# k) |' M5 X. W  y# Q8 N. K

  40. 2 h" W4 ~. j( e7 `- D, S3 w2 N+ |
  41. #undef EDMA3_DEBUG
    - P' P' ~: C7 {; @& P
  42. /*#define EDMA3_DEBUG*/
    ! I4 s& T, g- w# c- m2 `! s6 P

  43. + p0 D9 ^  b' l6 G
  44. #ifdef EDMA3_DEBUG# {' b+ z3 S! u" ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ j8 C9 O0 y; @) p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 @; U5 s/ I, w3 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 J( G2 J6 k* c
  48. #else, ~8 y9 ]* U, O, d! [6 s! L* T% x
  49. #define DMA_PRINTK( x... )# s0 R6 L4 x3 _. W! _
  50. #define DMA_FN_IN: r; R6 t6 q, I! h! h" S4 `
  51. #define DMA_FN_OUT
    4 G9 P  l; y: s
  52. #endif' T) A; h. e# x; }

  53. 5 g! m  k6 i. l1 E/ D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  z$ d; H$ k+ r/ F" m
  55. #define STATIC_SHIFT                3
    # t) R1 C1 s' [% P* S$ W
  56. #define TCINTEN_SHIFT               202 S- r! u( s) o) }; a  S
  57. #define ITCINTEN_SHIFT              21
    4 ?1 g( |% D! \1 ^* `0 L. s( N
  58. #define TCCHEN_SHIFT                22
    ' G2 C6 T- h" C. y1 H
  59. #define ITCCHEN_SHIFT               23
    3 s# E  G  \, e/ R7 A8 O

  60. " ^- @8 S  O! m- M
  61. static volatile int irqraised1 = 0;6 w8 K  ]: r9 e$ |
  62. static volatile int irqraised2 = 0;
    ' j9 _# x8 d* I; `3 ]
  63. . R4 k0 @- t- r  ~+ D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % N- X" Y$ U& M6 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M2 n) b* M, q1 b" w, K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 S6 W" p5 T; J% ~/ V5 u
  67. 4 m# M2 ?9 D' [
  68. dma_addr_t dmaphyssrc1 = 0;  \+ e, w8 N# O, t; {+ c
  69. dma_addr_t dmaphyssrc2 = 0;
    4 [& ]* @" W6 [$ P* }9 U' X
  70. dma_addr_t dmaphysdest1 = 0;
    + o; }0 W! k, u, L9 M8 i$ u
  71. dma_addr_t dmaphysdest2 = 0;
    * e+ U9 A' i' s2 j7 j+ k6 j8 J
  72.   J0 \- X/ }0 z7 T# {
  73. char *dmabufsrc1 = NULL;
    2 E& P& K$ k/ D) o0 g) Y# Q
  74. char *dmabufsrc2 = NULL;9 ~3 q1 x1 Q* {1 e
  75. char *dmabufdest1 = NULL;" M' ?/ G3 I9 v; |' X, D5 z3 }' G
  76. char *dmabufdest2 = NULL;9 a+ q# f% [( O5 p& Q

  77. 2 @9 M* t) y# D5 _
  78. static int acnt = 512;
    ( g: v, d. Y# y$ v- v  \7 y
  79. static int bcnt = 8;
    ( ?( Q* F8 }$ _* |+ {
  80. static int ccnt = 8;
    . M# {# n* g) S0 r* w
  81. # b7 y" h" G# p  [* X6 Y
  82. module_param(acnt, int, S_IRUGO);  Q1 ^0 ^5 j; ?. H. l4 o4 J3 F5 H
  83. module_param(bcnt, int, S_IRUGO);& T- {7 b' ~7 A5 B/ G0 K. J! D" r' o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' ]+ U, }6 d- P, O0 d! x4 ?+ O% w2 b3 l, ~3 G! G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 B* G# \6 y, [$ [" rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' x" H# [$ p3 Z: o& ^
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 Y4 R0 o& O: N+ L# o! k
# P$ J% `4 [6 h6 Q. M
0 P* O% w' ^1 G) }9 g" r8 ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-18 15:29 , Processed in 0.040342 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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