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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . J0 n( U2 |  V0 t& E
  1. [code]EDMA sample test application
      K' v& O' e( A1 m$ X; l$ t( }
  2. /*
      K  L! k( ^9 v
  3. * edma_test.c; I) A# J9 y7 n6 Z& |# h; H/ `
  4. *
    . B) e# g9 g/ O# J& l" c4 [
  5. * brief  EDMA3 Test Application
    0 m* f3 S: M- I' U$ M# I7 m
  6. *) _) S2 W, ?$ ~  b2 Y: d  e- e( b
  7. *   This file contains EDMA3 Test code.
      f# R6 P- d: G* M, Z. W! u
  8. *
    ' d( [5 F5 G$ u7 C' A- m# e& H" o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 ~1 l4 e# a3 @! Q% z, Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! s0 @; P( O7 F  ]/ M# |1 h" G
  11. *         TO CHANGE.3 r  V. [* y9 Q# e. F8 b
  12. *, Z6 A& G( u: p1 N- [- U9 Y9 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. u- d& Z, A2 n# Z  L$ d+ C
  14. *
    / |9 y6 K4 Q- n* y
  15. * This program is free software; you can redistribute it and/or5 Z. E, ^, U, ?1 V1 i
  16. * modify it under the terms of the GNU General Public License as
    . S- z+ p( w" ~! F% H* @2 g
  17. * published by the Free Software Foundation version 2.
    # P0 q- T! n' C  i# ~5 B
  18. *3 r$ }( w+ I1 ]8 K7 j) M' k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; R4 R% w- Q! J) ~! Q$ l# `
  20. * kind, whether express or implied; without even the implied warranty
    ' N2 w& }( o; |/ K  @, o# [9 A$ q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . t. R4 ?/ r. \8 r; A- t5 ?
  22. * GNU General Public License for more details.; X. C6 g2 t! f2 F; _
  23. */
    - `/ b; F* w! `  ]1 B
  24. 3 i2 f4 h1 L) Q+ `- C. \+ U
  25. #include <linux/module.h>
    0 f/ q; e! F/ T* C7 ]1 @
  26. #include <linux/init.h>8 {) Z5 L+ W( B" Q
  27. #include <linux/errno.h>2 b/ f2 v6 a, \; a  Z6 H
  28. #include <linux/types.h>4 g% K5 ]) B9 Y  P9 ]
  29. #include <linux/interrupt.h>& J4 _6 N6 ^! \4 [- k3 I" K" x8 W
  30. #include <asm/io.h>/ {' V# M  W. u
  31. #include <linux/moduleparam.h>- M7 c! D: e/ @! U" ^" S
  32. #include <linux/sysctl.h>
    ) s3 L/ A* ^2 Z* ~$ A& K8 X* v
  33. #include <linux/mm.h>; A9 p# Y5 d% X/ }5 t" {+ K
  34. #include <linux/dma-mapping.h>
    ' A* [1 H/ j: N0 e% ?

  35. ' h5 \' p: p5 P8 F
  36. #include <mach/memory.h># S/ o5 t. Q5 ^( N, X
  37. #include <mach/hardware.h>
    ; \1 r; z" _: l" n" a' C. R
  38. #include <mach/irqs.h>
    % j4 j' n: T( o0 Q% S1 W  r
  39. #include <asm/hardware/edma.h>
    + C3 ~1 v: o8 d
  40. 2 l, Z1 \/ w) B' S( B- ?' V+ i
  41. #undef EDMA3_DEBUG# |' n/ C, n1 u/ T" m& u
  42. /*#define EDMA3_DEBUG*/5 y# R. `1 k! W" l) Y) L8 c) b
  43. ( {8 i2 K/ C, |0 S( O
  44. #ifdef EDMA3_DEBUG
    ' s* m0 @! V1 Z! G+ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" w4 w- o5 c2 R& ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - m2 g+ Z; w6 |) W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); C/ K' Y  S0 E1 ^
  48. #else
    7 y) i2 O1 }0 P* r8 G/ T& [
  49. #define DMA_PRINTK( x... )
    2 s. ?6 f2 K& _5 }( {4 d
  50. #define DMA_FN_IN5 P' g0 p7 n' i! A
  51. #define DMA_FN_OUT* n. k: T. Y3 Z9 i5 f
  52. #endif0 R- u% k( [& N% T8 l5 K
  53. - ~1 W7 P& k+ E, Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " S; i8 e. g- z0 V4 X# I, @
  55. #define STATIC_SHIFT                3
    3 M- K. @! ?0 a; |
  56. #define TCINTEN_SHIFT               20: F, x4 }$ _. Y- ?3 s
  57. #define ITCINTEN_SHIFT              21& `$ w; z% t, b1 p* B" s
  58. #define TCCHEN_SHIFT                22
    0 C* A9 G) c) H. X% C/ A
  59. #define ITCCHEN_SHIFT               23$ U4 N" k" y1 Y

  60. # |% `/ d% K4 ~$ W2 R
  61. static volatile int irqraised1 = 0;
    . b# [" r- R0 b& O# n$ u
  62. static volatile int irqraised2 = 0;
    4 Y5 D* P- z8 x0 m6 q$ p
  63. 2 i3 b2 `1 f6 U1 G! T( l8 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: X5 U- l' j! y1 F, ^7 i* b' W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 v( l  Y9 O$ s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + G# k$ r5 y  p- t  x9 P) u

  67. 6 l0 r8 R  r! ?# Z+ W
  68. dma_addr_t dmaphyssrc1 = 0;/ r, F' j' q9 ]2 z
  69. dma_addr_t dmaphyssrc2 = 0;, J, X  ^1 i* y+ p- }1 r7 B
  70. dma_addr_t dmaphysdest1 = 0;
    : s8 M4 `# m5 V; e; _
  71. dma_addr_t dmaphysdest2 = 0;
    1 @. J1 b3 ~8 `

  72. 1 j. V% K& Z$ v! [# f6 m
  73. char *dmabufsrc1 = NULL;( g% e. ~' Z2 h3 Y. A
  74. char *dmabufsrc2 = NULL;
      ?& n3 o$ _, _! U: y7 m: T
  75. char *dmabufdest1 = NULL;( Z+ H" o1 o- m, ]" W! }
  76. char *dmabufdest2 = NULL;
    # P+ [1 F/ C; k

  77. * n% u/ R8 {( b5 o; F) ?- c
  78. static int acnt = 512;& O5 ~  `7 g* H. a  @
  79. static int bcnt = 8;
    6 T9 q9 T3 b! ~0 {5 q
  80. static int ccnt = 8;
    6 w3 \+ m5 X8 }' D8 |9 e! D1 S
  81. 9 \# N' e3 L& z/ {
  82. module_param(acnt, int, S_IRUGO);- @) v& [/ F1 I! D8 K7 ?
  83. module_param(bcnt, int, S_IRUGO);
    1 P1 l" ?: U3 |0 S) {4 B: U
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( ^; a  s# u7 r/ @0 y" z( S& n; y: n3 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- ?# s1 F8 t! q( t- b7 l: z; a9 i  a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
, A) d+ b% G4 N$ W* r5 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 N& |1 e; B. g/ q, F! \, k% P
1 t/ {1 K: H6 x" f7 J( h) N/ m- K
8 H$ u9 M- z& b, _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 13:13 , Processed in 0.038377 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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