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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" G3 S2 H  H$ S" r* C: y) q# S
  1. [code]EDMA sample test application
    9 U: s4 R, O( K9 w8 V6 r  a7 |
  2. /*/ X7 r) d4 o4 C1 H! M
  3. * edma_test.c; C, N! H; ~, m! r1 [
  4. *6 P; v7 _, }7 m6 l8 _& @: i
  5. * brief  EDMA3 Test Application
    ) e9 m5 N9 l. |9 X
  6. *
    9 V: A0 {- M6 V9 W  u& H0 d' i
  7. *   This file contains EDMA3 Test code.. E9 G- T  l1 x: @  \) x
  8. *
    : p4 ?9 }2 N6 y# ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* x7 g( x- t1 D4 X  a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 H* [) b2 N- O0 B( O" h, k
  11. *         TO CHANGE.
    ! G" y0 w- L2 q6 u. q
  12. *
    & p$ c6 h, \) x: C1 b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / f: p) j! H- N3 I$ }
  14. *
    - S. {4 ~0 Y' E; i7 f1 U
  15. * This program is free software; you can redistribute it and/or( v$ r: Q' c5 p- w' z# ]
  16. * modify it under the terms of the GNU General Public License as
    % p! Q1 u: j0 y6 V% o& N  S
  17. * published by the Free Software Foundation version 2.
    ) ?2 z# \9 Y0 m* w. A
  18. *2 _2 E5 G5 P" B4 ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 ?9 }+ p1 H" g( G5 s
  20. * kind, whether express or implied; without even the implied warranty
    # q# g! P8 Y( x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 ~1 N. t- w& z' F/ y  ^
  22. * GNU General Public License for more details.
    & f/ [4 E$ @- F9 |
  23. */
    3 A4 x" C% S" H+ \- P

  24. 3 s! `9 l6 p8 x' y
  25. #include <linux/module.h>
    1 E, {* O' B/ Q* b/ q. I% x# ]* I
  26. #include <linux/init.h>
    0 G' \2 q& Z$ d4 S, ]
  27. #include <linux/errno.h>: ?' }- S9 |* d* C/ g
  28. #include <linux/types.h>. I/ N8 W. y. L/ \% ]4 u! {
  29. #include <linux/interrupt.h>
    ! ^* j2 F: C% t1 h  R; p# v- [
  30. #include <asm/io.h>
    1 Y/ s. ]' p) u  N4 L
  31. #include <linux/moduleparam.h>
    / B4 R9 J9 g  W$ r* z
  32. #include <linux/sysctl.h>9 `) _* H8 g* W! u: [
  33. #include <linux/mm.h>
    2 q# I2 ?9 `& A8 C- l6 o! F$ [" e
  34. #include <linux/dma-mapping.h>6 \) T$ v( `. T. c6 Z

  35. ( S# G8 s/ z. \  ?6 |
  36. #include <mach/memory.h>1 ?  B; p- b# i, J
  37. #include <mach/hardware.h>1 a) K. f0 `; S$ m, X
  38. #include <mach/irqs.h>
    $ A2 C  ]+ a) @! [: i
  39. #include <asm/hardware/edma.h>
    6 G. h/ A! D$ M' u6 O( n/ b. F% h! Q
  40. 0 \' W; ^( T9 u! Q
  41. #undef EDMA3_DEBUG
    ) o4 V9 r. y  a0 g5 f
  42. /*#define EDMA3_DEBUG*/9 W8 s& k2 y/ @/ Z' K
  43. 6 V( s* Q# Y" G( [
  44. #ifdef EDMA3_DEBUG
    ; e* r" A: r4 l4 c+ b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' G8 A, q* ?3 g) F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 ?. z: b# U* m+ B( G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); x% x& B8 ]  N% n& b" w
  48. #else0 ]* m0 a. \2 W
  49. #define DMA_PRINTK( x... )2 s: r( u2 X0 t% n- r7 ^
  50. #define DMA_FN_IN
    # R  S" c" s) z" s: e, c* J
  51. #define DMA_FN_OUT
    2 n* @" k5 f5 W; ^+ @
  52. #endif
    - f. g7 _& [# j/ _! }# Q
  53. 6 ]( {5 I( q$ E- P9 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    * x2 R% e. F$ u3 b7 H  n" W
  55. #define STATIC_SHIFT                3, s  J) `6 J6 F* J
  56. #define TCINTEN_SHIFT               20+ s( X( m9 l( X4 Y. J: d0 m
  57. #define ITCINTEN_SHIFT              21' \( Y0 K1 ^* v  n
  58. #define TCCHEN_SHIFT                22
    + r! l$ R$ A2 I8 \: ~
  59. #define ITCCHEN_SHIFT               23  o+ a" i" O7 m$ v$ l% u- j! k+ `  |
  60. 4 p+ O  a9 y- e9 [" Q
  61. static volatile int irqraised1 = 0;' Z6 m; }- T( b
  62. static volatile int irqraised2 = 0;( y( \; F/ v0 {) U$ X
  63. 6 @% ~' N5 i( I3 Q& O8 n6 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) B3 {: f9 C4 L  f; [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ b' q3 {2 f! D# U  q/ Q3 A) V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j  X7 _( s2 d. `& I) G
  67. ) I7 p, N! m6 N$ a
  68. dma_addr_t dmaphyssrc1 = 0;
    3 v2 S6 z; ^) Q! f1 k- N7 T  b
  69. dma_addr_t dmaphyssrc2 = 0;
    , g% ~2 N& e/ K& _0 Y" i  M
  70. dma_addr_t dmaphysdest1 = 0;
    ( l0 c0 X0 p( t
  71. dma_addr_t dmaphysdest2 = 0;( `+ e* g) l" l4 k+ p$ T
  72. " Q8 A$ V5 m' G2 C& J
  73. char *dmabufsrc1 = NULL;4 R1 L+ m) M* {+ p5 d% h! S* H% Z. X
  74. char *dmabufsrc2 = NULL;. ^8 k2 N  M4 ]+ |5 K8 C2 _
  75. char *dmabufdest1 = NULL;
    ; q: D; b$ a  q/ T6 {
  76. char *dmabufdest2 = NULL;( V% `+ i* X% _5 r

  77. " J0 z1 g8 G& U& g7 x4 e" k: u
  78. static int acnt = 512;, N4 b" ^3 \3 |
  79. static int bcnt = 8;
    - l/ y0 }( D8 R3 `' [( o; I
  80. static int ccnt = 8;* V+ D3 p$ K' P) A. ?
  81. * ?' k3 X1 l- A7 L
  82. module_param(acnt, int, S_IRUGO);
    + X. T" ^0 T8 Y
  83. module_param(bcnt, int, S_IRUGO);
    4 R9 h( q& Z; r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' B6 n8 m# d& Y3 K3 `
/ \; }6 s" {! i! ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! Y9 q2 ^) A3 Y' v0 ~/ m0 j% harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# }' x$ ^( R  s; C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 V, v$ T% `: {. o; b; u
8 v7 V& ~# D- h/ G+ g$ I: r

1 W: }5 m! a3 H" i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-27 13:01 , Processed in 0.039482 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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