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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 x# T: G) R* _$ z
  1. [code]EDMA sample test application
    & q6 n# B9 Q# l( h8 N% d# E& C  ]
  2. /*
    + t4 t' \2 \8 m/ v0 }5 i2 b
  3. * edma_test.c
    - S+ _5 [7 B3 R. g1 [
  4. *
    3 ^3 }. e) i+ i$ `6 v& R2 {  }5 F
  5. * brief  EDMA3 Test Application: T4 Z0 H0 C1 u) E' \; m6 q
  6. *  ~1 f0 ]! ^7 `9 k3 p; d$ X
  7. *   This file contains EDMA3 Test code.3 ~/ G/ r, p3 g  z/ W% n, E# H
  8. *  Z( n8 G4 z" V! [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, f' r7 W. U* D( J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 `# i2 L4 S) b% D7 k$ Z3 c
  11. *         TO CHANGE.
    . s! g2 n! N- i1 _( |) j7 g
  12. *
    9 U9 |2 `' D( S. s: e8 P6 A4 w4 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 l% U+ [9 T3 N8 d, U5 m7 m1 |
  14. *
    : y8 H+ R/ b+ h* R3 f7 O
  15. * This program is free software; you can redistribute it and/or% }! K8 V( g8 Q" U( Y( X
  16. * modify it under the terms of the GNU General Public License as# N' o( o( I% l0 P: t$ M, W
  17. * published by the Free Software Foundation version 2.
    - ^* N5 w; V. ]) L0 i5 F. Y
  18. *. F4 s% m% F: L( N4 i5 s2 t" M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 p$ W) ?8 ~+ U! r  w2 l- X8 j
  20. * kind, whether express or implied; without even the implied warranty
    4 n$ M/ Q3 c+ o. o( d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 \! u4 P) W; r1 W! q
  22. * GNU General Public License for more details.
    7 f1 ~0 D( z5 \0 d  d7 ?
  23. */
      h9 ~( V( b% k- {1 |. a

  24. 4 c4 Q' {2 U$ ^* v. I" e; U! J% ?
  25. #include <linux/module.h>* O5 s' |6 d2 L. O7 r
  26. #include <linux/init.h>, z* c6 N/ P- R6 x% d
  27. #include <linux/errno.h>, Q$ X# o# v; a" [' J* g; Q
  28. #include <linux/types.h>
    8 r7 T3 \" f! c! D7 h
  29. #include <linux/interrupt.h>* L* M: F: T" f. \& h
  30. #include <asm/io.h>+ q8 q9 _! K$ P: Z4 e
  31. #include <linux/moduleparam.h>, j+ O$ f& l0 D- R5 ?1 a  A) ]/ V4 N
  32. #include <linux/sysctl.h>
    ! i& U. j6 c$ C% `8 I
  33. #include <linux/mm.h>
    # Y8 M$ k1 C! y' [; c7 I. L1 R
  34. #include <linux/dma-mapping.h>$ Y; b8 Q) F4 ?

  35. - M6 a5 ]% z" o$ u
  36. #include <mach/memory.h>1 J- X+ r9 h5 T3 t$ I
  37. #include <mach/hardware.h>
    " c% w& l; R" _8 V7 P( t( M
  38. #include <mach/irqs.h>* @$ d' v6 {! d+ k3 V- o% K! i
  39. #include <asm/hardware/edma.h>+ R0 O& Q7 g( C# K
  40. / [' g. V  p+ U. _. {2 c
  41. #undef EDMA3_DEBUG1 e& t9 O4 a4 u; T3 C. a4 |! Q
  42. /*#define EDMA3_DEBUG*/
    # ]' N$ ?4 F5 X8 m

  43. ( h% [) Q7 U( K" m4 e
  44. #ifdef EDMA3_DEBUG
    / F6 n7 _0 x. b) `" B. a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) v3 N7 n- _0 e  K( M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " x! z; x) T# `0 P  ]  J8 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 |: t3 r* w, C( G4 w; H
  48. #else. f( k9 l( O! p3 D4 r
  49. #define DMA_PRINTK( x... )3 K8 L3 I0 n, u" Z2 ~# v
  50. #define DMA_FN_IN
    3 l1 m$ C( ^" O
  51. #define DMA_FN_OUT3 G1 \$ g  [) x, I
  52. #endif0 D6 K6 V+ B2 K5 g1 Z; \- P. P6 L
  53. 3 v! E" F) m. @# Z  Q! A2 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - t" i& t) Q5 o8 t7 k
  55. #define STATIC_SHIFT                33 G6 T' x% v$ ]$ B! B
  56. #define TCINTEN_SHIFT               208 ]! \* d% S/ H2 k7 f/ O
  57. #define ITCINTEN_SHIFT              218 e' V5 X4 _; i3 n7 v* N) ~" q
  58. #define TCCHEN_SHIFT                22. X( D4 V3 g6 r) @0 ~, h+ J9 H
  59. #define ITCCHEN_SHIFT               23
    : q* C, z" P8 z' M
  60. + ?0 v1 P/ ~% [2 o
  61. static volatile int irqraised1 = 0;$ L( r/ I. u, \& Y; d; J7 Y. {
  62. static volatile int irqraised2 = 0;
    & i3 \! z' l% F% x0 l1 e

  63. 8 ~, |5 O" G* O3 X, J/ P" r! e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % G4 g9 l' ]1 l% V) T: w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " @8 u  y: h# U! a3 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Q& Y$ f" x! u/ Q8 ]
  67. # P& \) y$ i8 H& m; ~; i7 S
  68. dma_addr_t dmaphyssrc1 = 0;6 M6 x$ c& @/ u$ u2 W& y3 M
  69. dma_addr_t dmaphyssrc2 = 0;: h6 O1 x* a" f2 T6 W
  70. dma_addr_t dmaphysdest1 = 0;$ r/ M4 y* X. H# ?% V6 T
  71. dma_addr_t dmaphysdest2 = 0;7 g2 l2 v8 H3 C$ Q
  72. 9 y2 Q7 A5 v2 G9 z  f$ w5 z
  73. char *dmabufsrc1 = NULL;
    ( {. h  u$ H* R/ z2 D+ x# X( m
  74. char *dmabufsrc2 = NULL;
    * r3 _9 X% O. k& q* [
  75. char *dmabufdest1 = NULL;% ?! A6 w) M% s. G/ M, v$ ~
  76. char *dmabufdest2 = NULL;
    / o# G+ {- ?' O) y$ I) w
  77. - {  {5 z8 t# U, Z
  78. static int acnt = 512;. ^1 X: l( w4 W7 N& E+ i, `4 [
  79. static int bcnt = 8;) A$ G! }2 u3 F2 E2 r$ j/ K
  80. static int ccnt = 8;8 n' q' d* r; S3 r6 u  k! q
  81. ) _) m7 P9 F! m, ^& \3 V
  82. module_param(acnt, int, S_IRUGO);4 R$ y9 ^9 t0 n7 n, H4 l
  83. module_param(bcnt, int, S_IRUGO);
    / g: }$ d6 g7 K0 W; k- k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ W. F" }+ {& U5 [5 G3 B% _) f
% _6 ~' N' Z/ \' e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ F' B- M% t# Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' {* F* J% B8 G* C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  k3 F; H/ d1 h8 t& V  I$ w
$ R( m3 n- v( m' \# g; b0 M3 l+ P- J' K7 F3 K) v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 22:57 , Processed in 0.039788 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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