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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 c+ ~  i- ?0 f, v9 P  g
  1. [code]EDMA sample test application9 t4 x5 Q; p3 p3 f) N) E
  2. /*  a* o& T( m7 l) k
  3. * edma_test.c! `% \$ I+ G; W2 M" v! H
  4. ** A4 N2 B7 l$ P1 B- C  K3 F
  5. * brief  EDMA3 Test Application; Z" W( f7 _$ d. Y% Q0 t
  6. *8 }& S0 b3 U/ ]  ]
  7. *   This file contains EDMA3 Test code." z  H; r" H: c/ [
  8. *& O+ ], a% [$ ?: x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) _$ q* Y7 ^0 ^8 _) ]4 e5 `" u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' c' m. T* ?1 m# ~7 v2 L+ u. `
  11. *         TO CHANGE.8 E- s: k* c8 H
  12. */ w" y0 Y. Z3 k! f) \5 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' v/ W1 H* t; \2 F: ^3 |8 {. a/ L
  14. *# l5 B3 k3 F: m3 y
  15. * This program is free software; you can redistribute it and/or
    6 O( D9 N% j/ S3 M3 E
  16. * modify it under the terms of the GNU General Public License as
    . z2 e* ]+ h8 g5 s9 t/ t: C: S
  17. * published by the Free Software Foundation version 2.( L1 j, `+ G/ h7 i$ I
  18. *2 E8 G* r4 s' T' L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, a4 |- ]: }$ r" f$ @7 U
  20. * kind, whether express or implied; without even the implied warranty
    6 I/ b; I' w. P6 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + J9 S  k( H: X6 c, h
  22. * GNU General Public License for more details.* D1 ^5 U# {) X4 l8 ^0 W) }
  23. */1 N8 H7 u' e5 a( c9 N
  24. ! u# [0 z/ Y0 |* c& q
  25. #include <linux/module.h>8 W2 z$ v# u' ]- }* O# Y. z2 d! v
  26. #include <linux/init.h>
    - p; k; y# p$ p6 y+ V+ x; G5 n7 n% }
  27. #include <linux/errno.h>' A) ?1 ^- T- Y+ t, S/ j& \# N
  28. #include <linux/types.h>
    2 o" g8 W# I/ ]; j
  29. #include <linux/interrupt.h>1 k% ?& [' V/ K
  30. #include <asm/io.h>
    2 G1 b3 P" I: y' e
  31. #include <linux/moduleparam.h>2 e& L/ d: g" \, n0 g' A- \: y7 |
  32. #include <linux/sysctl.h>+ J  F. m  `# P" H% N) c
  33. #include <linux/mm.h>; u) U6 @! T0 @) _2 m
  34. #include <linux/dma-mapping.h>
    / R3 A( }" @* w7 j

  35. - k8 t2 q4 v% d
  36. #include <mach/memory.h>
    ' F+ i  a9 f7 j0 s( R" g: j. b
  37. #include <mach/hardware.h>
    ! r: o& L; Y* \2 F
  38. #include <mach/irqs.h>- x4 Y) N* \* X% L# w
  39. #include <asm/hardware/edma.h>5 y- o9 i4 d2 l( Y

  40. " o8 L( n$ z! K: i
  41. #undef EDMA3_DEBUG' J9 q* L; l# m  J  z
  42. /*#define EDMA3_DEBUG*/: E! f( i; X! A8 M1 \

  43. + H7 E# m& ?) M4 A# H0 D
  44. #ifdef EDMA3_DEBUG5 z) `2 `5 _3 {+ K! Q$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + t6 M) j6 m+ t5 W' B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- S  X- Y) J0 N' k, `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ w0 j1 P; Q2 r* O: m
  48. #else' V/ Q, m4 T2 L
  49. #define DMA_PRINTK( x... )% s& A) `$ u# N3 v' V
  50. #define DMA_FN_IN+ w! Q2 N+ y+ _" x+ i& m5 i2 ]& W  |
  51. #define DMA_FN_OUT6 C! ]& n3 M1 v" [+ d; i, n
  52. #endif
    8 A, x% A. X* [# I9 t6 P9 U$ p1 s

  53. . T9 J, h" p2 f/ A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 k# }! a8 f) j  m
  55. #define STATIC_SHIFT                3! D- F5 M. ?& q1 [! O
  56. #define TCINTEN_SHIFT               20, E( g. [8 s. o1 |5 }% i
  57. #define ITCINTEN_SHIFT              21( I+ g' {: P/ @# p8 y
  58. #define TCCHEN_SHIFT                223 X# \# i' R( `% l
  59. #define ITCCHEN_SHIFT               23
    2 N) T4 a* ^4 {9 i7 r/ t
  60. " ?4 {% T  c/ m
  61. static volatile int irqraised1 = 0;/ x: ^' |0 V4 X8 }: b2 P7 m' M4 Z
  62. static volatile int irqraised2 = 0;! Q. }$ {4 ?. i# [0 g3 X* ~
  63. * e& B. Z5 T* Q3 H2 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; n' d4 f( Y% a" }% c0 M- t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  z- P8 O, l/ w( p9 r0 I- _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      C8 j- h& @( ?) v1 m: G
  67. # W" R; R2 x) k2 a% o5 K
  68. dma_addr_t dmaphyssrc1 = 0;
    ' X) c: Z/ R0 `
  69. dma_addr_t dmaphyssrc2 = 0;9 O* O8 J9 p  C/ L
  70. dma_addr_t dmaphysdest1 = 0;; E8 j" ^9 [2 N6 l0 i% e, a- ]
  71. dma_addr_t dmaphysdest2 = 0;
    / Y, ^) r5 o% d8 G3 r6 A
  72. : d4 t7 K# b4 }1 m" W" M' S
  73. char *dmabufsrc1 = NULL;
    8 h6 I0 J& g! E5 I
  74. char *dmabufsrc2 = NULL;
    : F+ W4 x4 ^1 ~. ^) \
  75. char *dmabufdest1 = NULL;. ]/ ~8 _5 s* s( s/ G
  76. char *dmabufdest2 = NULL;
    1 p0 d$ |/ T0 O

  77. 0 ]4 ~& Q0 B! \( t$ y9 J/ u! K
  78. static int acnt = 512;
    & G" a* ]0 \" O$ Z/ K
  79. static int bcnt = 8;
    ( d+ O* F: l1 M) Z8 h0 E# K
  80. static int ccnt = 8;
    ! m2 X. f) a& U) P; n

  81. 7 L4 o: W! W8 ?+ C
  82. module_param(acnt, int, S_IRUGO);7 T: r+ z0 H. V/ B; m$ ~
  83. module_param(bcnt, int, S_IRUGO);
    0 R  N: D+ F* L# j4 T: a& W/ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 R( U' C4 G- J8 ~2 p3 b. X
% s2 `, ]/ o. A4 s: P. m
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 p  W, }, n+ v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 y2 L5 Y$ R% s6 ^# e% \9 S0 I" G' E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( \) S  S+ E* @+ ]

5 k( d% I2 _  |" X- i
' t6 `% k( [4 t6 H' @4 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 05:14 , Processed in 0.043302 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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