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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 w+ ?$ Z+ M! ^  R9 C) o& f  e) s
  1. [code]EDMA sample test application" s  z4 Q% ^& U
  2. /*
    ! A: l& b1 B( Q! |4 K8 r( S
  3. * edma_test.c6 R# E# k1 c! c
  4. *: W- \4 C: ]! U" ~/ r  n& e0 V
  5. * brief  EDMA3 Test Application
    * a4 e- l0 T/ {/ I. m* L* e+ d
  6. *8 T1 U& ^7 {: M( `$ o
  7. *   This file contains EDMA3 Test code.3 z8 v; @! F  R( L
  8. *
    ) w3 a- W  P2 _- I* H! ~. f0 K: v6 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# X+ t/ ~# H/ p* {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' s9 U5 w7 U  [" Z
  11. *         TO CHANGE.
    7 D  M. _' x+ j5 n
  12. *
    $ e( l5 F4 Q2 R: ?9 j/ L4 z# k8 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; _! p/ J0 l. A* q9 V
  14. *
    4 s$ O( Y0 D2 u' z7 V7 b
  15. * This program is free software; you can redistribute it and/or
    ; \6 m+ f  i& o: a  n  H3 O
  16. * modify it under the terms of the GNU General Public License as
    7 e& Q, Z" w0 x
  17. * published by the Free Software Foundation version 2.
    6 M% q1 c- S9 S7 B- E6 X: J" K
  18. *
    5 N  O! s2 @0 j2 G6 }5 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 [: e7 K5 E+ [8 C
  20. * kind, whether express or implied; without even the implied warranty
    5 R, j" e2 Y& R; \9 o! x2 n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 {4 B: {' G1 o7 u: i0 {
  22. * GNU General Public License for more details.0 \; f; M, W8 {. a# Q9 o
  23. */
    3 W. |- \  M$ C' c: X  w/ _5 s

  24. + T+ I$ n6 Y8 ~7 p
  25. #include <linux/module.h>
    6 R, R5 r7 k; P. U* c
  26. #include <linux/init.h>' v, m1 U/ t% U
  27. #include <linux/errno.h>
    0 a" ^. ~! {* o  s
  28. #include <linux/types.h># e6 J! \5 y3 C$ a) f
  29. #include <linux/interrupt.h>6 D$ R7 w0 Q; u
  30. #include <asm/io.h>- J6 i3 c& Z0 f- l
  31. #include <linux/moduleparam.h>$ c! a* Q9 W" e# W& J! @% R
  32. #include <linux/sysctl.h>
    * h' l( h+ A4 ?* G# \) A
  33. #include <linux/mm.h>; k; `( j' C+ C) m
  34. #include <linux/dma-mapping.h>) O5 D" T8 `6 H
  35. ( }- i( i* l5 e9 [
  36. #include <mach/memory.h>
    6 n7 c$ ^% U3 K
  37. #include <mach/hardware.h>
    / w8 d% A7 N1 ?8 c5 D
  38. #include <mach/irqs.h>
    : \' k; l, a/ L5 d; H, P- V
  39. #include <asm/hardware/edma.h>. z. a$ C  l4 M- U8 |  ]. G

  40. # u/ O. c8 s3 }0 h% |  ?1 }8 g
  41. #undef EDMA3_DEBUG. b; z7 b% R8 U1 C
  42. /*#define EDMA3_DEBUG*/1 B% N/ L" J0 m8 G6 k- y5 h

  43. 2 A6 g3 Q; P# f5 z
  44. #ifdef EDMA3_DEBUG
    * L& d3 t- a0 t% Y4 b! T$ }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); j! u' i* y' b% X9 F: X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " z  a: R* t2 ]' h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " \7 n7 G: k/ C8 [9 D" i
  48. #else
    ) ^% f- O. g8 _3 J
  49. #define DMA_PRINTK( x... )
    : S) ~- J2 [8 O* }
  50. #define DMA_FN_IN! t7 u; Y4 ]: I+ N+ c! d2 p8 ?# o
  51. #define DMA_FN_OUT
    ; O+ M$ Y- _( V, h  G6 V" ~
  52. #endif+ j% V+ ~& r! b
  53. 4 b) N! ?% ~5 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( F8 E( _& D$ T& d0 `3 Y
  55. #define STATIC_SHIFT                3
    ! w2 K$ ]+ [! g; Y
  56. #define TCINTEN_SHIFT               209 q. e1 [# t# d0 P: J
  57. #define ITCINTEN_SHIFT              21
    $ P: G8 o4 G$ t3 p2 K5 }
  58. #define TCCHEN_SHIFT                22/ B4 Y2 F: ~$ N: q3 C- ?1 p! N
  59. #define ITCCHEN_SHIFT               23
    2 ^2 S  U6 `* ~. B: P
  60. / d6 s# \% n- s" H7 k5 D. P0 ~
  61. static volatile int irqraised1 = 0;
    + g# c# E2 J1 L) m4 _4 O9 L
  62. static volatile int irqraised2 = 0;
    + D! [6 a7 z9 l2 a& A

  63. ! i5 P1 F8 ~  J6 I" J* B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f' `7 B4 ~1 u! T, o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , P, ]8 `: w0 N9 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 K7 a8 y" }2 n/ h4 w6 r

  67. , Y9 ]4 H$ ]% e* ~! f- ]. X
  68. dma_addr_t dmaphyssrc1 = 0;8 g4 j3 T% H2 v  ?1 A+ L
  69. dma_addr_t dmaphyssrc2 = 0;
    0 ]8 p8 M( S7 X5 `; D- U
  70. dma_addr_t dmaphysdest1 = 0;5 W9 l( \, z7 F0 O# v# J
  71. dma_addr_t dmaphysdest2 = 0;
    2 J! K' C5 u; H; ~
  72. 8 \9 h& H% d8 G) ?2 w9 B
  73. char *dmabufsrc1 = NULL;
    , v/ S4 y. U0 O7 W! K
  74. char *dmabufsrc2 = NULL;
    - ^1 b/ ^8 t, W$ i+ n  p, j
  75. char *dmabufdest1 = NULL;0 ~$ e! M* G2 |. j8 o
  76. char *dmabufdest2 = NULL;
      s& ?1 |- Y1 b

  77. , o, D: Q; F. i# ~; {) H! O, B' ^
  78. static int acnt = 512;* @1 u, p8 B; Y
  79. static int bcnt = 8;6 [6 x8 m4 @8 L% r; q
  80. static int ccnt = 8;8 a, R5 O2 T# X2 G( f
  81.   ?- c) E0 b9 @' _- L5 I
  82. module_param(acnt, int, S_IRUGO);/ z) S- V, f- ^5 E2 F, c7 _/ v  _1 A
  83. module_param(bcnt, int, S_IRUGO);
    " x5 M9 R2 w6 z7 H; n6 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' ~0 t, T+ r) B& ?

; q' \3 S" l$ H! t1 p9 l# H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 U7 O9 Z$ X, H/ ]. A8 M* [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" \/ N6 }3 |" X3 }' B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. C& M% _# l/ T5 n( a
( P5 g4 U/ F* F4 O  o, B! C9 \% d/ L6 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-30 14:35 , Processed in 0.063939 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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