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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 l: h. h1 O0 m
  1. [code]EDMA sample test application, y) L3 D1 H3 f4 ^
  2. /*
    9 q7 l0 P4 Y- k& h  S$ K$ J
  3. * edma_test.c+ E5 [* {- E5 S" N: @1 g( d, c
  4. *- Y5 X  Q# d8 D3 g8 e' l
  5. * brief  EDMA3 Test Application
    " n6 a( [6 P+ t. k" J
  6. *7 v9 \1 q7 b& j; n  C! `0 M
  7. *   This file contains EDMA3 Test code.3 A5 f% w" S% ]3 L
  8. *
    % n( S/ C# Q9 d: C  [* O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# V2 o( t2 x# @% e- F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 ?6 d2 b& O$ [1 D8 A
  11. *         TO CHANGE.! L7 S2 f* w+ ^0 L& V
  12. *( R5 i% u: x, A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 k5 u' e9 X% k) E
  14. *
      L* c% f# _, ]
  15. * This program is free software; you can redistribute it and/or
    $ d* @: @  h) u$ N9 @8 {
  16. * modify it under the terms of the GNU General Public License as( M$ d/ U- `$ x( V! B+ e2 \
  17. * published by the Free Software Foundation version 2.+ {& ^! y+ `0 u& p0 \4 M! r
  18. *) I, m% y" {9 m9 B( `  u" B. o3 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 c( B- q* Y  l
  20. * kind, whether express or implied; without even the implied warranty
    7 c4 s- n% [7 U% I; `1 m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  v9 e. q1 k" E; P; N; K
  22. * GNU General Public License for more details.+ Q: t6 o* P/ @$ a. a" p8 C$ |& ?
  23. */
    ' g9 o% s5 k" ]' k( F

  24. - U9 h/ v7 n! G9 L- u. D
  25. #include <linux/module.h>
    - J# x1 m7 v5 \4 C$ f
  26. #include <linux/init.h>
    4 I, f" V. u* E& [6 r
  27. #include <linux/errno.h>
    ) B1 B4 ?4 J; k* ~
  28. #include <linux/types.h>
    ( W. s* H* X! H1 i; h) o
  29. #include <linux/interrupt.h># r8 W, e  y9 L$ U
  30. #include <asm/io.h>
    7 N2 C) [+ g# Y
  31. #include <linux/moduleparam.h>% |/ y; ^+ N1 n# V9 V3 ~( `4 o
  32. #include <linux/sysctl.h>" e2 M: ^8 \, P, T) I  v$ n
  33. #include <linux/mm.h>
    1 V% b+ Z+ g" J6 \2 Z  x. Z5 V
  34. #include <linux/dma-mapping.h>) b( o3 n' q' x% J4 G
  35. 6 ~( ]3 L& b* o; |
  36. #include <mach/memory.h>  S: ~" n# x7 `
  37. #include <mach/hardware.h>( z2 N& v$ j3 I# Y/ H# p  }: g5 Q+ g
  38. #include <mach/irqs.h>/ y$ W6 ^8 g; Y( }) o: U% n
  39. #include <asm/hardware/edma.h>
    - J7 ]; a* \2 H# D

  40. ( q! E; H: b% C2 i
  41. #undef EDMA3_DEBUG
    ( a1 {' F2 |- @7 u$ Z" Q, H
  42. /*#define EDMA3_DEBUG*/& I; c3 n) H7 I" V2 r* B
  43.   @# t. ~. Q( u5 Q/ L% x& @
  44. #ifdef EDMA3_DEBUG0 t! E. t- C% \; ?/ {- {$ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' d0 F2 _7 X7 K7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" V9 }. w$ V# s% w/ _& F- O# ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 V9 j. h+ ?7 v- a" `' L
  48. #else: m# O! f% O. O# W8 K2 @) m
  49. #define DMA_PRINTK( x... )
    : I8 _: o* z# a
  50. #define DMA_FN_IN
    7 ~7 K9 |8 h% m
  51. #define DMA_FN_OUT9 A; X! Q* D9 n
  52. #endif
    # j& \( t3 z  K( u: h9 f
  53. & B- `  l' b" u- S+ g9 N* p6 e' _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 [4 D8 H6 O5 E, _6 ]5 E
  55. #define STATIC_SHIFT                3; U( q5 T: ]8 C3 I3 \9 U, E
  56. #define TCINTEN_SHIFT               20- c4 Y: t0 {7 A3 {1 r6 j& H
  57. #define ITCINTEN_SHIFT              21( M7 V/ H" A; h# R$ ^6 K0 h
  58. #define TCCHEN_SHIFT                22& i. C8 A+ ^( B: O/ C. C- ?
  59. #define ITCCHEN_SHIFT               23
    ! Z  o4 c' u8 q( z2 k
  60. 8 ~+ J5 j/ I) b( ^0 ^
  61. static volatile int irqraised1 = 0;3 v- ^0 \* S: m# i5 X
  62. static volatile int irqraised2 = 0;( b' R  H3 H  \& _" N' l
  63. ! K; a' j8 p3 A9 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* W5 d7 g) k  I  R7 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 K3 B3 W4 `- [- c6 u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ C, {7 c* d& G" z( M$ V6 T
  67.   n8 ?* B, E  k: n: x# u
  68. dma_addr_t dmaphyssrc1 = 0;8 N7 ?/ P7 u& o5 B
  69. dma_addr_t dmaphyssrc2 = 0;
    ' Q# |$ n; M2 g$ I  B
  70. dma_addr_t dmaphysdest1 = 0;
    * ^, ~9 I7 m. K. G9 t. R8 T
  71. dma_addr_t dmaphysdest2 = 0;+ |% N( a  o, a& b, L
  72. " |. v; l7 \0 o5 H0 d
  73. char *dmabufsrc1 = NULL;
    # {% u) V& i+ [  h! E
  74. char *dmabufsrc2 = NULL;1 ~* I3 w- P& M9 j  s* Y3 Q
  75. char *dmabufdest1 = NULL;
    1 N# H% [, l, N  E
  76. char *dmabufdest2 = NULL;
    8 n& r1 t9 ]1 X( ]

  77. + M$ n! B+ m% ^2 p
  78. static int acnt = 512;" P% R1 o2 ^# [; O
  79. static int bcnt = 8;
    5 H4 c% ]: @: ?1 ~$ l* {
  80. static int ccnt = 8;
    2 O% e/ m  _8 y" K# p1 |

  81. 2 L6 m' K" R3 R' X9 |0 c6 g  i  R, g$ j
  82. module_param(acnt, int, S_IRUGO);
    9 H: {* Y* C) N8 o6 W: a4 K: H
  83. module_param(bcnt, int, S_IRUGO);
    7 s/ F* O! g! G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ {% \- \8 }! i' w; J- y) X) \2 i- p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' U: |7 i4 |' `% a8 q. p& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 y4 U! C3 ~- T( B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( f3 J$ U0 ^/ |8 ?; G1 `" }
' L2 C8 ?# l# b( m0 U; w& f/ d& D% I& v7 l. |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-16 15:08 , Processed in 0.046366 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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