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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , r. f5 Q8 Z. n" Z2 w
  1. [code]EDMA sample test application5 b: A( w; }1 B" |9 q! Y
  2. /*
    0 w( z  w( Z. x7 [1 v
  3. * edma_test.c3 j7 K7 e4 F: I  ?, }
  4. *, ~  K2 M( A& G( n8 a6 t
  5. * brief  EDMA3 Test Application' w8 ~6 \+ C" t- F5 Y: f
  6. *7 [" d* U' X9 w# l
  7. *   This file contains EDMA3 Test code.
    ! \0 r. R( W3 a2 q: _$ S
  8. *
    % m/ l  U5 o" {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  p3 ^, M$ o$ k3 |2 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 _! J/ E* m+ G# M
  11. *         TO CHANGE.
    7 Q* b1 `+ h  T  t, Y* b) @
  12. *
    * h/ L6 c0 K& Q; Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / m3 I3 }4 m) o2 a/ x+ y
  14. *# M% j9 ?" _5 j: S1 ^! \- W1 ]
  15. * This program is free software; you can redistribute it and/or5 S3 q: D" l. J% u; L: J  c
  16. * modify it under the terms of the GNU General Public License as
    ! v/ O  h/ w5 E
  17. * published by the Free Software Foundation version 2.% u  p' a) g$ {9 `6 k
  18. *
    " }  d) n) I3 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 W$ h0 P+ A3 h4 ?; F4 B7 a4 D
  20. * kind, whether express or implied; without even the implied warranty
    ! K4 t% z* }! @- i, Q6 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 Y! |/ H; @9 d; i' z
  22. * GNU General Public License for more details.% N1 T- d* L/ ~0 A% [
  23. */
    9 e( A" Q( Z; c" s2 a( ~( \9 {
  24. 1 P% e5 k' Q: o
  25. #include <linux/module.h>3 {: K" G- `1 O% B& I1 K; K2 Y
  26. #include <linux/init.h># e6 z  r* ?- V1 h4 |
  27. #include <linux/errno.h>
    # z2 T0 b# I- y+ N: }( j% h
  28. #include <linux/types.h>5 a5 K9 o9 x- F' w1 Y
  29. #include <linux/interrupt.h>
    ' Z: s# l! O! k4 ]; b
  30. #include <asm/io.h>
    3 K; w( p; w- Z' V* S
  31. #include <linux/moduleparam.h>- N1 \& C5 @" f7 s
  32. #include <linux/sysctl.h>; x* S! G0 b* V% [- Z  w
  33. #include <linux/mm.h>- r2 Q3 j1 T* F! d3 [+ B3 [1 F3 N, D
  34. #include <linux/dma-mapping.h>
    & ^7 m7 j) l. Z: a* k& Y

  35. 3 [/ L) k# a6 `/ O" d
  36. #include <mach/memory.h>* t. P5 ~# M: c, g+ B* s
  37. #include <mach/hardware.h>
    8 A* g0 k+ ~% v  S
  38. #include <mach/irqs.h>  [% D7 z, R% U( }6 k+ P
  39. #include <asm/hardware/edma.h>, v  N' [. V" E/ d& [
  40. ; L* _! j( w3 r
  41. #undef EDMA3_DEBUG2 `$ [4 {! @$ }8 o8 C( R7 X
  42. /*#define EDMA3_DEBUG*/; _) L4 `/ p8 \3 A# W/ q5 U

  43. " g8 ~% |% A2 G
  44. #ifdef EDMA3_DEBUG
    * i4 }7 r, N( w6 z* k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 l3 p8 k1 H# l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* O) E1 L& M* q4 r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ~6 Z# n2 g" O, B# K! @
  48. #else# {9 ^. G2 w2 Y" V
  49. #define DMA_PRINTK( x... )+ k' P% g" g2 _" E
  50. #define DMA_FN_IN3 H; d, P6 C7 M# q+ |+ f: p
  51. #define DMA_FN_OUT
    9 L! }- u8 Q. W: M% s- `* k& [9 s6 d+ |
  52. #endif
    $ t% ^& p8 X  g3 o
  53. " d1 D1 }0 A6 g9 E, S+ k6 i2 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% ~8 r) E5 T' F
  55. #define STATIC_SHIFT                34 D, ]) ?- g, d% Z/ i; ^) c
  56. #define TCINTEN_SHIFT               20; G' P0 g$ @4 k7 J3 d! r8 l3 \
  57. #define ITCINTEN_SHIFT              21
    2 d- m0 M6 C, F0 \% S/ ?" v
  58. #define TCCHEN_SHIFT                225 D3 e, E1 W: v+ @* I9 s
  59. #define ITCCHEN_SHIFT               23. \  B' ^1 D" O& |( h
  60. ' S' n  w/ S: o' O
  61. static volatile int irqraised1 = 0;
    % j' D1 @+ j6 G" l1 i+ Y
  62. static volatile int irqraised2 = 0;
    2 `( L/ n2 i, n! a7 }# }
  63. 0 \3 J$ r& o, A/ S; ^4 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' T+ I  u+ Y3 i$ N6 w$ }6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q8 ?; B' O7 x0 n$ Q4 c; H8 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& {* d  A6 [+ ?7 h0 h

  67. : l* Y% p4 i) N
  68. dma_addr_t dmaphyssrc1 = 0;9 e1 g9 D* i3 s! g
  69. dma_addr_t dmaphyssrc2 = 0;
    4 f6 M) t  P, l7 f; h% e
  70. dma_addr_t dmaphysdest1 = 0;! b# u+ J# ^3 s1 ~/ ^2 D8 U8 D4 M7 \
  71. dma_addr_t dmaphysdest2 = 0;
    8 }' q( `5 g: f. Y

  72. 9 k3 ]2 q8 g# `9 K# @% d
  73. char *dmabufsrc1 = NULL;
    + F% ~" J& J1 x" O
  74. char *dmabufsrc2 = NULL;
    % b4 t: g  ~, P
  75. char *dmabufdest1 = NULL;
    . {7 S' _8 A5 c
  76. char *dmabufdest2 = NULL;
    5 s1 x) _5 Q0 d1 Q4 ?
  77. & ~! }. L  s# n" A
  78. static int acnt = 512;6 v8 D" v3 o1 k- }' U. B/ O
  79. static int bcnt = 8;% K* V7 j, w; j* J
  80. static int ccnt = 8;
    * g" A" x# g& U! U2 K; ~
  81. 3 ^- ]- k0 Z; t; h7 r) n) Y2 e( C( G% A
  82. module_param(acnt, int, S_IRUGO);
    5 A* j9 @3 k/ X  v, `
  83. module_param(bcnt, int, S_IRUGO);
      o  q' L+ F+ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; r% {8 ?, S7 c0 J
8 A1 S1 J) L0 V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* y$ z0 G1 Y6 O- D: U7 }! o2 I& R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 Z+ L2 M' |8 f* F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, N. |6 _+ S* S8 Z- c; b  ]$ ~% O, P- x; A( X" F5 N3 n
- l& z8 l% t9 _- v# w- K$ I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 11:14 , Processed in 0.059759 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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