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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" x' e% h" V+ w. m
  1. [code]EDMA sample test application
    , y5 ]9 c, s' ^5 g0 L
  2. /*; |; v6 o" d4 |* C, k
  3. * edma_test.c
    8 ?$ |$ y/ J8 P' f% T- V& f
  4. *
    : m2 E8 U  U% Q
  5. * brief  EDMA3 Test Application
    4 ]  F5 R7 E* w
  6. *
    . K6 z* O1 D) B
  7. *   This file contains EDMA3 Test code.) p8 D2 w7 W) \0 M. k
  8. *
    : k7 P% `4 A# m9 w  r# y5 O+ K& R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# S) g- I2 W' j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  @* L+ P! x) j- C# C; _4 x+ J
  11. *         TO CHANGE.( d" F1 Y# ^  f8 j: b2 B
  12. *
    2 n  J% K: D5 b  f* }) f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 P: f5 o$ Q2 F
  14. *9 I) }3 d0 Z( }& O, Y* E  \" g
  15. * This program is free software; you can redistribute it and/or
    * }. z( ~4 j, y0 D# _% d7 a
  16. * modify it under the terms of the GNU General Public License as+ S: ?& N. m' v8 b8 V
  17. * published by the Free Software Foundation version 2.4 b. T# d* F/ ^2 }+ D
  18. *
    2 D  \) y, X/ F5 s. L, X) H7 A" h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " o# I2 j. m' {& T; u0 ]
  20. * kind, whether express or implied; without even the implied warranty& [8 M! b8 C/ k8 t" M6 E4 Q7 h7 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 ~( x! L1 i! O7 D! Q+ m
  22. * GNU General Public License for more details.' i8 Z& r5 K" J" q  N* I% ~  X0 |, |
  23. */
    / M. b9 k$ s" p; e0 o+ m6 X
  24. + o8 d3 F! h) ?( t5 a2 v2 Q
  25. #include <linux/module.h>
    9 K7 u. o3 V) L! S$ V
  26. #include <linux/init.h>
    4 t! h) w1 o0 V+ G5 P! T6 J: y8 V
  27. #include <linux/errno.h>! h* R/ \% C( [
  28. #include <linux/types.h>
    6 P. t3 _$ P0 }& P
  29. #include <linux/interrupt.h>+ [& }  u9 e) Z: _
  30. #include <asm/io.h>
    % \- W" P% i: K8 D4 L+ q
  31. #include <linux/moduleparam.h>7 u8 v7 _# Q! @( C4 j) g6 @
  32. #include <linux/sysctl.h>
    . o4 x+ N# B# q3 Z0 x
  33. #include <linux/mm.h>
    * x+ g- p9 a9 g# J0 K' [9 Q
  34. #include <linux/dma-mapping.h>- v9 l! X" [; u/ z/ B% i
  35. 8 q3 p! C8 z' ?+ Y' b2 x  d5 l# O
  36. #include <mach/memory.h>) T2 b; I: E8 R* a3 S
  37. #include <mach/hardware.h>
    9 A, @' B2 |4 a2 @! @
  38. #include <mach/irqs.h>
    5 x0 V1 t; N. M! @5 a, j2 N
  39. #include <asm/hardware/edma.h>% H4 j8 ]: n6 L9 U  U6 T, a/ R. ~! m
  40. 8 T8 m5 f$ R2 L( i
  41. #undef EDMA3_DEBUG, i9 m5 h1 o3 r1 b
  42. /*#define EDMA3_DEBUG*/
    / R7 E, Y6 S0 a& [; I% ?5 X

  43. 3 b; R, M7 @! v2 q4 O* M% i
  44. #ifdef EDMA3_DEBUG! e6 D& `) g' [$ W4 e- v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( R: G: A& U/ J; r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * `& W, j# ^+ q/ P3 T) w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 o9 a" G& f  ^+ ]! c! @
  48. #else
    8 B$ y* s! W, `8 h7 N! Q
  49. #define DMA_PRINTK( x... )# u8 e8 c7 ~( ~0 U/ G7 O* w/ y  Y0 t
  50. #define DMA_FN_IN
    ; h" `9 O. _  H6 N( _1 z& l' K5 _
  51. #define DMA_FN_OUT
    : v* j/ M* D- Q9 H+ Q8 Q1 {
  52. #endif
    ' `4 {0 q8 h" S7 }+ ?7 q. U8 q
  53. / ]0 P$ I) h. y  `' e. @: n7 {" U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): v- p) K$ i6 `" p) W; M# d
  55. #define STATIC_SHIFT                3
    / t1 L/ x+ ~' o7 d: ^/ C
  56. #define TCINTEN_SHIFT               201 I- D# Q4 [/ G( `7 e# H. n" A7 f
  57. #define ITCINTEN_SHIFT              21
    - l$ k' R( y, Q
  58. #define TCCHEN_SHIFT                22
    + c! n6 q. b1 B9 ]. _
  59. #define ITCCHEN_SHIFT               23
    4 h# `: |# t9 E1 v- r5 r0 M0 @
  60. " P; G+ V* C: l# W
  61. static volatile int irqraised1 = 0;0 D5 M0 q6 w1 p6 W% [0 N" n& P
  62. static volatile int irqraised2 = 0;' f% l5 ]" ^/ [( N  a0 @
  63. # G& P1 G7 z5 m* _  ~$ j0 w3 N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; s- e+ l$ d& g! l" X4 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 l& V' ?' w$ }" e% D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 K+ @  k1 Z; W: P& ~
  67. $ H. V: I! D7 n! ~- b# w) X
  68. dma_addr_t dmaphyssrc1 = 0;& ]/ Y+ J- G9 s* x7 M
  69. dma_addr_t dmaphyssrc2 = 0;
    # C( O, q4 m4 W3 f% Y% M
  70. dma_addr_t dmaphysdest1 = 0;7 J7 c7 s7 o9 X0 t
  71. dma_addr_t dmaphysdest2 = 0;8 c' U9 z4 K+ J3 U( G
  72. 5 T; D& @! W/ s7 E9 E; T5 A2 B
  73. char *dmabufsrc1 = NULL;
      J$ W  }1 M5 G/ o$ t# e5 y. ?
  74. char *dmabufsrc2 = NULL;
    # M! s$ Z; g# j# k$ Q; ]- t
  75. char *dmabufdest1 = NULL;
    7 f& D- d, J7 r( Z7 H& v
  76. char *dmabufdest2 = NULL;: Z& n& }4 k7 P+ N

  77. % `) N, V8 Q. F1 u
  78. static int acnt = 512;+ c$ p7 B% S" L+ Z' y
  79. static int bcnt = 8;) m/ O9 {, I. g/ F
  80. static int ccnt = 8;
    / ^' u% b5 Z9 j0 u. D% N: ^
  81. ' N7 `# U# M/ K, I6 O
  82. module_param(acnt, int, S_IRUGO);
    1 N$ Q" y3 q0 `
  83. module_param(bcnt, int, S_IRUGO);
    4 F/ E0 H' \9 `7 j! k) f9 R7 Y) r! Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 x3 s9 U+ ]6 G! P' Q0 t( Q
4 X: \1 `' t0 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) |, J3 `# ^5 u7 W% l% F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 ?9 G- R' I$ w6 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- y+ D: y$ m2 E. r9 b0 ?  t$ }5 V6 s/ H. w$ ]% B, k
1 R; p" ], V2 a! p. J! k) e  A" o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 03:11 , Processed in 0.039595 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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