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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # Z3 f5 z8 M5 {2 D5 L3 y
  1. [code]EDMA sample test application
    . P8 Y! A7 }# i: {' Y7 o
  2. /*
    1 Y  ]! m" n5 p1 X- z
  3. * edma_test.c
    / n; R8 E. `- h5 Y: E0 I- C, G5 \
  4. *2 {5 C. ?* l: z1 q: N) k' [8 l
  5. * brief  EDMA3 Test Application
    1 b3 ~( @0 S6 B7 t
  6. *
    / L& W1 V( Y7 T2 d  N
  7. *   This file contains EDMA3 Test code.. b3 P' ^. X+ V, Q. N
  8. *
    ; i6 Q# ^/ r# r) r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& r' `( {! z7 P! u- ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 {) m+ Q% j( ]# P0 |, W2 x8 \
  11. *         TO CHANGE.
    / i+ U3 u5 ^* o6 V
  12. *
    ; ^/ Q- h/ R& a, Q1 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 q5 D1 B7 ^( w. y+ a/ Y5 I; v
  14. *
    3 g. t* Z! X2 Z, x. y
  15. * This program is free software; you can redistribute it and/or
    5 e. a: r3 b, Y, b$ D$ x% K- x5 x
  16. * modify it under the terms of the GNU General Public License as
    & o5 P% R/ h& T- m; s5 w) p3 l
  17. * published by the Free Software Foundation version 2.6 Z5 o- t# v( F1 L. }
  18. *4 x, q) V/ M7 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) S1 l, G: i& J( X8 y& g0 D
  20. * kind, whether express or implied; without even the implied warranty
    - A: {4 r# w' {; B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  g+ w* N1 r5 v- x
  22. * GNU General Public License for more details.+ ?% h" w! {. s" K8 }9 [: ?
  23. */
      B9 J0 }6 k  U8 K- O4 r8 I$ B- g
  24. 3 K3 J# y/ M. A) h- d
  25. #include <linux/module.h>& I4 j* ~# H/ }; K
  26. #include <linux/init.h>8 s) e3 b8 {$ X/ |2 o
  27. #include <linux/errno.h>
    $ P# I' `3 T, D* A" q2 M2 ]% n
  28. #include <linux/types.h>
    4 ?4 j2 h( e4 q! _: E6 R
  29. #include <linux/interrupt.h>( `* Y& J& [" e, n. p
  30. #include <asm/io.h>) s; l4 T# o/ C0 n' {( L8 K
  31. #include <linux/moduleparam.h>
    9 ~! n% W) u- Q
  32. #include <linux/sysctl.h># J3 j+ I! X  [. F! g
  33. #include <linux/mm.h>/ s2 c5 X, i. q5 K; v. }' x- a
  34. #include <linux/dma-mapping.h>+ r0 t3 {! o, p9 g+ m: M

  35.   I; e  e' G4 n, z
  36. #include <mach/memory.h>
    ; W* Z1 F- K; p6 p5 C
  37. #include <mach/hardware.h>
    ' z! r, J7 \8 g
  38. #include <mach/irqs.h>6 G* h) H9 b  O; c5 {% c
  39. #include <asm/hardware/edma.h>+ B, f0 |" q) @$ ]) ?

  40. - t. S& q. v1 g
  41. #undef EDMA3_DEBUG
      `9 W& o. N8 j9 I" {8 w
  42. /*#define EDMA3_DEBUG*/6 _: S$ ^: \! L% `; _0 W# Q

  43. ) R7 u4 g7 J- X
  44. #ifdef EDMA3_DEBUG/ e! r. D( ?- R  G+ D/ d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 v* C9 f! Z- A# X) s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      c& o' p- }- l0 D/ ~5 I1 o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Q1 E8 N2 C- l$ U3 z7 l3 B' \
  48. #else
    2 n/ O5 z0 s# N, ^" e1 s4 y0 h+ C
  49. #define DMA_PRINTK( x... )
    1 x4 ~6 R5 }: z2 h7 Q
  50. #define DMA_FN_IN! u, c8 s' F: V& u4 f4 B& ?
  51. #define DMA_FN_OUT
    " O8 p) D# @3 R* P0 T3 p
  52. #endif( g; U" f6 E( F! F  o3 Y( z

  53. & b6 ^; Q, ^6 z" M, S/ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 f9 t9 J( r! `% r9 K
  55. #define STATIC_SHIFT                3& W' ~' T4 V) T  H0 p3 A
  56. #define TCINTEN_SHIFT               20
    5 R& K  c; U! K! @* |: T' W
  57. #define ITCINTEN_SHIFT              21
    ) t1 U" H( F  d  R+ W7 U& B
  58. #define TCCHEN_SHIFT                22
    3 H+ i) b4 M( I1 |; F. T
  59. #define ITCCHEN_SHIFT               23& s3 I2 Q: j0 P8 K9 s4 {; y
  60. 7 S1 |$ b# K) D6 W
  61. static volatile int irqraised1 = 0;) T. V4 r" r8 m* J8 V7 y  F$ x2 p
  62. static volatile int irqraised2 = 0;
    2 a1 G! b, ^; d3 d- I

  63. . z. _" V$ R7 ^# G! i$ ^) y+ E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: p7 R6 ]3 y" c7 T6 F, Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 I3 X2 n5 a# E/ _. @) K6 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * N/ F/ z% K/ f8 o# \" S

  67. ) S0 ?% P# _7 \- @
  68. dma_addr_t dmaphyssrc1 = 0;! p: g$ C3 e8 C8 {
  69. dma_addr_t dmaphyssrc2 = 0;) a2 @! e: A5 y0 t+ \- U) ]
  70. dma_addr_t dmaphysdest1 = 0;5 E( Q  `  H9 c8 W0 A
  71. dma_addr_t dmaphysdest2 = 0;7 D! T) |) j. f- f0 P

  72. 4 B8 o4 q/ a2 f' S
  73. char *dmabufsrc1 = NULL;5 l0 U' V2 m: s" e8 t6 ]
  74. char *dmabufsrc2 = NULL;
    , Z& U/ Z* _. S- e! F
  75. char *dmabufdest1 = NULL;
    0 D& \9 {' R" ?8 Q
  76. char *dmabufdest2 = NULL;; X0 b; ]+ ~' |% C/ i+ R
  77. 9 g) G7 ], T1 D4 u2 o1 f/ `
  78. static int acnt = 512;
    0 O* a1 b+ {: E, g
  79. static int bcnt = 8;9 t7 j' I2 r8 C# X$ J  W
  80. static int ccnt = 8;( o( [) S/ l' g$ J+ R, u3 g- T

  81. 8 j  S& U# B+ ~( J7 ]
  82. module_param(acnt, int, S_IRUGO);
      k& X0 U# }0 S) A' K. x$ ~
  83. module_param(bcnt, int, S_IRUGO);
    8 Z- X) @4 B! W; T& G: V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" x* G; p" M  \, F- f$ }+ ]
2 ^. Z/ f- _% u9 N  E* Q& U7 `& w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 I" i! z5 \( ^( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; ~0 p* O1 f2 j. i+ L' m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 s; W) w8 O3 g4 F- Q( ^
, W" L. R, m, k% k

' c! J% j9 R7 p4 i* g$ `1 R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-23 18:27 , Processed in 0.041069 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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