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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   |- u$ I9 s0 K' h
  1. [code]EDMA sample test application
    ) k/ r  \9 i" B
  2. /*0 j3 i* J+ G* h
  3. * edma_test.c
    & g* S% ]/ Z- _4 u" j4 V! }* X- ^% V
  4. *
    # g: ~# u0 ?7 ~& s* B9 E
  5. * brief  EDMA3 Test Application
    3 P, ?2 a6 W: i$ ]. d  |; z; k
  6. *
    # Z& P+ W9 D- ]3 }  m
  7. *   This file contains EDMA3 Test code.
    : b, @! D2 [3 ^/ y8 i( X$ `, d
  8. *
    8 o/ V( ?  G3 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! x/ x- |, d/ r5 Z3 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( w  U- e$ z1 B; y: ^
  11. *         TO CHANGE.  ]& d# Y# b7 ^" e( ?, T; I) n
  12. *
    " J2 N1 b- l) V3 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * F* n2 a/ W; [8 x
  14. *
    ( d6 y/ L1 Z, m9 Q' x5 S- D! o) r
  15. * This program is free software; you can redistribute it and/or
    % R8 v" h8 @/ u  B
  16. * modify it under the terms of the GNU General Public License as! \6 N7 ?& V: i1 {4 U9 T2 }, k- V6 `
  17. * published by the Free Software Foundation version 2.) E$ {. y- M' r8 Q3 ]+ z" g
  18. *
    7 {% B+ H" K! O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & y% q- I) k5 h4 {
  20. * kind, whether express or implied; without even the implied warranty
    ( c# r- N+ d, M; f# n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; D5 S9 I3 L# z7 Q
  22. * GNU General Public License for more details.
    7 |! |( x1 z5 ?" j
  23. */
    ! S; Q6 o* }0 h2 N$ M6 n6 A$ I

  24. 6 C8 K4 H! U. U) z5 [
  25. #include <linux/module.h>; P0 u# s# B8 c- u# _2 |
  26. #include <linux/init.h>
    % B- u5 w; v7 t/ j$ C5 g6 n0 E- T
  27. #include <linux/errno.h>* n0 F: U5 F! b  i/ j4 n7 r
  28. #include <linux/types.h>
    4 Z4 e% M( q% s5 E3 P# b
  29. #include <linux/interrupt.h>+ L5 c( H/ \7 g" c7 p/ B* C
  30. #include <asm/io.h>; y4 Z/ H" @- B* |6 Z* {/ G
  31. #include <linux/moduleparam.h>
    7 Y4 T9 ~. `7 j- f
  32. #include <linux/sysctl.h>( v9 P) Y2 g: m! F" ]4 N0 G) G
  33. #include <linux/mm.h>) @4 Z0 b8 M! D
  34. #include <linux/dma-mapping.h>
    & W% Y) h) _: R# |# r  M
  35.   {' E/ G. i! z5 c3 {: }
  36. #include <mach/memory.h>9 q4 J4 |9 ]; r8 i' N; b* E$ S
  37. #include <mach/hardware.h>1 ~0 b7 W$ Q8 K% p0 o
  38. #include <mach/irqs.h>
      r2 E8 |8 I! t# i, U; T1 E) l
  39. #include <asm/hardware/edma.h>2 w& N9 _9 k" ]1 V( R

  40. : L4 a9 E1 [# ]$ W
  41. #undef EDMA3_DEBUG: W/ ~9 e$ e) A% c
  42. /*#define EDMA3_DEBUG*/2 I8 r  o, f2 t. Z' Q) |1 y

  43. " E1 b& {, l5 _! O$ O
  44. #ifdef EDMA3_DEBUG
    / J" @( T% z% B# R2 |8 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 h. s& t$ B& }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 H: `7 @. w8 O) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & U( m& N  S/ }/ u5 D
  48. #else" i& S# {9 |  h5 e
  49. #define DMA_PRINTK( x... )
    0 r5 Y" D9 j* m) j, _# @
  50. #define DMA_FN_IN
    : e1 R$ ^) i0 G
  51. #define DMA_FN_OUT
    6 |5 ~- o8 C$ _4 O. f5 y
  52. #endif% x1 I* ^$ ~6 t4 L* {  w
  53. 8 {  d; I0 c! B6 w- q6 {5 U8 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + a7 g# N: t' B( R' t1 H  k% j
  55. #define STATIC_SHIFT                3% W( ?  C% K  p; p
  56. #define TCINTEN_SHIFT               20
    : P, }' e* u$ p$ k9 d
  57. #define ITCINTEN_SHIFT              21
    # w. W8 b9 F  K: }# ~: z! ^+ a& h
  58. #define TCCHEN_SHIFT                22
      F3 F  _0 R2 Z# p' ~2 s
  59. #define ITCCHEN_SHIFT               23
    & c# g* B& b4 I
  60. 2 K. p+ L/ g6 p
  61. static volatile int irqraised1 = 0;- m# h; H6 W8 r; f) n! ?" [4 q
  62. static volatile int irqraised2 = 0;
    6 q1 {( Q. a) k, \' \9 V0 |

  63. " k. I$ Q7 S7 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : z' W( g$ V6 _/ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; M* ~: F& t% m/ ~, Q0 @. S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A) m# H1 f1 d: X' ?1 C

  67. 9 s( X- Q( C  h3 C3 L
  68. dma_addr_t dmaphyssrc1 = 0;2 d9 v8 Q. b5 g9 @* H3 M
  69. dma_addr_t dmaphyssrc2 = 0;
    7 D; b. O# F; o& i9 {+ o" ?
  70. dma_addr_t dmaphysdest1 = 0;/ W9 s7 _( m/ w" e
  71. dma_addr_t dmaphysdest2 = 0;
    ! U9 X1 r% E" }

  72. ' D7 H, G- _% l2 p9 {* h
  73. char *dmabufsrc1 = NULL;. @% B( r. n4 I" t! M/ i- R: S
  74. char *dmabufsrc2 = NULL;
    ( `# I3 S! u3 B4 r/ o4 L! `
  75. char *dmabufdest1 = NULL;
    * y( R" u# W. m: Q3 l( g% |
  76. char *dmabufdest2 = NULL;6 m6 Y! A2 ?. h
  77. 2 Y- @& D' q4 U% m2 N' U. h& H5 \) `
  78. static int acnt = 512;
    6 R* _  r3 P1 r" u& L: z
  79. static int bcnt = 8;
    2 i9 Y2 a6 J2 T2 C' r
  80. static int ccnt = 8;
    * O: O- a8 v# ^* }9 z
  81. 5 P0 J; o/ y8 T/ c3 N# G# {
  82. module_param(acnt, int, S_IRUGO);
    + H  I# }2 c+ K; r8 q
  83. module_param(bcnt, int, S_IRUGO);! }6 Z- l1 A# [7 ?; O' m# h; U9 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 S" X" A; v( K+ W# W0 e7 H) m6 l
8 f; s' a% _* l* L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 s& D2 `# B* }/ w0 K6 N" b8 Narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
! O4 T6 ~4 G+ ?* b6 ~0 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' z( m; l3 ?$ c! j, O
" K) X* Q3 Y) }: U2 T

8 ]4 i% ~7 H0 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 19:05 , Processed in 0.039135 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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