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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # f  W1 Q4 \6 c% Z2 T0 @1 I( ^
  1. [code]EDMA sample test application
    & y; G  x6 e  |2 g" X
  2. /*( q  g% L  d9 F5 v5 G
  3. * edma_test.c
    - W/ N8 L3 O; \& M
  4. *
    , p+ A$ A9 V0 J* y+ t
  5. * brief  EDMA3 Test Application' q/ b7 P9 U  D1 C% T: Z
  6. *
    & [) k+ M7 M( I# `4 J5 d
  7. *   This file contains EDMA3 Test code.& @) j0 G! R3 M$ N' O
  8. *4 M" G9 U0 d2 |) U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % b, X5 y( E# L( d9 A  @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) j, b3 ~3 Q7 }/ ?1 l
  11. *         TO CHANGE.
    / k2 p& w4 L. m+ p) @; Z
  12. *
    ; p* B! u  ^# A4 T+ |! v/ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) O: h: y  P" N1 |9 P0 Y
  14. *& e! G- d+ a7 z
  15. * This program is free software; you can redistribute it and/or; F, L& ^! s: m9 Z
  16. * modify it under the terms of the GNU General Public License as4 H" t% [/ w0 R
  17. * published by the Free Software Foundation version 2.
    , y. r% s( D+ q" u; b8 }1 I
  18. *
    $ k2 E. ^5 ^' K0 E1 j7 u6 i5 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 l1 J/ S7 U9 _& u
  20. * kind, whether express or implied; without even the implied warranty8 {! _% N' r1 G( g6 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& M, {* R5 |. V$ Z6 @
  22. * GNU General Public License for more details.* ]: [( P2 X1 n  V2 l
  23. */# t9 S: O6 s9 v7 ?' Q# O
  24. # L7 r* `6 E- \, G9 T$ \+ G
  25. #include <linux/module.h>6 p' j2 e! p: u. O) d( C$ [
  26. #include <linux/init.h>
    8 \5 k% f) J/ S3 H  \2 w0 z
  27. #include <linux/errno.h>$ O+ F  u  e% ~: @
  28. #include <linux/types.h>
    % [# K0 d! c, h. W
  29. #include <linux/interrupt.h>9 q* g2 m9 X$ ^. B# l
  30. #include <asm/io.h>; K6 J+ d1 ~& t# x4 M3 {6 ~
  31. #include <linux/moduleparam.h># h, z' g' {# k# E
  32. #include <linux/sysctl.h>
    / z$ T- {8 y7 j) \4 \6 ]; E7 P) X! E
  33. #include <linux/mm.h>: a- l* C; M4 C  C* d
  34. #include <linux/dma-mapping.h>2 X! }' R8 {1 K& F% U9 Y3 ?, t

  35. * X: F- Z3 Q. S0 ~5 A  x" h
  36. #include <mach/memory.h>
    ! g0 w( J( Y% i% m' j
  37. #include <mach/hardware.h>
    8 {9 K# D# H) H7 c1 @' J9 v
  38. #include <mach/irqs.h># G* T% ?+ Q+ A; R# I+ l  Y
  39. #include <asm/hardware/edma.h>+ p3 t  G1 p, K, J4 f( s6 W
  40. & {* J* o9 V4 J
  41. #undef EDMA3_DEBUG
    $ \9 O( ]6 Q7 D; S" P: q
  42. /*#define EDMA3_DEBUG*/6 b! i/ x+ S/ I& x; F* o7 G( B

  43. 3 C' D: A. E' I0 `
  44. #ifdef EDMA3_DEBUG
    4 T: F% c6 @. m9 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 E3 p# }3 n; @/ G; l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* U1 F, C: F& F- F. N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 u/ \# X* @) ?( Y0 W+ p4 t
  48. #else. ^. L* Z& [! f0 _5 R
  49. #define DMA_PRINTK( x... )& K* F# _1 T+ `, A# {& z: q
  50. #define DMA_FN_IN, J+ `9 x; u$ }: S6 L3 M
  51. #define DMA_FN_OUT
    , u9 C4 h9 r6 R, R$ Q0 y+ J+ P2 g
  52. #endif
      V/ V' v7 O! [+ U
  53. 8 D6 B! Z$ G6 N6 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 l+ u4 C2 m6 H5 N1 ^) R
  55. #define STATIC_SHIFT                3" e8 ^' e' ~, k2 b9 I
  56. #define TCINTEN_SHIFT               20
    . b8 t. a' U6 l# ?' Z2 N4 v
  57. #define ITCINTEN_SHIFT              21
    # M7 Y' d7 o  ~$ b! x
  58. #define TCCHEN_SHIFT                221 _1 w9 k- |; k& M) i6 N
  59. #define ITCCHEN_SHIFT               23" Y. c. E- F; _2 E

  60. : I1 T) b* m+ `: }; T
  61. static volatile int irqraised1 = 0;
    + @% W3 t8 b) [3 {: C
  62. static volatile int irqraised2 = 0;
    8 i, M" h' ?) ^% y: l, d" s7 A
  63. , I; p0 s% _! c/ N; S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 Z8 J( m3 `$ J: k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 _( S! \- Y3 x3 y6 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 M* o% q. i. u1 s

  67. , p, _0 d& B0 F3 _0 w& J6 S
  68. dma_addr_t dmaphyssrc1 = 0;2 q- }9 u4 M0 z
  69. dma_addr_t dmaphyssrc2 = 0;
    ' }6 s5 U: o1 _2 |2 t+ X3 v# r
  70. dma_addr_t dmaphysdest1 = 0;1 t6 _- }* `4 D6 N! y0 G5 W6 b
  71. dma_addr_t dmaphysdest2 = 0;
    6 M1 a5 G, j  y% Q8 G

  72. ! `' p0 b; R7 M/ f
  73. char *dmabufsrc1 = NULL;  ?: w7 P& e4 R6 w
  74. char *dmabufsrc2 = NULL;" H: Q8 N' ^7 u; d
  75. char *dmabufdest1 = NULL;# C, p+ y7 q& U& R0 r, t; h
  76. char *dmabufdest2 = NULL;
    / @! I, {2 F6 C4 Y7 u

  77. " f  {  o2 C! \. J6 R
  78. static int acnt = 512;4 ]0 q) S4 E& ?% [
  79. static int bcnt = 8;
    ; e( |8 w& f2 o, F* K* I
  80. static int ccnt = 8;
    . ~/ G: s5 i  p, B' K4 t6 j2 q

  81. ) P! M: I& x& o5 P! j
  82. module_param(acnt, int, S_IRUGO);. R0 m: K9 o9 w7 q1 v
  83. module_param(bcnt, int, S_IRUGO);# m9 S+ X: l8 H0 I- c# m
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ S  {$ T: Y& A

  W- o( A2 ~: c$ W4 s  ]% P- b* v9 j8 e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ R1 g! K4 k& A. ~( Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" G9 _7 q" K3 E, l4 ?0 [1 [' N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) w  X% v: B; }% }7 ~+ c# _. g8 ~9 }1 i) \6 O) j

5 }. N4 r- j- ]% p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 21:59 , Processed in 0.040396 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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