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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . l/ J9 n0 ?; f! ?/ H9 V9 F
  1. [code]EDMA sample test application6 M. o  T- c6 y' o. l
  2. /*8 |( J9 C% u6 v+ z. N; {. h# l
  3. * edma_test.c
      t' N3 l6 N. U( E6 U$ X
  4. *
    & [& y/ K' i2 T2 _. H+ Y8 e; j
  5. * brief  EDMA3 Test Application* K: a5 D/ O+ S1 ~
  6. *
    9 R5 z( N( y/ M2 A; H' h
  7. *   This file contains EDMA3 Test code.; B( Q$ [0 _6 N+ x2 v
  8. *0 V# P/ R% F! E0 D+ G9 [1 r4 x& i8 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 H3 e1 g' E' x* I( ^' i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ p& V5 f4 F( l7 t! L4 a1 [
  11. *         TO CHANGE.
    . f* N% f) G5 r6 @9 O
  12. *
    8 h5 p" n4 Z; a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, U* N8 i1 j; _, Z3 T" z# x4 I
  14. *
    4 R  B( V; Q; t0 H" ]. |
  15. * This program is free software; you can redistribute it and/or
    3 `1 t. m2 p* z8 ?. G. J9 S0 e
  16. * modify it under the terms of the GNU General Public License as
    * C3 t7 w( s1 V. L0 K
  17. * published by the Free Software Foundation version 2.1 d& }7 c7 a7 G2 w3 ?: x1 b+ Z- ]
  18. *
    * |( X. c& S- ]  W) n# S, |0 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: e3 B- k& g( w- H2 E1 o
  20. * kind, whether express or implied; without even the implied warranty4 o0 H! P( X5 \$ @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 N( b8 }% @2 }; \( D7 R
  22. * GNU General Public License for more details.5 n! u2 @( a, K$ f4 E4 f
  23. */
    ; H' H! m# K8 W
  24. 2 ^: ~) W; Q" C) \; P
  25. #include <linux/module.h>4 E5 o8 m# v, k% S# E
  26. #include <linux/init.h>, y$ l: S0 Q) ]: _7 F
  27. #include <linux/errno.h>
    % f  t' w( M# h5 i5 T
  28. #include <linux/types.h>
    0 s' d) C0 t3 ]8 }) x
  29. #include <linux/interrupt.h>8 l4 b) a. N6 a# I
  30. #include <asm/io.h>4 d# \  a% s# ~
  31. #include <linux/moduleparam.h>2 a0 _* O, U; r
  32. #include <linux/sysctl.h>0 o  l5 t" n+ A8 l/ L4 l
  33. #include <linux/mm.h>
    0 ~, q5 a% b- @" \0 K: `
  34. #include <linux/dma-mapping.h>
    4 ^$ k4 {4 M% e

  35.   p) s" p  M% D/ b8 n& w
  36. #include <mach/memory.h>
    9 D1 V. H/ |% r9 P& y% R4 z1 m1 z
  37. #include <mach/hardware.h>
    1 T; R" b/ j, q: S  L
  38. #include <mach/irqs.h>
    9 ]: c  H  J! c  _( S
  39. #include <asm/hardware/edma.h>
    , s8 H2 b4 n! G

  40.   t  G6 e* T! A0 s; t0 M
  41. #undef EDMA3_DEBUG
    6 Z7 p1 W! B: Q/ V
  42. /*#define EDMA3_DEBUG*/
    " o8 ?1 Z+ O, i; W- j, u

  43. " Y4 U- i, b9 F) i& E: W
  44. #ifdef EDMA3_DEBUG' ?7 F5 K, q3 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 m3 N( C5 h( V; P* c8 X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ~6 M4 ]- V& S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % w! a/ |# Z5 K
  48. #else5 k2 I! B$ v1 j: s
  49. #define DMA_PRINTK( x... )
    * J( J$ t8 R% G3 u: v# j! r/ k
  50. #define DMA_FN_IN
    3 c5 _- E0 `7 @) R5 }1 A7 O
  51. #define DMA_FN_OUT
    6 t9 G; t/ W! Q, _) a( D1 C' p+ U
  52. #endif9 w' T% `" [$ R; N: ~& t9 d

  53. - r$ m6 m  I) i7 N' s5 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! |5 `* ]3 }% f& |5 \
  55. #define STATIC_SHIFT                3) [. g9 Y9 Y  q4 G% z) g% a9 M9 m
  56. #define TCINTEN_SHIFT               20
    5 S  S( A1 @! T
  57. #define ITCINTEN_SHIFT              21
    7 T$ P6 |( x3 s" ~/ R; ~
  58. #define TCCHEN_SHIFT                228 S8 F3 Q. C9 u
  59. #define ITCCHEN_SHIFT               235 m3 p/ ~# W; Y  h+ R/ c0 \
  60. : k# Q# {# i  ]" }( H
  61. static volatile int irqraised1 = 0;# [9 I* Q' R( {) M  \1 S. D
  62. static volatile int irqraised2 = 0;
    7 m% a) q2 @* i* n1 l, Z

  63. # V: b# l* I) R3 T6 _, w- l+ }3 P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 q; ?. z, n1 T( D  c0 C; {0 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ^( y( F0 d" d/ b5 i4 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # K; [+ P0 X) l8 e
  67. * |# g! \/ a  C' }- T# ~
  68. dma_addr_t dmaphyssrc1 = 0;1 V" s  q3 G& T" z# A' [% K
  69. dma_addr_t dmaphyssrc2 = 0;5 v& `- J) q# R( n8 ?
  70. dma_addr_t dmaphysdest1 = 0;
    3 [5 [$ g/ G) Y% u9 c6 j
  71. dma_addr_t dmaphysdest2 = 0;8 }8 b; {4 Q' ~

  72. " i7 {3 X7 N0 I
  73. char *dmabufsrc1 = NULL;
    + k% Q3 X8 R% z6 W) W- y% G
  74. char *dmabufsrc2 = NULL;! @: j) I2 o+ d3 I( o; U- ^
  75. char *dmabufdest1 = NULL;3 @* t& x5 @3 g# Q2 a# x+ m4 {7 L
  76. char *dmabufdest2 = NULL;
    4 E2 ]8 {$ F  z# A( H/ {" O- @* e

  77. 3 _0 _. _* k/ f( i: u, s
  78. static int acnt = 512;& P- O) C. q5 ^3 t3 ~; W0 `
  79. static int bcnt = 8;
    ( F; _) O6 E- J* t
  80. static int ccnt = 8;  }3 o3 p9 h7 \2 M7 S# K9 Z4 U
  81. 4 r  G& V" q7 ~4 C! H
  82. module_param(acnt, int, S_IRUGO);
    . v( ]/ t! {- @( E
  83. module_param(bcnt, int, S_IRUGO);% J) p3 ?. I5 j% z  r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 x; R/ x' c* b1 h! t% ^4 p
, p8 t5 }: s, n0 X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; [- z% y; W; j: Q5 l* m8 S& y) A/ c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 t5 X) A9 d  j6 d3 x
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 ]; Q) U& k# X8 h. v9 u
  b, q4 C% _* H% {
- w4 Y0 o4 l4 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 03:08 , Processed in 0.037826 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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