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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 J* A  [! E8 }2 J- |
  1. [code]EDMA sample test application* Q' T1 J' V( V6 {/ R
  2. /*
    5 t$ Q4 E" F9 b- I: f
  3. * edma_test.c
    , q/ z3 X! O+ K0 b, y% |  X) q1 p
  4. *, S( f2 Y! i, Z
  5. * brief  EDMA3 Test Application. Q, S$ h4 F2 R* g3 s# A
  6. *
    # \% O7 F$ b! V+ k: C) _# g
  7. *   This file contains EDMA3 Test code.* M8 `* i: T; `# A
  8. *2 m$ A* W9 r3 z) Y6 k0 s. U* ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" f8 n% T1 i' Z4 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 q5 O8 {) I+ |. I/ a
  11. *         TO CHANGE.( F5 j( [. \& B1 U- v, Q
  12. *
    , Q/ k) H% s; K  h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % P, w& V3 [3 S% i: l& ?
  14. *% r5 m7 e2 U) R3 j1 c
  15. * This program is free software; you can redistribute it and/or
    1 x$ M" k5 f. d% W8 {: t9 l1 i
  16. * modify it under the terms of the GNU General Public License as6 ^$ ?1 X( H" _7 z9 J9 ]
  17. * published by the Free Software Foundation version 2.* P9 s# ^  `$ N
  18. *
    ' m( Z- v/ b+ ^9 u& ^8 q2 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 Q2 ]% A, [, Y1 o5 h9 S' }  d
  20. * kind, whether express or implied; without even the implied warranty4 ?4 N  e% s" Y" [6 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . L, B' S, i# V$ R7 X5 O
  22. * GNU General Public License for more details.
    . S, w( @, Y$ q% T
  23. */
    2 D6 a! ?: U% U5 ~# M
  24. : I" l' Z% d# m" \3 h
  25. #include <linux/module.h>
    8 h9 v! A, J; ], `2 F
  26. #include <linux/init.h>9 L$ o0 G0 L' g* o
  27. #include <linux/errno.h>
    , Q3 B7 L8 A) [) d5 O0 p6 o! c9 B
  28. #include <linux/types.h>8 n+ h8 M0 ?9 H1 G' X
  29. #include <linux/interrupt.h>
    , K# n: }( ~7 h: W1 e5 k
  30. #include <asm/io.h>3 y. x: i# _; m3 L8 z
  31. #include <linux/moduleparam.h>
    ' F6 [& A9 F5 y. F8 ]0 x
  32. #include <linux/sysctl.h>1 L! `7 q  w2 G. X* Q  y
  33. #include <linux/mm.h>
    ! {. \; t! d5 w6 @7 D, ?+ a8 M
  34. #include <linux/dma-mapping.h>0 O& Z9 V2 F6 s+ P
  35. 2 Z" |8 A2 h6 B. b
  36. #include <mach/memory.h>1 [+ `  {; J* ~1 k) D, }
  37. #include <mach/hardware.h>) d5 H5 U" _6 k- i4 x6 i
  38. #include <mach/irqs.h>' @/ [/ m# Y% Y# Y3 t
  39. #include <asm/hardware/edma.h>- j7 S! z  E, K7 C8 M) a5 d1 U

  40. 9 N3 B* u" Q( O0 W+ ?; l
  41. #undef EDMA3_DEBUG5 ]" s3 C7 |4 ]0 q9 ^
  42. /*#define EDMA3_DEBUG*/9 c. {8 b. K" p
  43. , `! F. a' ~. r! x5 q* ?
  44. #ifdef EDMA3_DEBUG4 P$ @4 i6 b% q6 p! e5 Y" I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): d7 D2 ?% t1 h) x8 g' J' ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " L: o; Q& c+ R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      G5 i; ^1 L) R
  48. #else4 n% J8 T6 N$ R
  49. #define DMA_PRINTK( x... )
    4 T+ d; |) S) J9 ^. [
  50. #define DMA_FN_IN
    % S3 S: A. c4 \' f( ^  j% F: L
  51. #define DMA_FN_OUT
    / o. q/ Z, |: l* y- B0 `% J+ M
  52. #endif. q7 s9 R$ Z/ C9 t

  53. 6 U. \1 x- X: L( w* |- ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' Z. J" g* v: G0 M2 B  M1 m
  55. #define STATIC_SHIFT                3
    $ n% C/ _. r( q
  56. #define TCINTEN_SHIFT               20
    9 H# x0 u9 m% j1 v; O! C3 r$ B! ?
  57. #define ITCINTEN_SHIFT              21/ t9 Q1 W, U- A
  58. #define TCCHEN_SHIFT                22
      h# k$ G0 P4 n9 n. _  p9 ^
  59. #define ITCCHEN_SHIFT               238 f  ]& }) C5 U+ K) K, S5 }3 U1 L

  60. 9 p# u1 i: ^7 ^* B# ?
  61. static volatile int irqraised1 = 0;; |& i/ L: A4 z
  62. static volatile int irqraised2 = 0;
    ! c' ~: h6 Q  q% i

  63. ! R6 x  o: e# H* j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- x. Z3 G# b% k% w7 M1 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' u: z+ J4 g6 n1 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ n. h" C+ @9 O, C: _1 \

  67. 2 U3 l( S  j7 Y& [
  68. dma_addr_t dmaphyssrc1 = 0;5 |  s" I6 B8 k: x) ?
  69. dma_addr_t dmaphyssrc2 = 0;
    ; @, |% \" H( X% k, P1 N* H- Y! X
  70. dma_addr_t dmaphysdest1 = 0;
    / }) d7 y! @' P
  71. dma_addr_t dmaphysdest2 = 0;
    ) ~1 h7 m" r4 n
  72. 6 M; y$ ^0 L# q/ G8 r5 C3 W6 C
  73. char *dmabufsrc1 = NULL;
    7 B0 X! Y' F) e! \+ C
  74. char *dmabufsrc2 = NULL;
    ( r" V, \4 o5 z' k
  75. char *dmabufdest1 = NULL;; p( b  m4 F: o4 m! k
  76. char *dmabufdest2 = NULL;
    ! B, S- C' t3 \. g5 A# ^) ]( B% i

  77. ( W6 a1 U" v, S% w7 K
  78. static int acnt = 512;
    ' B$ j4 p2 S* k2 I
  79. static int bcnt = 8;
    & D! }, E) F4 X2 }1 q/ ~
  80. static int ccnt = 8;
    5 m7 o( H2 e! n/ W) W+ A. `: T

  81. 8 h' F8 ~" D" F/ N: |
  82. module_param(acnt, int, S_IRUGO);
    9 C$ j( R) Q1 _8 U1 C' [
  83. module_param(bcnt, int, S_IRUGO);
    # X' h4 N  g% D" k4 t6 z: o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" O4 p1 f# Y3 |0 S: t5 U- @+ j
1 D& B% W2 @6 m8 ~6 Q9 M; I1 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 M" O( n2 G$ u2 ]" v4 D( B8 h# {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- A0 k: Z! G2 {! c
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, ]9 l4 D5 {# h8 U. \' g
5 O/ T- L: e4 B: Z+ ~  R
8 m& e7 D9 \# @: w/ ], I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 06:20 , Processed in 0.044404 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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