OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 P$ c' i/ W4 [; Y# |# t0 W
  1. [code]EDMA sample test application: g0 ]: V6 F! z- c4 J8 E5 R1 s
  2. /*% p) C6 |$ P5 r8 x. t
  3. * edma_test.c' ?' c1 p0 }: B. j+ M  U
  4. *4 r% J6 o# P7 f% U
  5. * brief  EDMA3 Test Application0 A$ V. s' s' F  h3 n+ B4 k$ n
  6. *
    3 {9 e) ~. u/ Z8 x( _" @) q0 J
  7. *   This file contains EDMA3 Test code.: j$ o/ R$ \$ Q1 E2 z
  8. *
    ( \) i$ M3 ?5 W* a3 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / b! @5 E" x" J- @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 w  ~" G, k8 {2 R$ R
  11. *         TO CHANGE.7 U/ d6 C  k: E: }
  12. *
    # w  |; h7 [' J0 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 s/ Y& _/ B: p( |  Q; d; ]
  14. *
      @( x$ I( |4 F/ f' {
  15. * This program is free software; you can redistribute it and/or! k$ T7 B+ V% i! w* y- A
  16. * modify it under the terms of the GNU General Public License as
    6 B5 o& U" q3 h" _( \* c7 k
  17. * published by the Free Software Foundation version 2.1 f. O* {" H2 [
  18. *! [* P& ]* Z! E1 s" S. q( c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 k. J8 Y. Y6 X: f' P. c  D) @
  20. * kind, whether express or implied; without even the implied warranty
    1 V( o& n- H- _' M+ H. W9 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + e$ H' t, k7 Y5 U3 {
  22. * GNU General Public License for more details.1 a: S5 h5 {) W7 c6 H
  23. */
    - w, K, X% \2 t

  24. 9 G2 Z$ a) |: [; t! ?5 `3 i
  25. #include <linux/module.h>9 }# B" c  z3 t  o( U
  26. #include <linux/init.h>) l4 a# H% m/ D% ?, ]# f: G: e
  27. #include <linux/errno.h>( P" }0 g8 d; Z/ r' L
  28. #include <linux/types.h>. |+ w% z" }3 e+ Y# f# W. ^
  29. #include <linux/interrupt.h>
    $ G2 S7 F! M5 U3 e
  30. #include <asm/io.h>/ L  K9 u" l- G
  31. #include <linux/moduleparam.h>- y. @  d3 P% T# G- b
  32. #include <linux/sysctl.h>% S2 c% h# Q6 ?: k. Z( C
  33. #include <linux/mm.h>8 s2 p) a+ ^9 b( K2 a8 x9 ]
  34. #include <linux/dma-mapping.h>
    & K, H; c; L0 {% u6 d

  35. ' k7 l& Z4 j2 l2 A: L- R' A
  36. #include <mach/memory.h>
    & @1 V( }" @) t; {" |8 @/ ~  L$ o3 S
  37. #include <mach/hardware.h>! c0 P) e- h" B* U. x
  38. #include <mach/irqs.h>
    " y" k/ ]+ ?# a+ I
  39. #include <asm/hardware/edma.h>- B4 Y; h" q# }( A& @& ^) u% R
  40. + A5 x  v' W7 f$ J& m, T6 D
  41. #undef EDMA3_DEBUG" }8 R$ T6 P7 A/ d; [9 w' Z
  42. /*#define EDMA3_DEBUG*/& J6 L0 M( Z/ u8 j( {; W3 |
  43. ' W8 B" i& s- `0 Q- D6 r
  44. #ifdef EDMA3_DEBUG
    7 M  v5 {; Q. h/ g( Y: A) g( ~- Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! x9 u6 D2 k2 t) p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 F3 N8 k" y% w5 j  U! H( N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & l# v0 U$ |6 e. X8 {# [+ P
  48. #else4 I$ r& {4 X7 E  o& F* T
  49. #define DMA_PRINTK( x... )0 w$ \1 v6 A8 f; E. E
  50. #define DMA_FN_IN/ P8 N6 X. X) W8 R" R+ u
  51. #define DMA_FN_OUT
    8 M7 s- e9 b) P. P
  52. #endif1 X6 `( J  s& m8 G0 X! p5 E
  53. ! u, t- |( t4 Q0 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & `  ?6 w( h7 e. }- b$ ?
  55. #define STATIC_SHIFT                3
    ' ^* b/ v* H% a. Z* K
  56. #define TCINTEN_SHIFT               20* q/ v5 ^7 J7 X! D1 R  G8 @
  57. #define ITCINTEN_SHIFT              21. T) _8 m) J2 `8 |- y+ ^
  58. #define TCCHEN_SHIFT                22$ u* N' S, D* a# C8 i) x4 o
  59. #define ITCCHEN_SHIFT               23; {! W; i5 @' s( ^& H& G

  60. ' D' F2 S% ]# n$ v1 P( Y7 ?
  61. static volatile int irqraised1 = 0;# g6 \0 k5 k5 f1 E" A5 `
  62. static volatile int irqraised2 = 0;7 W7 _+ Q) t# s5 G4 x

  63. % J; |5 k+ u' ?# M+ i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  l- z" s- B' Y* @2 ]  u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 H) D" D6 N) @7 u* Q, |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ g' f9 }( S" ?5 ]3 t+ Z
  67. . X% O7 r) ~- F8 ^
  68. dma_addr_t dmaphyssrc1 = 0;/ \; r6 V# i/ e0 f; d+ P
  69. dma_addr_t dmaphyssrc2 = 0;, Y4 g$ L  p& h+ U9 K3 ]
  70. dma_addr_t dmaphysdest1 = 0;
    , t& Y* ]8 T9 k# u
  71. dma_addr_t dmaphysdest2 = 0;
    + |0 a: e0 L. T$ o- X( l- `2 e

  72. % ~; n3 V$ A3 a
  73. char *dmabufsrc1 = NULL;: |6 q) _4 @! w+ J2 a: q$ Y: ?4 N
  74. char *dmabufsrc2 = NULL;2 A) ~3 I, r  Y! P2 w5 _% ~! z
  75. char *dmabufdest1 = NULL;8 Z" u; W$ Z- V. e
  76. char *dmabufdest2 = NULL;
    8 P; l* Y* B. ?4 v4 D; W; ]
  77. / i4 T7 q* w1 o0 I+ p/ [; f5 V
  78. static int acnt = 512;3 a. A/ s) t: A. O4 F
  79. static int bcnt = 8;5 P; R  {# q8 h$ h3 q# J/ b
  80. static int ccnt = 8;3 F4 @# ^6 ^6 L$ R' n
  81. ) k3 g' X3 {) D9 `4 L" G7 r/ A2 y
  82. module_param(acnt, int, S_IRUGO);
      [5 ]  N* T) A6 k/ a% @/ c
  83. module_param(bcnt, int, S_IRUGO);
    ' t  {% w6 G& [: Y: _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ B" U* {  P! Y# I) n/ X

. {( V9 y  V4 u3 C7 l2 H' \      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 E4 }/ P$ ]* F+ _9 m0 K; J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  G# Z( _  `8 n' }" P7 @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 J4 O4 ~, r: O; G: ]+ _) b& z5 K
/ w0 b6 Y  b1 M
' `/ K' ^7 i) y7 e; N7 X- f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 17:35 , Processed in 0.037200 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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