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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 X) E  x  m8 A
  1. [code]EDMA sample test application
    $ d0 V9 u6 N  T8 |; Q8 P
  2. /*
    : b, e( a, g$ S6 p
  3. * edma_test.c
    8 \) I4 V  M& \* H' y! c% U0 c
  4. *
    : `; n8 j1 N0 q* B+ ]
  5. * brief  EDMA3 Test Application3 t+ e4 c  t. v; ?$ T+ h
  6. *5 @2 j+ L" Y0 @1 [* Y- `+ u- Y
  7. *   This file contains EDMA3 Test code.
    ! A# F: M/ H4 f* ^/ v, L: B
  8. *
    9 _) d5 z) l  z9 G- {+ Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% P( j9 z7 x7 M+ h, x+ ^3 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i7 t& r7 D9 H; [) z  b( I$ R- U
  11. *         TO CHANGE.* N5 W0 g7 C( R* o7 \
  12. *
    ! j5 u1 C* p4 L; ?. X* T' E* r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 g/ `1 X7 p* ~! k, w( R9 n6 g
  14. *
    * F( Z; N1 j- ]
  15. * This program is free software; you can redistribute it and/or- F  O7 k1 _- l* @) n6 D' D4 G& \
  16. * modify it under the terms of the GNU General Public License as' M9 p7 `9 ^0 }5 Z) X' f0 z
  17. * published by the Free Software Foundation version 2.
    : U- K- X" p  z: u( E
  18. *
    2 a  F5 l4 M$ I; `: p: e; o9 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 ^/ ~* B: W" N
  20. * kind, whether express or implied; without even the implied warranty
    4 C! U% {) W- l( y- k& z# V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 h7 @$ K; p1 @5 D
  22. * GNU General Public License for more details.
    % R5 u: B# z3 t, ]9 W( Q
  23. */
    : y5 ^- s6 |7 S+ ]. G! x" v
  24. / {3 ?/ E7 G+ n& p5 o
  25. #include <linux/module.h>9 G) T0 n. }6 [7 m/ {. }. [( @
  26. #include <linux/init.h>
    ( X- F* y9 {& G2 Z$ d: O) v
  27. #include <linux/errno.h># @7 ?; [3 |8 m9 L
  28. #include <linux/types.h>/ [$ y* u7 U8 i3 [- t- T
  29. #include <linux/interrupt.h>5 o, p% B# S4 `/ S( H
  30. #include <asm/io.h>2 d# B# [- A$ W5 m; E8 _
  31. #include <linux/moduleparam.h>
    ' {+ n9 c/ b6 l% D4 c
  32. #include <linux/sysctl.h>2 ]- L7 n( Q/ G6 z' {' [
  33. #include <linux/mm.h>
    ; S  m9 j* l/ K; J: z$ H
  34. #include <linux/dma-mapping.h>6 ^; a. l& x  K, E3 e8 O/ E9 V

  35. , \" F2 u- |8 b. N3 g. F8 Y2 Y: ~; ]
  36. #include <mach/memory.h>- i5 p& t* P; f* _
  37. #include <mach/hardware.h>8 s/ I% {0 y4 k) ^5 j& w9 s* B; {
  38. #include <mach/irqs.h>
      p6 |5 i! O+ n
  39. #include <asm/hardware/edma.h>8 }! }6 U  r4 s9 h2 Y3 E/ V6 Y

  40. : ~; C, c/ C6 t
  41. #undef EDMA3_DEBUG
    5 G2 |  K0 l/ t# {
  42. /*#define EDMA3_DEBUG*/0 p/ V8 e0 Y% a! X7 R5 M# |7 a
  43. % l/ W# ?  b& y2 B  u& H# I* g2 \
  44. #ifdef EDMA3_DEBUG1 B$ |, F' p5 j: W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 z9 ?2 d7 z4 A, u, m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! s( `* h* G/ ]# ?" y; K$ N' R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) ^6 W& P9 Q! A! z' b4 u% H
  48. #else
    3 U% p! j0 `4 w4 }! S
  49. #define DMA_PRINTK( x... )
    ! O) X  h( ?$ M
  50. #define DMA_FN_IN
    ; \, B: X) z% l6 o% i- K
  51. #define DMA_FN_OUT8 p+ E  w* B- Z+ R8 h' r  C
  52. #endif
    ! K2 q3 U9 k$ w# K

  53. 1 J; }1 T' R9 `- w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : o9 w, b( y/ Z  g9 V  |
  55. #define STATIC_SHIFT                3
    - q- f% y& E+ P# y) _
  56. #define TCINTEN_SHIFT               20
    $ z1 k- S4 ^+ q- s
  57. #define ITCINTEN_SHIFT              21& v; P$ v, c0 ?1 |2 e/ Y4 B1 z) V
  58. #define TCCHEN_SHIFT                22
    0 }$ F! ~5 }5 q# ^
  59. #define ITCCHEN_SHIFT               23
    . n$ T5 ^3 ^9 O; _
  60. 7 |& w& X9 X1 ^3 j/ Y
  61. static volatile int irqraised1 = 0;
    ) e! r6 G* [0 q& J' u! U
  62. static volatile int irqraised2 = 0;
      ]% l7 `- M* P+ P9 }( q* K- |5 M+ m
  63. 3 Q5 v$ L3 g. H" s( U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / k- T1 ?$ C. l( D* w! Z+ {8 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( L, A" h9 u  r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Z9 a' D! I, M
  67. ) B/ F+ [! o/ N
  68. dma_addr_t dmaphyssrc1 = 0;
    ; x; f7 e0 M; ~4 Q3 u
  69. dma_addr_t dmaphyssrc2 = 0;
    " Q8 N9 y7 q( A' `
  70. dma_addr_t dmaphysdest1 = 0;0 \& q* R5 m. n  w) ~. i
  71. dma_addr_t dmaphysdest2 = 0;. a& `2 H3 J, b8 X. ?
  72. ( Y% K7 _8 h- }5 D( z( S- v. D% H* [
  73. char *dmabufsrc1 = NULL;
    3 x; x( k3 a# F7 E+ C0 s8 X7 m
  74. char *dmabufsrc2 = NULL;4 T9 `8 O% e* @0 v2 v
  75. char *dmabufdest1 = NULL;
      _1 M7 B! y4 O/ U: B( N3 t# e* |
  76. char *dmabufdest2 = NULL;
    5 y* Y3 R5 i; |6 o

  77. ( [! n& l, f/ C% ]0 k5 ?$ N
  78. static int acnt = 512;9 Z+ o2 P2 _( Z, m: i% o6 x
  79. static int bcnt = 8;
    8 H& F8 o6 f. e/ E. h8 \
  80. static int ccnt = 8;
    ; `# A9 o+ q  ]! x3 V3 Q; B

  81. ; |, L5 \* c! |- ~) c3 W4 l
  82. module_param(acnt, int, S_IRUGO);
    , g7 S3 f9 [0 L: E
  83. module_param(bcnt, int, S_IRUGO);
    ) {6 M; U( W0 }# F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 |# A  b) i) \2 ?" K4 ?  r
- ]2 f0 V9 Q/ T2 M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ]- _# [/ F( d! T  ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 d3 F0 Z, P0 P, X; S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 x! c3 c  C3 s

' R6 m/ E/ H5 e2 H. V
- Q# `  d: k$ I8 n8 Z$ n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-11 12:49 , Processed in 0.037599 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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