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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 f6 X' [; O* F5 @
  1. [code]EDMA sample test application
    / z7 i: z5 n" B4 E4 g* o
  2. /*  q) i& W) r4 g! X9 Y+ p) [2 d* V. o
  3. * edma_test.c. d9 p, [5 h$ @" u8 `
  4. *
    9 Y, O; [( f: @; a$ ]6 M
  5. * brief  EDMA3 Test Application
    % ]1 [) m6 V3 B/ q$ C5 z4 [
  6. *
    2 a2 _  r! o) j0 k+ j0 T# n! I5 q. @
  7. *   This file contains EDMA3 Test code.
    . Q# m" ?( M7 _6 M1 p. [
  8. *
    . M8 Y: Z  ~" E. s5 [# d' Q. M6 ]! z" d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + S# @/ R; t( b/ ^8 T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; [4 e5 v, \, Q; n- u) ~
  11. *         TO CHANGE.) c8 c$ y( E9 }: n
  12. *5 A. z9 l8 o; q/ S0 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 K' g  P. K, ~, `4 ?
  14. *% h% {) u7 Q0 v+ N+ W; U4 m
  15. * This program is free software; you can redistribute it and/or
    . S" A/ r0 U9 n2 M1 [
  16. * modify it under the terms of the GNU General Public License as
    5 _- j% C% z- U( |5 E( ^/ `
  17. * published by the Free Software Foundation version 2.
      v5 q7 M% m' f
  18. *
    8 @3 ~1 a. r7 G* K. {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 n4 I7 s* M2 u: g
  20. * kind, whether express or implied; without even the implied warranty
    " y/ `7 m( K# d6 N* L4 z, ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 U2 A6 S& m) j3 a) ^, y
  22. * GNU General Public License for more details.* t6 N7 X+ \& k( l3 @
  23. */
    : ]/ T+ `7 L4 h4 K. ~! y
  24. - G+ H7 [  y# ^6 F2 w
  25. #include <linux/module.h>! ^% e) V: e' S+ ^! y7 f2 X& s8 O
  26. #include <linux/init.h>
    ' h0 N3 ]% ^$ L6 G% U
  27. #include <linux/errno.h>& ]+ G. C) c  {4 x4 ]  `' o. }
  28. #include <linux/types.h>
    9 C- V$ b% d  `. t1 b0 Q8 {' e9 H. |
  29. #include <linux/interrupt.h>7 s8 B3 c1 F) U- W7 l6 \
  30. #include <asm/io.h>5 Y4 ]; f* {3 P6 _6 g" O* ]
  31. #include <linux/moduleparam.h>5 t3 P0 U8 k. G& [: _. d6 z
  32. #include <linux/sysctl.h>
    . `- J3 x! y* Z; X: I, @, t" V
  33. #include <linux/mm.h>6 X) ~: i. N& K( ?; ~
  34. #include <linux/dma-mapping.h>( i" z# T7 l, Z
  35. / }* e, `2 U9 s7 p
  36. #include <mach/memory.h>2 J2 r" X* G& O1 h* K
  37. #include <mach/hardware.h>
    1 q" G2 r- j  S$ J; c" A) x
  38. #include <mach/irqs.h>
    0 H# Y+ O" U& a# m4 \! b" p
  39. #include <asm/hardware/edma.h>
    " L- D& q9 m" K% r
  40. + H) @0 ?6 ~9 v9 |2 r/ |2 u8 b2 M
  41. #undef EDMA3_DEBUG
    9 S7 q# L; ]# p- R( ~( [+ o
  42. /*#define EDMA3_DEBUG*/
    / |$ `; a# v/ j. f5 S% n
  43. 5 t3 N  B: h7 G) y
  44. #ifdef EDMA3_DEBUG
    5 l( F( A: H; ~5 Z, u- U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 [5 l% E" X7 I& D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! b: o+ B9 m4 U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ J1 I, C) l) ?) d3 s- ?4 ]0 _+ _/ w
  48. #else
    8 p8 _3 _% [6 H
  49. #define DMA_PRINTK( x... )3 C6 p7 b6 b$ d$ @
  50. #define DMA_FN_IN
    * `4 d% V9 h* C: `
  51. #define DMA_FN_OUT0 h5 a% C7 A2 N8 q; h2 j
  52. #endif
    ) r9 n: M1 s& M8 G1 g7 m
  53. + K' i8 m, ]/ T. l! q0 ?3 ^9 m7 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 m  b+ i% |1 @6 `% D$ G% n. U7 P, l
  55. #define STATIC_SHIFT                3# t6 l' k& O6 z7 u  s
  56. #define TCINTEN_SHIFT               20
    9 E0 X3 a+ j1 P- M  _  T- P7 c
  57. #define ITCINTEN_SHIFT              216 N5 y. h8 J) D$ q5 w# R0 H3 }& P
  58. #define TCCHEN_SHIFT                22/ y. n6 |; ?' q, u# B! c
  59. #define ITCCHEN_SHIFT               23
    & B, l9 N  v0 J+ W
  60. & q- H# K8 Z; n4 m
  61. static volatile int irqraised1 = 0;0 e! @: V6 b, c. w9 v
  62. static volatile int irqraised2 = 0;$ B/ T6 z1 z0 X6 c& @* r
  63. 6 Z( T8 q, V5 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ z; k8 C+ ]& H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ T6 D5 y  w, W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 a8 _, C  }. G; L! G

  67. 3 ]8 U7 Z5 E( Z. A0 F& M- Q
  68. dma_addr_t dmaphyssrc1 = 0;
    9 `% K1 y+ n  @9 k& T# x1 ?
  69. dma_addr_t dmaphyssrc2 = 0;! e5 L5 z& F/ a) B
  70. dma_addr_t dmaphysdest1 = 0;: P' B! G1 E/ x! E7 @
  71. dma_addr_t dmaphysdest2 = 0;8 ^9 C5 c2 s( i8 m* q
  72.   e7 ^3 A0 I. P" ?! ?! f
  73. char *dmabufsrc1 = NULL;/ E; h4 e, n* m/ G) @/ D
  74. char *dmabufsrc2 = NULL;
    : |5 \- K1 \1 K( ^+ b, }
  75. char *dmabufdest1 = NULL;2 y* p" y" Z4 |; q9 h
  76. char *dmabufdest2 = NULL;
    8 q$ `/ n9 t9 k; N
  77. : N- V; r0 p- ~+ `  J
  78. static int acnt = 512;; S. Y$ X- @' H1 s0 j9 i+ w; X0 R% N
  79. static int bcnt = 8;
    % y% [* J7 M) M: J6 e" v
  80. static int ccnt = 8;8 y" C) z6 R1 T) R3 X3 m  L

  81. 9 U9 H' m" A) M7 O' G( {) Y% c) W
  82. module_param(acnt, int, S_IRUGO);. a2 ~* y. j; s! W' h
  83. module_param(bcnt, int, S_IRUGO);" E6 B) H# b1 C+ G2 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, t2 {9 N. t# F* y8 v2 {! v* i

0 U, r, }* u, N6 T  p0 ]; v" r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' P0 Z$ R: m+ v  p# ?2 ~( m; l7 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 A( e, ~) e. Y1 q' A* e% E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) p& M0 h; X. G5 ?+ w
: n: I4 |/ q5 `8 V: Q1 L
" Z0 @5 {5 q, s, F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 20:35 , Processed in 0.041990 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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