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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! m2 E' R$ I' H
  1. [code]EDMA sample test application1 O" w5 ?) F+ G# H  q
  2. /** k5 n" W/ A5 [$ e+ K* V" h
  3. * edma_test.c
    ; n3 F( I( t) A! H  m( [
  4. *
    + V- ]0 B- \* M% m
  5. * brief  EDMA3 Test Application' B, |, B% v1 p. h* Z
  6. *
    4 M& x& |  a" v% C  Y
  7. *   This file contains EDMA3 Test code.
    0 N) a- ]; p5 t& p9 g0 n+ i
  8. ** b3 f* T! Z! {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 e0 C8 O7 z/ g+ h1 o0 X5 l$ v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) t! O! K8 n: C- D1 X1 U' j
  11. *         TO CHANGE.$ D" H: G3 q8 u! O) l# e' y
  12. *
    $ n; b. |( ~& y! G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 T6 `, @; w. G" B7 d
  14. *" z) b5 y6 D+ p. L  I; Y1 A$ [( t) S
  15. * This program is free software; you can redistribute it and/or
    5 u8 p1 V) T: ~& z% _; Y
  16. * modify it under the terms of the GNU General Public License as
    2 B* t6 K5 M1 l/ m
  17. * published by the Free Software Foundation version 2.# F2 ?7 \# c+ O$ B& X- Z
  18. *
    7 v. ~( Z% k$ P+ p! Z( w/ Y1 s$ S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / {! W; Z, Z! D) @
  20. * kind, whether express or implied; without even the implied warranty6 A3 p# ^, T; |1 B% {8 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ F5 t8 F6 s! M  D% m0 ?
  22. * GNU General Public License for more details., s5 d+ W# `* q
  23. */
    0 R( k% t" v# Q4 p! e# W. c! k  ^
  24. , y$ J, k# q/ x
  25. #include <linux/module.h>' f- j% d" {" g* L8 j* u- D
  26. #include <linux/init.h>/ s$ u. I7 U# p
  27. #include <linux/errno.h>9 i, M: F( ]5 U) R! _
  28. #include <linux/types.h>' P8 ~1 }6 {$ M5 |) e6 k5 i
  29. #include <linux/interrupt.h>
    8 |6 n0 O1 ^* p! \* W
  30. #include <asm/io.h>
    - n/ n; J4 s8 l' C/ m- i5 V, T( S- L
  31. #include <linux/moduleparam.h>
    # D" f% B# U. w* N. J+ b3 q! V4 X
  32. #include <linux/sysctl.h>$ @1 Z0 `/ q4 G+ L2 ]. R
  33. #include <linux/mm.h>
    3 U6 P, Y& O" y2 }# e; g8 R
  34. #include <linux/dma-mapping.h>$ H# |0 B7 H/ c5 X1 v# u9 ~- @4 ^$ S

  35. : Z- T0 g. r0 H  f9 j# y
  36. #include <mach/memory.h>
      ]8 }5 z1 j% N: w+ V9 q/ L) G' P# U
  37. #include <mach/hardware.h>
    ! V( l( O: T9 h! }1 W1 @
  38. #include <mach/irqs.h>
    " y0 A1 Q6 x4 c7 ~7 W1 u3 T
  39. #include <asm/hardware/edma.h>
    1 m1 P( K+ O+ _

  40. 7 I  ~( `: l2 _, V' O
  41. #undef EDMA3_DEBUG% o  h- V+ E! z  Q3 [
  42. /*#define EDMA3_DEBUG*/
    2 r8 z" r& W7 |5 a+ ?/ n- H

  43. : f/ e5 v: U$ _* X* w9 X
  44. #ifdef EDMA3_DEBUG9 ^; D9 {6 F" T0 `- @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 K+ x4 l5 y& J* r+ L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / f  J# {: U# ]* F3 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 d/ L0 B1 r$ Z+ |
  48. #else
    2 _) m& L, l' _7 H+ c' q1 V/ q
  49. #define DMA_PRINTK( x... )
    2 `& |# q) d* n7 a
  50. #define DMA_FN_IN
    * P/ O; j3 F; L5 ~0 l7 ~$ a
  51. #define DMA_FN_OUT# ^' `: u+ [# v3 n' b( n
  52. #endif
    , @$ g' b- Y: L: F
  53. + W6 C9 }* _+ H. `  y6 r$ `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / ~9 c4 i' _) o! o
  55. #define STATIC_SHIFT                30 d) `7 X( M0 q4 b' [& V: m4 b
  56. #define TCINTEN_SHIFT               20
    ' V# H9 X* @/ ]9 e; i, d
  57. #define ITCINTEN_SHIFT              21
    . l4 `3 s! n+ @) X7 }
  58. #define TCCHEN_SHIFT                22
    ; h" ?9 [% ]# r
  59. #define ITCCHEN_SHIFT               23. b+ Y( L4 \5 {; ]+ Q
  60.   l" H- Z$ E5 C3 d/ F9 X1 k
  61. static volatile int irqraised1 = 0;
    ! m" ?1 o& v- X# s. S/ t
  62. static volatile int irqraised2 = 0;* v) ?- l) k1 F. o5 ~* |0 i
  63. ) ~( b0 T. m# B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ A3 J; F; z, J7 C! O. B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p1 |$ [7 z+ @7 E" V' {; O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?' X6 ^7 H" I* R9 q
  67. : v, R  Z# d) h1 h+ a# K
  68. dma_addr_t dmaphyssrc1 = 0;
    : a6 b( z  r) `% C; f# U( u8 `
  69. dma_addr_t dmaphyssrc2 = 0;
    $ [+ ^. E# e9 _1 b0 H
  70. dma_addr_t dmaphysdest1 = 0;# L( O( b0 y% {$ Q
  71. dma_addr_t dmaphysdest2 = 0;6 ~/ ]6 b" d% Q9 @- y4 |
  72. + z" ]. r4 E1 V3 i: I1 m
  73. char *dmabufsrc1 = NULL;6 F2 M4 o; Y) S9 k1 g+ }; I
  74. char *dmabufsrc2 = NULL;6 g7 Y- h+ w' |
  75. char *dmabufdest1 = NULL;
    9 W2 a5 Z4 v3 \- s' D
  76. char *dmabufdest2 = NULL;
    ! m3 C5 A1 O  E  N- ^% U) x

  77. : h5 f3 n! h8 {" u
  78. static int acnt = 512;
    / c- l) w7 z0 R7 a' D9 p! C7 t" Z) k
  79. static int bcnt = 8;7 I# a* n4 Q+ n  J
  80. static int ccnt = 8;
    3 m) f3 C$ f/ W  j7 _( k# }
  81. $ z5 g/ H: ]' l8 B$ _2 R
  82. module_param(acnt, int, S_IRUGO);: Y  U, N/ ^% `: X) M; W2 `% l! |
  83. module_param(bcnt, int, S_IRUGO);. N% x4 e0 z7 _+ }% l
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 k( G; d" _8 X& V! l
) q1 \& ~2 O6 d- s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 |6 n! t7 D5 }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 O3 U, u) h% r- ]  h. P/ X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" U3 f3 A% y" I$ }2 {5 T
3 `' i( ]% c7 c2 P7 x* {/ t+ b
$ h0 y# G5 d, y) m" A+ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 01:27 , Processed in 0.042848 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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