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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" D: Y. y) u: d9 T
  1. [code]EDMA sample test application
    * p" {+ }; k: E7 a
  2. /*
    ) s3 ^! k" s4 E
  3. * edma_test.c; f$ k& E( P5 U( q/ v" P
  4. *- I5 Z$ @" t  i- P, x$ u; b
  5. * brief  EDMA3 Test Application9 a# s  I+ A0 b& J* ?* j* ^
  6. *4 R/ a" F" @4 o0 [9 L
  7. *   This file contains EDMA3 Test code.' r0 j% N  p9 n* [# w* h1 X
  8. *- t8 o  _8 J# U1 B  f' e( n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 K0 c, y: ?; A3 \2 s! {( z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, ]  @% C$ }% k5 s  z# j* U1 U
  11. *         TO CHANGE.
    3 e1 n" V# H- ]6 S! U0 B
  12. *3 {$ A/ o& `3 d# R  s7 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 y- e+ O' I  g' D
  14. *
    ' ]9 y3 P! Q3 X
  15. * This program is free software; you can redistribute it and/or2 |- B7 G  K% \6 `3 P
  16. * modify it under the terms of the GNU General Public License as
    1 S1 p& {8 g* A" w5 D: T
  17. * published by the Free Software Foundation version 2.
    7 v# L; t6 M6 K& e, I
  18. *$ G8 f  C7 A. @4 F& Y- `7 f0 n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 [7 m. |4 G" a! j( Z$ _& r
  20. * kind, whether express or implied; without even the implied warranty8 Q0 F, X" E7 f4 H7 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / o2 c4 g+ g/ i5 C0 o& `9 e& P0 Q
  22. * GNU General Public License for more details.! `! [0 z) N( Q8 E* c
  23. */
    2 f; z. X; p! Y8 T' V6 @* z
  24. ! @- F/ X- g! ^3 s- ^, N  r
  25. #include <linux/module.h>
    . @$ }4 f- C) n% }2 O
  26. #include <linux/init.h>
    7 s0 ~  n( k4 R/ T. [
  27. #include <linux/errno.h>
    % s6 L5 x# H# ^* i5 {5 e$ P( q! h. U
  28. #include <linux/types.h>) K* K" q5 T# G6 z
  29. #include <linux/interrupt.h>% D  H. A3 |# O5 F% b
  30. #include <asm/io.h>5 h! r" q8 T4 k+ G6 `
  31. #include <linux/moduleparam.h>
    6 i- G0 a' {' c) a6 b
  32. #include <linux/sysctl.h>
    : @5 m- H8 j8 a: t
  33. #include <linux/mm.h>
      d! T% e. I4 ?
  34. #include <linux/dma-mapping.h>: {4 d! G6 k7 `+ c7 V8 ?

  35. . J6 z! X2 x$ m& x) i  d
  36. #include <mach/memory.h>
    ' E1 `+ h$ q2 z! d6 i' h
  37. #include <mach/hardware.h>! `* }! |0 P! w: g; V% Z
  38. #include <mach/irqs.h>
    8 ?8 F  I, K9 W( L3 w5 _4 N2 a: q
  39. #include <asm/hardware/edma.h>
    & l7 v8 d) U7 d# X7 y- k2 a+ s
  40. ) q! g" T+ s1 `+ O9 P9 |
  41. #undef EDMA3_DEBUG
    + d! h$ P* t/ p; [
  42. /*#define EDMA3_DEBUG*/
    8 I5 d' F+ z9 i" `1 [) y

  43. ( y0 U% R; a+ \9 l" a! F
  44. #ifdef EDMA3_DEBUG& b; i0 R8 C1 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 y. M- F' w8 ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% Q2 [' r# I! H2 `0 p& m# U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ~" p5 S+ {; x/ }7 }( ^0 o
  48. #else$ o6 N4 ?' o4 b; ?5 X" t
  49. #define DMA_PRINTK( x... )
    0 Z  |( B! H8 E# V# z
  50. #define DMA_FN_IN+ H% E( f5 Q: N- J+ f) `, ^
  51. #define DMA_FN_OUT1 D: O/ r& d- G: K# v0 h. B8 N
  52. #endif) ?' ~! X7 j- Q  s# l

  53. $ y9 k4 z' a6 r* }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ t$ e, l, Y- b  g" {5 e
  55. #define STATIC_SHIFT                3
    $ i& N/ t' b3 K# w1 T  V4 H
  56. #define TCINTEN_SHIFT               200 R/ B& T6 t! K8 t  c: n" N* V) O
  57. #define ITCINTEN_SHIFT              21" j2 b0 V1 X/ ]/ l; @
  58. #define TCCHEN_SHIFT                22
    ' c& ^) K9 O' l- G, {$ T9 d
  59. #define ITCCHEN_SHIFT               231 l3 m! e7 k% b
  60. ; q0 ^" ^, r# b' V# _% C2 y
  61. static volatile int irqraised1 = 0;3 {0 e, g( X* h
  62. static volatile int irqraised2 = 0;+ }7 p$ d' S$ b) y' M
  63.   Z1 @; b; h  b* M5 Y5 l9 j+ n8 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & q7 a, a: Q& l- F* ~; r& W8 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, a1 D0 W* H. j& b) \% D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 o, b4 _5 b* O# f5 h

  67. 1 z5 J7 ]; f7 i0 Y! g
  68. dma_addr_t dmaphyssrc1 = 0;2 T8 N, p$ E' M" p+ a
  69. dma_addr_t dmaphyssrc2 = 0;
    0 c2 w+ ?5 S+ [, k& L
  70. dma_addr_t dmaphysdest1 = 0;
    ; K: F3 p) Z0 z) S5 g+ B9 E
  71. dma_addr_t dmaphysdest2 = 0;7 E% n* j. w" V6 D0 }0 }0 t9 P

  72. 8 ^$ F% |4 _- d1 F2 ~
  73. char *dmabufsrc1 = NULL;: I  g2 Z( p+ z9 q  G$ k
  74. char *dmabufsrc2 = NULL;4 ?7 R( M$ P8 B8 r8 s  {
  75. char *dmabufdest1 = NULL;
    2 L6 i- H! S: t7 c
  76. char *dmabufdest2 = NULL;* u) b1 I+ f. V+ i

  77. / o+ i8 a9 Y! `" s  u2 I, @
  78. static int acnt = 512;# H' M% n8 H2 V% j4 S( s  u& k3 D* Z
  79. static int bcnt = 8;
    7 k) u# s" O  V0 N
  80. static int ccnt = 8;
    , q7 f  I2 x& H2 u  y

  81. 4 [% b- p+ t$ x9 P# g' P) G
  82. module_param(acnt, int, S_IRUGO);3 R  e/ N# I) o6 ]9 E  F2 B# {% ]
  83. module_param(bcnt, int, S_IRUGO);7 ~  R; r* u2 i8 y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ P& I; |# w# b& [% w9 f) j+ E( E- [- Q; x
$ c1 z4 e% j; u2 d) C/ l! y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 X, q# v3 g/ H) Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 f+ C' G( G. I) |6 s# H/ ]
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ~+ b+ j  ^. }. K, v

/ D7 V" w0 T/ n  ]0 Y6 X' s/ h7 Z& a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-17 19:14 , Processed in 0.046013 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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