OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 P' k$ o# }, v
  1. [code]EDMA sample test application
    2 V2 u9 w4 d' v# R$ ^1 i0 ]
  2. /*$ W. U6 B9 l5 y) Z
  3. * edma_test.c/ C( k+ G# E% R6 U# N( I$ E
  4. *
    ( [( Z; m8 y+ [1 S
  5. * brief  EDMA3 Test Application
    7 |4 T/ S1 a" e+ q5 ?% i
  6. *1 E8 C5 U. q; t
  7. *   This file contains EDMA3 Test code.
    ) e5 T$ g! U0 R  L/ A
  8. *& R$ o; Z( j3 p3 y7 M) t0 e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ x0 n( W+ m: A; L* O, A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - d; U2 r9 B  C8 H: B; u
  11. *         TO CHANGE.& o& `8 N- |- d
  12. *- w) d8 P5 F9 ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & h5 t1 P' x. A9 u
  14. *
    " {* `& i, ?$ \$ @) Y+ Q
  15. * This program is free software; you can redistribute it and/or
    0 y9 v) R% ?7 f& a1 q
  16. * modify it under the terms of the GNU General Public License as0 d/ f  e1 R' A1 X
  17. * published by the Free Software Foundation version 2.  l! D' i$ H, [( g1 z
  18. *4 ]+ l: F* {8 A9 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # p6 ~) U- e" v5 ^3 n
  20. * kind, whether express or implied; without even the implied warranty
    + ?9 l# F9 d3 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( U5 s* q& Z0 _
  22. * GNU General Public License for more details.8 Y3 N. a/ I0 G2 h7 V
  23. */
    4 N( B1 i0 H! j8 o7 B

  24. . c4 ^) |, ?  `( ]# D
  25. #include <linux/module.h>
    3 B) a# S' R) a( y+ E4 c% P4 u
  26. #include <linux/init.h>
    3 }9 T! C! r: v% G0 N
  27. #include <linux/errno.h>3 H8 l6 A# ~# a5 A" m
  28. #include <linux/types.h>
    * i; F1 c( V+ o4 C6 r# i% w
  29. #include <linux/interrupt.h>
    + {6 {0 n' _+ f, O& W5 v
  30. #include <asm/io.h>  w" j* S5 x/ [& m3 \
  31. #include <linux/moduleparam.h>9 d( _% m& o6 V& u
  32. #include <linux/sysctl.h>
    0 Y5 ]5 V, q& j/ t. i7 R& W+ T
  33. #include <linux/mm.h>2 @& W2 |! Z1 L; N: l
  34. #include <linux/dma-mapping.h>
    ! Q8 @2 ~! _- X6 e+ ]
  35. $ L- @0 G8 `5 q! |9 E  n" O* W
  36. #include <mach/memory.h>" n: e+ d6 ]  n7 ^
  37. #include <mach/hardware.h>( D: |: ^: L3 r8 T; d5 G" q5 N
  38. #include <mach/irqs.h>+ K" T4 `5 R* E5 H2 p) d
  39. #include <asm/hardware/edma.h>
    4 O- e* L7 g: N; Y5 {

  40. 2 _- d$ j$ f4 K% e
  41. #undef EDMA3_DEBUG
    7 D6 ~2 z' e  D6 [1 i
  42. /*#define EDMA3_DEBUG*/
    6 B$ z& j$ P$ B

  43. : {5 r% H. ?8 T* s3 }- [( U) W
  44. #ifdef EDMA3_DEBUG
      H, K2 ]/ |" `% E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + T& x6 ?. h0 S$ O; s
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 [: C% u  [7 E2 x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! D; w7 W& t( X; g
  48. #else( c9 H* i6 Y) G7 C  D* F. |& @
  49. #define DMA_PRINTK( x... )
    2 X+ J2 B# l; H, k0 b
  50. #define DMA_FN_IN
    3 x- L. @/ @# u6 ]: f
  51. #define DMA_FN_OUT
    / E3 f( r% M# T  T1 i5 ~! u. o& K
  52. #endif
    1 G8 G* O$ j1 x
  53.   y0 r. O  O6 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): i. w% Q0 l$ p% W* s7 l
  55. #define STATIC_SHIFT                3
    0 i5 V) x+ N0 I5 h3 X0 Q
  56. #define TCINTEN_SHIFT               20$ u* G# q# ]! s' L8 w! S$ n; C5 e
  57. #define ITCINTEN_SHIFT              21
    ( w$ v4 x/ o. t+ I" [2 o
  58. #define TCCHEN_SHIFT                22
    % l0 e, c+ I# U6 w0 j
  59. #define ITCCHEN_SHIFT               23# N0 v' [: x: c* h/ n

  60. + b. P: O9 v$ _
  61. static volatile int irqraised1 = 0;
    + J* h- [) K7 g9 O) c4 f, [1 G5 }
  62. static volatile int irqraised2 = 0;
    & S" H+ ]; ?8 M- [+ j: }

  63. ! E. K' A2 S8 Q) e' l8 ]7 w; |: x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o1 v1 j) M7 g# m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 \5 K2 l' w3 L( ~$ S& A! {# _, t9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& _2 u7 K; O  r  H# l: e1 M2 v

  67. * h/ T+ G) q: F
  68. dma_addr_t dmaphyssrc1 = 0;$ T2 H- j) P4 m; X  X
  69. dma_addr_t dmaphyssrc2 = 0;
    # d6 |! I3 ]: [8 I
  70. dma_addr_t dmaphysdest1 = 0;
    ! e, d8 e6 {8 _/ E8 l" V
  71. dma_addr_t dmaphysdest2 = 0;" Q$ Y, Q& A- V. P, J& h

  72. # ?  h( k3 B6 s5 d
  73. char *dmabufsrc1 = NULL;
    2 e" }7 Y; p3 a
  74. char *dmabufsrc2 = NULL;) D- P1 Z& w( ^
  75. char *dmabufdest1 = NULL;4 e/ B$ Z) I$ I6 d: r3 E  P1 n; r/ d# F
  76. char *dmabufdest2 = NULL;. X- ^+ e8 Y8 v- c5 E$ x- s7 |# P) D

  77. # n2 v; g1 {% E- d3 y
  78. static int acnt = 512;
    8 I  R2 v5 `3 X
  79. static int bcnt = 8;$ z( Z- [- z0 |' ?. _! V7 Z
  80. static int ccnt = 8;
    , w8 q  t6 o2 h

  81. 7 w# }9 `( j% i. X
  82. module_param(acnt, int, S_IRUGO);
    / n8 T* x3 s; W9 J5 ]# ^5 G& \3 [" [
  83. module_param(bcnt, int, S_IRUGO);
    # f  U, D2 ?$ T' G  C8 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 c6 G- V! h/ |7 o  R
8 L7 n9 n' M# G$ Y0 \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! A- D8 `$ X# q$ ^- \: ~; garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 q: i# t4 [) W' w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! j3 ?4 t1 `$ Y7 x% R3 q+ [* O% y) X0 M- e
. O2 p4 z9 V  k( Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 19:04 , Processed in 0.038775 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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