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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 z' E1 I% j8 i: Y% Y5 K5 x9 o: s& J; n
  1. [code]EDMA sample test application
    % [& B' v" s8 F- Y5 z9 b
  2. /*
    ( x8 g# i7 f/ d8 o
  3. * edma_test.c
    - F" O( O2 I5 X- I& u& D
  4. *2 ?! S- k7 H1 \# T" X5 Z8 r
  5. * brief  EDMA3 Test Application' y) i0 ^3 [# `" X
  6. *
    ' @: Y2 d/ ^+ S* K0 d
  7. *   This file contains EDMA3 Test code.
    " X. N5 H0 i& M
  8. *
    . I7 U+ c2 H# r- D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% {- r; T/ [9 e$ \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; b# I  }" @* M, E
  11. *         TO CHANGE." B# u! F: T% G+ m
  12. *
    ( g5 S+ v  \- H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 u- h% b- ]# |' R  R/ D
  14. *
    / u7 x! Z5 ?7 s3 E$ D3 {- R
  15. * This program is free software; you can redistribute it and/or) o7 F' d% `9 |$ F  W3 K) e
  16. * modify it under the terms of the GNU General Public License as
    1 @  i/ T2 q% T7 F% W- v$ l+ \
  17. * published by the Free Software Foundation version 2.; Z- N0 g/ M8 F: b# H
  18. *
    3 H: D1 s$ {4 A, c5 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 Y5 t$ S* ]3 ?; w1 m6 \8 b1 [
  20. * kind, whether express or implied; without even the implied warranty+ R3 V; `  H  E. w# e% M; Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# {" ]3 q7 l. |6 Q& C# p8 e3 J
  22. * GNU General Public License for more details.5 h0 g2 {; x3 K5 U2 \( d! O. K
  23. */& ~  O/ l2 r- W0 \, k

  24. 2 \. m  S  }, y# E8 o
  25. #include <linux/module.h>6 j, M+ D( W. E
  26. #include <linux/init.h>
    / c- H+ \4 `. R7 D! m
  27. #include <linux/errno.h>! k' J* {8 q( b" K" [! b9 s$ I, }  ^$ K
  28. #include <linux/types.h>
      h' |# a/ i; S' g
  29. #include <linux/interrupt.h>: A3 M! M/ k; g, P& n8 W: L7 Y% B
  30. #include <asm/io.h>
    ! h7 r* d9 h3 q5 i" {1 ]& ]
  31. #include <linux/moduleparam.h>
    : `' N/ g3 m  v8 Q
  32. #include <linux/sysctl.h>
    0 \5 \# a) l% r# D) Q$ e6 H, B
  33. #include <linux/mm.h>
    / p. D2 F$ E. s1 L0 i
  34. #include <linux/dma-mapping.h># H( O! x2 Z2 Q

  35. % I4 x( q: S9 Z5 L" t
  36. #include <mach/memory.h>+ R" ^2 M9 `3 O' r# x
  37. #include <mach/hardware.h>  \8 V* {2 l/ c8 j2 V' J
  38. #include <mach/irqs.h>
    - @# U4 y  U, s; p
  39. #include <asm/hardware/edma.h>
    & X0 |9 O3 a2 i8 X0 C! D8 V& [
  40. " B7 x8 v# @. a; {: s! g" e0 u
  41. #undef EDMA3_DEBUG) C. r! c; j7 I: K% y  [0 D$ F
  42. /*#define EDMA3_DEBUG*/
    8 N4 T4 L+ e- N( F

  43. ; Q' P! [$ t; l$ J  K- ^. A/ ^
  44. #ifdef EDMA3_DEBUG
    ) \9 T+ I7 Q( r! c' O6 r, N: X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). f/ s% c: q/ B* P- @+ T( M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). F" P( Q% D* _; r9 {9 b+ d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 E0 P1 h/ F- }" ^6 u
  48. #else
    # n5 h# u- Y) Y) ~# [3 W$ @
  49. #define DMA_PRINTK( x... )/ D- i  ~% d1 P; s; W% L
  50. #define DMA_FN_IN9 Y: A$ m4 N1 Y! N
  51. #define DMA_FN_OUT  d# |3 B- E' l1 K
  52. #endif3 m6 c/ K. S6 v% u& e$ V" }
  53. # t0 f) }; T9 v2 {! g- F8 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! ]: P) f4 f- I& Y9 t) e2 l
  55. #define STATIC_SHIFT                3
    ' O% @) s4 i; L
  56. #define TCINTEN_SHIFT               20
    8 L% T0 [0 ~* ]: _3 N  h
  57. #define ITCINTEN_SHIFT              218 T* o" p3 L7 V* ^* _; e
  58. #define TCCHEN_SHIFT                22
    ( g) c3 D& l' Y$ k# t, ]
  59. #define ITCCHEN_SHIFT               23, p$ H9 z; `* }7 ~3 [

  60. 4 H# p. l3 B6 d2 R4 h; E1 B
  61. static volatile int irqraised1 = 0;
    ; u- F, g8 c. \4 G
  62. static volatile int irqraised2 = 0;
    7 E* L7 Q9 F1 B4 B* x' u
  63. # F# P$ @- q# T: r! ^/ o( ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. v0 H4 C, t% a. J. {! \  t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 P. y) l* t; ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {- E) D; |7 X4 K: s: X: i
  67. 8 x3 O: k9 G. }9 K
  68. dma_addr_t dmaphyssrc1 = 0;$ ~: {* u- ~5 y
  69. dma_addr_t dmaphyssrc2 = 0;3 p( k2 n0 d8 N3 d% [, q
  70. dma_addr_t dmaphysdest1 = 0;- ]/ Y: U9 f: _5 Q% g
  71. dma_addr_t dmaphysdest2 = 0;
    9 N& y- D- u4 F4 M; |
  72. $ @( I' _' G$ @" O
  73. char *dmabufsrc1 = NULL;2 @- w& U2 V. ?' ~0 i- a, X
  74. char *dmabufsrc2 = NULL;
    & |3 R" b# z) ?) d  T
  75. char *dmabufdest1 = NULL;
    0 ]3 D5 N9 z! ]" ~& d
  76. char *dmabufdest2 = NULL;1 H$ \0 c$ ]5 d' [  B
  77. ( N! M5 K' W. y
  78. static int acnt = 512;
    - r7 P3 l3 |9 {  D& x# `
  79. static int bcnt = 8;4 O2 x" E( k! X# f* k
  80. static int ccnt = 8;3 ^  m( `3 ~( P$ l  q6 s( `6 J. g

  81. , @; [; s4 j2 ?0 f( u7 n
  82. module_param(acnt, int, S_IRUGO);1 A  n5 Z' Z2 \& F
  83. module_param(bcnt, int, S_IRUGO);$ m  {2 h) _% E! [1 m3 U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 ^% D9 `- t- O, c7 W
/ x3 r1 l/ ^9 z' d( B% e' X3 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ r, j7 ?5 a8 \* F3 h6 D3 Y8 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, Z% V9 n- @# F6 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: V1 s" f3 K( m9 ?

5 G- `' f2 c9 c1 {. f' Y# r1 V6 Q( S9 P1 ^% s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 23:59 , Processed in 0.040714 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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