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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ~- u  q! U3 Z1 D& ]
  1. [code]EDMA sample test application
    7 Z9 g6 I. Y: F/ J6 y( f5 B. D/ G7 [
  2. /*
    ; p: m4 X' O& C$ `' K; G; m
  3. * edma_test.c
    + c5 I( h, K& `/ V: g: B
  4. *
      C8 a3 @5 [2 M6 i6 r
  5. * brief  EDMA3 Test Application4 ^4 G4 \7 k+ a; K' `% E+ {
  6. *4 X# }2 m7 e' |" c6 r& A, g/ I
  7. *   This file contains EDMA3 Test code.
    , @/ p( w" z  U) i- p' H
  8. *
    ; ^8 t6 H, ]+ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' c. v* |% p3 N+ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 G4 i8 v/ E( L5 k$ R* O6 ^
  11. *         TO CHANGE.
    8 D: ]+ g! G5 G+ a' D
  12. *
    ( m' m7 I) n+ E8 S% x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  y" @) U1 ?* d7 g- R" \
  14. *5 T6 H. V) i8 R. g5 B. d
  15. * This program is free software; you can redistribute it and/or
    6 @1 o6 t$ ^( ]8 U0 \' y/ k0 S
  16. * modify it under the terms of the GNU General Public License as5 e  w7 G' m+ C( ?9 w
  17. * published by the Free Software Foundation version 2.
    8 ]! k1 t7 i/ w  X$ g9 a7 l
  18. *0 d4 O: R9 H/ n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # h3 {* o8 |6 Q1 \! [
  20. * kind, whether express or implied; without even the implied warranty- Q3 P2 R, Y6 B; p. [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 {7 y& t  O0 @9 B5 N5 I
  22. * GNU General Public License for more details.
    ; {+ J: Y# S8 E3 c
  23. */
    ( o5 a% h# H/ n, ^6 H) o" l6 |
  24. ) o7 o3 i& @* M& I0 N. K6 `9 M
  25. #include <linux/module.h>
    & J# F; m+ m7 ^! j' ?' [% }3 h- a% C6 v
  26. #include <linux/init.h>
    ; N5 C4 n8 W* ?
  27. #include <linux/errno.h>. i& @1 s- R- x& I( [
  28. #include <linux/types.h>' h# |0 h' Z6 \3 e9 b7 i# W
  29. #include <linux/interrupt.h>% f# l0 o4 Z& e$ H+ Q* V! u. h
  30. #include <asm/io.h>
    4 o- Q1 Q, L4 B& }9 j/ r3 J
  31. #include <linux/moduleparam.h>
    $ G; b* y% F4 E- v% s
  32. #include <linux/sysctl.h>
    $ t9 `. ]. L: O, R# o# b
  33. #include <linux/mm.h>
    4 {3 K, ^% _- M! p! u
  34. #include <linux/dma-mapping.h>0 e, r) Q3 i0 e# g! _! R
  35. , p) H1 ]. P! L8 }
  36. #include <mach/memory.h>$ \+ Y6 O% D; V" p! m0 A( N( H
  37. #include <mach/hardware.h>
    * k* ^0 Z: I; ~* _2 m9 i
  38. #include <mach/irqs.h>
    # @8 K9 K; L4 u( N8 M: S
  39. #include <asm/hardware/edma.h>
    / O. ~6 c4 N5 Q" d

  40. % C- o4 v6 t% \- P% c6 l
  41. #undef EDMA3_DEBUG
    9 q% R  u  d  P2 s
  42. /*#define EDMA3_DEBUG*/$ L& f$ t. p. ]6 a1 z' ?5 @
  43. : c+ S: @0 y" M# U- q
  44. #ifdef EDMA3_DEBUG/ }" I5 r% H1 {; r3 Z& w! M; a1 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / }: l: R0 w. c/ S# X' @% @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {$ W& _- c) `! D5 r8 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' I) f0 C; `) L
  48. #else; F$ h& U" h! F
  49. #define DMA_PRINTK( x... )7 j2 `. I3 H% L" ]" S/ w; l
  50. #define DMA_FN_IN
    " x1 Y4 h+ f% d( h- e
  51. #define DMA_FN_OUT5 j- f2 J$ ]% z. J6 ~9 H
  52. #endif( {/ q4 x7 j6 c! V; S

  53. & d2 r  `" o5 {: k8 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), L4 B) f+ R% W0 S& s- q. B: @, d
  55. #define STATIC_SHIFT                3
    7 B9 w. Y; f& ^7 `
  56. #define TCINTEN_SHIFT               20* q# X# ]* O2 y/ i( y( g0 s* k6 U
  57. #define ITCINTEN_SHIFT              21# }5 a) v4 ?) P# w3 f6 ^: G
  58. #define TCCHEN_SHIFT                22& [9 x% u2 X0 d5 @' t
  59. #define ITCCHEN_SHIFT               23: ]3 B( L* C$ N. u5 l
  60. + q% |2 [5 j8 a- m2 R: H/ i
  61. static volatile int irqraised1 = 0;
    % {( Y3 o4 m8 y: G! S# i8 I. O' P
  62. static volatile int irqraised2 = 0;
    4 `% U: ^, d, F) w" B; s! ]2 p

  63. 4 E& Z# M1 z$ u' q$ @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" v- R) R+ L7 c& V! J4 o: }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; y$ n: a, l& i$ `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^' a9 ~0 J- D; p) w7 B
  67. 2 E! c( s# k$ r7 `0 Y: P
  68. dma_addr_t dmaphyssrc1 = 0;
    8 d4 `4 }* G  n8 x1 v' e- M
  69. dma_addr_t dmaphyssrc2 = 0;
    7 G5 ?9 Z9 A' h2 L2 N3 S# ^
  70. dma_addr_t dmaphysdest1 = 0;( L: s+ ^, \- g1 h) b
  71. dma_addr_t dmaphysdest2 = 0;
    ) b/ Q6 z; n' k& o9 [! Q; m" t

  72. 9 d" n1 M; \4 }
  73. char *dmabufsrc1 = NULL;: K. x1 ~+ z. N" A$ E
  74. char *dmabufsrc2 = NULL;3 r- Q* o! V/ T5 `1 }
  75. char *dmabufdest1 = NULL;
    7 V9 E* N0 Q6 K/ S3 Q, o
  76. char *dmabufdest2 = NULL;1 }, ]  B0 h7 r
  77. ' _$ C1 `  p1 R
  78. static int acnt = 512;
    4 f' Z& f* Z" B  }( V
  79. static int bcnt = 8;
    5 X5 h* w& D# x) u1 Y5 M- _
  80. static int ccnt = 8;8 z3 z) t7 t4 j4 y4 e( R4 n: M
  81. 3 @. |% x& _+ i8 O- l& o/ ]
  82. module_param(acnt, int, S_IRUGO);
    7 F7 X, C$ N# H4 u* o: _( I3 w4 Y
  83. module_param(bcnt, int, S_IRUGO);
    1 c/ s: l9 X( ]# G: O4 `1 L5 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" R! j' O5 l6 a3 F3 U) M6 H
; I8 T% s5 v$ Z7 f" U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. f, O. z# f1 k; O/ Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 ]0 K) Y$ c+ z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" \+ b6 P  t9 F$ m( U+ n; J
4 A5 y3 y6 H, @+ x

' Q6 q) v* w" S5 M3 j% c+ s( R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 03:37 , Processed in 0.041463 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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