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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ k& t2 a8 a1 t8 f: k, y
  1. [code]EDMA sample test application
    * g" G+ |5 g7 y) C( o+ o4 d
  2. /*
    ; {( s5 {$ Y4 I% m- `6 L3 S  s
  3. * edma_test.c- Y) W/ n. v8 ?4 @" e9 z2 f- o
  4. *
    : N" k) }0 J  W
  5. * brief  EDMA3 Test Application
    7 E5 |! ?# f+ \5 v5 G* r$ h
  6. *' z# `3 C' J( D. y& s
  7. *   This file contains EDMA3 Test code.+ P  S. R. I" H# J' M4 j
  8. *5 v- G+ l1 G( }2 D+ O/ V: W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* L3 i0 O# t* v3 w, y) t' J5 k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 E6 H8 a! ^! i+ j
  11. *         TO CHANGE.
    - z+ Y. E* ]- w9 {
  12. *) W. X4 L5 M8 d) [/ U  B0 f2 _3 l  R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: e; u& D4 M: g! y  Y' a$ W: s
  14. */ h) P5 y0 I5 Q
  15. * This program is free software; you can redistribute it and/or+ B: G" L- n, M2 `1 Q7 C
  16. * modify it under the terms of the GNU General Public License as9 u. R0 o5 m9 M, t7 q5 J
  17. * published by the Free Software Foundation version 2.
    ) R, i' w/ b$ |% a" H0 z
  18. *: m* n3 |( k2 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 v" O1 t- P, {
  20. * kind, whether express or implied; without even the implied warranty  V% |/ C2 K$ j, H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Y! U) ^7 Q6 \+ e; Q7 l( @
  22. * GNU General Public License for more details.* M1 m0 L* J3 S8 P' |; `5 E
  23. */6 v& R; {8 _2 Q5 P5 b- v

  24. ( M6 F$ E2 ?% m. T6 v) X" [4 `
  25. #include <linux/module.h>
    . E5 F+ Y  T% h$ J' ]" Z4 x
  26. #include <linux/init.h>
    # t% M/ T4 g. f9 t
  27. #include <linux/errno.h>" M: g$ c2 V# ~1 c# ~
  28. #include <linux/types.h>
    5 ^4 C. J! J, c# o
  29. #include <linux/interrupt.h>7 k" o' ]& r; C2 M" p
  30. #include <asm/io.h>
    4 y- M& v8 K- a; Y9 w7 y
  31. #include <linux/moduleparam.h>
    $ Q1 ]" }$ @! F7 V- E
  32. #include <linux/sysctl.h>
    8 T1 W0 i& U/ |' K- M
  33. #include <linux/mm.h>7 ^$ c8 r/ C% N4 o, N# \; D# x
  34. #include <linux/dma-mapping.h>5 {- ]7 i, W9 b; U  s5 T

  35. ) |" |$ H- H/ E7 X; {
  36. #include <mach/memory.h>
    % y5 `/ |. }9 Y/ M" `
  37. #include <mach/hardware.h>
    5 Q# K. x! ?3 a
  38. #include <mach/irqs.h>9 w; T' I' M' U! x/ R5 |& h
  39. #include <asm/hardware/edma.h>! g* e$ N3 F) {- ]
  40. $ b& p# m" D5 k. N
  41. #undef EDMA3_DEBUG. X5 n$ {# |# y: g$ u2 E3 F
  42. /*#define EDMA3_DEBUG*/
    ) a5 E7 i3 t& }/ v
  43. # Z. x5 G+ q. h
  44. #ifdef EDMA3_DEBUG# {, R8 M( w* `' \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , Y" k+ a. y# r: U' Z" L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). c5 j. K5 _: y2 N" l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # h9 {, n  }- {
  48. #else( u9 Y: {; m$ q; X
  49. #define DMA_PRINTK( x... )
    & u  q. e1 r2 }7 U- n+ @4 O
  50. #define DMA_FN_IN" y, \8 t2 ^: f1 ^7 u( p. r
  51. #define DMA_FN_OUT
    . |. ?# U% K/ O( l) Z
  52. #endif8 T& |5 i' x& h9 h  p

  53. 8 k# b6 z" C5 t& Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ _  p( N* y' a- g
  55. #define STATIC_SHIFT                3
    - g: `) ?8 Y9 l" P" m
  56. #define TCINTEN_SHIFT               20
    - ]3 P4 m* Y0 U. \2 Y
  57. #define ITCINTEN_SHIFT              21; x! W7 c$ u- L; t5 M
  58. #define TCCHEN_SHIFT                22
    ! A4 {" I1 `0 H! t3 R$ r
  59. #define ITCCHEN_SHIFT               23
    % ]  Q3 j# t; Q0 ~
  60. 3 B- X( ]) p. X2 `0 R  l" b
  61. static volatile int irqraised1 = 0;  l" i- Q# c  _( `2 P; u7 S
  62. static volatile int irqraised2 = 0;
    " Z9 W* m5 \; Q$ {9 P8 P

  63. 5 _) b  c9 \0 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! u: |7 t' d# N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* u% s+ d) _( c/ T9 |6 `) }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ^. w1 i- ?* {4 y
  67. ! R1 C0 M' `' ?- y# z/ P
  68. dma_addr_t dmaphyssrc1 = 0;1 v2 h; w: \7 H! c% h8 _
  69. dma_addr_t dmaphyssrc2 = 0;% x( Y6 Q3 C0 \
  70. dma_addr_t dmaphysdest1 = 0;
    % F: ^7 F9 w  ~- Z. t
  71. dma_addr_t dmaphysdest2 = 0;1 K3 f/ h+ A4 r: r0 i
  72. , H  a3 `$ X8 Y% \3 C
  73. char *dmabufsrc1 = NULL;
    ! b$ N' l1 c) |4 N+ l
  74. char *dmabufsrc2 = NULL;
    . p# m9 v2 v( x% s( E; t' R( C
  75. char *dmabufdest1 = NULL;
    3 z, ^, [+ o, U6 i
  76. char *dmabufdest2 = NULL;
    ; T4 ^! ~. ]: X- A2 b1 h

  77. : X- A9 w6 ^* c. H$ D
  78. static int acnt = 512;/ K& Q: G4 q# P0 \1 I
  79. static int bcnt = 8;. T& j( k" C/ H. k+ u
  80. static int ccnt = 8;
    + ?) s3 i9 A6 B0 h% `
  81. 5 a9 d8 b: ~% e8 q
  82. module_param(acnt, int, S_IRUGO);
    9 j( @) s+ X( F
  83. module_param(bcnt, int, S_IRUGO);
      l9 Q$ Q6 a4 y+ P6 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 E6 b+ f5 p) Z  o3 @1 f0 V, L, v% `: C$ u5 t
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" v, v0 x3 |# `( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# f; A8 Z6 K$ t0 ^7 K  f4 \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" u$ h+ G. G) e4 b/ }4 X( D

" V; Z' f0 X# o' J; A3 f
" f/ X) L6 v6 L3 |$ p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-17 15:47 , Processed in 0.040186 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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